IDEMPIERE-5359 Unit test not working with Oracle (#1414)

This commit is contained in:
hengsin 2022-08-01 01:22:06 +08:00 committed by GitHub
parent edc96cca12
commit 9f22430aad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 128 additions and 65 deletions

View File

@ -0,0 +1,13 @@
-- IDEMPIERE-5359 Unit test not working with Oracle
SELECT register_migration_script('202207291542_IDEMPIERE-5359.sql') FROM dual;
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Jul 29, 2022, 3:42:38 PM MYT
UPDATE AD_Column SET ColumnSQL='(SELECT 123.45 FROM DUAL)',Updated=TO_DATE('2022-07-29 15:42:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=214655
;
DROP INDEX M_PRODUCTIONLINEMA_KEY
;

View File

@ -0,0 +1,7 @@
-- IDEMPIERE-5359 Unit test not working with Oracle
SELECT register_migration_script('202207291542_IDEMPIERE-5359.sql') FROM dual;
-- Jul 29, 2022, 3:42:38 PM MYT
UPDATE AD_Column SET ColumnSQL='(SELECT 123.45 FROM DUAL)',Updated=TO_TIMESTAMP('2022-07-29 15:42:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=214655
;

View File

@ -311,7 +311,7 @@ public class Match
m_sql.append(" AND mi.M_InOutLine_ID = ").append(Line_ID); m_sql.append(" AND mi.M_InOutLine_ID = ").append(Line_ID);
m_groupBy = " GROUP BY hdr.C_Invoice_ID,hdr.DocumentNo,hdr.DateInvoiced,bp.Name,hdr.C_BPartner_ID," m_groupBy = " GROUP BY hdr.C_Invoice_ID,hdr.DocumentNo,hdr.DateInvoiced,bp.Name,hdr.C_BPartner_ID,"
+ " lin.Line,lin.C_InvoiceLine_ID,p.Name,lin.M_Product_ID,dt.DocBaseType,lin.QtyInvoiced, org.Name, hdr.AD_Org_ID " //JAVIER + " lin.Line,lin.C_InvoiceLine_ID,p.Name,lin.M_Product_ID,dt.DocBaseType,lin.QtyInvoiced, org.Name, hdr.AD_Org_ID, dt.DocBaseType " //JAVIER
+ "HAVING " + "HAVING "
+ (matched ? "0" : "CASE WHEN dt.DocBaseType='APC' THEN lin.QtyInvoiced * -1 ELSE lin.QtyInvoiced END") + (matched ? "0" : "CASE WHEN dt.DocBaseType='APC' THEN lin.QtyInvoiced * -1 ELSE lin.QtyInvoiced END")
+ "<>SUM(NVL(mi.Qty,0))"; + "<>SUM(NVL(mi.Qty,0))";
@ -394,7 +394,7 @@ public class Match
m_sql.append(" AND m.C_OrderLine_ID = ").append(Line_ID); m_sql.append(" AND m.C_OrderLine_ID = ").append(Line_ID);
m_groupBy = " GROUP BY hdr.M_InOut_ID,hdr.DocumentNo,hdr.MovementDate,bp.Name,hdr.C_BPartner_ID," m_groupBy = " GROUP BY hdr.M_InOut_ID,hdr.DocumentNo,hdr.MovementDate,bp.Name,hdr.C_BPartner_ID,"
+ " lin.Line,lin.M_InOutLine_ID,p.Name,lin.M_Product_ID,lin.MovementQty, org.Name, hdr.AD_Org_ID, dt.DocBaseType " //JAVIER + " lin.Line,lin.M_InOutLine_ID,p.Name,lin.M_Product_ID,lin.MovementQty, org.Name, hdr.AD_Org_ID, dt.DocBaseType, hdr.IsSOTrx " //JAVIER
+ "HAVING " + "HAVING "
+ (matched ? "0" : "CASE WHEN (dt.DocBaseType='MMS' AND hdr.issotrx='N') THEN lin.MovementQty * -1 ELSE lin.MovementQty END"); + (matched ? "0" : "CASE WHEN (dt.DocBaseType='MMS' AND hdr.issotrx='N') THEN lin.MovementQty * -1 ELSE lin.MovementQty END");
if (matchToType == MATCH_ORDER) if (matchToType == MATCH_ORDER)

View File

@ -52,6 +52,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
@Test @Test
public void test1807657() { public void test1807657() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -78,6 +79,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
} }
@Test @Test
public void test1751966() { public void test1751966() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -113,6 +115,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
//[ 1707959 ] Copy from other PrintFormat doesn't work anymore //[ 1707959 ] Copy from other PrintFormat doesn't work anymore
@Test @Test
public void test1707959() { public void test1707959() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -139,6 +142,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
//[ 1707611 ] Column synchronization for mandatory columns doesn't work //[ 1707611 ] Column synchronization for mandatory columns doesn't work
@Test @Test
public void testAlterColumn() { public void testAlterColumn() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -201,6 +205,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
// https://sourceforge.net/p/adempiere/bugs/504/ // https://sourceforge.net/p/adempiere/bugs/504/
@Test @Test
public void test1705768() { public void test1705768() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -215,6 +220,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
@Test @Test
public void test1704261() { public void test1704261() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -230,6 +236,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
@Test @Test
public void testAlterTable() { public void testAlterTable() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -251,6 +258,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
@Test @Test
public void test1662983() { public void test1662983() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -271,6 +279,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
@Test @Test
public void testMultiColumnAssignment() { public void testMultiColumnAssignment() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -324,6 +333,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
@Test @Test
public void testReservedWordInQuote() { public void testReservedWordInQuote() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -339,6 +349,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
@Test @Test
public void test1580231() { public void test1580231() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -391,6 +402,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
@Test @Test
public void testAliasInUpdate() { public void testAliasInUpdate() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -406,6 +418,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
@Test @Test
public void test1580226() { public void test1580226() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -453,6 +466,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
@Test @Test
public void testTrunc() { public void testTrunc() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -468,6 +482,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
@Test @Test
public void testSubQuery() { public void testSubQuery() {
if (DB.isOracle()) return;
//MLanguage.addTable //MLanguage.addTable
sql = "INSERT INTO " + "AD_Column_Trl" sql = "INSERT INTO " + "AD_Column_Trl"
+ "(AD_Language,IsTranslated, AD_Client_ID,AD_Org_ID, " + "(AD_Language,IsTranslated, AD_Client_ID,AD_Org_ID, "
@ -487,6 +502,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
@Test @Test
public void test1622302() { public void test1622302() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -504,6 +520,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
@Test @Test
public void test1638046() { public void test1638046() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -529,6 +546,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
//[ 1727193 ] Convert failed with decode in quoted string //[ 1727193 ] Convert failed with decode in quoted string
@Test @Test
public void test1727193() { public void test1727193() {
if (DB.isOracle()) return;
sql = "UPDATE a set a.ten_decode = 'b'"; sql = "UPDATE a set a.ten_decode = 'b'";
sqe = "UPDATE a set a.ten_decode = 'b'"; sqe = "UPDATE a set a.ten_decode = 'b'";
r = DB.getDatabase().convertStatement(sql); r = DB.getDatabase().convertStatement(sql);
@ -542,6 +560,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
@Test @Test
public void testDecode() { public void testDecode() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -568,6 +587,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
@Test @Test
public void test2371805_GetDate() { public void test2371805_GetDate() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -590,6 +610,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
*/ */
@Test @Test
public void testCasts() { public void testCasts() {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
try { try {
testNotNative(); testNotNative();
@ -630,6 +651,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
*/ */
@Test @Test
public void test2521586() { public void test2521586() {
if (DB.isOracle()) return;
sql = "INSERT INTO M_Forecast (M_Forecast_ID) VALUES (1000000)"; sql = "INSERT INTO M_Forecast (M_Forecast_ID) VALUES (1000000)";
sqe = "INSERT INTO M_Forecast (M_Forecast_ID) VALUES (1000000)"; sqe = "INSERT INTO M_Forecast (M_Forecast_ID) VALUES (1000000)";
r = DB.getDatabase().convertStatement(sql); r = DB.getDatabase().convertStatement(sql);
@ -643,6 +665,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
@Test @Test
public void test3137355() public void test3137355()
{ {
if (DB.isOracle()) return;
sql = "INSERT INTO MyTable (a, b, c, d, xml) VALUES ('val1', 'val2', 'this ''is'' a string with ''quotes'' and backslashes ''\\''', 'val4')"; sql = "INSERT INTO MyTable (a, b, c, d, xml) VALUES ('val1', 'val2', 'this ''is'' a string with ''quotes'' and backslashes ''\\''', 'val4')";
sqe = "INSERT INTO MyTable (a, b, c, d, xml) VALUES ('val1', 'val2', E'this ''is'' a string with ''quotes'' and backslashes ''\\\\''', 'val4')"; sqe = "INSERT INTO MyTable (a, b, c, d, xml) VALUES ('val1', 'val2', E'this ''is'' a string with ''quotes'' and backslashes ''\\\\''', 'val4')";
r = DB.getDatabase().convertStatement(sql); r = DB.getDatabase().convertStatement(sql);
@ -662,6 +685,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
@Test @Test
public void testNativeSysdate() public void testNativeSysdate()
{ {
if (DB.isOracle()) return;
String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE); String originalNative = Ini.getProperty(P_POSTGRE_SQL_NATIVE);
String originalSimilarTo = Env.getContext(Env.getCtx(), "P|IsUseSimilarTo"); String originalSimilarTo = Env.getContext(Env.getCtx(), "P|IsUseSimilarTo");
try { try {

View File

@ -198,6 +198,8 @@ public class InOutTest extends AbstractTestCase {
} }
} }
} finally { } finally {
rollback();
deleteConversionRate(crUsdCompany); deleteConversionRate(crUsdCompany);
deleteConversionRate(crUsdSpot); deleteConversionRate(crUsdSpot);
deleteConversionRate(crEurCompany); deleteConversionRate(crEurCompany);
@ -206,8 +208,6 @@ public class InOutTest extends AbstractTestCase {
pp.deleteEx(true); pp.deleteEx(true);
plv.deleteEx(true); plv.deleteEx(true);
priceList.deleteEx(true); priceList.deleteEx(true);
rollback();
} }
} }
@ -357,14 +357,13 @@ public class InOutTest extends AbstractTestCase {
} }
} }
} finally { } finally {
rollback();
deleteConversionRate(crUsdCompany); deleteConversionRate(crUsdCompany);
deleteConversionRate(crEurCompany); deleteConversionRate(crEurCompany);
pp.deleteEx(true); pp.deleteEx(true);
plv.deleteEx(true); plv.deleteEx(true);
priceList.deleteEx(true); priceList.deleteEx(true);
rollback();
} }
} }

View File

@ -395,6 +395,8 @@ public class MatchInv2ndAcctSchemaTest extends AbstractTestCase {
testMatchInvoicePosting(ass, miList, notInvoicedReceiptsLineList, inventoryClearingLineList); testMatchInvoicePosting(ass, miList, notInvoicedReceiptsLineList, inventoryClearingLineList);
} finally { } finally {
rollback();
deleteConversionRate(crUsd1); deleteConversionRate(crUsd1);
deleteConversionRate(crUsd2); deleteConversionRate(crUsd2);
deleteConversionRate(crEur1); deleteConversionRate(crEur1);
@ -403,8 +405,6 @@ public class MatchInv2ndAcctSchemaTest extends AbstractTestCase {
pp.deleteEx(true); pp.deleteEx(true);
plv.deleteEx(true); plv.deleteEx(true);
priceList.deleteEx(true); priceList.deleteEx(true);
rollback();
} }
} }
@ -1538,14 +1538,13 @@ public class MatchInv2ndAcctSchemaTest extends AbstractTestCase {
testMatchInvoicePosting(ass, miList, notInvoicedReceiptsLineList, inventoryClearingLineList); testMatchInvoicePosting(ass, miList, notInvoicedReceiptsLineList, inventoryClearingLineList);
} finally { } finally {
rollback();
deleteConversionRate(crUsd); deleteConversionRate(crUsd);
deleteConversionRate(crEur); deleteConversionRate(crEur);
pp.deleteEx(true); pp.deleteEx(true);
plv.deleteEx(true); plv.deleteEx(true);
priceList.deleteEx(true); priceList.deleteEx(true);
rollback();
} }
} }
@ -1642,13 +1641,13 @@ public class MatchInv2ndAcctSchemaTest extends AbstractTestCase {
inventoryClearingLineList2.add(new PostingLine(inventoryClearingLine.currency, inventoryClearingLine.amtAcctCr, inventoryClearingLine.amtAcctDr)); inventoryClearingLineList2.add(new PostingLine(inventoryClearingLine.currency, inventoryClearingLine.amtAcctCr, inventoryClearingLine.amtAcctDr));
testMatchInvoicePosting(ass, miList0.toArray(miList2), notInvoicedReceiptsLineList2, inventoryClearingLineList2); testMatchInvoicePosting(ass, miList0.toArray(miList2), notInvoicedReceiptsLineList2, inventoryClearingLineList2);
} finally { } finally {
rollback();
deleteConversionRate(crUsd); deleteConversionRate(crUsd);
deleteConversionRate(crEur); deleteConversionRate(crEur);
pp.deleteEx(true); pp.deleteEx(true);
plv.deleteEx(true); plv.deleteEx(true);
priceList.deleteEx(true); priceList.deleteEx(true);
rollback();
} }
} }

View File

@ -237,9 +237,9 @@ public class MatchInvTest extends AbstractTestCase {
for (int id : ids) { for (int id : ids) {
MFactAcct fa = new MFactAcct(Env.getCtx(), id, getTrxName()); MFactAcct fa = new MFactAcct(Env.getCtx(), id, getTrxName());
if (fa.getAccount_ID() == acctNIR.getAccount_ID()) if (fa.getAccount_ID() == acctNIR.getAccount_ID())
assertEquals(fa.getAmtAcctCr(), credMatchAmt, "MatchInv incorrect amount posted "+fa.getAmtAcctCr().toPlainString()); assertEquals(fa.getAmtAcctCr().setScale(2, RoundingMode.HALF_UP), credMatchAmt.setScale(2, RoundingMode.HALF_UP), "MatchInv incorrect amount posted "+fa.getAmtAcctCr().toPlainString());
else if (fa.getAccount_ID() == acctInvClr.getAccount_ID()) else if (fa.getAccount_ID() == acctInvClr.getAccount_ID())
assertEquals(fa.getAmtAcctDr(), credMatchAmt, "MatchInv incorrect amount posted "+fa.getAmtAcctDr().toPlainString()); assertEquals(fa.getAmtAcctDr().setScale(2, RoundingMode.HALF_UP), credMatchAmt.setScale(2, RoundingMode.HALF_UP), "MatchInv incorrect amount posted "+fa.getAmtAcctDr().toPlainString());
} }
} }
@ -348,9 +348,9 @@ public class MatchInvTest extends AbstractTestCase {
for (int id : ids) { for (int id : ids) {
MFactAcct fa = new MFactAcct(Env.getCtx(), id, getTrxName()); MFactAcct fa = new MFactAcct(Env.getCtx(), id, getTrxName());
if (fa.getAccount_ID() == acctNIR.getAccount_ID()) if (fa.getAccount_ID() == acctNIR.getAccount_ID())
assertEquals(fa.getAmtAcctDr(), invMatchAmt, "MatchInv incorrect amount posted "+fa.getAmtAcctCr().toPlainString()); assertEquals(fa.getAmtAcctDr().setScale(2, RoundingMode.HALF_UP), invMatchAmt.setScale(2, RoundingMode.HALF_UP), "MatchInv incorrect amount posted "+fa.getAmtAcctCr().toPlainString());
else if (fa.getAccount_ID() == acctInvClr.getAccount_ID()) else if (fa.getAccount_ID() == acctInvClr.getAccount_ID())
assertEquals(fa.getAmtAcctCr(), invMatchAmt, "MatchInv incorrect amount posted "+fa.getAmtAcctCr().toPlainString()); assertEquals(fa.getAmtAcctCr().setScale(2, RoundingMode.HALF_UP), invMatchAmt.setScale(2, RoundingMode.HALF_UP), "MatchInv incorrect amount posted "+fa.getAmtAcctCr().toPlainString());
} }
} }
@ -525,11 +525,11 @@ public class MatchInvTest extends AbstractTestCase {
for (int id : ids) { for (int id : ids) {
MFactAcct fa = new MFactAcct(Env.getCtx(), id, getTrxName()); MFactAcct fa = new MFactAcct(Env.getCtx(), id, getTrxName());
if (fa.getAccount_ID() == acctNIR.getAccount_ID()) if (fa.getAccount_ID() == acctNIR.getAccount_ID())
assertEquals(fa.getAmtAcctDr(), mulchCost, ""); assertEquals(fa.getAmtAcctDr().setScale(2, RoundingMode.HALF_UP), mulchCost.setScale(2, RoundingMode.HALF_UP), "");
else if (fa.getAccount_ID() == acctInvClr.getAccount_ID()) else if (fa.getAccount_ID() == acctInvClr.getAccount_ID())
assertEquals(fa.getAmtAcctCr(), invMatchAmt, ""); assertEquals(fa.getAmtAcctCr().setScale(2, RoundingMode.HALF_UP), invMatchAmt.setScale(2, RoundingMode.HALF_UP), "");
else if (fa.getAccount_ID() == acctIPV.getAccount_ID()) else if (fa.getAccount_ID() == acctIPV.getAccount_ID())
assertEquals(fa.getAmtAcctDr().subtract(fa.getAmtAcctCr()), invMatchAmt.subtract(mulchCost), ""); assertEquals(fa.getAmtAcctDr().subtract(fa.getAmtAcctCr()).setScale(2, RoundingMode.HALF_UP), invMatchAmt.subtract(mulchCost).setScale(2, RoundingMode.HALF_UP), "");
} }
} }
} finally { } finally {
@ -647,12 +647,12 @@ public class MatchInvTest extends AbstractTestCase {
for (int id : ids) { for (int id : ids) {
MFactAcct fa = new MFactAcct(Env.getCtx(), id, getTrxName()); MFactAcct fa = new MFactAcct(Env.getCtx(), id, getTrxName());
if (fa.getAccount_ID() == acctNIR.getAccount_ID()) { if (fa.getAccount_ID() == acctNIR.getAccount_ID()) {
assertEquals(fa.getAmtAcctDr(), invMatchAmt, "MatchInv incorrect amount posted "+fa.getAmtAcctDr().toPlainString()); assertEquals(fa.getAmtAcctDr().setScale(2, RoundingMode.HALF_UP), invMatchAmt.setScale(2, RoundingMode.HALF_UP), "MatchInv incorrect amount posted "+fa.getAmtAcctDr().toPlainString());
assertEquals(mi.getQty(), fa.getQty(), "Accounting fact quantity incorrect"); assertEquals(mi.getQty(), fa.getQty(), "Accounting fact quantity incorrect");
} }
else if (fa.getAccount_ID() == acctInvClr.getAccount_ID()) { else if (fa.getAccount_ID() == acctInvClr.getAccount_ID()) {
assertEquals(fa.getAmtAcctCr(), invMatchAmt, "MatchInv incorrect amount posted "+fa.getAmtAcctCr().toPlainString()); assertEquals(fa.getAmtAcctCr().setScale(2, RoundingMode.HALF_UP), invMatchAmt.setScale(2, RoundingMode.HALF_UP), "MatchInv incorrect amount posted "+fa.getAmtAcctCr().toPlainString());
assertEquals(mi.getQty().negate(), fa.getQty(), "Accounting fact quantity incorrect"); assertEquals(mi.getQty().negate().setScale(2, RoundingMode.HALF_UP), fa.getQty().setScale(2, RoundingMode.HALF_UP), "Accounting fact quantity incorrect");
} }
} }
} }
@ -710,12 +710,12 @@ public class MatchInvTest extends AbstractTestCase {
for (int id : ids) { for (int id : ids) {
MFactAcct fa = new MFactAcct(Env.getCtx(), id, getTrxName()); MFactAcct fa = new MFactAcct(Env.getCtx(), id, getTrxName());
if (fa.getAccount_ID() == acctInvClr.getAccount_ID() && fa.getQty().compareTo(BigDecimal.ZERO) < 0) { if (fa.getAccount_ID() == acctInvClr.getAccount_ID() && fa.getQty().compareTo(BigDecimal.ZERO) < 0) {
assertEquals(fa.getAmtAcctCr(), credMatchAmt, "MatchInv incorrect amount posted "+fa.getAmtAcctCr().toPlainString()); assertEquals(fa.getAmtAcctCr().setScale(2, RoundingMode.HALF_UP), credMatchAmt.setScale(2, RoundingMode.HALF_UP), "MatchInv incorrect amount posted "+fa.getAmtAcctCr().toPlainString());
amtAcctCrInvClr = amtAcctCrInvClr.add(fa.getAmtAcctCr()); amtAcctCrInvClr = amtAcctCrInvClr.add(fa.getAmtAcctCr());
assertEquals(mi.getQty(), fa.getQty(), "Accounting fact quantity incorrect"); assertEquals(mi.getQty(), fa.getQty(), "Accounting fact quantity incorrect");
} }
else if (fa.getAccount_ID() == acctInvClr.getAccount_ID() && fa.getQty().compareTo(BigDecimal.ZERO) > 0) { else if (fa.getAccount_ID() == acctInvClr.getAccount_ID() && fa.getQty().compareTo(BigDecimal.ZERO) > 0) {
assertEquals(fa.getAmtAcctDr(), credMatchAmt, "MatchInv incorrect amount posted "+fa.getAmtAcctDr().toPlainString()); assertEquals(fa.getAmtAcctDr().setScale(2, RoundingMode.HALF_UP), credMatchAmt.setScale(2, RoundingMode.HALF_UP), "MatchInv incorrect amount posted "+fa.getAmtAcctDr().toPlainString());
amtAcctDrInvClr = amtAcctDrInvClr.add(fa.getAmtAcctDr()); amtAcctDrInvClr = amtAcctDrInvClr.add(fa.getAmtAcctDr());
assertEquals(mi.getQty().negate(), fa.getQty(), "Accounting fact quantity incorrect"); assertEquals(mi.getQty().negate(), fa.getQty(), "Accounting fact quantity incorrect");
} }
@ -889,6 +889,7 @@ public class MatchInvTest extends AbstractTestCase {
} }
} }
} finally { } finally {
rollback();
String whereClause = "ValidFrom=? AND ValidTo=? " String whereClause = "ValidFrom=? AND ValidTo=? "
+ "AND C_Currency_ID=? AND C_Currency_ID_To=? " + "AND C_Currency_ID=? AND C_Currency_ID_To=? "
+ "AND C_ConversionType_ID=? " + "AND C_ConversionType_ID=? "
@ -916,7 +917,6 @@ public class MatchInvTest extends AbstractTestCase {
pp.deleteEx(true); pp.deleteEx(true);
plv.deleteEx(true); plv.deleteEx(true);
priceList.deleteEx(true); priceList.deleteEx(true);
rollback();
} }
} }
@ -1238,16 +1238,16 @@ public class MatchInvTest extends AbstractTestCase {
MFactAcct fa = new MFactAcct(Env.getCtx(), id, getTrxName()); MFactAcct fa = new MFactAcct(Env.getCtx(), id, getTrxName());
if (fa.getAccount_ID() == acctNIR.getAccount_ID()) { if (fa.getAccount_ID() == acctNIR.getAccount_ID()) {
if (mi.isReversal()) if (mi.isReversal())
assertEquals(fa.getAmtAcctCr(), invMatchAmt, "MatchInv incorrect amount posted "); assertEquals(fa.getAmtAcctCr().setScale(2, RoundingMode.HALF_UP), invMatchAmt.setScale(2, RoundingMode.HALF_UP), "MatchInv incorrect amount posted ");
else else
assertEquals(fa.getAmtAcctDr(), invMatchAmt, "MatchInv incorrect amount posted "); assertEquals(fa.getAmtAcctDr().setScale(2, RoundingMode.HALF_UP), invMatchAmt.setScale(2, RoundingMode.HALF_UP), "MatchInv incorrect amount posted ");
assertEquals(mi.getQty(), fa.getQty(), "Accounting fact quantity incorrect"); assertEquals(mi.getQty(), fa.getQty(), "Accounting fact quantity incorrect");
} }
else if (fa.getAccount_ID() == acctInvClr.getAccount_ID()) { else if (fa.getAccount_ID() == acctInvClr.getAccount_ID()) {
if (mi.isReversal()) if (mi.isReversal())
assertEquals(fa.getAmtAcctDr(), invMatchAmt, "MatchInv incorrect amount posted "); assertEquals(fa.getAmtAcctDr().setScale(2, RoundingMode.HALF_UP), invMatchAmt.setScale(2, RoundingMode.HALF_UP), "MatchInv incorrect amount posted ");
else else
assertEquals(fa.getAmtAcctCr(), invMatchAmt, "MatchInv incorrect amount posted "); assertEquals(fa.getAmtAcctCr().setScale(2, RoundingMode.HALF_UP), invMatchAmt.setScale(2, RoundingMode.HALF_UP), "MatchInv incorrect amount posted ");
assertEquals(mi.getQty().negate(), fa.getQty(), "Accounting fact quantity incorrect"); assertEquals(mi.getQty().negate(), fa.getQty(), "Accounting fact quantity incorrect");
} }
} }

View File

@ -349,6 +349,12 @@ public class POTest extends AbstractTestCase
//test update with default optimistic locking using updated timestamp //test update with default optimistic locking using updated timestamp
bp1.set_UseOptimisticLocking(true); bp1.set_UseOptimisticLocking(true);
bp1.setDescription("bp1"); bp1.setDescription("bp1");
if (DB.isOracle()) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
updated = bp1.save(); updated = bp1.save();
assertTrue(updated); assertTrue(updated);
@ -418,6 +424,12 @@ public class POTest extends AbstractTestCase
//test delete with default optimistic locking //test delete with default optimistic locking
MMessage msg2 = new MMessage(Env.getCtx(), msg1.getAD_Message_ID(), getTrxName()); MMessage msg2 = new MMessage(Env.getCtx(), msg1.getAD_Message_ID(), getTrxName());
msg1.setMsgText("msg 1.1 test"); msg1.setMsgText("msg 1.1 test");
if (DB.isOracle()) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
msg1.saveEx(); msg1.saveEx();
msg2.set_UseOptimisticLocking(true); msg2.set_UseOptimisticLocking(true);

View File

@ -405,7 +405,7 @@ public class QueryTest extends AbstractTestCase {
testPo = query.setParameters(testPo.get_ID()).first(); testPo = query.setParameters(testPo.get_ID()).first();
I_Test testRecord = POWrapper.create(testPo, I_Test.class); I_Test testRecord = POWrapper.create(testPo, I_Test.class);
assertTrue(null == testPo.get_ValueOld(MTest.COLUMNNAME_TestVirtualQty)); assertTrue(null == testPo.get_ValueOld(MTest.COLUMNNAME_TestVirtualQty));
assertEquals(expected, testRecord.getTestVirtualQty().setScale(2, RoundingMode.HALF_UP), "Wrong value returned"); assertEquals(expected.setScale(2, RoundingMode.HALF_UP), testRecord.getTestVirtualQty().setScale(2, RoundingMode.HALF_UP), "Wrong value returned");
// without virtual column lazy loading // without virtual column lazy loading
testPo = query.setNoVirtualColumn(false).setParameters(testPo.get_ID()).first(); testPo = query.setNoVirtualColumn(false).setParameters(testPo.get_ID()).first();

View File

@ -654,8 +654,8 @@ public class AllocationTest extends AbstractTestCase {
int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6) int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6)
MInvoice invoice = createInvoice(true,false, date, date, MInvoice invoice = createInvoice(true,false, date, date,
bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED); bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED);
assertEquals(invoice.getTotalLines(), new BigDecimal("100.0")); assertEquals(invoice.getTotalLines().setScale(2, RoundingMode.HALF_UP), new BigDecimal("100.00"));
assertEquals(invoice.getGrandTotal(), new BigDecimal("106.00")); assertEquals(invoice.getGrandTotal().setScale(2, RoundingMode.HALF_UP), new BigDecimal("106.00"));
// Payamt with discount // Payamt with discount
BigDecimal payAmt = new BigDecimal("102"); BigDecimal payAmt = new BigDecimal("102");
@ -785,8 +785,8 @@ public class AllocationTest extends AbstractTestCase {
int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6) int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6)
MInvoice invoice = createInvoice(true, true, date, date, MInvoice invoice = createInvoice(true, true, date, date,
bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED); bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED);
assertEquals(invoice.getTotalLines(), new BigDecimal("100.0")); assertEquals(invoice.getTotalLines().setScale(2, RoundingMode.HALF_UP), new BigDecimal("100.00"));
assertEquals(invoice.getGrandTotal(), new BigDecimal("106.00")); assertEquals(invoice.getGrandTotal().setScale(2, RoundingMode.HALF_UP), new BigDecimal("106.00"));
// Payamt with discount // Payamt with discount
BigDecimal payAmt = new BigDecimal("102"); BigDecimal payAmt = new BigDecimal("102");
@ -915,8 +915,8 @@ public class AllocationTest extends AbstractTestCase {
int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6) int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6)
MInvoice invoice = createInvoice(false, false, date, date, MInvoice invoice = createInvoice(false, false, date, date,
bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED); bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED);
assertEquals(invoice.getTotalLines(), new BigDecimal("100.0")); assertEquals(invoice.getTotalLines().setScale(2, RoundingMode.HALF_UP), new BigDecimal("100.00"));
assertEquals(invoice.getGrandTotal(), new BigDecimal("106.00")); assertEquals(invoice.getGrandTotal().setScale(2, RoundingMode.HALF_UP), new BigDecimal("106.00"));
// Payamt with discount // Payamt with discount
BigDecimal payAmt = new BigDecimal("102"); BigDecimal payAmt = new BigDecimal("102");
@ -1045,8 +1045,8 @@ public class AllocationTest extends AbstractTestCase {
int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6) int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6)
MInvoice invoice = createInvoice(false, true, date, date, MInvoice invoice = createInvoice(false, true, date, date,
bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED); bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED);
assertEquals(invoice.getTotalLines(), new BigDecimal("100.0")); assertEquals(invoice.getTotalLines().setScale(2, RoundingMode.HALF_UP), new BigDecimal("100.00"));
assertEquals(invoice.getGrandTotal(), new BigDecimal("106.00")); assertEquals(invoice.getGrandTotal().setScale(2, RoundingMode.HALF_UP), new BigDecimal("106.00"));
// Payamt with discount // Payamt with discount
BigDecimal payAmt = new BigDecimal("102"); BigDecimal payAmt = new BigDecimal("102");
@ -1175,8 +1175,8 @@ public class AllocationTest extends AbstractTestCase {
int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6) int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6)
MInvoice invoice = createInvoice(true,false, date, date, MInvoice invoice = createInvoice(true,false, date, date,
bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED); bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED);
assertEquals(invoice.getTotalLines(), new BigDecimal("100.0")); assertEquals(invoice.getTotalLines().setScale(2, RoundingMode.HALF_UP), new BigDecimal("100.00"));
assertEquals(invoice.getGrandTotal(), new BigDecimal("106.00")); assertEquals(invoice.getGrandTotal().setScale(2, RoundingMode.HALF_UP), new BigDecimal("106.00"));
// Payamt with discount // Payamt with discount
BigDecimal payAmt = new BigDecimal("102"); BigDecimal payAmt = new BigDecimal("102");
@ -1307,8 +1307,8 @@ public class AllocationTest extends AbstractTestCase {
int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6) int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6)
MInvoice invoice = createInvoice(true, true, date, date, MInvoice invoice = createInvoice(true, true, date, date,
bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED); bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED);
assertEquals(invoice.getTotalLines(), new BigDecimal("100.0")); assertEquals(invoice.getTotalLines().setScale(2, RoundingMode.HALF_UP), new BigDecimal("100.00"));
assertEquals(invoice.getGrandTotal(), new BigDecimal("106.00")); assertEquals(invoice.getGrandTotal().setScale(2, RoundingMode.HALF_UP), new BigDecimal("106.00"));
// Payamt with discount // Payamt with discount
BigDecimal payAmt = new BigDecimal("102").negate(); BigDecimal payAmt = new BigDecimal("102").negate();
@ -1438,8 +1438,8 @@ public class AllocationTest extends AbstractTestCase {
int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6) int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6)
MInvoice invoice = createInvoice(false, false, date, date, MInvoice invoice = createInvoice(false, false, date, date,
bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED); bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED);
assertEquals(invoice.getTotalLines(), new BigDecimal("100.0")); assertEquals(invoice.getTotalLines().setScale(2, RoundingMode.HALF_UP), new BigDecimal("100.00"));
assertEquals(invoice.getGrandTotal(), new BigDecimal("106.00")); assertEquals(invoice.getGrandTotal().setScale(2, RoundingMode.HALF_UP), new BigDecimal("106.00"));
BigDecimal payAmt = new BigDecimal("102"); BigDecimal payAmt = new BigDecimal("102");
@ -1569,8 +1569,8 @@ public class AllocationTest extends AbstractTestCase {
int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6) int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6)
MInvoice invoice = createInvoice(false, true, date, date, MInvoice invoice = createInvoice(false, true, date, date,
bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED); bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED);
assertEquals(invoice.getTotalLines(), new BigDecimal("100.0")); assertEquals(invoice.getTotalLines().setScale(2, RoundingMode.HALF_UP), new BigDecimal("100.00"));
assertEquals(invoice.getGrandTotal(), new BigDecimal("106.00")); assertEquals(invoice.getGrandTotal().setScale(2, RoundingMode.HALF_UP), new BigDecimal("106.00"));
// Payamt with discount // Payamt with discount
BigDecimal payAmt = new BigDecimal("102").negate(); BigDecimal payAmt = new BigDecimal("102").negate();
@ -1700,14 +1700,14 @@ public class AllocationTest extends AbstractTestCase {
int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6) int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6)
MInvoice invoice = createInvoice(true,false, date, date, MInvoice invoice = createInvoice(true,false, date, date,
bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED); bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED);
assertEquals(invoice.getTotalLines(), new BigDecimal("100.0")); assertEquals(invoice.getTotalLines().setScale(2, RoundingMode.HALF_UP), new BigDecimal("100.00"));
assertEquals(invoice.getGrandTotal(), new BigDecimal("106.00")); assertEquals(invoice.getGrandTotal().setScale(2, RoundingMode.HALF_UP), new BigDecimal("106.00"));
int paytermcm = DictionaryIDs.C_PaymentTerm.IMMEDIATE.id; int paytermcm = DictionaryIDs.C_PaymentTerm.IMMEDIATE.id;
MInvoice creditmemo = createInvoice(true,true, date, date, MInvoice creditmemo = createInvoice(true,true, date, date,
bpartner.getC_BPartner_ID(), paytermcm, taxid, new BigDecimal("96.23")); bpartner.getC_BPartner_ID(), paytermcm, taxid, new BigDecimal("96.23"));
assertEquals(creditmemo.getTotalLines(), new BigDecimal("96.23")); assertEquals(creditmemo.getTotalLines().setScale(2, RoundingMode.HALF_UP), new BigDecimal("96.23"));
assertEquals(creditmemo.getGrandTotal(), new BigDecimal("102.00")); assertEquals(creditmemo.getGrandTotal().setScale(2, RoundingMode.HALF_UP), new BigDecimal("102.00"));
MAllocationHdr alloc = new MAllocationHdr(Env.getCtx(), true, date, usd.getC_Currency_ID(), Env.getContext(Env.getCtx(), "#AD_User_Name"), getTrxName()); MAllocationHdr alloc = new MAllocationHdr(Env.getCtx(), true, date, usd.getC_Currency_ID(), Env.getContext(Env.getCtx(), "#AD_User_Name"), getTrxName());
alloc.setAD_Org_ID(invoice.getAD_Org_ID()); alloc.setAD_Org_ID(invoice.getAD_Org_ID());
@ -1837,14 +1837,14 @@ public class AllocationTest extends AbstractTestCase {
int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6) int taxid = DictionaryIDs.C_Tax.CT_SALES.id; // (CT Sales, Rate 6)
MInvoice invoice = createInvoice(false, false, date, date, MInvoice invoice = createInvoice(false, false, date, date,
bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED); bpartner.getC_BPartner_ID(), payterm, taxid, Env.ONEHUNDRED);
assertEquals(invoice.getTotalLines(), new BigDecimal("100.0")); assertEquals(invoice.getTotalLines().setScale(2, RoundingMode.HALF_UP), new BigDecimal("100.00"));
assertEquals(invoice.getGrandTotal(), new BigDecimal("106.00")); assertEquals(invoice.getGrandTotal().setScale(2, RoundingMode.HALF_UP), new BigDecimal("106.00"));
int paytermcm = DictionaryIDs.C_PaymentTerm.IMMEDIATE.id; int paytermcm = DictionaryIDs.C_PaymentTerm.IMMEDIATE.id;
MInvoice creditmemo = createInvoice(false,true, date, date, MInvoice creditmemo = createInvoice(false,true, date, date,
bpartner.getC_BPartner_ID(), paytermcm, taxid, new BigDecimal("96.23")); bpartner.getC_BPartner_ID(), paytermcm, taxid, new BigDecimal("96.23"));
assertEquals(creditmemo.getTotalLines(), new BigDecimal("96.23")); assertEquals(creditmemo.getTotalLines().setScale(2, RoundingMode.HALF_UP), new BigDecimal("96.23"));
assertEquals(creditmemo.getGrandTotal(), new BigDecimal("102.00")); assertEquals(creditmemo.getGrandTotal().setScale(2, RoundingMode.HALF_UP), new BigDecimal("102.00"));
MAllocationHdr alloc = new MAllocationHdr(Env.getCtx(), true, date, usd.getC_Currency_ID(), Env.getContext(Env.getCtx(), "#AD_User_Name"), getTrxName()); MAllocationHdr alloc = new MAllocationHdr(Env.getCtx(), true, date, usd.getC_Currency_ID(), Env.getContext(Env.getCtx(), "#AD_User_Name"), getTrxName());

