Commits

Anonymous committed 7b421c4

Correctly destroy the db after every test, fixes random test failures

Comments (0)

Files changed (7)

src/test/com/opensymphony/workflow/spi/hibernate/NewHibernateFunctionalWorkflowTestCase.java

         session.flush();
         session.close();
         factory.close();
+        DatabaseHelper.runScript(getClass().getResource("/scripts/jdbc/dropschema.sql"), "jdbc/DefaultDS");
     }
 }

src/test/com/opensymphony/workflow/spi/hibernate/NewSpringHibernateFunctionalWorkflowTestCase.java

     protected String getWorkflowName() {
         return "example";
     }
+  
+    protected void tearDown() throws Exception {
+      DatabaseHelper.runScript(getClass().getResource("/scripts/jdbc/dropschema.sql"), "jdbc/DefaultDS");
+    }
+    
 }

src/test/com/opensymphony/workflow/spi/hibernate/SpringHibernateFunctionalWorkflowTestCase.java

     protected String getWorkflowName() {
         return "example";
     }
+  
+    protected void tearDown() throws Exception {
+        DatabaseHelper.runScript(getClass().getResource("/scripts/jdbc/dropschema.sql"), "jdbc/DefaultDS");
+    }
 }

src/test/com/opensymphony/workflow/spi/hibernate3/NewHibernateFunctionalWorkflowTestCase.java

 
         factory.close();
         factory3.close();
+        DatabaseHelper.runScript(getClass().getResource("/scripts/jdbc/dropschema.sql"), "jdbc/DefaultDS");
     }
 }

src/test/com/opensymphony/workflow/spi/hibernate3/NewSpringHibernateFunctionalWorkflowTestCase.java

     protected String getWorkflowName() {
         return "example";
     }
+  
+    protected void tearDown() throws Exception {
+        DatabaseHelper.runScript(getClass().getResource("/scripts/jdbc/dropschema.sql"), "jdbc/DefaultDS");
+    }
 }

src/test/hibernate.properties

-######################
-### Query Language ###
-######################
+hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N'
+hibernate.dialect=com.opensymphony.workflow.util.PatchedMckoiDialect
 
-## define query language constants / function names
+hibernate.connection.datasource=jdbc/DefaultDS
+hibernate.connection.username=test
+hibernate.connection.password=test
 
-hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
-
-## package imports
-
-hibernate.query.imports net.sf.hibernate.test, net.sf.hibernate.eg
-
-hibernate.dialect com.opensymphony.workflow.util.PatchedMckoiDialect
-
-#################
-### Platforms ###
-#################
-
-## JNDI Datasource
-
-hibernate.connection.datasource jdbc/DefaultDS
-hibernate.connection.username test
-hibernate.connection.password test
-
-#################################
-### Hibernate Connection Pool ###
-#################################
-
-hibernate.connection.pool_size 1
-hibernate.statement_cache.size 25
-
-
-
-
-
-##############################
-### Miscellaneous Settings ###
-##############################
-
-## print all generated SQL to the console
-
-hibernate.show_sql false
-
-
-## specify a JDBC isolation level
-
-#hibernate.connection.isolation 4
-
-
-## set the JDBC fetch size
-
-#hibernate.jdbc.fetch_size 25
-
-
-## set the maximum JDBC 2 batch size (a nonzero value enables batching)
-
-hibernate.jdbc.batch_size 0
-
-
-## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will cause Hibernate to use a sensible default)
-
-#hibernate.jdbc.use_scrollable_resultset true
-
-
-## use streams when writing binary types to / from JDBC
-
-hibernate.jdbc.use_streams_for_binary true
-
-
-## specify a default schema for unqualified tablenames
-
-#hibernate.default_schema test
-
-
-## use a custom stylesheet for XML generation (if not specified, hibernate-default.xslt will be used)
-
-#hibernate.xml.output_stylesheet C:/Hibernate/net/sf/hibernate/hibernate-default.xslt
-
-
-## enable outerjoin fetching (specifying a Dialect will cause Hibernate to use sensible default)
-
-#hibernate.use_outer_join false
-
-
-## enable CGLIB reflection optimizer (enabled by default)
+hibernate.show_sql=false
+hibernate.jdbc.use_streams_for_binary=true
 
 # hibernate.cglib.use_reflection_optimizer false
-
-
-
-############
-### JNDI ###
-############
-
-## specify a JNDI name for the SessionFactory
-
-#hibernate.session_factory_name hibernate/session_factory
-
-
-## Hibernate uses JNDI to bind a name to a SessionFactory and to look up the JTA UserTransaction;
-## if hibernate.jndi.* are not specified, Hibernate will use the default InitialContext() which
-## is the best approach in an application server
-
-#file system
-#hibernate.jndi.class com.sun.jndi.fscontext.RefFSContextFactory
-#hibernate.jndi.url file:/
-
-#WebSphere
-#hibernate.jndi.class com.ibm.websphere.naming.WsnInitialContextFactory
-#hibernate.jndi.url iiop://localhost:900/
-
+hibernate.hbm2ddl.auto=create-drop

src/test/scripts/jdbc/dropschema.sql

 DROP TABLE IF EXISTS OS_HISTORYSTEP;
 DROP TABLE IF EXISTS OS_WFENTRY;
 
-DROP SEQUENCE SEQ_OS_WFENTRY;
-DROP SEQUENCE SEQ_OS_CURRENTSTEPS;
+DROP SEQUENCE IF EXISTS SEQ_OS_WFENTRY;
+DROP SEQUENCE IF EXISTS SEQ_OS_CURRENTSTEPS;
+DROP TABLE IF EXISTS hibernate_sequence;
+DROP SEQUENCE IF EXISTS hibernate_sequence;