You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by su...@apache.org on 2019/10/06 12:22:40 UTC

svn commit: r1868057 - in /ofbiz/ofbiz-framework/trunk/applications/accounting: src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentTests.groovy testdef/data/AccountingTestsData.xml

Author: surajk
Date: Sun Oct  6 12:22:40 2019
New Revision: 1868057

URL: http://svn.apache.org/viewvc?rev=1868057&view=rev
Log:
Improved: Unit test case for service - createPaymentContent.
(OFBIZ-9093)
Thanks: Deepak Nigam for reporting and Yogesh Naroliya for providing the updated patch.

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

Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentTests.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentTests.groovy?rev=1868057&r1=1868056&r2=1868057&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentTests.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentTests.groovy Sun Oct  6 12:22:40 2019
@@ -18,16 +18,18 @@
  *******************************************************************************/
 package org.apache.ofbiz.accounting
 
+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.service.testtools.OFBizTestCase
 
+import java.sql.Timestamp
+
 class AutoAcctgPaymentTests extends OFBizTestCase {
     public AutoAcctgPaymentTests(String name) {
         super(name)
     }
-
     void testCreatePayment() {
         Map serviceCtx = [:]
         serviceCtx.paymentTypeId = 'CUSTOMER_PAYMENT'
@@ -43,7 +45,6 @@ class AutoAcctgPaymentTests extends OFBi
         assert payment.paymentTypeId == 'CUSTOMER_PAYMENT'
         assert payment.paymentMethodTypeId == 'COMPANY_CHECK'
     }
-
     void testSetPaymentStatus() {
         Map serviceCtx = [:]
         serviceCtx.paymentId = '1000'
@@ -56,7 +57,6 @@ class AutoAcctgPaymentTests extends OFBi
         assert payment
         assert serviceResult.oldStatusId == 'PAYMENT_NOT_AUTH'
     }
-
     void testQuickSendPayment() {
         Map serviceCtx = [:]
         serviceCtx.paymentId = '1001'
@@ -68,16 +68,26 @@ class AutoAcctgPaymentTests extends OFBi
         assert payment
         assert payment.statusId == 'PMNT_SENT'
     }
-
     void testGetPayments() {
         Map serviceCtx = [
-                finAccountTransId: '1001',
-                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+            finAccountTransId: '1001',
+            userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
         ]
-
         Map serviceResult = dispatcher.runSync('getPayments', serviceCtx)
-
         assert ServiceUtil.isSuccess(serviceResult)
         assert serviceResult.payments != null
     }
+    void testCreatePaymentContent() {
+        Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
+        Map serviceCtx = [
+            paymentId: '1006',
+            paymentContentTypeId: 'COMMENTS',
+            contentId: '1006',
+            fromDate: nowTimestamp,
+            userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        ]
+        Map serviceResult = dispatcher.runSync('createPaymentContent', serviceCtx)
+        GenericValue paymentContent = EntityQuery.use(delegator).from('PaymentContent').where(paymentId: '1006', paymentContentTypeId: 'COMMENTS', contentId: '1006').filterByDate().queryFirst()
+        assert paymentContent
+    }
 }

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=1868057&r1=1868056&r2=1868057&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/data/AccountingTestsData.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/testdef/data/AccountingTestsData.xml Sun Oct  6 12:22:40 2019
@@ -107,4 +107,8 @@ under the License.
     <!-- For Testing service quickSendPayment -->
     <PaymentMethod paymentMethodId="1001" paymentMethodTypeId="COMPANY_CHECK"/>
     <Payment paymentId="1001" paymentTypeId="CUSTOMER_PAYMENT" paymentMethodId="1001" paymentMethodTypeId="COMPANY_CHECK" partyIdFrom="DEMO_COMPANY" partyIdTo="DEMO_COMPANY1" amount="100.00" statusId="PMNT_CONFIRMED"/>
+    <!-- For Testing service createPaymentContent -->
+    <Payment paymentId="1006" paymentTypeId="CUSTOMER_PAYMENT" paymentMethodTypeId="COMPANY_CHECK" partyIdFrom="DEMO_COMPANY" partyIdTo="DEMO_COMPANY1" amount="100.00" statusId="PMNT_CONFIRMED" />
+    <Content contentId="1006" contentTypeId="DOCUMENT"/>
+    <PaymentContentType paymentContentTypeId="COMMENTS" hasTable="N" />
 </entity-engine-xml>