svn commit: r1867666 - in /ofbiz/ofbiz-framework/trunk/applications: accounting/src/main/groovy/org/apache/ofbiz/accounting/ accounting/testdef/data/ order/src/main/groovy/org/apache/ofbiz/order/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1867666 - in /ofbiz/ofbiz-framework/trunk/applications: accounting/src/main/groovy/org/apache/ofbiz/accounting/ accounting/testdef/data/ order/src/main/groovy/org/apache/ofbiz/order/

Pawan Verma-2
Author: pawan
Date: Sat Sep 28 12:08:46 2019
New Revision: 1867666

URL: http://svn.apache.org/viewvc?rev=1867666&view=rev
Log:
Improved: Added Unit test case for following services
- createSimpleTextContentForInvoice
- processWaitReplacementReturn
- processWaitReplacementReservedReturn
- processSubscriptionReturn
- processReplacementReturn
- processReplaceImmediatelyReturn
- processRefundOnlyReturn
(OFBIZ-8936)(OFBIZ-8874)(OFBIZ-8873)(OFBIZ-8872)(OFBIZ-8871)(OFBIZ-8870)(OFBIZ-8866)

Thanks, Deepak Nigam, Avnindra Sharma and Anushi Gupta for your contribution.

Modified:
    ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgInvoiceTests.groovy
    ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/data/AccountingTestsData.xml
    ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderTests.groovy

Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgInvoiceTests.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgInvoiceTests.groovy?rev=1867666&r1=1867665&r2=1867666&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgInvoiceTests.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgInvoiceTests.groovy Sat Sep 28 12:08:46 2019
@@ -52,4 +52,30 @@ class AutoAcctgInvoiceTests extends OFBi
 
         assert invoiceContent.contentId == serviceResult.contentId
     }
+    void testCreateSimpleTextContentForInvoice() {
+        def userLogin = EntityQuery.use(delegator).from('UserLogin')
+                .where('userLoginId', 'system')
+                .cache()
+                .queryOne()
+
+        Map serviceCtx = [
+                invoiceId: '1009',
+                contentId: '1001',
+                contentTypeId: 'DOCUMENT',
+                invoiceContentTypeId: 'COMMENTS',
+                text: 'Content for invoice # 1009',
+                fromDate: UtilDateTime.nowTimestamp(),
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('createSimpleTextContentForInvoice', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        GenericValue invoiceContent = EntityQuery.use(delegator).from('InvoiceContent')
+                .where('invoiceId', '1009',
+                'contentId', '1001',
+                'invoiceContentTypeId', 'DOCUMENT')
+                .queryFirst()
+
+        assert invoiceContent != null
+    }
 }

Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/data/AccountingTestsData.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/data/AccountingTestsData.xml?rev=1867666&r1=1867665&r2=1867666&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/data/AccountingTestsData.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/data/AccountingTestsData.xml Sat Sep 28 12:08:46 2019
@@ -99,6 +99,8 @@ under the License.
     <Invoice invoiceId="1007" invoiceTypeId="PURCHASE_INVOICE" statusId="INVOICE_IN_PROCESS" partyIdFrom="DEMO_COMPANY" partyId="DEMO_COMPANY1" invoiceDate="2016-11-03 00:00:00"/>
     <!-- For Testing service createInvoiceContent-->
     <Invoice invoiceId="1008" invoiceTypeId="PURCHASE_INVOICE" statusId="INVOICE_IN_PROCESS" partyIdFrom="DEMO_COMPANY" partyId="DEMO_COMPANY1" invoiceDate="2016-11-03 00:00:00"/>
+    <!-- For Testing service createSimpleTextContentForInvoice-->
+    <Invoice invoiceId="1009" invoiceTypeId="PURCHASE_INVOICE" statusId="INVOICE_IN_PROCESS" partyIdFrom="DEMO_COMPANY" partyId="DEMO_COMPANY1" invoiceDate="2016-11-03 00:00:00"/>
     <Content contentId="1000" contentTypeId="DOCUMENT"/>
     <!-- For Testing service setPaymentStatus -->
     <Payment paymentId="1000" paymentTypeId="CUSTOMER_PAYMENT" paymentMethodTypeId="COMPANY_CHECK"  partyIdFrom="DEMO_COMPANY" partyIdTo="DEMO_COMPANY1" amount="100.00" statusId="PAYMENT_NOT_AUTH" />

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderTests.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderTests.groovy?rev=1867666&r1=1867665&r2=1867666&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderTests.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderTests.groovy Sat Sep 28 12:08:46 2019
@@ -141,4 +141,55 @@ class OrderTests extends OFBizTestCase {
         Map serviceResult = dispatcher.runSync('checkCreateStockRequirementQoh', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
     }
+    void testProcessWaitReplacementReturn() {
+        Map serviceCtx = [
+                returnId: '1009',
+                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        ]
+        Map serviceResult = dispatcher.runSync('processWaitReplacementReturn', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+    }
+    void testProcessWaitReplacementReservedReturn() {
+        Map serviceCtx = [
+                returnId: '1009',
+                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        ]
+        Map serviceResult = dispatcher.runSync('processWaitReplacementReservedReturn', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        assert serviceResult != null
+    }
+    void testProcessSubscriptionReturn() {
+        Map serviceCtx = [
+                returnId: '1009',
+                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        ]
+        Map serviceResult = dispatcher.runSync('processSubscriptionReturn', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+    }
+    void testProcessReplacementReturn() {
+        Map serviceCtx = [
+                returnId: '1009',
+                returnTypeId: 'RTN_REFUND',
+                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        ]
+        Map serviceResult = dispatcher.runSync('processReplacementReturn', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+    }
+    void testProcessReplaceImmediatelyReturn() {
+        Map serviceCtx = [
+                returnId: '1009',
+                orderItemSeqId: '00001',
+                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        ]
+        Map serviceResult = dispatcher.runSync('processReplaceImmediatelyReturn', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+    }
+    void testProcessRefundOnlyReturn() {
+        Map serviceCtx = [
+                returnId: '1009',
+                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        ]
+        Map serviceResult = dispatcher.runSync('processRefundOnlyReturn', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+    }
 }