This is an automated email from the ASF dual-hosted git repository.
mridulpathak 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 c6d0d00db9 Fix integration tests that fail on PostgreSQL
c6d0d00db9 is described below
commit c6d0d00db9e7d84a9ab2590dbeeaba8e901b8d45
Author: Mridul Pathak <[email protected]>
AuthorDate: Tue Oct 27 12:09:37 2026 +0530
Fix integration tests that fail on PostgreSQL
- Give the inventory issuance test GL accounts their own account codes.
They reused codes from the demo data, which PostgreSQL rejects through the
unique index on GlAccount.accountCode, so the test data failed to load. H2 did
not catch this because its datasources create unique indexes as non-unique.
- Order the reallocation candidates in getProductionRunTaskForceIssueImpact
by creation time, so reservations on the same inventory item are always
reallocated oldest first instead of in whatever order the database returns
them. WorkEffortInvResAndItem and OrderItemShipGrpInvResAndItem now alias the
reservation's createdStamp for this.
- Check that the duplicated work effort notes contain TestNote-1 instead of
expecting it first, since the work effort has two notes at that point.
---
.../manufacturing/jobshopmgt/ProductionRunResServices.groovy | 2 ++
.../manufacturing/testdef/data/InventoryIssuanceTestData.xml | 8 ++++----
applications/order/entitydef/entitymodel_view.xml | 1 +
applications/workeffort/entitydef/entitymodel_view.xml | 1 +
.../ofbiz/workeffort/workeffort/test/WorkEffortTests.groovy | 2 +-
5 files changed, 9 insertions(+), 5 deletions(-)
diff --git
a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunResServices.groovy
b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunResServices.groovy
index 7c3603d0bf..e07628a978 100644
---
a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunResServices.groovy
+++
b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunResServices.groovy
@@ -627,6 +627,7 @@ Map getProductionRunTaskForceIssueImpact() {
EntityCondition.makeCondition(productId: productId,
facilityId: facilityId),
EntityCondition.makeCondition('workEffortId',
EntityOperator.NOT_EQUAL, workEffortId)
], EntityOperator.AND))
+ .orderBy('createdStamp')
.queryList()
.each { res ->
if (res.get('productId') != productId) {
@@ -653,6 +654,7 @@ Map getProductionRunTaskForceIssueImpact() {
// 4.2 Sales Order Reservations
from('OrderItemShipGrpInvResAndItem')
.where('productId', productId, 'facilityId', facilityId)
+ .orderBy('createdStamp')
.queryList()
.each { res ->
if (res.get('productId') != productId) {
diff --git
a/applications/manufacturing/testdef/data/InventoryIssuanceTestData.xml
b/applications/manufacturing/testdef/data/InventoryIssuanceTestData.xml
index 9b8a6a540d..141ec5b4bb 100644
--- a/applications/manufacturing/testdef/data/InventoryIssuanceTestData.xml
+++ b/applications/manufacturing/testdef/data/InventoryIssuanceTestData.xml
@@ -56,10 +56,10 @@ under the License.
<!-- Accounting Setup -->
<CustomTimePeriod customTimePeriodId="II_FISCAL_YEAR"
periodTypeId="FISCAL_YEAR" fromDate="2020-01-01 00:00:00.0"
thruDate="2026-12-31 23:59:59.0" isClosed="N" organizationPartyId="II_COMPANY"/>
- <GlAccount glAccountId="II_INV_ACCOUNT"
glAccountTypeId="INVENTORY_ACCOUNT" glAccountClassId="INVENTORY_ASSET"
accountCode="140000" accountName="Inventory"/>
- <GlAccount glAccountId="II_RAW_MAT_ACCOUNT"
glAccountTypeId="RAWMAT_INVENTORY" glAccountClassId="INVENTORY_ASSET"
accountCode="141000" accountName="Raw Materials"/>
- <GlAccount glAccountId="II_WIP_ACCOUNT" glAccountTypeId="WIP_INVENTORY"
glAccountClassId="INVENTORY_ASSET" accountCode="142000" accountName="Work In
Progress"/>
- <GlAccount glAccountId="II_COGS_ACCOUNT" glAccountTypeId="COGS_ACCOUNT"
glAccountClassId="COGS_EXPENSE" accountCode="500000" accountName="COGS"/>
+ <GlAccount glAccountId="II_INV_ACCOUNT"
glAccountTypeId="INVENTORY_ACCOUNT" glAccountClassId="INVENTORY_ASSET"
accountCode="II140000" accountName="Inventory"/>
+ <GlAccount glAccountId="II_RAW_MAT_ACCOUNT"
glAccountTypeId="RAWMAT_INVENTORY" glAccountClassId="INVENTORY_ASSET"
accountCode="II141000" accountName="Raw Materials"/>
+ <GlAccount glAccountId="II_WIP_ACCOUNT" glAccountTypeId="WIP_INVENTORY"
glAccountClassId="INVENTORY_ASSET" accountCode="II142000" accountName="Work In
Progress"/>
+ <GlAccount glAccountId="II_COGS_ACCOUNT" glAccountTypeId="COGS_ACCOUNT"
glAccountClassId="COGS_EXPENSE" accountCode="II500000" accountName="COGS"/>
<GlAccountOrganization glAccountId="II_INV_ACCOUNT"
organizationPartyId="II_COMPANY" fromDate="2020-01-01 00:00:00.0"/>
<GlAccountOrganization glAccountId="II_RAW_MAT_ACCOUNT"
organizationPartyId="II_COMPANY" fromDate="2020-01-01 00:00:00.0"/>
diff --git a/applications/order/entitydef/entitymodel_view.xml
b/applications/order/entitydef/entitymodel_view.xml
index 4a9068c8d3..f8bed9093a 100644
--- a/applications/order/entitydef/entitymodel_view.xml
+++ b/applications/order/entitydef/entitymodel_view.xml
@@ -801,6 +801,7 @@ under the License.
<member-entity entity-alias="II" entity-name="InventoryItem"/>
<alias-all entity-alias="OISGIR"/>
<alias-all entity-alias="II"/>
+ <alias entity-alias="OISGIR" name="createdStamp"/>
<view-link entity-alias="OISGIR" rel-entity-alias="II">
<key-map field-name="inventoryItemId"/>
</view-link>
diff --git a/applications/workeffort/entitydef/entitymodel_view.xml
b/applications/workeffort/entitydef/entitymodel_view.xml
index 916c01a6ab..aa5c2c1665 100644
--- a/applications/workeffort/entitydef/entitymodel_view.xml
+++ b/applications/workeffort/entitydef/entitymodel_view.xml
@@ -621,6 +621,7 @@ under the License.
</alias-all>
<alias entity-alias="II" name="inventoryProductId" field="productId"/>
<alias entity-alias="WE" name="workEffortParentId"/>
+ <alias entity-alias="WEIR" name="createdStamp"/>
<view-link entity-alias="WEIR" rel-entity-alias="II" rel-optional="true">
<key-map field-name="inventoryItemId"/>
</view-link>
diff --git
a/applications/workeffort/src/test/groovy/org/apache/ofbiz/workeffort/workeffort/test/WorkEffortTests.groovy
b/applications/workeffort/src/test/groovy/org/apache/ofbiz/workeffort/workeffort/test/WorkEffortTests.groovy
index 1dbbee0833..f345fc570e 100644
---
a/applications/workeffort/src/test/groovy/org/apache/ofbiz/workeffort/workeffort/test/WorkEffortTests.groovy
+++
b/applications/workeffort/src/test/groovy/org/apache/ofbiz/workeffort/workeffort/test/WorkEffortTests.groovy
@@ -761,7 +761,7 @@ class WorkEffortTests implements JupiterTestHelper {
List<GenericValue> duplicatedNotes =
from('WorkEffortNote').where('workEffortId', workEffortId).queryList()
assert duplicatedNotes
- assert duplicatedNotes[0].noteId == 'TestNote-1'
+ assert 'TestNote-1' in duplicatedNotes*.noteId
}
}