[jboss-svn-commits] JBL Code SVN: r30528 - labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/auction/test/basic.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Dec 8 05:45:56 EST 2009


Author: whitingjr
Date: 2009-12-08 05:45:56 -0500 (Tue, 08 Dec 2009)
New Revision: 30528

Modified:
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/auction/test/basic/ProfiledStateTransitions.java
Log:
Changed profiling to use a second resource. Removed profiling stop start methods. 

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-08 10:44:59 UTC (rev 30527)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/auction/test/basic/ProfiledStateTransitions.java	2009-12-08 10:45:56 UTC (rev 30528)
@@ -60,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.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.AfterGroups;
 import org.testng.annotations.BeforeClass;
@@ -186,10 +187,9 @@
    public void stopProfiling()
    {
       logger.info("Profiling stopped.");
-      Profile.stop();
-      Profile.shutdown();
    }
 
+   
    private IDatabaseConnection getConnection(String jndiDataSource) throws Exception
    {
 
@@ -280,38 +280,36 @@
    }
    @BeforeGroups(groups = "integration-warmup")
    @Parameters ({"basedata_location"})
-   public void beforeTestMethod(String basedataLocation) throws Exception {
-      this.beforeTestMethod(basedataLocation, getSessionFactoryA());
-      this.beforeTestMethod(basedataLocation, getSessionFactoryB());
+   public void beforeTestMethod(String basedataLocation) throws Exception 
+   {
+      this.beforeTestMethod(basedataLocation, getSessionFactoryA(), getConnectionA());
+      this.beforeTestMethod(basedataLocation, getSessionFactoryB(), getConnectionB());
    }
    
-   
-   
-   private void beforeTestMethod(String basedataLocation, SessionFactory hSessionFactory) throws Exception {
-      Profile.stop();
-      SessionFactoryImpl sessionFactory = null;
+   private void beforeTestMethod(String basedataLocation, SessionFactory hSessionFactory, IDatabaseConnection iDatabaseConn) throws Exception 
+   {
+      SessionFactoryImpl sessionFactory = (SessionFactoryImpl) hSessionFactory;
       Configuration configuration = null;
       String[] dropStatements = null;
       
-       Connection connectionConstraintModify =  null;
+       Connection connection =  iDatabaseConn.getConnection();
        try
        {
           if (null != this.vendorController)
           {
-             connectionConstraintModify = getConnection().getConnection();
+             //connectionConstraintModify 
              if (this.vendorController.isDisablePreferedOverDrop())
              {
-                this.vendorController.relax(connectionConstraintModify);
+                this.vendorController.relax(connection);
              }
              else
              {
-                sessionFactory = (SessionFactoryImpl) hSessionFactory;
                 configuration = getConfiguration();
                 dropStatements = configuration.generateDropSchemaScript(sessionFactory.getDialect());
-                this.vendorController.relax(connectionConstraintModify, dropStatements);
+                this.vendorController.relax(connection, dropStatements);
              }
              
-              this.vendorController.purge(connectionConstraintModify);
+              this.vendorController.purge(connection);
           }
        }
        catch (SQLException sqle)
@@ -320,18 +318,17 @@
        }
        finally
        {
-          DbUtils.closeQuietly(connectionConstraintModify );
-          connectionConstraintModify = null;
+          /*DbUtils.closeQuietly(connectionConstraintModify );
+          connectionConstraintModify = null;*/
        }
        
-       for (DatabaseOperation op : beforeTestOperations ) {
-          IDatabaseConnection idbConnection = null;
-          Connection connection =  null;
+       for (DatabaseOperation op : beforeTestOperations ) 
+       {
+          //Connection connection =  null;
           try
             {
-                idbConnection = getConnection();
-                connection = idbConnection.getConnection(); 
-               op.execute(idbConnection , dataSet);
+               //connection = iDatabaseConn.getConnection(); 
+               op.execute(iDatabaseConn , dataSet);
             }
             catch (SQLException sqle)
             {
@@ -339,28 +336,28 @@
             }
             finally 
             {
-               DbUtils.closeQuietly(connection);
+               //DbUtils.closeQuietly(connection);
             }
        }
        
        try
        {
-          connectionConstraintModify = getConnection().getConnection();
+          //connectionConstraintModify = iDatabaseConn.getConnection();
           if (null != this.vendorController) 
           {
              if (this.vendorController.isDisablePreferedOverDrop())
              {
-                this.vendorController.constrain (connectionConstraintModify);
+                this.vendorController.constrain (connection);
              }
              else
              {
-                DatabaseMetadata metadata= new DatabaseMetadata(connectionConstraintModify, sessionFactory.getDialect());
+                DatabaseMetadata metadata= new DatabaseMetadata(connection, sessionFactory.getDialect());
                 configuration.setProperty(Environment.DIALECT, sessionFactory.getDialect().getClass().getName());
                 
                 configuration.setProperty( Environment.TRANSACTION_STRATEGY,  sessionFactory.getSettings().getTransactionFactory().getClass().getName());
                 configuration.setProperty( Environment.TRANSACTION_MANAGER_STRATEGY , sessionFactory.getSettings().getTransactionManagerLookup().getClass().getName());
                 String[] constrainStatements = configuration.generateSchemaUpdateScript(sessionFactory.getDialect(), metadata);
-                this.vendorController.constrain (connectionConstraintModify,constrainStatements);
+                this.vendorController.constrain (connection,constrainStatements);
              }
           }
        }
@@ -370,17 +367,22 @@
        }
        finally
        {
-          DbUtils.closeQuietly(connectionConstraintModify );
+          //DbUtils.closeQuietly(connectionConstraintModify );
        }
-       
-       Profile.start();
+       try
+       {
+          connection.close();
+       }
+       catch (SQLException sqle)
+       {
+          Assert.fail(sqle.getMessage(), sqle);
+       }
    }
 
    @Override
-   @AfterGroups(groups = "integration-integration")
+   @AfterGroups(groups = "integration-persistence")
    public void afterTestMethod() throws Exception
    {
-      Profile.stop();
       for (DatabaseOperation op : afterTestOperations)
       {
          IDatabaseConnection connection =  null;
@@ -402,7 +404,6 @@
            }
          
       }
-      Profile.start();
    }
    
    private Set<String> getTableNames(String basedataLocation)



More information about the jboss-svn-commits mailing list