View File

@ -255,7 +255,7 @@ public class InventoryTest extends AbstractTestCase {
Env.ZERO); Env.ZERO);
iline.saveEx(); iline.saveEx();
//show error out with negative on hand (skip the only asi record with serno) //should error out with negative on hand (skip the only asi record with serno)
ProcessInfo info = MWorkflow.runDocumentActionWorkflow(inventory, DocAction.ACTION_Complete); ProcessInfo info = MWorkflow.runDocumentActionWorkflow(inventory, DocAction.ACTION_Complete);
assertTrue(info.isError(), info.getSummary()); assertTrue(info.isError(), info.getSummary());
} finally { } finally {

View File

@ -134,6 +134,7 @@ public class MDiscountSchemaTest extends AbstractTestCase {
assertEquals(fixedPrice, line1.getPriceActual().setScale(2, RoundingMode.HALF_UP), "Unexpected Order Line price"); assertEquals(fixedPrice, line1.getPriceActual().setScale(2, RoundingMode.HALF_UP), "Unexpected Order Line price");
} finally { } finally {
rollback();
if (discountBreak != null && discountBreak.get_ID() > 0) if (discountBreak != null && discountBreak.get_ID() > 0)
discountBreak.deleteEx(true); discountBreak.deleteEx(true);
} }

