This is an automated email from the ASF dual-hosted git repository.
akashjain pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 38d17e2 Improved: Convert OrderTests.xml to Groovy (OFBIZ-11849) 38d17e2 is described below commit 38d17e2667ee3dc97b9c0a49a485d7776297a0f1 Author: Akash Jain <[hidden email]> AuthorDate: Tue Jul 7 11:01:31 2020 +0530 Improved: Convert OrderTests.xml to Groovy (OFBIZ-11849) --- applications/order/minilang/test/OrderTests.xml | 141 --------------------- .../org/apache/ofbiz/order/OrderTests.groovy | 107 ++++++++++++++++ applications/order/testdef/OrderTest.xml | 2 +- 3 files changed, 108 insertions(+), 142 deletions(-) diff --git a/applications/order/minilang/test/OrderTests.xml b/applications/order/minilang/test/OrderTests.xml deleted file mode 100644 index 2d15880..0000000 --- a/applications/order/minilang/test/OrderTests.xml +++ /dev/null @@ -1,141 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -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. ---> - -<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"> - - <simple-method method-name="testCreateOrderDeliverySchedule" short-description="Create Order Delivery Schedule" login-required="false"> - <entity-one entity-name="UserLogin" value-field="userLogin"> - <field-map field-name="userLoginId" value="system"/> - </entity-one> - <set-current-user-login value-field="userLogin"/> - <set field="serviceCtx.orderId" value="TEST_DEMO10090"/> - <call-service service-name="createOrderDeliverySchedule" in-map-name="serviceCtx"> - <results-to-map map-name="serviceResult"/> - </call-service> - <assert> - <not><if-empty field="serviceResult"/></not> - </assert> - <check-errors/> - </simple-method> - <simple-method method-name="testCreateOrderItemChange" short-description="create Order Item Change" login-required="false"> - <entity-one entity-name="UserLogin" value-field="userLogin"> - <field-map field-name="userLoginId" value="system"/> - </entity-one> - <set-current-user-login value-field="userLogin"/> - <set field="serviceCtx.changeTypeEnumId" value="ODR_ITM_APPEND"/> - <set field="serviceCtx.orderId" value="TEST_DEMO10090"/> - <set field="serviceCtx.orderItemSeqId" value="00001"/> - <call-service service-name="createOrderItemChange" in-map-name="serviceCtx"> - <results-to-map map-name="orderItemChangeId"/> - </call-service> - <assert> - <not><if-empty field="orderItemChangeId"/></not> - </assert> - <check-errors/> - </simple-method> - <simple-method method-name="testCreateOrderPaymentApplication" short-description="create Order Payment Application" login-required="false"> - <entity-one entity-name="UserLogin" value-field="userLogin"> - <field-map field-name="userLoginId" value="system"/> - </entity-one> - <set-current-user-login value-field="userLogin"/> - <set field="serviceCtx.paymentId" value="1014"/> - <call-service service-name="createOrderPaymentApplication" in-map-name="serviceCtx"> - <results-to-map map-name="serviceResult"/> - </call-service> - <assert> - <not><if-empty field="serviceResult"/></not> - </assert> - <check-errors/> - </simple-method> - <simple-method method-name="testCreateRequirement" short-description="Create Requirement" login-required="false"> - <entity-one entity-name="UserLogin" value-field="userLogin"> - <field-map field-name="userLoginId" value="system"/> - </entity-one> - <set-current-user-login value-field="userLogin"/> - <set field="serviceCtx.custRequestId" value="9000"/> - <set field="serviceCtx.requirementTypeId" value="CUSTOMER_REQUIREMENT"/> - <call-service service-name="createRequirement" in-map-name="serviceCtx"> - <results-to-map map-name="serviceResult"/> - </call-service> - <assert> - <not><if-empty field="serviceResult"/></not> - </assert> - <check-errors/> - </simple-method> - <simple-method method-name="testGetRequirementsForSupplier" short-description="Get Requirements For Supplier" login-required="false"> - <entity-one entity-name="UserLogin" value-field="userLogin"> - <field-map field-name="userLoginId" value="system"/> - </entity-one> - <set-current-user-login value-field="userLogin"/> - <set field="serviceCtx.partyId" value="Company"/> - <call-service service-name="getRequirementsForSupplier" in-map-name="serviceCtx"> - <results-to-map map-name="serviceResult"/> - </call-service> - <assert> - <not><if-empty field="serviceResult"/></not> - </assert> - <check-errors/> - </simple-method> - <simple-method method-name="testCreateRequirementRole" short-description="Create Requirement Role" login-required="false"> - <entity-one entity-name="UserLogin" value-field="userLogin"> - <field-map field-name="userLoginId" value="system"/> - </entity-one> - <set-current-user-login value-field="userLogin"/> - <set field="serviceCtx.requirementId" value="1000"/> - <set field="serviceCtx.roleTypeId" value="OWNER"/> - <set field="serviceCtx.partyId" value="Company"/> - <call-service service-name="createRequirementRole" in-map-name="serviceCtx"> - <results-to-map map-name="serviceResult"/> - </call-service> - <assert> - <not><if-empty field="serviceResult"/></not> - </assert> - <check-errors/> - </simple-method> - <simple-method method-name="testCreateAutoRequirementsForOrder" short-description="Create AutoRequirements For Order" login-required="false"> - <entity-one entity-name="UserLogin" value-field="userLogin"> - <field-map field-name="userLoginId" value="system"/> - </entity-one> - <set-current-user-login value-field="userLogin"/> - <set field="serviceCtx.orderId" value="TEST_DEMO10090"/> - <call-service service-name="createAutoRequirementsForOrder" in-map-name="serviceCtx"> - <results-to-map map-name="serviceResult"/> - </call-service> - <assert> - <not><if-empty field="serviceResult"/></not> - </assert> - <check-errors/> - </simple-method> - <simple-method method-name="testCreateATPRequirementsForOrder" short-description="Create ATP Requirements For Order" login-required="false"> - <entity-one entity-name="UserLogin" value-field="userLogin"> - <field-map field-name="userLoginId" value="system"/> - </entity-one> - <set-current-user-login value-field="userLogin"/> - <set field="serviceCtx.orderId" value="TEST_DEMO10090"/> - <call-service service-name="createATPRequirementsForOrder" in-map-name="serviceCtx"> - <results-to-map map-name="serviceResult"/> - </call-service> - <assert> - <not><if-empty field="serviceResult"/></not> - </assert> - <check-errors/> - </simple-method> -</simple-methods> diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderTests.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderTests.groovy new file mode 100644 index 0000000..5c3c866 --- /dev/null +++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderTests.groovy @@ -0,0 +1,107 @@ +/******************************************************************************* + * 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. + *******************************************************************************/ + +package org.apache.ofbiz.order + +import org.apache.ofbiz.service.ServiceUtil +import org.apache.ofbiz.service.testtools.OFBizTestCase + +class OrderTests extends OFBizTestCase { + public OrderTests(String name) { + super(name) + } + + void testCreateOrderDeliverySchedule() { + Map serviceCtx = [ + orderId: 'TEST_DEMO10090', + userLogin: userLogin + ] + Map serviceResult = dispatcher.runSync('createOrderDeliverySchedule', serviceCtx) + assert ServiceUtil.isSuccess(serviceResult) + } + + void testCreateOrderItemChange() { + Map serviceCtx = [ + changeTypeEnumId: 'ODR_ITM_APPEND', + orderId: 'TEST_DEMO10090', + orderItemSeqId: '00001', + userLogin: userLogin + ] + Map serviceResult = dispatcher.runSync('createOrderItemChange', serviceCtx) + assert ServiceUtil.isSuccess(serviceResult) + assert serviceResult.orderItemChangeId + } + + void testCreateOrderPaymentApplication() { + Map serviceCtx = [ + paymentId: '1014', + userLogin: userLogin + ] + Map serviceResult = dispatcher.runSync('createOrderPaymentApplication', serviceCtx) + assert ServiceUtil.isSuccess(serviceResult) + } + + void testCreateRequirement() { + Map serviceCtx = [ + custRequestId: '9000', + requirementTypeId: 'CUSTOMER_REQUIREMENT', + userLogin: userLogin + ] + Map serviceResult = dispatcher.runSync('createRequirement', serviceCtx) + assert ServiceUtil.isSuccess(serviceResult) + } + + void testGetRequirementsForSupplier() { + Map serviceCtx = [ + partyId: 'Company', + userLogin: userLogin + ] + Map serviceResult = dispatcher.runSync('getRequirementsForSupplier', serviceCtx) + assert ServiceUtil.isSuccess(serviceResult) + } + + void testCreateRequirementRole() { + Map serviceCtx = [ + requirementId: '1000', + partyId: 'Company', + roleTypeId: 'OWNER', + userLogin: userLogin + ] + Map serviceResult = dispatcher.runSync('createRequirementRole', serviceCtx) + assert ServiceUtil.isSuccess(serviceResult) + } + + void testCreateAutoRequirementsForOrder() { + Map serviceCtx = [ + orderId: 'TEST_DEMO10090', + userLogin: userLogin + ] + Map serviceResult = dispatcher.runSync('createAutoRequirementsForOrder', serviceCtx) + assert ServiceUtil.isSuccess(serviceResult) + } + + void testCreateATPRequirementsForOrder() { + Map serviceCtx = [ + orderId: 'TEST_DEMO10090', + userLogin: userLogin + ] + Map serviceResult = dispatcher.runSync('createATPRequirementsForOrder', serviceCtx) + assert ServiceUtil.isSuccess(serviceResult) + } +} \ No newline at end of file diff --git a/applications/order/testdef/OrderTest.xml b/applications/order/testdef/OrderTest.xml index e55150a..75bdde7 100644 --- a/applications/order/testdef/OrderTest.xml +++ b/applications/order/testdef/OrderTest.xml @@ -34,7 +34,7 @@ under the License. <junit-test-suite class-name="org.apache.ofbiz.order.test.SalesOrderTest"/> </test-case> <test-case case-name="order-tests-xml"> - <simple-method-test location="component://order/minilang/test/OrderTests.xml"/> + <junit-test-suite class-name="org.apache.ofbiz.order.OrderTests"/> </test-case> <test-case case-name="order-return-tests"> <junit-test-suite class-name="org.apache.ofbiz.order.OrderReturnTests"/> |
Free forum by Nabble | Edit this page |