Fixed: Integration tests fail with Postgres DB (OFBIZ-12666)
This fixes testUpdateFixedAssetMaintAndWorkEffort. It works in both Derby and
Postgres
Thanks: Johannes Schreiber for report
diff --git a/assetmaint/src/main/groovy/org/apache/ofbiz/assetmaint/test/FixedAssetMaintTests.groovy b/assetmaint/src/main/groovy/org/apache/ofbiz/assetmaint/test/FixedAssetMaintTests.groovy
index c9af5b7..fcaae97 100644
--- a/assetmaint/src/main/groovy/org/apache/ofbiz/assetmaint/test/FixedAssetMaintTests.groovy
+++ b/assetmaint/src/main/groovy/org/apache/ofbiz/assetmaint/test/FixedAssetMaintTests.groovy
@@ -20,6 +20,7 @@
import java.sql.Timestamp
import java.text.SimpleDateFormat
+
import org.apache.ofbiz.base.util.UtilDateTime
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.service.testtools.OFBizTestCase
@@ -38,9 +39,9 @@
serviceCtx.productMaintSeqId = "seq03" // product maintenance
serviceCtx.intervalMeterTypeId = "ODOMETER"
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")
String estimatedStartDate = "2009-12-18 00:00:00.000"
- serviceCtx.estimatedStartDate = new Timestamp(sdf.parse(estimatedStartDate).getTime());
+ serviceCtx.estimatedStartDate = new Timestamp(sdf.parse(estimatedStartDate).getTime())
String estimatedCompletionDate = "2009-12-18 01:00:00.000"
serviceCtx.estimatedCompletionDate = new Timestamp(sdf.parse(estimatedCompletionDate).getTime())
@@ -71,9 +72,9 @@
serviceCtx.productMaintTypeId = "OIL_CHANGE"
serviceCtx.intervalMeterTypeId = "ODOMETER"
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")
String estimatedStartDate = "2009-12-18 00:00:00.000"
- serviceCtx.estimatedStartDate = new Timestamp(sdf.parse(estimatedStartDate).getTime());
+ serviceCtx.estimatedStartDate = new Timestamp(sdf.parse(estimatedStartDate).getTime())
String estimatedCompletionDate = "2009-12-18 01:00:00.000"
serviceCtx.estimatedCompletionDate = new Timestamp(sdf.parse(estimatedCompletionDate).getTime())
@@ -107,7 +108,7 @@
serviceCtx.productMaintTypeId = "OIL_CHANGE"
serviceCtx.intervalMeterTypeId = "ODOMETER"
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")
String estimatedCompletionDate = "2009-12-22 01:00:00.000" // Changed estimatedCompletionDate to test update service
serviceCtx.estimatedCompletionDate = new Timestamp(sdf.parse(estimatedCompletionDate).getTime())
@@ -117,8 +118,6 @@
serviceCtx.userLogin = userLogin
Map serviceResult = dispatcher.runSync('updateFixedAssetMaintAndWorkEffort', serviceCtx)
- fixedAssetMaint.clear()
- fixedAssetMaint = from("FixedAssetMaint").where("fixedAssetId", fixedAssetId).queryFirst()
GenericValue workEffort = from("WorkEffort").where("workEffortId", fixedAssetMaint.scheduleWorkEffortId).queryOne()
assert fixedAssetMaint
@@ -145,4 +144,4 @@
assert workEffort.currentStatusId == "CAL_COMPLETED"
assert workEffort.actualCompletionDate == serviceCtx.actualCompletionDate
}
-}
\ No newline at end of file
+}