From ea11fb8599452df92806d5922dfdede7dae44741 Mon Sep 17 00:00:00 2001 From: trifonnt Date: Thu, 25 Mar 2010 16:59:12 +0000 Subject: [PATCH] Improved ADempiere performance test. Added more properties in order to control behavior of the test. --- extend/build.xml | 10 +++++++- extend/src/test/performance/MProductTest.java | 23 +++++++++++-------- extend/test.properties.template | 5 +++- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/extend/build.xml b/extend/build.xml index 7685ca7db8..8630378489 100644 --- a/extend/build.xml +++ b/extend/build.xml @@ -105,7 +105,15 @@ - + + + + + + + + + diff --git a/extend/src/test/performance/MProductTest.java b/extend/src/test/performance/MProductTest.java index 59b947bef2..386e761b4d 100644 --- a/extend/src/test/performance/MProductTest.java +++ b/extend/src/test/performance/MProductTest.java @@ -45,7 +45,9 @@ public class MProductTest extends AdempiereTestCase { private int C_TaxCategory_ID = 0; private int C_UOM_ID = 0; private String ProductType = null; - + private int startIndex = 43000; + private int runCount = 500; + private boolean singleCommit = false; protected void setUp() throws Exception { @@ -61,9 +63,13 @@ public class MProductTest extends AdempiereTestCase { C_TaxCategory_ID = Integer.parseInt( testProperties.getProperty("C_TaxCategory_ID", "107") ); // 107 in GardenWorld // C_UOM C_UOM_ID = Integer.parseInt( testProperties.getProperty("C_UOM_ID", "100") ); // 100 in GardenWorld - // C_UOM + // ProductType ProductType = testProperties.getProperty("ProductType", "I"); // 'I' in GardenWorld + startIndex = Integer.parseInt( testProperties.getProperty("startIndex", "43000") ); + runCount = Integer.parseInt( testProperties.getProperty("runCount", "500") ); + singleCommit = Boolean.parseBoolean( testProperties.getProperty("singleCommit", "false") ); + // How to setup Log Level. Not necessary as AdempiereTestCase is taking care of it! // CLogMgt.setLevel(Level.OFF); /* Available levels: @@ -76,20 +82,17 @@ public class MProductTest extends AdempiereTestCase { } public void testMProductCreation() { - boolean singleCommit = true; - // Start time - 20:16 long startTime = System.currentTimeMillis(); System.out.println("Start Time(ms) = " + startTime); System.out.println("Start Time = " + new java.util.Date(startTime)); - int startCount = 43000; - int count = 500; + // The 0 symbol shows a digit or 0 if no digit present // The # symbol shows a digit or nothing if no digit present NumberFormat formatter = new DecimalFormat("00000"); // -001235 - for (int idx= startCount; idx < (startCount + count); idx++) { - System.out.println("idx = " + idx); + for (int idx= startIndex; idx < (startIndex + runCount); idx++) { + //System.out.println("idx = " + idx); product = new MProduct(getCtx(), 0, getTrxName()); String formattedIdx = formatter.format( idx ); @@ -134,8 +137,8 @@ public class MProductTest extends AdempiereTestCase { } System.out.println( - "Count = " + count - + "; Time(seconds) = " + time + "; Produsts/Second = " + ((float)count/time) + "; "); + "Count = " + runCount + + "; Time(seconds) = " + time + "; Produsts/Second = " + ((float)runCount/time) + "; "); assertTrue(this.getClass().getName(), true); } diff --git a/extend/test.properties.template b/extend/test.properties.template index 53ea4bf9c0..30b93073e3 100644 --- a/extend/test.properties.template +++ b/extend/test.properties.template @@ -12,7 +12,10 @@ M_Product_Category_ID=105 C_TaxCategory_ID=107 C_UOM_ID=100 ProductType=I - +startIndex=43000 +runCount=500 +singleCommit=false + # MProductTest - Tenant: Test6 #AD_Org_ID=0 #M_Product_Category_ID=1000006