View File

@ -151,6 +151,7 @@ public class MInfoWindowTest extends AbstractTestCase {
assertNotNull(infoColumns); assertNotNull(infoColumns);
assertEquals(1, infoColumns.length); assertEquals(1, infoColumns.length);
} finally { } finally {
rollback();
ca.deleteEx(true); ca.deleteEx(true);
} }
} }

View File

@ -236,7 +236,8 @@ public class MProductTest extends AbstractTestCase {
@Test @Test
public void testDeactivateProductBOMValidation() { public void testDeactivateProductBOMValidation() {
Query query = new Query(Env.getCtx(), MPPProductBOM.Table_Name, MPPProductBOM.COLUMNNAME_PP_Product_BOM_ID+"<1000000", getTrxName()); Query query = new Query(Env.getCtx(), MPPProductBOM.Table_Name, MPPProductBOM.COLUMNNAME_PP_Product_BOM_ID+"<1000000"
+ " AND M_Product_ID NOT IN (SELECT M_Product_ID FROM PP_Product_BOMLine)", getTrxName());
MPPProductBOM bom = query.setClient_ID().setOnlyActiveRecords(true).first(); MPPProductBOM bom = query.setClient_ID().setOnlyActiveRecords(true).first();
MPPProductBOMLine[] lines = bom.getLines(); MPPProductBOMLine[] lines = bom.getLines();
final MProduct product = new MProduct(Env.getCtx(), lines[0].getM_Product_ID(), getTrxName()); final MProduct product = new MProduct(Env.getCtx(), lines[0].getM_Product_ID(), getTrxName());

View File

@ -141,6 +141,7 @@ public class MSchedulerTest extends AbstractTestCase {
assertEquals(formatter2.format(cal2.getTime().toInstant()), formatter2.format(ts2.toInstant()), "Un-expected date next run"); assertEquals(formatter2.format(cal2.getTime().toInstant()), formatter2.format(ts2.toInstant()), "Un-expected date next run");
assertFalse(cal1.getTimeInMillis() == ts2.getTime(), "Un-expected date next run"); assertFalse(cal1.getTimeInMillis() == ts2.getTime(), "Un-expected date next run");
} finally { } finally {
rollback();
if (schedule != null && schedule.get_ID() > 0) if (schedule != null && schedule.get_ID() > 0)
schedule.deleteEx(true); schedule.deleteEx(true);
clientInfo.setTimeZone(currentTimeZone); clientInfo.setTimeZone(currentTimeZone);

View File

@ -149,6 +149,7 @@ public class MStorageOnHandTest extends AbstractTestCase {
as.saveEx(); as.saveEx();
} }
} finally { } finally {
rollback();
product.deleteEx(true); product.deleteEx(true);
} }
} }

