svn commit: r1858260 - in /ofbiz/ofbiz-framework/trunk/applications/accounting: groovyScripts/test/AutoAcctgInvoiceTests.groovy testdef/accountingtests.xml testdef/data/AccountingTestsData.xml

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

svn commit: r1858260 - in /ofbiz/ofbiz-framework/trunk/applications/accounting: groovyScripts/test/AutoAcctgInvoiceTests.groovy testdef/accountingtests.xml testdef/data/AccountingTestsData.xml

surajk
Author: surajk
Date: Sat Apr 27 09:49:00 2019
New Revision: 1858260

URL: http://svn.apache.org/viewvc?rev=1858260&view=rev
Log:
Improved: Unit test case for service -  createInvoiceContent.
(OFBIZ-8932)
Thanks Deepak Nigam for reporting and Vivek Singh Bisen for providing the patch.

Added:
    ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgInvoiceTests.groovy   (with props)
Modified:
    ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/accountingtests.xml
    ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/data/AccountingTestsData.xml

Added: ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgInvoiceTests.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgInvoiceTests.groovy?rev=1858260&view=auto
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgInvoiceTests.groovy (added)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgInvoiceTests.groovy Sat Apr 27 09:49:00 2019
@@ -0,0 +1,19 @@
+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 AutoAcctgInvoiceTests extends GroovyScriptTestCase {
+    void testCreateInvoiceContent() {
+        Map serviceCtx = [:]
+        serviceCtx.invoiceId = '1008'
+        serviceCtx.contentId = '1000'
+        serviceCtx.invoiceContentTypeId = 'COMMENTS'
+        serviceCtx.fromDate = UtilDateTime.nowTimestamp()
+        serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        Map serviceResult = dispatcher.runSync('createInvoiceContent', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        GenericValue InvoiceContent = EntityQuery.use(delegator).from('InvoiceContent').where('invoiceId', serviceResult.invoiceId, 'contentId', serviceResult.contentId, 'invoiceContentTypeId', serviceResult.invoiceContentTypeId, 'fromDate',UtilDateTime.nowTimestamp()).queryList()
+        assert invoiceContent.contentId == serviceResult.contentId
+    }
+}

Propchange: ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgInvoiceTests.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgInvoiceTests.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/test/AutoAcctgInvoiceTests.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/accountingtests.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/accountingtests.xml?rev=1858260&r1=1858259&r2=1858260&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/accountingtests.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/accountingtests.xml Sat Apr 27 09:49:00 2019
@@ -57,6 +57,9 @@
     <test-case case-name="auto-accounting-invoice-tests">
         <simple-method-test location="component://accounting/minilang/test/AutoAcctgInvoiceTests.xml"/>
     </test-case>
+    <test-case case-name="auto-accounting-invoice-tests">
+        <simple-method-test location="component://accounting/groovyScripts/test/AutoAcctgInvoiceTests.groovy"/>
+    </test-case>
     <test-case case-name="auto-accounting-payment-tests">
         <groovy-test-suite location="component://accounting/groovyScripts/test/AutoAcctgPaymentTests.groovy"/>
     </test-case>

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=1858260&r1=1858259&r2=1858260&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/data/AccountingTestsData.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/data/AccountingTestsData.xml Sat Apr 27 09:49:00 2019
@@ -97,4 +97,7 @@ under the License.
     <Invoice invoiceId="1006" invoiceTypeId="PURCHASE_INVOICE" statusId="INVOICE_IN_PROCESS" partyIdFrom="DEMO_COMPANY" partyId="DEMO_COMPANY1" invoiceDate="2016-11-03 00:00:00"/>
     <InvoiceItem invoiceId="1006" invoiceItemSeqId="00001" invoiceItemTypeId="PINV_FXASTPRD_ITEM"/>
     <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"/>
+    <Content contentId="1000" contentTypeId="DOCUMENT"/>
 </entity-engine-xml>