Improved ADempiere performance test.

Added more properties in order to control behavior of the test.
This commit is contained in:
trifonnt 2010-03-25 16:59:12 +00:00
parent 55a737f200
commit ea11fb8599
3 changed files with 26 additions and 12 deletions

View File

@ -105,7 +105,15 @@
<!-- test name="test.functional.BPMigrationTest" / --> <!-- test name="test.functional.BPMigrationTest" / -->
</junit> </junit>
</target> </target>
<target name="performance.test" depends="dist">
<junit>
<classpath refid="class.path.test" />
<formatter type="brief" usefile="false" />
<test name="test.performance.MProductTest" />
</junit>
</target>
<target name="run" depends="dist"> <target name="run" depends="dist">
<java fork="true" classname="test.functional.XMLImportStructureTest"> <java fork="true" classname="test.functional.XMLImportStructureTest">
<classpath refid="class.path.test" /> <classpath refid="class.path.test" />

View File

@ -45,7 +45,9 @@ public class MProductTest extends AdempiereTestCase {
private int C_TaxCategory_ID = 0; private int C_TaxCategory_ID = 0;
private int C_UOM_ID = 0; private int C_UOM_ID = 0;
private String ProductType = null; private String ProductType = null;
private int startIndex = 43000;
private int runCount = 500;
private boolean singleCommit = false;
protected void setUp() throws Exception 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_TaxCategory_ID = Integer.parseInt( testProperties.getProperty("C_TaxCategory_ID", "107") ); // 107 in GardenWorld
// C_UOM // C_UOM
C_UOM_ID = Integer.parseInt( testProperties.getProperty("C_UOM_ID", "100") ); // 100 in GardenWorld 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 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! // How to setup Log Level. Not necessary as AdempiereTestCase is taking care of it!
// CLogMgt.setLevel(Level.OFF); // CLogMgt.setLevel(Level.OFF);
/* Available levels: /* Available levels:
@ -76,20 +82,17 @@ public class MProductTest extends AdempiereTestCase {
} }
public void testMProductCreation() { public void testMProductCreation() {
boolean singleCommit = true;
// Start time - 20:16 // Start time - 20:16
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
System.out.println("Start Time(ms) = " + startTime); System.out.println("Start Time(ms) = " + startTime);
System.out.println("Start Time = " + new java.util.Date(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 0 symbol shows a digit or 0 if no digit present
// The # symbol shows a digit or nothing if no digit present // The # symbol shows a digit or nothing if no digit present
NumberFormat formatter = new DecimalFormat("00000"); // -001235 NumberFormat formatter = new DecimalFormat("00000"); // -001235
for (int idx= startCount; idx < (startCount + count); idx++) { for (int idx= startIndex; idx < (startIndex + runCount); idx++) {
System.out.println("idx = " + idx); //System.out.println("idx = " + idx);
product = new MProduct(getCtx(), 0, getTrxName()); product = new MProduct(getCtx(), 0, getTrxName());
String formattedIdx = formatter.format( idx ); String formattedIdx = formatter.format( idx );
@ -134,8 +137,8 @@ public class MProductTest extends AdempiereTestCase {
} }
System.out.println( System.out.println(
"Count = " + count "Count = " + runCount
+ "; Time(seconds) = " + time + "; Produsts/Second = " + ((float)count/time) + "; "); + "; Time(seconds) = " + time + "; Produsts/Second = " + ((float)runCount/time) + "; ");
assertTrue(this.getClass().getName(), true); assertTrue(this.getClass().getName(), true);
} }

View File

@ -12,7 +12,10 @@ M_Product_Category_ID=105
C_TaxCategory_ID=107 C_TaxCategory_ID=107
C_UOM_ID=100 C_UOM_ID=100
ProductType=I ProductType=I
startIndex=43000
runCount=500
singleCommit=false
# MProductTest - Tenant: Test6 # MProductTest - Tenant: Test6
#AD_Org_ID=0 #AD_Org_ID=0
#M_Product_Category_ID=1000006 #M_Product_Category_ID=1000006