[jboss-svn-commits] JBL Code SVN: r29896 - in labs/jbosstm/workspace/whitingjr/trunk/performance/src: main/resources/META-INF and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Nov 2 11:04:45 EST 2009


Author: whitingjr
Date: 2009-11-02 11:04:45 -0500 (Mon, 02 Nov 2009)
New Revision: 29896

Modified:
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/META-INF/persistence.xml
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/profile-remote.properties
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/hsql/db-profile.properties
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/mysql/db-profile.properties
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/auction/test/basic/ProfiledStateTransitions.java
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/resources/testsuite-integration-ejb3.xml
Log:
Added configuration for profiled classes.

Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/META-INF/persistence.xml
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/META-INF/persistence.xml	2009-11-02 16:03:48 UTC (rev 29895)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/META-INF/persistence.xml	2009-11-02 16:04:45 UTC (rev 29896)
@@ -27,7 +27,7 @@
            -->
           <property name="hibernate.show_sql" value="true"/>
           <property name="hibernate.format_sql" value="true"/>
-          <property name="use_sql_comments" value="true"/>
+          <property name="use_sql_comments" value="false"/>
 
            <!-- We have a JTA data source...
           <property name="hibernate.connection.driver_class"

Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/profile-remote.properties
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/profile-remote.properties	2009-11-02 16:03:48 UTC (rev 29895)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/profile-remote.properties	2009-11-02 16:04:45 UTC (rev 29896)
@@ -56,8 +56,8 @@
 # (comma separated)
 # Note: com.mentorgen.tools.profile is always excluded
 #
-exclude=org.apache.lo4j.*,org.testng.*,org.jboss.*
-include=org.jboss.application.Demo,${db-vendor-profiling},org.hibernate.ejb.EntityManagerImpl
+exclude=org.apache.lo4j.*,org.testng.*,org.jboss.*,org.dbunit
+include=${db-vendor-profiling},org.hibernate,auction.test.basic.ProfiledStateTransitions,com.arjuna,org.jboss.jbossts.performance.MCXaDataSourceWrapper,javax.persistence.EntityManager
 #
 # Track Object Allocation (very expensive)
 # values: on, off

Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/hsql/db-profile.properties
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/hsql/db-profile.properties	2009-11-02 16:03:48 UTC (rev 29895)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/hsql/db-profile.properties	2009-11-02 16:04:45 UTC (rev 29896)
@@ -16,3 +16,7 @@
 
 # dbunit vendor db factory for data types
 db-vendor-dbunit-datatype.factory=org.dbunit.ext.hsqldb.HsqldbDataTypeFactory
+
+# class used to relax integrity constraint
+db-vendor-constraint-class=org.jboss.jbossts.performance.persistence.vendor.HSQLDB
+

Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/mysql/db-profile.properties
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/mysql/db-profile.properties	2009-11-02 16:03:48 UTC (rev 29895)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/mysql/db-profile.properties	2009-11-02 16:04:45 UTC (rev 29896)
@@ -1,5 +1,5 @@
 # specify which packages or classes are to be profiled. These will be identical across any database installation
-db-vendor-profiling=com.mysql.jdbc.jdbc2.optional
+db-vendor-profiling=com.mysql
 
 # inclusion xpaths
 db.xslt.xpaths=/*/@db-class='x.x.DriverClass'
@@ -16,3 +16,6 @@
 
 # database dialect
 db-vendor-hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
+
+# class used to relax integrity constraint
+db-vendor-constraint-class=org.jboss.jbossts.performance.persistence.vendor.MySQL

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-11-02 16:03:48 UTC (rev 29895)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/auction/test/basic/ProfiledStateTransitions.java	2009-11-02 16:04:45 UTC (rev 29896)
@@ -22,15 +22,61 @@
 
 package auction.test.basic;
 
+import java.io.InputStream;
+import java.sql.Connection;
+
 import org.apache.log4j.Logger;
-import org.testng.annotations.AfterGroups;
+import org.dbunit.database.DatabaseConfig;
+import org.dbunit.database.DatabaseDataSourceConnection;
+import org.dbunit.database.IDatabaseConnection;
+import org.dbunit.dataset.ReplacementDataSet;
+import org.dbunit.dataset.datatype.DefaultDataTypeFactory;
+import org.dbunit.dataset.xml.FlatXmlDataSet;
+import org.jboss.jbossts.performance.persistence.IntegrityConstraint;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeGroups;
+import org.testng.annotations.Parameters;
 
 import com.mentorgen.tools.profile.runtime.Profile;
 
 public class ProfiledStateTransitions extends PersistentStateTransitions
 {
    private static Logger logger = Logger.getLogger(ProfiledStateTransitions.class);
+   private IntegrityConstraint integrityConstraint;
+   
+   @BeforeGroups(groups = "integration-persistence")
+   @Parameters ({ "basedata_location", "datatype_factory", "integrity-constraint"})
+   public void prepareDataSet(String location, String factory, String constraint) throws Exception {
+      
+       // Check if subclass has prepared everything
+       prepareSettings();
+       if (location == null)
+           throw new RuntimeException(
+               "Test subclass needs to prepare a dataset location"
+           );
+
+       // Load the base dataset file
+       InputStream input =
+               Thread.currentThread().getContextClassLoader()
+                       .getResourceAsStream(location);
+
+       dataSet = new ReplacementDataSet(
+                       new FlatXmlDataSet(input)
+                     );
+       dataSet.addReplacementObject("[NULL]", null);
+       
+       if (null != factory && !"".equals( factory.trim()))
+       {
+          this.datatypeFactory = (DefaultDataTypeFactory)Class.forName(factory).newInstance();           
+       }
+       
+       if (null != constraint && !"".equals(constraint.trim()))
+       {
+           this.integrityConstraint = (IntegrityConstraint)Class.forName(constraint).newInstance();
+       }
+   }
+   
    @BeforeGroups (groups="integration-persistence")
    public void startProfiler( ) throws Exception
    {
@@ -39,11 +85,32 @@
       Profile.start();
    }
    
-   @AfterGroups (groups="integration-persistence")
+   @AfterClass (groups="integration-persistence")
    public void stopProfiling()
    {
       logger.info("Profiling stopped.");
       Profile.stop();
       Profile.shutdown();
    }
+   
+   protected IDatabaseConnection getConnection() throws Exception {
+
+      // Get a JDBC connection from JNDI datasource
+      IDatabaseConnection dbUnitCon = new DatabaseDataSourceConnection(this.jndi, JNDI_DATASOURCE);
+
+      /* Relax the constraints for this connection allowing bulk imports of data */
+      Connection con = dbUnitCon.getConnection();
+      if (null != this.integrityConstraint)
+      {
+         this.integrityConstraint.relax(con);
+      }
+
+      if (null != this.datatypeFactory)
+      {
+         DatabaseConfig config = dbUnitCon.getConfig();
+         config.setProperty  (DatabaseConfig.PROPERTY_DATATYPE_FACTORY, this.datatypeFactory);
+      }
+      
+      return dbUnitCon;
+  }
 }

Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/resources/testsuite-integration-ejb3.xml
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/resources/testsuite-integration-ejb3.xml	2009-11-02 16:03:48 UTC (rev 29895)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/resources/testsuite-integration-ejb3.xml	2009-11-02 16:04:45 UTC (rev 29896)
@@ -28,6 +28,9 @@
 	
 	<!-- Database dataset factory for DBUnit -->
 	<parameter name="datatype_factory" value="${db-vendor-dbunit-datatype.factory}"/>
+	
+	<!-- Class name for vendor specific database relaxing for bulk imports -->
+	<parameter name="integrity-constraint" value="${db-vendor-constraint-class}"/>
 
 	<test name="Integration JPA">
 		<groups>
@@ -46,4 +49,3 @@
 	</test>
 
 </suite>
-



More information about the jboss-svn-commits mailing list