This is an automated email from the ASF dual-hosted git repository.
ashishvijaywargiya 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 2ddf03a237 Migrate order and product Jupiter integration tests from
Java to Groovy (#1628)
2ddf03a237 is described below
commit 2ddf03a2378b253dbe9b5722d5214a1f73a35208
Author: Ashish Vijaywargiya <[email protected]>
AuthorDate: Tue Aug 11 17:50:21 2026 +0530
Migrate order and product Jupiter integration tests from Java to Groovy
(#1628)
Ports FinAccountTest, OrderTest, PurchaseOrderTest, and SalesOrderTest
under applications/order, plus StockMovesTest,
InventoryItemTransferTest, and IssuanceTest under applications/product,
from Java to Groovy. Class names, package structure, and testdef case
names are unchanged, so no testdef XML updates were needed.
Follows the Groovy conventions already used elsewhere in these modules:
JupiterTestHelper property access for dispatcher/delegator/userLogin,
map literals instead of UtilMisc.toMap, and plain assert statements
instead of JUnit Assertions.
---
.../apache/ofbiz/order/test/FinAccountTest.groovy | 56 +++++++
.../org/apache/ofbiz/order/test/OrderTest.groovy | 75 +++++++++
.../ofbiz/order/test/PurchaseOrderTest.groovy | 93 +++++++++++
.../apache/ofbiz/order/test/SalesOrderTest.groovy | 186 +++++++++++++++++++++
.../apache/ofbiz/order/test/FinAccountTest.java | 73 --------
.../org/apache/ofbiz/order/test/OrderTest.java | 96 -----------
.../apache/ofbiz/order/test/PurchaseOrderTest.java | 109 ------------
.../apache/ofbiz/order/test/SalesOrderTest.java | 162 ------------------
.../product/test/InventoryItemTransferTest.groovy | 58 +++++++
.../ofbiz/product/test/StockMovesTest.groovy | 57 +++++++
.../apache/ofbiz/shipment/test/IssuanceTest.groovy | 103 ++++++++++++
.../product/test/InventoryItemTransferTest.java | 80 ---------
.../apache/ofbiz/product/test/StockMovesTest.java | 75 ---------
.../apache/ofbiz/shipment/test/IssuanceTest.java | 115 -------------
14 files changed, 628 insertions(+), 710 deletions(-)
diff --git
a/applications/order/src/test/groovy/org/apache/ofbiz/order/test/FinAccountTest.groovy
b/applications/order/src/test/groovy/org/apache/ofbiz/order/test/FinAccountTest.groovy
new file mode 100644
index 0000000000..defe65a177
--- /dev/null
+++
b/applications/order/src/test/groovy/org/apache/ofbiz/order/test/FinAccountTest.groovy
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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.test
+
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.order.finaccount.FinAccountHelper
+import org.apache.ofbiz.testtools.JunitJupiterTest
+import org.apache.ofbiz.testtools.JupiterTestHelper
+import org.junit.jupiter.api.Test
+
+@JunitJupiterTest
+class FinAccountTest implements JupiterTestHelper {
+
+ @Test
+ void testCreateFinAccountBasic() {
+ String finAccountCode = FinAccountHelper.getNewFinAccountCode(20,
delegator)
+ logInfo("finAccountCode=${finAccountCode}")
+ assert finAccountCode
+
+ GenericValue account =
FinAccountHelper.getFinAccountFromCode(finAccountCode, delegator)
+ assert !account
+
+ delegator.createSetNextSeqId(delegator.makeValue('FinAccount',
[finAccountCode: finAccountCode]))
+
+ account = FinAccountHelper.getFinAccountFromCode(finAccountCode,
delegator)
+ assert account
+ assert account.finAccountCode == finAccountCode
+ account =
FinAccountHelper.getFinAccountFromCode(finAccountCode.toUpperCase(Locale.default),
delegator)
+ assert account
+ assert account.finAccountCode == finAccountCode
+ account =
FinAccountHelper.getFinAccountFromCode(finAccountCode.toLowerCase(Locale.default),
delegator)
+ assert account
+ assert account.finAccountCode == finAccountCode
+
+ delegator.createSetNextSeqId(delegator.makeValue('FinAccount',
[finAccountCode: finAccountCode]))
+ account = FinAccountHelper.getFinAccountFromCode(finAccountCode,
delegator)
+ assert !account
+ }
+
+}
diff --git
a/applications/order/src/test/groovy/org/apache/ofbiz/order/test/OrderTest.groovy
b/applications/order/src/test/groovy/org/apache/ofbiz/order/test/OrderTest.groovy
new file mode 100644
index 0000000000..c89eeee6af
--- /dev/null
+++
b/applications/order/src/test/groovy/org/apache/ofbiz/order/test/OrderTest.groovy
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * 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.test
+
+import org.apache.ofbiz.service.ServiceUtil
+import org.apache.ofbiz.testtools.JunitJupiterTest
+import org.apache.ofbiz.testtools.JupiterTestHelper
+import org.junit.jupiter.api.Order
+import org.junit.jupiter.api.Test
+
+@JunitJupiterTest
+class OrderTest implements JupiterTestHelper {
+
+ @Test
+ @Order(1)
+ void testAdminGetNextOrderSeqId() {
+ Map serviceCtx = [partyId: 'admin'] // party with no AcctgPref prefix
+ Map resp = dispatcher.runSync('getNextOrderId', serviceCtx)
+ if (ServiceUtil.isError(resp)) {
+ logError(ServiceUtil.getErrorMessage(resp))
+ return
+ }
+ String orderId = resp.orderId
+ assert orderId
+ assert orderId ==~ /\d{5,}/
+ }
+
+ @Test
+ @Order(2)
+ void testCompanyGetNextOrderSeqId() {
+ Map serviceCtx = [partyId: 'Company'] // party with AcctgPref prefix :
CO
+ Map resp = dispatcher.runSync('getNextOrderId', serviceCtx)
+ if (ServiceUtil.isError(resp)) {
+ logError(ServiceUtil.getErrorMessage(resp))
+ return
+ }
+ String orderId = resp.orderId
+ assert orderId
+ assert orderId.startsWith('CO')
+ }
+
+ @Test
+ @Order(3)
+ void testCompleteGetNextOrderSeqId() {
+ Map serviceCtx = [
+ partyId: 'Company', // party with AcctgPref prefix : CO
+ productStoreId: '9000' // prefix WS
+ ]
+ Map resp = dispatcher.runSync('getNextOrderId', serviceCtx)
+ if (ServiceUtil.isError(resp)) {
+ logError(ServiceUtil.getErrorMessage(resp))
+ return
+ }
+ String orderId = resp.orderId
+ assert orderId
+ assert orderId.startsWith('WSCO')
+ }
+
+}
diff --git
a/applications/order/src/test/groovy/org/apache/ofbiz/order/test/PurchaseOrderTest.groovy
b/applications/order/src/test/groovy/org/apache/ofbiz/order/test/PurchaseOrderTest.groovy
new file mode 100644
index 0000000000..143e2924e4
--- /dev/null
+++
b/applications/order/src/test/groovy/org/apache/ofbiz/order/test/PurchaseOrderTest.groovy
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * 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.test
+
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.service.ServiceUtil
+import org.apache.ofbiz.testtools.JunitJupiterTest
+import org.apache.ofbiz.testtools.JupiterTestHelper
+import org.junit.jupiter.api.Test
+
+@JunitJupiterTest
+class PurchaseOrderTest implements JupiterTestHelper {
+
+ @Test
+ void testCreatePurchaseOrder() {
+ GenericValue orderItem = delegator.makeValue('OrderItem', [
+ orderItemSeqId: '00001',
+ orderItemTypeId: 'PRODUCT_ORDER_ITEM',
+ prodCatalogId: 'DemoCatalog',
+ productId: 'GZ-1000',
+ quantity: new BigDecimal('2'),
+ isPromo: 'N'
+ ])
+ orderItem.unitPrice = 1399.5
+ orderItem.unitListPrice = BigDecimal.ZERO
+ orderItem.isModifiedPrice = 'N'
+ orderItem.statusId = 'ITEM_CREATED'
+
+ GenericValue orderContactMech =
delegator.makeValue('OrderContactMech', [
+ contactMechPurposeTypeId: 'SHIPPING_LOCATION',
+ contactMechId: '9000'
+ ])
+
+ GenericValue orderItemContactMech =
delegator.makeValue('OrderItemContactMech', [
+ contactMechPurposeTypeId: 'SHIPPING_LOCATION',
+ contactMechId: '9000',
+ orderItemSeqId: '00001'
+ ])
+
+ GenericValue orderItemShipGroup =
delegator.makeValue('OrderItemShipGroup', [
+ carrierPartyId: 'UPS',
+ contactMechId: '9000',
+ isGift: 'N',
+ maySplit: 'N',
+ shipGroupSeqId: '00001',
+ shipmentMethodTypeId: 'NEXT_DAY'
+ ])
+ orderItemShipGroup.carrierRoleTypeId = 'CARRIER'
+
+ Map serviceCtx = [
+ partyId: 'Company',
+ orderTypeId: 'PURCHASE_ORDER',
+ currencyUom: 'USD',
+ productStoreId: '9000',
+ orderItems: [orderItem],
+ orderContactMechs: [orderContactMech],
+ orderItemContactMechs: [orderItemContactMech],
+ orderItemShipGroupInfo: [orderItemShipGroup],
+ orderTerms: [],
+ orderAdjustments: [],
+ billToCustomerPartyId: 'Company',
+ billFromVendorPartyId: 'DemoSupplier',
+ shipFromVendorPartyId: 'Company',
+ supplierAgentPartyId: 'DemoSupplier',
+ userLogin: userLogin
+ ]
+
+ Map resp = dispatcher.runSync('storeOrder', serviceCtx)
+ if (ServiceUtil.isError(resp)) {
+ logError(ServiceUtil.getErrorMessage(resp))
+ return
+ }
+ assert resp.orderId
+ assert resp.statusId
+ }
+
+}
diff --git
a/applications/order/src/test/groovy/org/apache/ofbiz/order/test/SalesOrderTest.groovy
b/applications/order/src/test/groovy/org/apache/ofbiz/order/test/SalesOrderTest.groovy
new file mode 100644
index 0000000000..8067d89516
--- /dev/null
+++
b/applications/order/src/test/groovy/org/apache/ofbiz/order/test/SalesOrderTest.groovy
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * 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.test
+
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.service.ServiceUtil
+import org.apache.ofbiz.testtools.JunitJupiterTest
+import org.apache.ofbiz.testtools.JupiterTestHelper
+import org.junit.jupiter.api.Test
+
+@JunitJupiterTest
+class SalesOrderTest implements JupiterTestHelper {
+
+ @Test
+ void testCreateSalesOrder() {
+ Map serviceCtx = [
+ partyId: 'DemoCustomer',
+ orderTypeId: 'SALES_ORDER',
+ currencyUom: 'USD',
+ productStoreId: '9000'
+ ]
+
+ List orderPaymentInfo = []
+ GenericValue orderContactMech =
delegator.makeValue('OrderContactMech', [
+ contactMechId: '9015',
+ contactMechPurposeTypeId: 'BILLING_LOCATION'
+ ])
+ orderPaymentInfo << orderContactMech
+
+ GenericValue orderPaymentPreference =
delegator.makeValue('OrderPaymentPreference', [
+ paymentMethodId: '9015',
+ paymentMethodTypeId: 'CREDIT_CARD',
+ statusId: 'PAYMENT_NOT_AUTH',
+ overflowFlag: 'N',
+ maxAmount: 49.26
+ ])
+ orderPaymentInfo << orderPaymentPreference
+ serviceCtx.orderPaymentInfo = orderPaymentInfo
+
+ List orderItemShipGroupInfo = []
+ orderContactMech.contactMechPurposeTypeId = 'SHIPPING_LOCATION'
+ orderItemShipGroupInfo << orderContactMech
+
+ GenericValue orderItemShipGroup =
delegator.makeValue('OrderItemShipGroup', [
+ carrierPartyId: 'UPS',
+ contactMechId: '9015',
+ isGift: 'N',
+ shipGroupSeqId: '00001',
+ shipmentMethodTypeId: 'NEXT_DAY'
+ ])
+ orderItemShipGroupInfo << orderItemShipGroup
+
+ GenericValue orderItemShipGroupAssoc =
delegator.makeValue('OrderItemShipGroupAssoc', [
+ orderItemSeqId: '00001',
+ quantity: BigDecimal.ONE,
+ shipGroupSeqId: '00001'
+ ])
+ orderItemShipGroupInfo << orderItemShipGroupAssoc
+
+ GenericValue shippingCharges = delegator.makeValue('OrderAdjustment', [
+ orderAdjustmentTypeId: 'SHIPPING_CHARGES',
+ shipGroupSeqId: '00001',
+ amount: 12.45
+ ])
+ orderItemShipGroupInfo << shippingCharges
+
+ GenericValue salesTaxUt = delegator.makeValue('OrderAdjustment', [
+ orderAdjustmentTypeId: 'SALES_TAX',
+ orderItemSeqId: '00001',
+ overrideGlAccountId: '224153',
+ primaryGeoId: 'UT',
+ shipGroupSeqId: '00001',
+ sourcePercentage: BigDecimal.valueOf(4.7)
+ ])
+ salesTaxUt.taxAuthGeoId = 'UT'
+ salesTaxUt.taxAuthPartyId = 'UT_TAXMAN'
+ salesTaxUt.taxAuthorityRateSeqId = '9004'
+ salesTaxUt.amount = BigDecimal.valueOf(1.824)
+ salesTaxUt.comments = 'Utah State Sales Tax'
+ orderItemShipGroupInfo << salesTaxUt
+
+ GenericValue salesTaxUtahCounty =
delegator.makeValue('OrderAdjustment', [
+ orderAdjustmentTypeId: 'SALES_TAX',
+ orderItemSeqId: '00001',
+ overrideGlAccountId: '224153',
+ primaryGeoId: 'UT-UTAH',
+ shipGroupSeqId: '00001',
+ sourcePercentage: BigDecimal.valueOf(0.1)
+ ])
+ salesTaxUtahCounty.taxAuthGeoId = 'UT-UTAH'
+ salesTaxUtahCounty.taxAuthPartyId = 'UT_UTAH_TAXMAN'
+ salesTaxUtahCounty.taxAuthorityRateSeqId = '9005'
+ salesTaxUtahCounty.amount = BigDecimal.valueOf(0.039)
+ salesTaxUtahCounty.comments = 'Utah County, Utah Sales Tax'
+ orderItemShipGroupInfo << salesTaxUtahCounty
+
+ GenericValue ofbTax = delegator.makeValue('OrderAdjustment', [
+ orderAdjustmentTypeId: 'SALES_TAX',
+ orderItemSeqId: '00001',
+ overrideGlAccountId: '224000',
+ primaryGeoId: '_NA_',
+ shipGroupSeqId: '00001',
+ sourcePercentage: BigDecimal.valueOf(1)
+ ])
+ ofbTax.taxAuthGeoId = '_NA_'
+ ofbTax.taxAuthPartyId = '_NA_'
+ ofbTax.taxAuthorityRateSeqId = '9000'
+ ofbTax.amount = BigDecimal.valueOf(0.384)
+ ofbTax.comments = '1% OFB _NA_ Tax'
+ orderItemShipGroupInfo << ofbTax
+
+ serviceCtx.orderItemShipGroupInfo = orderItemShipGroupInfo
+
+ GenericValue promoAdjustment = delegator.makeValue('OrderAdjustment', [
+ orderAdjustmentTypeId: 'PROMOTION_ADJUSTMENT',
+ productPromoActionSeqId: '01',
+ productPromoId: '9011',
+ productPromoRuleId: '01',
+ amount: BigDecimal.valueOf(-3.84)
+ ])
+ serviceCtx.orderAdjustments = [promoAdjustment]
+
+ GenericValue orderItem1 = delegator.makeValue('OrderItem', [
+ orderItemSeqId: '00001',
+ orderItemTypeId: 'PRODUCT_ORDER_ITEM',
+ prodCatalogId: 'DemoCatalog',
+ productId: 'GZ-2644',
+ quantity: BigDecimal.ONE,
+ selectedAmount: BigDecimal.ZERO
+ ])
+ orderItem1.isPromo = 'N'
+ orderItem1.isModifiedPrice = 'N'
+ orderItem1.unitPrice = 38.4
+ orderItem1.unitListPrice = 48.0
+ orderItem1.statusId = 'ITEM_CREATED'
+
+ GenericValue orderItem2 = delegator.makeValue('OrderItem', [
+ orderItemSeqId: '00002',
+ orderItemTypeId: 'PRODUCT_ORDER_ITEM',
+ prodCatalogId: 'DemoCatalog',
+ productId: 'GZ-1006-1',
+ quantity: BigDecimal.ONE,
+ selectedAmount: BigDecimal.ZERO
+ ])
+ orderItem2.isPromo = 'N'
+ orderItem2.isModifiedPrice = 'N'
+ orderItem2.unitPrice = 1.99
+ orderItem2.unitListPrice = 5.99
+ orderItem2.statusId = 'ITEM_CREATED'
+
+ serviceCtx.orderItems = [orderItem1, orderItem2]
+ serviceCtx.orderTerms = []
+
+ serviceCtx.placingCustomerPartyId = 'DemoCustomer'
+ serviceCtx.endUserCustomerPartyId = 'DemoCustomer'
+ serviceCtx.shipToCustomerPartyId = 'DemoCustomer'
+ serviceCtx.billToCustomerPartyId = 'DemoCustomer'
+ serviceCtx.billFromVendorPartyId = 'Company'
+ serviceCtx.userLogin = userLogin
+
+ Map resp = dispatcher.runSync('storeOrder', serviceCtx)
+ if (ServiceUtil.isError(resp)) {
+ logError(ServiceUtil.getErrorMessage(resp))
+ return
+ }
+ assert resp.orderId
+ assert resp.statusId
+ }
+
+}
diff --git
a/applications/order/src/test/java/org/apache/ofbiz/order/test/FinAccountTest.java
b/applications/order/src/test/java/org/apache/ofbiz/order/test/FinAccountTest.java
deleted file mode 100644
index 08f184246c..0000000000
---
a/applications/order/src/test/java/org/apache/ofbiz/order/test/FinAccountTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * 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.test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-
-import java.util.Locale;
-
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.order.finaccount.FinAccountHelper;
-import org.apache.ofbiz.testtools.JunitJupiterTest;
-import org.apache.ofbiz.testtools.JupiterTestHelper;
-import org.junit.jupiter.api.Test;
-
-@JunitJupiterTest
-public class FinAccountTest implements JupiterTestHelper {
- private static final String MODULE = FinAccountTest.class.getName();
-
- /**
- * Test create fin account basic.
- * @throws Exception the exception
- */
- @Test
- public void testCreateFinAccountBasic() throws Exception {
- Delegator delegator = getDelegator();
- String finAccountCode;
- GenericValue account;
-
- finAccountCode = FinAccountHelper.getNewFinAccountCode(20, delegator);
- Debug.logInfo("finAccountCode=%s%n", MODULE, finAccountCode);
- assertNotNull(finAccountCode);
-
- account = FinAccountHelper.getFinAccountFromCode(finAccountCode,
delegator);
- assertNull(account);
-
- delegator.createSetNextSeqId(delegator.makeValue("FinAccount",
UtilMisc.toMap("finAccountCode", finAccountCode)));
-
- account = FinAccountHelper.getFinAccountFromCode(finAccountCode,
delegator);
- assertNotNull(account);
- assertEquals(finAccountCode, account.get("finAccountCode"));
- account =
FinAccountHelper.getFinAccountFromCode(finAccountCode.toUpperCase(Locale.getDefault()),
delegator);
- assertNotNull(account);
- assertEquals(finAccountCode, account.get("finAccountCode"));
- account =
FinAccountHelper.getFinAccountFromCode(finAccountCode.toLowerCase(Locale.getDefault()),
delegator);
- assertNotNull(account);
- assertEquals(finAccountCode, account.get("finAccountCode"));
-
- delegator.createSetNextSeqId(delegator.makeValue("FinAccount",
UtilMisc.toMap("finAccountCode", finAccountCode)));
- account = FinAccountHelper.getFinAccountFromCode(finAccountCode,
delegator);
- assertNull(account);
- }
-}
diff --git
a/applications/order/src/test/java/org/apache/ofbiz/order/test/OrderTest.java
b/applications/order/src/test/java/org/apache/ofbiz/order/test/OrderTest.java
deleted file mode 100644
index e7d69c4679..0000000000
---
a/applications/order/src/test/java/org/apache/ofbiz/order/test/OrderTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * 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.test;
-
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.service.ServiceUtil;
-import org.apache.ofbiz.testtools.JunitJupiterTest;
-import org.apache.ofbiz.testtools.JupiterTestHelper;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.jupiter.api.Order;
-import org.junit.jupiter.api.Test;
-
-@JunitJupiterTest
-public class OrderTest implements JupiterTestHelper {
- private static final String MODULE = OrderTest.class.getName();
-
- /**
- * Test admin get next order seq id.
- * @throws Exception the exception
- */
- @Test
- @Order(1)
- public void testAdminGetNextOrderSeqId() throws Exception {
- Map<String, Object> ctx = new HashMap<>();
- ctx.put("partyId", "admin"); //party with no AcctgPref prefix
- Map<String, Object> resp = getDispatcher().runSync("getNextOrderId",
ctx);
- if (ServiceUtil.isError(resp)) {
- Debug.logError(ServiceUtil.getErrorMessage(resp), MODULE);
- return;
- }
- String orderId = (String) resp.get("orderId");
- assertNotNull(orderId);
- assertTrue(orderId.matches("\\d{5,}"));
- }
-
- /**
- * Test company get next order seq id.
- * @throws Exception the exception
- */
- @Test
- @Order(2)
- public void testCompanyGetNextOrderSeqId() throws Exception {
- Map<String, Object> ctx = new HashMap<>();
- ctx.put("partyId", "Company"); //party with AcctgPref prefix : CO
- Map<String, Object> resp = getDispatcher().runSync("getNextOrderId",
ctx);
- if (ServiceUtil.isError(resp)) {
- Debug.logError(ServiceUtil.getErrorMessage(resp), MODULE);
- return;
- }
- String orderId = (String) resp.get("orderId");
- assertNotNull(orderId);
- assertTrue(orderId.startsWith("CO"));
- }
-
- /**
- * Test complete get next order seq id.
- * @throws Exception the exception
- */
- @Test
- @Order(3)
- public void testCompleteGetNextOrderSeqId() throws Exception {
- Map<String, Object> ctx = new HashMap<>();
- ctx.put("partyId", "Company"); //party with AcctgPref prefix : CO
- ctx.put("productStoreId", "9000"); // prefix WS
- Map<String, Object> resp = getDispatcher().runSync("getNextOrderId",
ctx);
- if (ServiceUtil.isError(resp)) {
- Debug.logError(ServiceUtil.getErrorMessage(resp), MODULE);
- return;
- }
- String orderId = (String) resp.get("orderId");
- assertNotNull(orderId);
- assertTrue(orderId.startsWith("WSCO"));
- }
-}
diff --git
a/applications/order/src/test/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java
b/applications/order/src/test/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java
deleted file mode 100644
index d20f515b2b..0000000000
---
a/applications/order/src/test/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * 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.test;
-
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.testtools.JunitJupiterTest;
-import org.apache.ofbiz.testtools.JupiterTestHelper;
-import org.apache.ofbiz.service.ServiceUtil;
-import org.junit.jupiter.api.Test;
-
-@JunitJupiterTest
-public class PurchaseOrderTest implements JupiterTestHelper {
- private static final String MODULE = PurchaseOrderTest.class.getName();
-
- private String orderId = null;
- private String statusId = null;
-
- /**
- * Test create purchase order.
- * @throws Exception the exception
- */
- @Test
- public void testCreatePurchaseOrder() throws Exception {
- Delegator delegator = getDelegator();
- Map<String, Object> ctx = new HashMap<>();
- ctx.put("partyId", "Company");
- ctx.put("orderTypeId", "PURCHASE_ORDER");
- ctx.put("currencyUom", "USD");
- ctx.put("productStoreId", "9000");
-
- GenericValue orderItem = delegator.makeValue("OrderItem",
UtilMisc.toMap("orderItemSeqId", "00001", "orderItemTypeId",
- "PRODUCT_ORDER_ITEM", "prodCatalogId", "DemoCatalog",
"productId", "GZ-1000", "quantity", new BigDecimal("2"), "isPromo", "N"));
- orderItem.set("unitPrice", new BigDecimal("1399.5"));
- orderItem.set("unitListPrice", BigDecimal.ZERO);
- orderItem.set("isModifiedPrice", "N");
- orderItem.set("statusId", "ITEM_CREATED");
- List<GenericValue> orderItems = new LinkedList<>();
- orderItems.add(orderItem);
- ctx.put("orderItems", orderItems);
-
- GenericValue orderContactMech =
delegator.makeValue("OrderContactMech",
UtilMisc.toMap("contactMechPurposeTypeId",
- "SHIPPING_LOCATION", "contactMechId", "9000"));
- List<GenericValue> orderContactMechs = new LinkedList<>();
- orderContactMechs.add(orderContactMech);
- ctx.put("orderContactMechs", orderContactMechs);
-
- GenericValue orderItemContactMech =
delegator.makeValue("OrderItemContactMech",
UtilMisc.toMap("contactMechPurposeTypeId",
- "SHIPPING_LOCATION", "contactMechId", "9000",
"orderItemSeqId", "00001"));
- List<GenericValue> orderItemContactMechs = new LinkedList<>();
- orderItemContactMechs.add(orderItemContactMech);
- ctx.put("orderItemContactMechs", orderItemContactMechs);
-
- GenericValue orderItemShipGroup =
delegator.makeValue("OrderItemShipGroup", UtilMisc.toMap("carrierPartyId",
"UPS",
- "contactMechId", "9000", "isGift", "N", "maySplit", "N",
"shipGroupSeqId", "00001", "shipmentMethodTypeId", "NEXT_DAY"));
- orderItemShipGroup.set("carrierRoleTypeId", "CARRIER");
- List<GenericValue> orderItemShipGroupInfo = new LinkedList<>();
- orderItemShipGroupInfo.add(orderItemShipGroup);
- ctx.put("orderItemShipGroupInfo", orderItemShipGroupInfo);
-
- List<GenericValue> orderTerms = new LinkedList<>();
- ctx.put("orderTerms", orderTerms);
-
- List<GenericValue> orderAdjustments = new LinkedList<>();
- ctx.put("orderAdjustments", orderAdjustments);
-
- ctx.put("billToCustomerPartyId", "Company");
- ctx.put("billFromVendorPartyId", "DemoSupplier");
- ctx.put("shipFromVendorPartyId", "Company");
- ctx.put("supplierAgentPartyId", "DemoSupplier");
- ctx.put("userLogin", getUserLogin("system"));
-
- Map<String, Object> resp = getDispatcher().runSync("storeOrder", ctx);
- if (ServiceUtil.isError(resp)) {
- Debug.logError(ServiceUtil.getErrorMessage(resp), MODULE);
- return;
- }
- orderId = (String) resp.get("orderId");
- statusId = (String) resp.get("statusId");
- assertNotNull(orderId);
- assertNotNull(statusId);
- }
-}
diff --git
a/applications/order/src/test/java/org/apache/ofbiz/order/test/SalesOrderTest.java
b/applications/order/src/test/java/org/apache/ofbiz/order/test/SalesOrderTest.java
deleted file mode 100644
index c3d7b564e2..0000000000
---
a/applications/order/src/test/java/org/apache/ofbiz/order/test/SalesOrderTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * 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.test;
-
-import java.math.BigDecimal;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.service.ServiceUtil;
-import org.apache.ofbiz.testtools.JunitJupiterTest;
-import org.apache.ofbiz.testtools.JupiterTestHelper;
-import org.junit.jupiter.api.Test;
-
-@JunitJupiterTest
-public class SalesOrderTest implements JupiterTestHelper {
- private static final String MODULE = SalesOrderTest.class.getName();
-
- /**
- * Test create sales order.
- * @throws Exception the exception
- */
- @Test
- public void testCreateSalesOrder() throws Exception {
- Delegator delegator = getDelegator();
- Map<String, Object> ctx = UtilMisc.<String, Object>toMap("partyId",
"DemoCustomer", "orderTypeId", "SALES_ORDER", "currencyUom", "USD",
- "productStoreId", "9000");
-
- List<GenericValue> orderPaymentInfo = new LinkedList<>();
- GenericValue orderContactMech =
delegator.makeValue("OrderContactMech", UtilMisc.toMap("contactMechId", "9015",
"contactMechPurposeTypeId",
- "BILLING_LOCATION"));
- orderPaymentInfo.add(orderContactMech);
-
- GenericValue orderPaymentPreference =
delegator.makeValue("OrderPaymentPreference", UtilMisc.toMap("paymentMethodId",
"9015",
- "paymentMethodTypeId", "CREDIT_CARD",
- "statusId", "PAYMENT_NOT_AUTH", "overflowFlag", "N",
"maxAmount", new BigDecimal("49.26")));
- orderPaymentInfo.add(orderPaymentPreference);
- ctx.put("orderPaymentInfo", orderPaymentInfo);
-
- List<GenericValue> orderItemShipGroupInfo = new LinkedList<>();
- orderContactMech.set("contactMechPurposeTypeId", "SHIPPING_LOCATION");
- orderItemShipGroupInfo.add(orderContactMech);
-
- GenericValue orderItemShipGroup =
delegator.makeValue("OrderItemShipGroup", UtilMisc.toMap("carrierPartyId",
"UPS", "contactMechId", "9015",
- "isGift", "N", "shipGroupSeqId", "00001",
"shipmentMethodTypeId", "NEXT_DAY"));
- orderItemShipGroupInfo.add(orderItemShipGroup);
-
- GenericValue orderItemShipGroupAssoc =
delegator.makeValue("OrderItemShipGroupAssoc", UtilMisc.toMap("orderItemSeqId",
"00001", "quantity",
- BigDecimal.ONE, "shipGroupSeqId", "00001"));
- orderItemShipGroupInfo.add(orderItemShipGroupAssoc);
-
- GenericValue orderAdjustment = null;
- orderAdjustment = delegator.makeValue("OrderAdjustment",
UtilMisc.toMap("orderAdjustmentTypeId", "SHIPPING_CHARGES", "shipGroupSeqId",
- "00001", "amount", new BigDecimal("12.45")));
- orderItemShipGroupInfo.add(orderAdjustment);
-
- orderAdjustment = delegator.makeValue("OrderAdjustment",
UtilMisc.toMap("orderAdjustmentTypeId", "SALES_TAX", "orderItemSeqId", "00001",
- "overrideGlAccountId", "224153",
- "primaryGeoId", "UT", "shipGroupSeqId", "00001",
"sourcePercentage", BigDecimal.valueOf(4.7)));
- orderAdjustment.set("taxAuthGeoId", "UT");
- orderAdjustment.set("taxAuthPartyId", "UT_TAXMAN");
- orderAdjustment.set("taxAuthorityRateSeqId", "9004");
- orderAdjustment.set("amount", BigDecimal.valueOf(1.824));
- orderAdjustment.set("comments", "Utah State Sales Tax");
- orderItemShipGroupInfo.add(orderAdjustment);
-
- orderAdjustment = delegator.makeValue("OrderAdjustment",
UtilMisc.toMap("orderAdjustmentTypeId", "SALES_TAX", "orderItemSeqId", "00001",
- "overrideGlAccountId", "224153",
- "primaryGeoId", "UT-UTAH", "shipGroupSeqId", "00001",
"sourcePercentage", BigDecimal.valueOf(0.1)));
- orderAdjustment.set("taxAuthGeoId", "UT-UTAH");
- orderAdjustment.set("taxAuthPartyId", "UT_UTAH_TAXMAN");
- orderAdjustment.set("taxAuthorityRateSeqId", "9005");
- orderAdjustment.set("amount", BigDecimal.valueOf(0.039));
- orderAdjustment.set("comments", "Utah County, Utah Sales Tax");
- orderItemShipGroupInfo.add(orderAdjustment);
-
- orderAdjustment = delegator.makeValue("OrderAdjustment",
UtilMisc.toMap("orderAdjustmentTypeId", "SALES_TAX", "orderItemSeqId", "00001",
- "overrideGlAccountId", "224000",
- "primaryGeoId", "_NA_", "shipGroupSeqId", "00001",
"sourcePercentage", BigDecimal.valueOf(1)));
- orderAdjustment.set("taxAuthGeoId", "_NA_");
- orderAdjustment.set("taxAuthPartyId", "_NA_");
- orderAdjustment.set("taxAuthorityRateSeqId", "9000");
- orderAdjustment.set("amount", BigDecimal.valueOf(0.384));
- orderAdjustment.set("comments", "1% OFB _NA_ Tax");
- orderItemShipGroupInfo.add(orderAdjustment);
-
- ctx.put("orderItemShipGroupInfo", orderItemShipGroupInfo);
-
- List<GenericValue> orderAdjustments = new LinkedList<>();
- orderAdjustment = delegator.makeValue("OrderAdjustment",
UtilMisc.toMap("orderAdjustmentTypeId", "PROMOTION_ADJUSTMENT",
- "productPromoActionSeqId", "01", "productPromoId", "9011",
"productPromoRuleId", "01", "amount", BigDecimal.valueOf(-3.84)));
- orderAdjustments.add(orderAdjustment);
- ctx.put("orderAdjustments", orderAdjustments);
-
- List<GenericValue> orderItems = new LinkedList<>();
- GenericValue orderItem = delegator.makeValue("OrderItem",
UtilMisc.toMap("orderItemSeqId", "00001", "orderItemTypeId",
"PRODUCT_ORDER_ITEM",
- "prodCatalogId", "DemoCatalog", "productId", "GZ-2644",
"quantity", BigDecimal.ONE, "selectedAmount", BigDecimal.ZERO));
- orderItem.set("isPromo", "N");
- orderItem.set("isModifiedPrice", "N");
- orderItem.set("unitPrice", new BigDecimal("38.4"));
- orderItem.set("unitListPrice", new BigDecimal("48.0"));
- orderItem.set("statusId", "ITEM_CREATED");
- orderItems.add(orderItem);
-
- orderItem = delegator.makeValue("OrderItem",
UtilMisc.toMap("orderItemSeqId", "00002", "orderItemTypeId",
"PRODUCT_ORDER_ITEM",
- "prodCatalogId", "DemoCatalog", "productId", "GZ-1006-1",
"quantity", BigDecimal.ONE, "selectedAmount", BigDecimal.ZERO));
- orderItem.set("isPromo", "N");
- orderItem.set("isModifiedPrice", "N");
- orderItem.set("unitPrice", new BigDecimal("1.99"));
- orderItem.set("unitListPrice", new BigDecimal("5.99"));
- orderItem.set("statusId", "ITEM_CREATED");
- orderItems.add(orderItem);
-
- ctx.put("orderItems", orderItems);
-
- List<GenericValue> orderTerms = new LinkedList<>();
- ctx.put("orderTerms", orderTerms);
-
- GenericValue orderContactMec = delegator.makeValue("OrderContactMech");
- orderContactMec.set("contactMechPurposeTypeId", "SHIPPING_LOCATION");
- orderContactMec.set("contactMechId", "10000");
-
- ctx.put("placingCustomerPartyId", "DemoCustomer");
- ctx.put("endUserCustomerPartyId", "DemoCustomer");
- ctx.put("shipToCustomerPartyId", "DemoCustomer");
- ctx.put("billToCustomerPartyId", "DemoCustomer");
- ctx.put("billFromVendorPartyId", "Company");
-
- ctx.put("userLogin", getUserLogin("system"));
- Map<String, Object> resp = getDispatcher().runSync("storeOrder", ctx);
- if (ServiceUtil.isError(resp)) {
- Debug.logError(ServiceUtil.getErrorMessage(resp), MODULE);
- return;
- }
- String orderId = (String) resp.get("orderId");
- String statusId = (String) resp.get("statusId");
- assertNotNull(orderId);
- assertNotNull(statusId);
- }
-}
diff --git
a/applications/product/src/test/groovy/org/apache/ofbiz/product/test/InventoryItemTransferTest.groovy
b/applications/product/src/test/groovy/org/apache/ofbiz/product/test/InventoryItemTransferTest.groovy
new file mode 100644
index 0000000000..17b1859a7b
--- /dev/null
+++
b/applications/product/src/test/groovy/org/apache/ofbiz/product/test/InventoryItemTransferTest.groovy
@@ -0,0 +1,58 @@
+/*
+ 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.product.test
+
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.testtools.JunitJupiterTest
+import org.apache.ofbiz.testtools.JupiterTestHelper
+import org.junit.jupiter.api.Test
+
+@JunitJupiterTest
+class InventoryItemTransferTest implements JupiterTestHelper {
+
+ @Test
+ void testCreateInventoryItemsTransfer() {
+ BigDecimal transferQty = BigDecimal.ONE
+
+ // create
+ Map createCtx = [
+ inventoryItemId: '9005',
+ statusId: 'IXF_REQUESTED',
+ facilityId: 'WebStoreWarehouse',
+ facilityIdTo: 'WebStoreWarehouse',
+ receiveDate: UtilDateTime.nowTimestamp(),
+ xferQty: transferQty,
+ userLogin: userLogin
+ ]
+ Map createResp = dispatcher.runSync('createInventoryTransfer',
createCtx)
+ String inventoryTransferId = createResp.inventoryTransferId
+ assert inventoryTransferId
+
+ // transfer
+ Map updateCtx = [
+ inventoryTransferId: inventoryTransferId,
+ inventoryItemId: '9005',
+ statusId: 'IXF_COMPLETE',
+ userLogin: userLogin
+ ]
+ Map updateResp = dispatcher.runSync('updateInventoryTransfer',
updateCtx)
+ assert updateResp.responseMessage != 'error'
+ }
+
+}
diff --git
a/applications/product/src/test/groovy/org/apache/ofbiz/product/test/StockMovesTest.groovy
b/applications/product/src/test/groovy/org/apache/ofbiz/product/test/StockMovesTest.groovy
new file mode 100644
index 0000000000..ea4025cae9
--- /dev/null
+++
b/applications/product/src/test/groovy/org/apache/ofbiz/product/test/StockMovesTest.groovy
@@ -0,0 +1,57 @@
+/*
+ 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.product.test
+
+import org.apache.ofbiz.testtools.JunitJupiterTest
+import org.apache.ofbiz.testtools.JupiterTestHelper
+import org.junit.jupiter.api.Test
+
+/**
+ * Facility Tests
+ */
+@JunitJupiterTest
+class StockMovesTest implements JupiterTestHelper {
+
+ @Test
+ void testStockMoves() {
+ Map fsmnCtx = [
+ facilityId: 'WebStoreWarehouse',
+ userLogin: userLogin
+ ]
+ Map respMap1 = dispatcher.runSync('findStockMovesNeeded', fsmnCtx)
+ assert !respMap1.warningMessageList
+
+ if (respMap1.stockMoveHandled) {
+ fsmnCtx.stockMoveHandled = respMap1.stockMoveHandled
+ }
+ Map respMap2 = dispatcher.runSync('findStockMovesRecommended', fsmnCtx)
+ assert !respMap2.warningMessageList
+
+ Map ppsmCtx = [
+ productId: 'GZ-2644',
+ facilityId: 'WebStoreWarehouse',
+ locationSeqId: 'TLTLTLUL01',
+ targetLocationSeqId: 'TLTLTLLL01',
+ quantityMoved: new BigDecimal('5'),
+ userLogin: userLogin
+ ]
+ dispatcher.runSync('processPhysicalStockMove', ppsmCtx)
+ }
+
+}
diff --git
a/applications/product/src/test/groovy/org/apache/ofbiz/shipment/test/IssuanceTest.groovy
b/applications/product/src/test/groovy/org/apache/ofbiz/shipment/test/IssuanceTest.groovy
new file mode 100644
index 0000000000..eab83c7199
--- /dev/null
+++
b/applications/product/src/test/groovy/org/apache/ofbiz/shipment/test/IssuanceTest.groovy
@@ -0,0 +1,103 @@
+/*
+ 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.shipment.test
+
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.shipment.packing.PackingSession
+import org.apache.ofbiz.testtools.JunitJupiterTest
+import org.apache.ofbiz.testtools.JupiterTestHelper
+import org.junit.jupiter.api.Test
+
+/**
+ * Item Issuance Tests
+ */
+@JunitJupiterTest
+class IssuanceTest implements JupiterTestHelper {
+
+ @Test
+ void testMultipleInventoryItemIssuance() {
+ String facilityId = 'WebStoreWarehouse'
+ String productId = 'GZ-2644'
+ String orderId = 'DEMO81015'
+ String orderItemSeqId = '00001'
+ String shipGroupSeqId = '00001'
+ String shipmentItemSeqId = '00001'
+
+ PackingSession packSession = new PackingSession(dispatcher, userLogin,
facilityId, null, orderId, shipGroupSeqId)
+ packSession.addOrIncreaseLine(orderId, orderItemSeqId, shipGroupSeqId,
productId, BigDecimal.valueOf(6L), 1,
+ BigDecimal.valueOf(1000L), false)
+ String shipmentId = packSession.complete(false)
+
+ GenericValue orderHeader = from('OrderHeader').where('orderId',
orderId).queryOne()
+
+ // Test the OrderShipment is correct
+ List<GenericValue> orderShipments =
orderHeader.getRelated('OrderShipment', null, null, false)
+
+ assert orderShipments : 'No OrderShipment for order'
+ assert orderShipments.size() == 1 : 'Incorrect number of
OrderShipments for order'
+
+ GenericValue orderShipment = orderShipments[0]
+ assert orderShipment.orderItemSeqId == orderItemSeqId
+ assert orderShipment.shipGroupSeqId == shipGroupSeqId
+ assert orderShipment.shipmentId == shipmentId
+ assert orderShipment.shipmentItemSeqId == shipmentItemSeqId
+ BigDecimal shipmentQuantity = orderShipment.getBigDecimal('quantity')
+ assert shipmentQuantity == 6 :
+ "Incorrect quantity in OrderShipment. Expected 6.00000 actual
${shipmentQuantity}"
+
+ // Test the ItemIssuances are correct
+ List<GenericValue> itemIssuances =
orderHeader.getRelated('ItemIssuance', null, ['inventoryItemId'], false)
+ assert itemIssuances : 'No ItemIssuances for order'
+ assert itemIssuances.size() == 2 : 'Incorrect number of ItemIssuances
for order'
+
+ GenericValue itemIssuance = itemIssuances[0]
+ assert itemIssuance.orderItemSeqId == orderItemSeqId
+ assert itemIssuance.shipGroupSeqId == shipGroupSeqId
+ assert itemIssuance.shipmentId == shipmentId
+ assert itemIssuance.shipmentItemSeqId == shipmentItemSeqId
+ assert itemIssuance.inventoryItemId == '9001'
+ BigDecimal firstQuantity = itemIssuance.getBigDecimal('quantity')
+ assert firstQuantity == 5 :
+ "Incorrect quantity in ItemIssuance. Expected 5.00000 actual
${firstQuantity}"
+
+ itemIssuance = itemIssuances[1]
+ assert itemIssuance.orderItemSeqId == orderItemSeqId
+ assert itemIssuance.shipGroupSeqId == shipGroupSeqId
+ assert itemIssuance.shipmentId == shipmentId
+ assert itemIssuance.shipmentItemSeqId == shipmentItemSeqId
+ assert itemIssuance.inventoryItemId == '9025'
+ BigDecimal secondQuantity = itemIssuance.getBigDecimal('quantity')
+ assert secondQuantity == 1 :
+ "Incorrect quantity in ItemIssuance. Expected 1.00000 actual
${secondQuantity}"
+
+ // Test reservations have been removed
+ List<GenericValue> reservations =
orderHeader.getRelated('OrderItemShipGrpInvRes', null, null, false)
+ assert !reservations : 'Reservations exist for order - should have
been deleted'
+
+ // Test order header status is now ORDER_COMPLETED
+ assert orderHeader.statusId == 'ORDER_COMPLETED'
+
+ // Test order items status are now ITEM_COMPLETED
+ List<GenericValue> orderItems = orderHeader.getRelated('OrderItem',
null, null, false)
+ orderItems.each { GenericValue orderItemGv ->
+ assert orderItemGv.statusId == 'ITEM_COMPLETED'
+ }
+ }
+
+}
diff --git
a/applications/product/src/test/java/org/apache/ofbiz/product/test/InventoryItemTransferTest.java
b/applications/product/src/test/java/org/apache/ofbiz/product/test/InventoryItemTransferTest.java
deleted file mode 100644
index f8bee732f5..0000000000
---
a/applications/product/src/test/java/org/apache/ofbiz/product/test/InventoryItemTransferTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- 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.product.test;
-
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNotSame;
-
-import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.testtools.JunitJupiterTest;
-import org.apache.ofbiz.testtools.JupiterTestHelper;
-import org.junit.jupiter.api.Test;
-
-@JunitJupiterTest
-public class InventoryItemTransferTest implements JupiterTestHelper {
-
- private static String inventoryTransferId = null;
- private BigDecimal transferQty = BigDecimal.ONE;
-
- /**
- * Test create inventory items transfer.
- * @throws Exception the exception
- */
- @Test
- public void testCreateInventoryItemsTransfer() throws Exception {
- GenericValue userLogin = getUserLogin("system");
- // create
- Map<String, Object> ctx = new HashMap<>();
- String inventoryItemId = "9005";
- ctx.put("inventoryItemId", inventoryItemId);
- ctx.put("statusId", "IXF_REQUESTED");
- ctx.put("facilityId", "WebStoreWarehouse");
- ctx.put("facilityIdTo", "WebStoreWarehouse");
- ctx.put("receiveDate", UtilDateTime.nowTimestamp());
- ctx.put("xferQty", transferQty);
- ctx.put("userLogin", userLogin);
- Map<String, Object> resp =
getDispatcher().runSync("createInventoryTransfer", ctx);
- setInventoryTransferId((String) resp.get("inventoryTransferId"));
- assertNotNull(inventoryTransferId);
-
- // transfer
- ctx = new HashMap<>();
- ctx.put("inventoryTransferId", getInventoryTransferId());
- ctx.put("inventoryItemId", inventoryItemId);
- ctx.put("statusId", "IXF_COMPLETE");
- ctx.put("userLogin", userLogin);
- resp = getDispatcher().runSync("updateInventoryTransfer", ctx);
- String respMsg = (String) resp.get("responseMessage");
- assertNotSame("error", respMsg);
- }
-
- public static String getInventoryTransferId() {
- return inventoryTransferId;
- }
-
- public static void setInventoryTransferId(String inventoryTransferId) {
- InventoryItemTransferTest.inventoryTransferId = inventoryTransferId;
- }
-}
diff --git
a/applications/product/src/test/java/org/apache/ofbiz/product/test/StockMovesTest.java
b/applications/product/src/test/java/org/apache/ofbiz/product/test/StockMovesTest.java
deleted file mode 100644
index e49cf38db0..0000000000
---
a/applications/product/src/test/java/org/apache/ofbiz/product/test/StockMovesTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- 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.product.test;
-
-import static org.junit.jupiter.api.Assertions.assertNull;
-
-import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.ofbiz.base.util.UtilGenerics;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.testtools.JunitJupiterTest;
-import org.apache.ofbiz.testtools.JupiterTestHelper;
-import org.junit.jupiter.api.Test;
-
-/**
- * Facility Tests
- */
-@JunitJupiterTest
-public class StockMovesTest implements JupiterTestHelper {
-
- /**
- * Test stock moves.
- * @throws Exception the exception
- */
- @Test
- public void testStockMoves() throws Exception {
- GenericValue userLogin = getUserLogin("system");
- Map<String, Object> fsmnCtx = new HashMap<>();
- Map<?, ?> stockMoveHandled = null;
- List<?> warningList;
-
- fsmnCtx.put("facilityId", "WebStoreWarehouse");
- fsmnCtx.put("userLogin", userLogin);
- Map<String, Object> respMap1 =
getDispatcher().runSync("findStockMovesNeeded", fsmnCtx);
- stockMoveHandled = UtilGenerics.cast(respMap1.get("stockMoveHandled"));
- warningList = UtilGenerics.cast(respMap1.get("warningMessageList"));
- assertNull(warningList);
-
- if (stockMoveHandled != null) {
- fsmnCtx.put("stockMoveHandled", stockMoveHandled);
- }
- Map<String, Object> respMap2 =
getDispatcher().runSync("findStockMovesRecommended", fsmnCtx);
- warningList = UtilGenerics.cast(respMap2.get("warningMessageList"));
- assertNull(warningList);
-
- Map<String, Object> ppsmCtx = new HashMap<>();
- ppsmCtx.put("productId", "GZ-2644");
- ppsmCtx.put("facilityId", "WebStoreWarehouse");
- ppsmCtx.put("locationSeqId", "TLTLTLUL01");
- ppsmCtx.put("targetLocationSeqId", "TLTLTLLL01");
- ppsmCtx.put("quantityMoved", new BigDecimal("5"));
- ppsmCtx.put("userLogin", userLogin);
- getDispatcher().runSync("processPhysicalStockMove", ppsmCtx);
- }
-}
diff --git
a/applications/product/src/test/java/org/apache/ofbiz/shipment/test/IssuanceTest.java
b/applications/product/src/test/java/org/apache/ofbiz/shipment/test/IssuanceTest.java
deleted file mode 100644
index bd212fac71..0000000000
---
a/applications/product/src/test/java/org/apache/ofbiz/shipment/test/IssuanceTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- 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.shipment.test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import java.math.BigDecimal;
-import java.util.List;
-
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.entity.util.EntityQuery;
-import org.apache.ofbiz.shipment.packing.PackingSession;
-import org.apache.ofbiz.testtools.JunitJupiterTest;
-import org.apache.ofbiz.testtools.JupiterTestHelper;
-import org.junit.jupiter.api.Test;
-
-/**
- * Item Issuance Tests
- */
-@JunitJupiterTest
-public class IssuanceTest implements JupiterTestHelper {
-
- /**
- * Test multiple inventory item issuance.
- * @throws Exception the exception
- */
- @Test
- public void testMultipleInventoryItemIssuance() throws Exception {
- String facilityId = "WebStoreWarehouse";
- String productId = "GZ-2644";
- String orderId = "DEMO81015";
- String orderItemSeqId = "00001";
- String shipGroupSeqId = "00001";
- String shipmentItemSeqId = "00001";
-
- PackingSession packSession = new PackingSession(getDispatcher(),
getUserLogin("system"), facilityId, null, orderId, shipGroupSeqId);
- packSession.addOrIncreaseLine(orderId, orderItemSeqId, shipGroupSeqId,
productId, BigDecimal.valueOf(6L), 1,
- BigDecimal.valueOf(1000L), false);
- String shipmentId = packSession.complete(false);
-
- GenericValue orderHeader =
EntityQuery.use(getDelegator()).from("OrderHeader").where("orderId",
orderId).queryOne();
-
- // Test the OrderShipment is correct
- List<GenericValue> orderShipments =
orderHeader.getRelated("OrderShipment", null, null, false);
-
- assertFalse(UtilValidate.isEmpty(orderShipments), "No OrderShipment
for order");
- assertEquals(1, orderShipments.size(), "Incorrect number of
OrderShipments for order");
-
- GenericValue orderShipment = orderShipments.get(0);
- assertEquals(orderItemSeqId,
orderShipment.getString("orderItemSeqId"));
- assertEquals(shipGroupSeqId,
orderShipment.getString("shipGroupSeqId"));
- assertEquals(shipmentId, orderShipment.getString("shipmentId"));
- assertEquals(shipmentItemSeqId,
orderShipment.getString("shipmentItemSeqId"));
- BigDecimal actual = orderShipment.getBigDecimal("quantity");
- assertTrue(actual.compareTo(BigDecimal.valueOf(6L)) == 0, "Incorrect
quantity in OrderShipment. Expected 6.00000 actual " + actual);
-
- // Test the ItemIssuances are correct
- List<GenericValue> itemIssuances =
orderHeader.getRelated("ItemIssuance", null,
UtilMisc.toList("inventoryItemId"), false);
- assertFalse(UtilValidate.isEmpty(itemIssuances), "No ItemIssuances for
order");
- assertEquals(2, itemIssuances.size(), "Incorrect number of
ItemIssuances for order");
-
- GenericValue itemIssuance = itemIssuances.get(0);
- assertEquals(orderItemSeqId, itemIssuance.getString("orderItemSeqId"));
- assertEquals(shipGroupSeqId, itemIssuance.getString("shipGroupSeqId"));
- assertEquals(shipmentId, itemIssuance.getString("shipmentId"));
- assertEquals(shipmentItemSeqId,
itemIssuance.getString("shipmentItemSeqId"));
- assertEquals("9001", itemIssuance.getString("inventoryItemId"));
- actual = itemIssuance.getBigDecimal("quantity");
- assertTrue(actual.compareTo(BigDecimal.valueOf(5L)) == 0, "Incorrect
quantity in ItemIssuance. Expected 5.00000 actual " + actual);
-
- itemIssuance = itemIssuances.get(1);
- assertEquals(orderItemSeqId, itemIssuance.getString("orderItemSeqId"));
- assertEquals(shipGroupSeqId, itemIssuance.getString("shipGroupSeqId"));
- assertEquals(shipmentId, itemIssuance.getString("shipmentId"));
- assertEquals(shipmentItemSeqId,
itemIssuance.getString("shipmentItemSeqId"));
- assertEquals("9025", itemIssuance.getString("inventoryItemId"));
- actual = itemIssuance.getBigDecimal("quantity");
- assertTrue(actual.compareTo(BigDecimal.valueOf(1L)) == 0, "Incorrect
quantity in ItemIssuance. Expected 1.00000 actual " + actual);
-
- // Test reservations have been removed
- List<GenericValue> reservations =
orderHeader.getRelated("OrderItemShipGrpInvRes", null, null, false);
- assertTrue(UtilValidate.isEmpty(reservations), "Reservations exist for
order - should have been deleted");
-
- // Test order header status is now ORDER_COMPLETED
- assertEquals(orderHeader.getString("statusId"), "ORDER_COMPLETED");
-
- // Test order items status are now ITEM_COMPLETED
- List<GenericValue> orderItems = orderHeader.getRelated("OrderItem",
null, null, false);
-
- for (GenericValue orderItem : orderItems) {
- assertEquals("ITEM_COMPLETED", orderItem.getString("statusId"));
- }
- }
-}