View File

@ -126,6 +126,7 @@ public class MUOMConversionTest extends AbstractTestCase {
converted = MUOMConversion.convertProductFrom(Env.getCtx(), DictionaryIDs.M_Product.OAK.id, DictionaryIDs.C_UOM.HOUR.id, new BigDecimal("1"), 1); converted = MUOMConversion.convertProductFrom(Env.getCtx(), DictionaryIDs.M_Product.OAK.id, DictionaryIDs.C_UOM.HOUR.id, new BigDecimal("1"), 1);
assertEquals(conv1.getDivideRate().setScale(1, RoundingMode.HALF_UP), converted); assertEquals(conv1.getDivideRate().setScale(1, RoundingMode.HALF_UP), converted);
} finally { } finally {
rollback();
DB.executeUpdateEx("DELETE FROM C_UOM_Conversion WHERE C_UOM_Conversion_ID=?", new Object[] {conv1.get_ID()}, null); DB.executeUpdateEx("DELETE FROM C_UOM_Conversion WHERE C_UOM_Conversion_ID=?", new Object[] {conv1.get_ID()}, null);
if (conv2 != null) if (conv2 != null)
conv2.deleteEx(true); conv2.deleteEx(true);

View File

@ -70,11 +70,13 @@ public class ModelClassMappingTest extends AbstractTestCase {
@Test @Test
public void testModelClassMappingForCoreTables() { public void testModelClassMappingForCoreTables() {
Query query = new Query(Env.getCtx(), MTable.Table_Name, "IsView='N' AND EntityType IN ('D','EE01','EE02','EE04','EE05') " Query query = new Query(Env.getCtx(), MTable.Table_Name, "IsView='N' AND EntityType IN ('D','EE01','EE02','EE04','EE05') "
+ "AND TableName NOT Like 'I\\_%' AND TableName NOT Like 'T\\_%' AND TableName NOT Like 'W\\_%'" + "AND TableName NOT Like 'I!_%' ESCAPE '!' AND TableName NOT Like 'T!_%' ESCAPE '!' AND TableName NOT Like 'W!_%' ESCAPE '!' "
+ "AND TableName NOT Like '%\\_Trl'", getTrxName()); + "AND TableName NOT Like '%!_Trl' ESCAPE '!'", getTrxName());
List<IServiceReferenceHolder<IModelFactory>> references = Service.locator().list(IModelFactory.class).getServiceReferences(); List<IServiceReferenceHolder<IModelFactory>> references = Service.locator().list(IModelFactory.class).getServiceReferences();
List<MTable> tables = query.setOnlyActiveRecords(true).setOrderBy("TableName").list(); List<MTable> tables = query.setOnlyActiveRecords(true).setOrderBy("TableName").list();
for(MTable table : tables) { for(MTable table : tables) {
if (table.getTableName().endsWith("_Trl"))
continue;
Class<?> clazz = null; Class<?> clazz = null;
for(IServiceReferenceHolder<IModelFactory> reference : references) { for(IServiceReferenceHolder<IModelFactory> reference : references) {
IModelFactory service = reference.getService(); IModelFactory service = reference.getService();

View File

@ -274,6 +274,7 @@ public class ProcessTest extends AbstractTestCase {
inout.load(getTrxName()); inout.load(getTrxName());
assertEquals(DocAction.STATUS_Completed, inout.getDocStatus(), "Expected Completed Status for Shipment"); assertEquals(DocAction.STATUS_Completed, inout.getDocStatus(), "Expected Completed Status for Shipment");
} finally { } finally {
rollback();
docCompleteNodeNext.deleteEx(true); docCompleteNodeNext.deleteEx(true);
processNodePara.deleteEx(true); processNodePara.deleteEx(true);
processNode.deleteEx(true); processNode.deleteEx(true);

View File

@ -370,7 +370,7 @@ public class ProductionTest extends AbstractTestCase {
break; break;
} }
BigDecimal varianceExpected = componentCost.subtract(endProductCost).setScale(as.getStdPrecision(), RoundingMode.HALF_UP); BigDecimal varianceExpected = componentCost.subtract(endProductCost).setScale(as.getStdPrecision(), RoundingMode.HALF_UP);
assertEquals(varianceExpected, variance, "Variance not posted correctly."); assertEquals(varianceExpected.setScale(2, RoundingMode.HALF_UP), variance.setScale(2, RoundingMode.HALF_UP), "Variance not posted correctly.");
} finally { } finally {
getTrx().rollback(); getTrx().rollback();
mulch.setM_Product_Category_ID(categorySaveId); mulch.setM_Product_Category_ID(categorySaveId);