details: https://code.openbravo.com/erp/devel/pi/rev/6b20e7da0de3
changeset: 33533:6b20e7da0de3
user: David Miguelez <david.miguelez <at> openbravo.com>
date: Thu Feb 22 09:09:51 2018 +0100
summary: Related to Issue 37357.
* Changed initialization of Longs. Instead of new Long("10") use 10L
to avoid warnings in Java 9
* Use setAdminMode(true) instead of setAdminMode()
* Remove unnecessary flush
* Log correctly the exceptions and do not launch e.printStackTrace()
diffstat:
src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/ICIInvoiceLineParameters.java
| 2 +-
src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/ICIOrderLineParameters.java
| 2 +-
src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/ICIUtility.java
| 5 ++---
src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/IsCompletelyInvoicedShipmentMultiLineTest.java
| 10 ++++------
src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/IsCompletelyInvoicedShipmentOneLineTest.java
| 9 +++------
5 files changed, 11 insertions(+), 17 deletions(-)
diffs (124 lines):
diff -r b6a93ba857f3 -r 6b20e7da0de3
src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/ICIInvoiceLineParameters.java
---
a/src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/ICIInvoiceLineParameters.java
Wed Feb 21 10:12:00 2018 +0100
+++
b/src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/ICIInvoiceLineParameters.java
Thu Feb 22 09:09:51 2018 +0100
@@ -57,7 +57,7 @@
this.priceLimit = new BigDecimal("10");
this.lineNetAmount = new BigDecimal("100");
this.taxRate = OBDal.getInstance().get(TaxRate.class, ICIConstants.TAX_ID);
- this.lineNo = new Long("10");
+ this.lineNo = 10L;
}
public Invoice getInvoice() {
diff -r b6a93ba857f3 -r 6b20e7da0de3
src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/ICIOrderLineParameters.java
---
a/src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/ICIOrderLineParameters.java
Wed Feb 21 10:12:00 2018 +0100
+++
b/src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/ICIOrderLineParameters.java
Thu Feb 22 09:09:51 2018 +0100
@@ -65,7 +65,7 @@
this.netListPrice = new BigDecimal("10");
this.lineNetAmount = new BigDecimal("100");
this.taxRate = OBDal.getInstance().get(TaxRate.class, ICIConstants.TAX_ID);
- this.lineNo = new Long("10");
+ this.lineNo = 10L;
}
public Order getOrder() {
diff -r b6a93ba857f3 -r 6b20e7da0de3
src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/ICIUtility.java
---
a/src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/ICIUtility.java
Wed Feb 21 10:12:00 2018 +0100
+++
b/src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/ICIUtility.java
Thu Feb 22 09:09:51 2018 +0100
@@ -296,7 +296,7 @@
*/
public static ShipmentInOutLine createShipmentLine(ICIShipmentLineParameters
parameters) {
ShipmentInOutLine shipmentLine =
OBProvider.getInstance().get(ShipmentInOutLine.class);
- shipmentLine.setLineNo(new Long("10"));
+ shipmentLine.setLineNo(10L);
shipmentLine.setClient(parameters.getShipment().getClient());
shipmentLine.setOrganization(parameters.getShipment().getOrganization());
shipmentLine.setProduct(parameters.getProduct());
@@ -320,13 +320,12 @@
}
private static boolean processDocument(BaseOBObject document, String
processId) {
- OBContext.setAdminMode();
+ OBContext.setAdminMode(true);
try {
Process process = null;
process = OBDal.getInstance().get(Process.class, processId);
final ProcessInstance pinstance = CallProcess.getInstance().call(process,
document.getId().toString(), null);
- OBDal.getInstance().flush();
return (pinstance.getResult() == 0L);
} finally {
OBContext.restorePreviousMode();
diff -r b6a93ba857f3 -r 6b20e7da0de3
src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/IsCompletelyInvoicedShipmentMultiLineTest.java
---
a/src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/IsCompletelyInvoicedShipmentMultiLineTest.java
Wed Feb 21 10:12:00 2018 +0100
+++
b/src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/IsCompletelyInvoicedShipmentMultiLineTest.java
Thu Feb 22 09:09:51 2018 +0100
@@ -112,8 +112,7 @@
shipment2 = ICIUtility.reloadAndRefreshShipment(shipment2);
assertEquals(true, shipment2.isCompletelyInvoiced());
} catch (Exception e) {
- e.printStackTrace();
- log.error(ICIUtility.getExceptionMessage(e));
+ log.error("Error in testIsCompletelyInvoicedMultiLine_01", e);
}
}
@@ -183,8 +182,7 @@
shipment2 = ICIUtility.reloadAndRefreshShipment(shipment2);
assertEquals(false, shipment2.isCompletelyInvoiced());
} catch (Exception e) {
- e.printStackTrace();
- log.error(ICIUtility.getExceptionMessage(e));
+ log.error("Error in testIsCompletelyInvoicedMultiLine_02", e);
}
}
@@ -197,14 +195,14 @@
orderLine2Parameters.setNetListPrice(new BigDecimal("20"));
orderLine2Parameters.setPriceLimit(new BigDecimal("20"));
orderLine2Parameters.setLineNetAmount(new BigDecimal("200"));
- orderLine2Parameters.setLineNo(new Long("20"));
+ orderLine2Parameters.setLineNo(20L);
OrderLine orderLine2 = ICIUtility.createNewOrderLine(orderLine2Parameters);
return orderLine2;
}
private InvoiceLine createSecondInvoiceLine(Product secondProduct, Invoice
invoice) {
ICIInvoiceLineParameters invoiceLine2Parameters = new
ICIInvoiceLineParameters(invoice);
- invoiceLine2Parameters.setLineNo(new Long("20"));
+ invoiceLine2Parameters.setLineNo(20L);
invoiceLine2Parameters.setProduct(secondProduct);
invoiceLine2Parameters.setUom(secondProduct.getUOM());
invoiceLine2Parameters.setInvoicedQuantity(new BigDecimal("20"));
diff -r b6a93ba857f3 -r 6b20e7da0de3
src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/IsCompletelyInvoicedShipmentOneLineTest.java
---
a/src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/IsCompletelyInvoicedShipmentOneLineTest.java
Wed Feb 21 10:12:00 2018 +0100
+++
b/src-test/src/org/openbravo/test/materialMgmt/iscompletelyinvoicedshipment/IsCompletelyInvoicedShipmentOneLineTest.java
Thu Feb 22 09:09:51 2018 +0100
@@ -83,8 +83,7 @@
shipment = ICIUtility.reloadAndRefreshShipment(shipment);
assertEquals(true, shipment.isCompletelyInvoiced());
} catch (Exception e) {
- e.printStackTrace();
- log.error(ICIUtility.getExceptionMessage(e));
+ log.error("Error in testIsCompletelyInvoicedOneLine_01", e);
}
}
@@ -133,8 +132,7 @@
shipment = ICIUtility.reloadAndRefreshShipment(shipment);
assertEquals(false, shipment.isCompletelyInvoiced());
} catch (Exception e) {
- e.printStackTrace();
- log.error(ICIUtility.getExceptionMessage(e));
+ log.error("Error in testIsCompletelyInvoicedOneLine_02", e);
}
}
@@ -182,8 +180,7 @@
shipment = ICIUtility.reloadAndRefreshShipment(shipment);
assertEquals(false, shipment.isCompletelyInvoiced());
} catch (Exception e) {
- e.printStackTrace();
- log.error(ICIUtility.getExceptionMessage(e));
+ log.error("Error in testIsCompletelyInvoicedOneLine_03", e);
}
}
}
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits