[jboss-svn-commits] JBL Code SVN: r30858 - in labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java: org/jboss/jbossts/performance and 2 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Dec 29 12:02:55 EST 2009
Author: whitingjr
Date: 2009-12-29 12:02:54 -0500 (Tue, 29 Dec 2009)
New Revision: 30858
Modified:
labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/auction/test/basic/ProfiledStateTransitions.java
labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/WarmedUpTest.java
labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/readonly/JPAExampleTests.java
labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/tm/performance/TestDemo.java
Log:
Updated classes to use profiler implementation neutral API.
Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/auction/test/basic/ProfiledStateTransitions.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/auction/test/basic/ProfiledStateTransitions.java 2009-12-29 17:02:03 UTC (rev 30857)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/auction/test/basic/ProfiledStateTransitions.java 2009-12-29 17:02:54 UTC (rev 30858)
@@ -43,6 +43,7 @@
import javax.xml.xpath.XPathFactory;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.dbunit.database.DatabaseConfig;
import org.dbunit.database.DatabaseDataSourceConnection;
@@ -59,6 +60,7 @@
import org.hibernate.tool.hbm2ddl.DatabaseMetadata;
import org.jboss.ejb3.embedded.EJB3StandaloneBootstrap;
import org.jboss.jbossts.performance.persistence.vendor.AbstractVendorControl;
+import org.jboss.jbossts.performance.profiler.Profiler;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterGroups;
@@ -90,8 +92,6 @@
import auction.model.ShipmentState;
import auction.model.User;
import auction.test.EJB3IntegrationTest;
-
-import com.mentorgen.tools.profile.runtime.Profile;
@SqlResultSetMapping(name = "PriceSellerResult", columns =
{@ColumnResult(name = "IP"), @ColumnResult(name = "SID")
@@ -112,6 +112,7 @@
protected String JNDI_NAME_EMF_B;
protected boolean isOptionalWriteEnabled;
private DefaultDataTypeFactory dataTypeFactoryB;
+ protected Profiler profiler;
@Override
public void prepareDataSet(String location, String factory) throws Exception
@@ -121,8 +122,8 @@
@BeforeClass(groups = "integration-warmup")
@Parameters
- ({"basedata_location", "datatype_factory_A", "datatype_factory_B", "integrity_constraint_A", "integrity_constraint_B"})
- public void prepareDataSet(String location, String factoryA, String factoryB, String constraintA, String constraintB) throws Exception
+ ({"basedata_location", "datatype_factory_A", "datatype_factory_B", "integrity_constraint_A", "integrity_constraint_B", "profiler_fqcn"})
+ public void prepareDataSet(String location, String factoryA, String factoryB, String constraintA, String constraintB, String profilerFQCN) throws Exception
{
// Check if subclass has prepared everything
prepareSettings();
@@ -144,6 +145,10 @@
this.dataTypeFactoryB = configureDataTypeFactory(factoryB);
this.vendorControllerB = configureVendorControlClass(constraintB, tableNames);
}
+ if (null != profilerFQCN && !StringUtils.equals("", profilerFQCN.trim()))
+ {
+ this.profiler = (Profiler)Class.forName(profilerFQCN).newInstance();
+ }
}
private DefaultDataTypeFactory configureDataTypeFactory( String type) throws Exception
{
@@ -199,8 +204,15 @@
public void startProfiler() throws Exception
{
logger.info("Starting profiler.....");
- Profile.clear();
- Profile.start();
+ try
+ {
+ this.profiler.clear();
+ this.profiler.start();
+ }
+ catch (NullPointerException npe)
+ {
+ logger.warn(npe.getMessage());
+ }
}
@AfterClass(groups = "profiled-integration-persistence")
@@ -463,8 +475,12 @@
}
abstract protected boolean isMultiResourceTest();
+
+ public Profiler getProfiler()
+ {
+ return this.profiler;
+ }
-
}
Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/WarmedUpTest.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/WarmedUpTest.java 2009-12-29 17:02:03 UTC (rev 30857)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/WarmedUpTest.java 2009-12-29 17:02:54 UTC (rev 30858)
@@ -27,8 +27,6 @@
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
-import com.mentorgen.tools.profile.runtime.Profile;
-
import auction.test.basic.ProfiledStateTransitions;
public abstract class WarmedUpTest extends ProfiledStateTransitions
@@ -45,9 +43,25 @@
@Parameters ({"test_count"})
public void profiledTest(String testCount)
{
- Profile.start();
+ try
+ {
+ getProfiler().start();
+ }
+ catch (Exception e)
+ {
+ logger.warn(e.getMessage());
+ }
+
recurse(Integer.parseInt(testCount));
- Profile.stop();
+
+ try
+ {
+ getProfiler().stop();
+ }
+ catch (Exception e)
+ {
+ logger.warn(e.getMessage());
+ }
}
private void recurse(int count)
Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/readonly/JPAExampleTests.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/readonly/JPAExampleTests.java 2009-12-29 17:02:03 UTC (rev 30857)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/readonly/JPAExampleTests.java 2009-12-29 17:02:54 UTC (rev 30858)
@@ -37,11 +37,6 @@
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
-import auction.dao.ItemDAO;
-import auction.dao.UserDAO;
-import auction.dao.ejb3.GenericEJB3DAO;
-import auction.dao.ejb3.ItemDAOBean;
-import auction.dao.ejb3.UserDAOBean;
import auction.dao.ejb3.persistence.ItemDAOBeanMultiResource;
import auction.dao.ejb3.persistence.UserDAOBeanMultiResource;
import auction.model.Item;
@@ -49,8 +44,6 @@
import auction.model.User;
import auction.test.basic.ProfiledStateTransitions;
-import com.mentorgen.tools.profile.runtime.Profile;
-
public class JPAExampleTests extends ProfiledStateTransitions
{
private static final Logger logger = Logger.getLogger(JPAExampleTests.class);
@@ -58,8 +51,9 @@
@Test(groups = "integration-warmup")
@Parameters ({"warmup_count"})
public void warmUp(String count)
+ throws Exception
{
- Profile.stop();
+ getProfiler().stop();
int co = Integer.parseInt(count);
for (int i = 0; i < co ; i += 1)
{
@@ -73,7 +67,7 @@
Assert.fail (e.getMessage(), e);
}
}
- Profile.start();
+ getProfiler().start();
}
@Test(groups = "integration-persistence", dependsOnGroups="integration-warmup")
Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/tm/performance/TestDemo.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/tm/performance/TestDemo.java 2009-12-29 17:02:03 UTC (rev 30857)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/tm/performance/TestDemo.java 2009-12-29 17:02:54 UTC (rev 30858)
@@ -24,18 +24,19 @@
import org.apache.log4j.Logger;
import org.jboss.application.Demo;
+import org.jboss.jbossts.performance.profiler.Profiler;
+import org.jboss.jbossts.performance.profiler.implementation.JavaInteractiveProfiler;
import org.testng.annotations.AfterGroups;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
-import com.mentorgen.tools.profile.runtime.Profile;
-
public class TestDemo
{
private static final Logger logger = Logger.getLogger(TestDemo.class);
private String warmupCount;
private String profileRepeatCount;
+ private Profiler profiler;
public String getWarmupCount()
{
@@ -72,6 +73,7 @@
@BeforeGroups (groups = "demo.tests")
@Parameters ({"warmup_repeat_count", "profile_repeat_count"})
public void setUp(String warmupCount, String profileCount)
+ throws Exception
{
Demo application = new Demo();
this.setWarmupCount(warmupCount);
@@ -86,14 +88,16 @@
}
/* The application has been warmed up and the compiler should have completed compilation.
* Now start the JIP profiler. */
- Profile.clear();
- Profile.start();
+ this.profiler = new JavaInteractiveProfiler();
+ this.profiler.clear();
+ this.profiler.start();
}
@AfterGroups (groups="demo.tests")
public void stopProfiling()
+ throws Exception
{
- Profile.stop();
- Profile.shutdown();
+ this.profiler.stop();
+ this.profiler.shutDown();
}
}
More information about the jboss-svn-commits
mailing list