details: https://code.openbravo.com/erp/devel/pi/rev/7ed116cab029 changeset: 33211:7ed116cab029 user: Nono Carballo <nonofce <at> gmail.com> date: Mon Jan 22 17:05:50 2018 +0100 summary: Fixes Issue 37703. Refactors TestCosting class
* Assert Classes were placed in a new package * Constants were moved to a new class * TestCostingUtils now contains all the API to create tests * New test classes were created containig the tests * TestCosting class was converted into a suite running all test classes details: https://code.openbravo.com/erp/devel/pi/rev/21e9102f2f7d changeset: 33212:21e9102f2f7d user: Nono Carballo <nonofce <at> gmail.com> date: Mon Jan 22 17:22:09 2018 +0100 summary: Fixes issue 37642: Enable tree view in MRP Manufacturing Plan window A tree of type LinkToParent was created using the column parentId (Report Set) in table mrp_run_productionline. The tree was set in manufacturing Plan/Lines tab. diffstat: src-db/database/sourcedata/AD_TAB.xml | 1 + src-db/database/sourcedata/AD_TABLE.xml | 2 +- src-db/database/sourcedata/AD_TABLE_TREE.xml | 20 + src-test/src/org/openbravo/test/costing/TestCosting.java | 14873 +--------- src-test/src/org/openbravo/test/costing/TestCostingBase.java | 204 + src-test/src/org/openbravo/test/costing/TestCostingLandedCost.java | 3981 ++ src-test/src/org/openbravo/test/costing/TestCostingNoSourceAdjustments.java | 1753 + src-test/src/org/openbravo/test/costing/TestCostingSourceAdjustments.java | 3056 ++ src-test/src/org/openbravo/test/costing/TestCostingUtils.java | 90 - src-test/src/org/openbravo/test/costing/TestIssue37033.java | 335 + src-test/src/org/openbravo/test/costing/TestIssue37279.java | 372 + src-test/src/org/openbravo/test/costing/assertclass/CostAdjustmentAssert.java | 133 + src-test/src/org/openbravo/test/costing/assertclass/DocumentPostAssert.java | 65 + src-test/src/org/openbravo/test/costing/assertclass/LandedCostCostMatchedAssert.java | 35 + src-test/src/org/openbravo/test/costing/assertclass/LandedCostReceiptLineAmountAssert.java | 52 + src-test/src/org/openbravo/test/costing/assertclass/MatchedInvoicesAssert.java | 43 + src-test/src/org/openbravo/test/costing/assertclass/OrderToReceiptResult.java | 42 + src-test/src/org/openbravo/test/costing/assertclass/PhysicalInventoryAssert.java | 57 + src-test/src/org/openbravo/test/costing/assertclass/ProductCostingAssert.java | 112 + src-test/src/org/openbravo/test/costing/assertclass/ProductTransactionAssert.java | 193 + src-test/src/org/openbravo/test/costing/utils/TestCostingConstants.java | 119 + src-test/src/org/openbravo/test/costing/utils/TestCostingUtils.java | 5399 +++ 22 files changed, 15986 insertions(+), 14951 deletions(-) diffs (truncated from 31061 to 300 lines): diff -r 18df599249e2 -r 21e9102f2f7d src-db/database/sourcedata/AD_TAB.xml --- a/src-db/database/sourcedata/AD_TAB.xml Thu Jan 11 12:26:25 2018 +0100 +++ b/src-db/database/sourcedata/AD_TAB.xml Mon Jan 22 17:22:09 2018 +0100 @@ -12207,6 +12207,7 @@ <!--800257--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID> <!--800257--> <UIPATTERN><![CDATA[STD]]></UIPATTERN> <!--800257--> <SHOWPARENTBUTTONS><![CDATA[Y]]></SHOWPARENTBUTTONS> +<!--800257--> <AD_TABLE_TREE_ID><![CDATA[6C111DA125CF407C976768B301D6AF26]]></AD_TABLE_TREE_ID> <!--800257--> <DISABLE_PARENT_KEY_PROPERTY><![CDATA[N]]></DISABLE_PARENT_KEY_PROPERTY> <!--800257--> <ISREADONLYTREE><![CDATA[N]]></ISREADONLYTREE> <!--800257--> <ISSHOWTREENODEICONS><![CDATA[Y]]></ISSHOWTREENODEICONS> diff -r 18df599249e2 -r 21e9102f2f7d src-db/database/sourcedata/AD_TABLE.xml --- a/src-db/database/sourcedata/AD_TABLE.xml Thu Jan 11 12:26:25 2018 +0100 +++ b/src-db/database/sourcedata/AD_TABLE.xml Mon Jan 22 17:22:09 2018 +0100 @@ -8226,7 +8226,7 @@ <!--800219--> <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS> <!--800219--> <AD_PACKAGE_ID><![CDATA[5A3ED54AB1F24B84E040007F01006125]]></AD_PACKAGE_ID> <!--800219--> <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE> -<!--800219--> <ISTREE><![CDATA[N]]></ISTREE> +<!--800219--> <ISTREE><![CDATA[Y]]></ISTREE> <!--800219--></AD_TABLE> <!--800220--><AD_TABLE> diff -r 18df599249e2 -r 21e9102f2f7d src-db/database/sourcedata/AD_TABLE_TREE.xml --- a/src-db/database/sourcedata/AD_TABLE_TREE.xml Thu Jan 11 12:26:25 2018 +0100 +++ b/src-db/database/sourcedata/AD_TABLE_TREE.xml Mon Jan 22 17:22:09 2018 +0100 @@ -96,6 +96,26 @@ <!--67F1DBEBB6B942C5A97C89A709E68CE8--> <NODEDELETIONPOLICY><![CDATA[RCN]]></NODEDELETIONPOLICY> <!--67F1DBEBB6B942C5A97C89A709E68CE8--></AD_TABLE_TREE> +<!--6C111DA125CF407C976768B301D6AF26--><AD_TABLE_TREE> +<!--6C111DA125CF407C976768B301D6AF26--> <AD_TABLE_TREE_ID><![CDATA[6C111DA125CF407C976768B301D6AF26]]></AD_TABLE_TREE_ID> +<!--6C111DA125CF407C976768B301D6AF26--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> +<!--6C111DA125CF407C976768B301D6AF26--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> +<!--6C111DA125CF407C976768B301D6AF26--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> +<!--6C111DA125CF407C976768B301D6AF26--> <AD_TABLE_ID><![CDATA[800219]]></AD_TABLE_ID> +<!--6C111DA125CF407C976768B301D6AF26--> <LINKTOPARENTCOLUMN><![CDATA[803636]]></LINKTOPARENTCOLUMN> +<!--6C111DA125CF407C976768B301D6AF26--> <NODEIDCOLUMN><![CDATA[803623]]></NODEIDCOLUMN> +<!--6C111DA125CF407C976768B301D6AF26--> <HASMULTIPARENTNODES><![CDATA[N]]></HASMULTIPARENTNODES> +<!--6C111DA125CF407C976768B301D6AF26--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID> +<!--6C111DA125CF407C976768B301D6AF26--> <APPLYWHERECLAUSETOCHILDNODES><![CDATA[Y]]></APPLYWHERECLAUSETOCHILDNODES> +<!--6C111DA125CF407C976768B301D6AF26--> <NAME><![CDATA[Report set]]></NAME> +<!--6C111DA125CF407C976768B301D6AF26--> <ISPARENTSELECTIONALLOWED><![CDATA[Y]]></ISPARENTSELECTIONALLOWED> +<!--6C111DA125CF407C976768B301D6AF26--> <ISORDERED><![CDATA[N]]></ISORDERED> +<!--6C111DA125CF407C976768B301D6AF26--> <TREESTRUCTURE><![CDATA[LinkToParent]]></TREESTRUCTURE> +<!--6C111DA125CF407C976768B301D6AF26--> <ISHANDLENODESMANUALLY><![CDATA[N]]></ISHANDLENODESMANUALLY> +<!--6C111DA125CF407C976768B301D6AF26--> <ISMAINTREE><![CDATA[Y]]></ISMAINTREE> +<!--6C111DA125CF407C976768B301D6AF26--> <NODEDELETIONPOLICY><![CDATA[DNAIHC]]></NODEDELETIONPOLICY> +<!--6C111DA125CF407C976768B301D6AF26--></AD_TABLE_TREE> + <!--8CA3833994EA4CF0B535A56307C5A11A--><AD_TABLE_TREE> <!--8CA3833994EA4CF0B535A56307C5A11A--> <AD_TABLE_TREE_ID><![CDATA[8CA3833994EA4CF0B535A56307C5A11A]]></AD_TABLE_TREE_ID> <!--8CA3833994EA4CF0B535A56307C5A11A--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> diff -r 18df599249e2 -r 21e9102f2f7d src-test/src/org/openbravo/test/costing/TestCosting.java --- a/src-test/src/org/openbravo/test/costing/TestCosting.java Thu Jan 11 12:26:25 2018 +0100 +++ b/src-test/src/org/openbravo/test/costing/TestCosting.java Mon Jan 22 17:22:09 2018 +0100 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2014-2017 Openbravo SLU + * All portions are Copyright (C) 2018 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -19,125 +19,8 @@ package org.openbravo.test.costing; -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -import java.lang.reflect.Method; -import java.math.BigDecimal; -import java.sql.Connection; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.time.DateUtils; -import org.codehaus.jettison.json.JSONObject; -import org.hibernate.Query; -import org.hibernate.criterion.Restrictions; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runners.MethodSorters; -import org.openbravo.base.exception.OBException; -import org.openbravo.base.provider.OBProvider; -import org.openbravo.base.secureApp.VariablesSecureApp; -import org.openbravo.base.structure.BaseOBObject; -import org.openbravo.base.weld.WeldUtils; -import org.openbravo.base.weld.test.WeldBaseTest; -import org.openbravo.costing.CancelCostAdjustment; -import org.openbravo.costing.CostingBackground; -import org.openbravo.costing.CostingRuleProcess; -import org.openbravo.costing.InventoryAmountUpdateProcess; -import org.openbravo.costing.LCCostMatchFromInvoiceHandler; -import org.openbravo.costing.LCMatchingCancelHandler; -import org.openbravo.costing.LCMatchingProcessHandler; -import org.openbravo.costing.LandedCostProcessHandler; -import org.openbravo.costing.ManualCostAdjustmentProcessHandler; -import org.openbravo.costing.PriceDifferenceBackground; -import org.openbravo.costing.ReactivateLandedCost; -import org.openbravo.dal.core.DalUtil; -import org.openbravo.dal.core.OBContext; -import org.openbravo.dal.core.SessionHandler; -import org.openbravo.dal.service.OBCriteria; -import org.openbravo.dal.service.OBDal; -import org.openbravo.dal.service.OBQuery; -import org.openbravo.database.ConnectionProvider; -import org.openbravo.erpCommon.ad_forms.AcctServer; -import org.openbravo.erpCommon.ad_process.VerifyBOM; -import org.openbravo.materialmgmt.InventoryCountProcess; -import org.openbravo.model.ad.access.User; -import org.openbravo.model.ad.datamodel.Table; -import org.openbravo.model.ad.process.ProcessInstance; -import org.openbravo.model.ad.system.Client; -import org.openbravo.model.ad.ui.Process; -import org.openbravo.model.ad.utility.Sequence; -import org.openbravo.model.common.businesspartner.BusinessPartner; -import org.openbravo.model.common.currency.ConversionRate; -import org.openbravo.model.common.currency.ConversionRateDoc; -import org.openbravo.model.common.currency.Currency; -import org.openbravo.model.common.enterprise.DocumentType; -import org.openbravo.model.common.enterprise.Locator; -import org.openbravo.model.common.enterprise.Organization; -import org.openbravo.model.common.enterprise.Warehouse; -import org.openbravo.model.common.invoice.Invoice; -import org.openbravo.model.common.invoice.InvoiceLine; -import org.openbravo.model.common.order.Order; -import org.openbravo.model.common.order.OrderLine; -import org.openbravo.model.common.plm.AttributeSetInstance; -import org.openbravo.model.common.plm.Product; -import org.openbravo.model.common.plm.ProductAccounts; -import org.openbravo.model.common.plm.ProductBOM; -import org.openbravo.model.common.uom.UOM; -import org.openbravo.model.financialmgmt.accounting.AccountingFact; -import org.openbravo.model.financialmgmt.accounting.coa.AcctSchema; -import org.openbravo.model.financialmgmt.accounting.coa.AcctSchemaTable; -import org.openbravo.model.financialmgmt.accounting.coa.ElementValue; -import org.openbravo.model.financialmgmt.calendar.Period; -import org.openbravo.model.financialmgmt.gl.GLItem; -import org.openbravo.model.financialmgmt.tax.TaxRate; -import org.openbravo.model.materialmgmt.cost.CostAdjustment; -import org.openbravo.model.materialmgmt.cost.CostAdjustmentLine; -import org.openbravo.model.materialmgmt.cost.Costing; -import org.openbravo.model.materialmgmt.cost.CostingAlgorithm; -import org.openbravo.model.materialmgmt.cost.CostingRule; -import org.openbravo.model.materialmgmt.cost.InventoryAmountUpdate; -import org.openbravo.model.materialmgmt.cost.InventoryAmountUpdateLine; -import org.openbravo.model.materialmgmt.cost.LCDistributionAlgorithm; -import org.openbravo.model.materialmgmt.cost.LCMatched; -import org.openbravo.model.materialmgmt.cost.LCReceipt; -import org.openbravo.model.materialmgmt.cost.LCReceiptLineAmt; -import org.openbravo.model.materialmgmt.cost.LandedCost; -import org.openbravo.model.materialmgmt.cost.LandedCostCost; -import org.openbravo.model.materialmgmt.cost.TransactionCost; -import org.openbravo.model.materialmgmt.onhandquantity.StorageDetail; -import org.openbravo.model.materialmgmt.transaction.InternalConsumption; -import org.openbravo.model.materialmgmt.transaction.InternalConsumptionLine; -import org.openbravo.model.materialmgmt.transaction.InternalMovement; -import org.openbravo.model.materialmgmt.transaction.InternalMovementLine; -import org.openbravo.model.materialmgmt.transaction.InventoryCount; -import org.openbravo.model.materialmgmt.transaction.InventoryCountLine; -import org.openbravo.model.materialmgmt.transaction.MaterialTransaction; -import org.openbravo.model.materialmgmt.transaction.ProductionLine; -import org.openbravo.model.materialmgmt.transaction.ProductionPlan; -import org.openbravo.model.materialmgmt.transaction.ProductionTransaction; -import org.openbravo.model.materialmgmt.transaction.ShipmentInOut; -import org.openbravo.model.materialmgmt.transaction.ShipmentInOutLine; -import org.openbravo.model.pricing.pricelist.PriceList; -import org.openbravo.model.pricing.pricelist.PriceListVersion; -import org.openbravo.model.pricing.pricelist.ProductPrice; -import org.openbravo.model.procurement.ReceiptInvoiceMatch; -import org.openbravo.scheduling.ProcessBundle; -import org.openbravo.service.db.CallStoredProcedure; -import org.openbravo.service.db.DalConnectionProvider; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; /** * Test cases to verify Cost Adjustment Project @@ -145,14743 +28,13 @@ * @author aferraz */ -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestCosting extends WeldBaseTest { - - private static final String INVENTORY_OPENING = "O"; - private static final String INVENTORY_NORMAL = "N"; - - // User System - private static String USERADMIN_ID = "0"; - // User Openbravo - private static String USER_ID = "100"; - // Client QA Testing - private static String CLIENT_ID = "4028E6C72959682B01295A070852010D"; - // Organization Spain - private static String ORGANIZATION_ID = "357947E87C284935AD1D783CF6F099A1"; - // Role QA Testing Admin - private static String ROLE_ID = "4028E6C72959682B01295A071429011E"; - // Warehouse with name: Spain warehouse - private static String WAREHOUSE1_ID = "4028E6C72959682B01295ECFEF4502A0"; - // Warehouse with name: Spain East warehouse - private static String WAREHOUSE2_ID = "4D7B97565A024DB7B4C61650FA2B9560"; - - // Document Sequence with name: DocumentNo_M_InOut - private static String SHIPMENTIN_SEQUENCE_ID = "910E14E8BA4A419B92DF9973ACDB8A8F"; - // Document Sequence with name: DocumentNo_C_Invoice - private static String INVOICEIN_SEQUENCE_ID = "766DC632FDCE485B88F7535CF2A3422E"; - // Document Sequence with name: DocumentNo_M_Movement - private static String MOVEMENT_SEQUENCE_ID = "07FD646511E14BADB5C1BB5CF2FCAC57"; - // Storage Bin with name: L01 - private static String LOCATOR1_ID = "193476BDD14E4A11B651B4E3E8D767C8"; - // Storage Bin with name: L02 - private static String LOCATOR2_ID = "1A11102F318D4720957B52C8719A34F2"; - // Storage Bin with name: L03 - private static String LOCATOR3_ID = "FB4D5926A1B443E68CC2DB2BBAE3315D"; - // Storage Bin with name: M01 - private static String LOCATOR4_ID = "96DEDCC179504711A81497DE68900F49"; - // UOM with name: Unit - private static String UOM_ID = "100"; - // Document sequence with name: DocumentNo_M_Production - private static String PRODUCTION_DOCUMENTSEQUENCE_ID = "617CDE87DFC24C2FBFF278F7B8D22B82"; - // Document type with name: RFC Order - private static String RFCORDER_DOCUMENTTYPE_ID = "C789FE062AA8480BAD91543A0C6B41AB"; - // Document type with name: RFC Receipt - private static String RFCRECEIPT_DOCUMENTTYPE_ID = "4683C39FF3B242CD8A5B5825550C4472"; - // Document type with name: Landed Cost - private static String LANDEDCOST_DOCUMENTTYPE_ID = "38E131FE95F949CA97C95A9B03B3D6A8"; - // Document type with name: Landed Cost Cost - private static String LANDEDCOSTCOST_DOCUMENTTYPE_ID = "F66B960D26C64215B1F4A09C3417FB16"; - // Landed Cost Distribution Algorithm with name: Distribution by Amount - private static String LANDEDCOSTCOST_ALGORITHM_ID = "CF9B55BD159B474A9F79849C48715540"; - // Process with name: Validate Costing Rule - private static String VALIDATECOSTINGRULE_PROCESS_ID = "A269DCA4DE114E438695B66E166999B4"; - // Process with name: Verify BOM - private static String VERIFYBOM_PROCESS_ID = "136"; - // Process with name: Create/Process Production - private static String PROCESSPRODUCTION_PROCESS_ID = "137"; - // Process request with name: Process Movements - private static String PROCESSMOVEMENT_PROCESS_ID = "122"; - // Process request with name: Process Internal Consumption - private static String PROCESSCONSUMPTION_PROCESS_ID = "800131"; - // G/L Item with name: Fees - private static String LANDEDCOSTTYPE1_ID = "1DA4C24347EA4494BBA4466FF23ECAA5"; - // Product with name: Transportation Cost - private static String LANDEDCOSTTYPE2_ID = "5557E7C0FD064FD7A1CCB8C0E824DEE6"; - // Product with name: USD Cost - private static String LANDEDCOSTTYPE3_ID = "CB473A64934B4D1583008D52DD0FBC49"; - // Business partner with name: Vendor USA - private static String BUSINESSPARTNER_ID = "C8AD0EAF3052415BB1E15EFDEFBFD4AF"; - // Costing Algorithm with name: Average Algorithm - private static String COSTINGALGORITHM_ID = "B069080A0AE149A79CF1FA0E24F16AB6"; - // General Ledger Configuration with name: Main US/A/Euro - private static String GENERALLEDGER_ID = "9A68A0F8D72D4580B3EC3CAA00A5E1F0"; - // Table with name: MaterialMgmtInternalConsumption - private static String TABLE1_ID = "800168"; - // Table with name: MaterialMgmtInternalMovement - private static String TABLE2_ID = "323"; - // Table with name: MaterialMgmtInventoryCount - private static String TABLE3_ID = "321"; - // Table with name: MaterialMgmtShipmentInOut - private static String TABLE4_ID = "319"; - // Table with name: MaterialMgmtProductionTransaction - private static String TABLE5_ID = "325"; - // Table with name: ProcurementReceiptInvoiceMatch - private static String TABLE6_ID = "472"; - - // Product with name: costing Product 1 - private static String PRODUCT_ID = "A8B10A097DBD4BF5865BA3C844A2299C"; - // Purchase Order with documentNo: 800010 - private static String ORDERIN_ID = "2C9CEDC0761A41DCB276A5124F8AAA90"; - // Sales Order with documentNo: 50012 - private static String ORDEROUT_ID = "8B53B7E6CF3B4D8D9BCF3A49EED6FCB4"; - // Purchase Invoice with documentNo: 10000017 - private static String INVOICEIN_ID = "9D0F6E57E59247F6AB6D063951811F51"; - // Goods Receipt with documentNo: 10000012 - private static String MOVEMENTIN_ID = "0450583047434254835B2B36B2E5B018"; - // Goods Shipment with documentNo: 500014 - private static String MOVEMENTOUT_ID = "2BCCC64DA82A48C3976B4D007315C2C9"; - // RTV Shipment doctype id - private static String RTV_SHIPMENT_DOCTYPE_ID = "4CBEA8CB77BB4208BCAD66235DC39AF2"; - - private static boolean runBefore = true; - - /********************************************** Automated tests **********************************************/ - ------------------------------------------------------------------------------ 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 Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits