Author: surajk
Date: Sat Mar 30 06:57:58 2019 New Revision: 1856608 URL: http://svn.apache.org/viewvc?rev=1856608&view=rev Log: Added: Unit test case for service - updateProductCategory. (OFBIZ-8579) Thanks Akash Jain for reporting and Yogesh Naroliya for providing the updated patch. Added: ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/test/ ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/test/ProductTests.groovy (with props) Modified: ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/test/ProductTest.xml ofbiz/ofbiz-framework/trunk/applications/product/testdef/ProductTest.xml Added: ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/test/ProductTests.groovy URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/test/ProductTests.groovy?rev=1856608&view=auto ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/test/ProductTests.groovy (added) +++ ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/test/ProductTests.groovy Sat Mar 30 06:57:58 2019 @@ -0,0 +1,42 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ + + +import org.apache.ofbiz.base.util.UtilDateTime +import org.apache.ofbiz.entity.GenericValue +import org.apache.ofbiz.entity.util.EntityQuery +import org.apache.ofbiz.service.ServiceUtil +import org.apache.ofbiz.testtools.GroovyScriptTestCase + +class ProductTests extends GroovyScriptTestCase { + void testUpdateProductCategory() { + Map serviceCtx = [:] + serviceCtx.categoryName = 'Updated Test Product Category' + serviceCtx.longDescription = 'Updated Long Test Product Category Description' + serviceCtx.productCategoryId = 'CATALOG1_BEST_SELL' + serviceCtx.productCategoryTypeId = 'BEST_SELL_CATEGORY' + serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + Map serviceResult = dispatcher.runSync('updateProductCategory', serviceCtx) + assert ServiceUtil.isSuccess(serviceResult) + + GenericValue prodCategory = EntityQuery.use(delegator).from('ProductCategory').where('productCategoryId', 'CATALOG1_BEST_SELL').queryOne() + assert prodCategory.categoryName == 'Updated Test Product Category' + assert prodCategory.productCategoryTypeId == 'BEST_SELL_CATEGORY' + } +} Propchange: ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/test/ProductTests.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/test/ProductTests.groovy ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/test/ProductTests.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/test/ProductTest.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/test/ProductTest.xml?rev=1856608&r1=1856607&r2=1856608&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/test/ProductTest.xml (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/test/ProductTest.xml Sat Mar 30 06:57:58 2019 @@ -17,6 +17,7 @@ KIND, either express or implied. See th specific language governing permissions and limitations under the License. --> +<!-- TODO: All the test cases of this file will be migrated to ProductTests.groovy --> <simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd"> Modified: ofbiz/ofbiz-framework/trunk/applications/product/testdef/ProductTest.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/testdef/ProductTest.xml?rev=1856608&r1=1856607&r2=1856608&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/testdef/ProductTest.xml (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/testdef/ProductTest.xml Sat Mar 30 06:57:58 2019 @@ -30,4 +30,7 @@ under the License. <simple-method-test location="component://product/minilang/product/test/ProductTest.xml"/> </test-case> + <test-case case-name="product-tests"> + <groovy-test-suite location="component://product/groovyScripts/test/ProductTests.groovy"/> + </test-case> </test-suite> \ No newline at end of file |
Free forum by Nabble | Edit this page |