[hibernate-commits] Hibernate SVN: r10984 - trunk/Hibernate3/test/org/hibernate/junit/functional

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Wed Dec 13 10:19:02 EST 2006


Author: steve.ebersole at jboss.com
Date: 2006-12-13 10:19:01 -0500 (Wed, 13 Dec 2006)
New Revision: 10984

Modified:
   trunk/Hibernate3/test/org/hibernate/junit/functional/FunctionalTestClassTestSuite.java
Log:
lenient of non-FunctionalTestCase cases

Modified: trunk/Hibernate3/test/org/hibernate/junit/functional/FunctionalTestClassTestSuite.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/junit/functional/FunctionalTestClassTestSuite.java	2006-12-13 14:52:34 UTC (rev 10983)
+++ trunk/Hibernate3/test/org/hibernate/junit/functional/FunctionalTestClassTestSuite.java	2006-12-13 15:19:01 UTC (rev 10984)
@@ -35,7 +35,7 @@
 
 	/**
 	 * Constructor form used during {@link org.hibernate.test.AllTests} filtering...
-	 * 
+	 *
 	 * @param name The name.
 	 */
 	private FunctionalTestClassTestSuite(String name) {
@@ -43,11 +43,14 @@
 	}
 
 	public void addTest(Test test) {
+		log.trace( "adding test [" + test + "]" );
 		if ( settings == null ) {
-			settings = ( ExecutionEnvironment.Settings ) test;
+			if ( test instanceof ExecutionEnvironment.Settings ) {
+				settings = ( ExecutionEnvironment.Settings ) test;
+				// todo : we could also centralize the skipping of "database specific" tests here
+				// instead of duplicating this notion in AllTests and DatabaseSpecificFunctionalTestCase.
+			}
 		}
-		// todo : we could also centralize the skipping of "database specific" tests here
-		// instead of duplicating this notion in AllTests and DatabaseSpecificFunctionalTestCase.
 		testCount++;
 		super.addTest( test );
 	}
@@ -59,12 +62,7 @@
 		}
 		try {
 			log.info( "Starting test-suite [" + getName() + "]" );
-			try {
-				setUp();
-			}
-			catch( Throwable t ) {
-				environmentSetupError = t;
-			}
+			setUp();
 			testPosition = 0;
 			super.run( testResult );
 		}
@@ -85,26 +83,39 @@
 			testResult.endTest( test );
 			return;
 		}
-		FunctionalTestCase functionalTest = ( ( FunctionalTestCase ) test );
-		try {
-			if ( ++testPosition < testCount ) {
-				// disallow rebuilding the schema because this is the last test
-				// in this suite, thus it is about to get dropped immediately
-				// afterwards anyway...
-				environment.setAllowRebuild( true );
+		if ( ! ( test instanceof FunctionalTestCase ) ) {
+			super.runTest( test, testResult );
+		}
+		else {
+			FunctionalTestCase functionalTest = ( ( FunctionalTestCase ) test );
+			try {
+				if ( ++testPosition < testCount ) {
+					// disallow rebuilding the schema because this is the last test
+					// in this suite, thus it is about to get dropped immediately
+					// afterwards anyway...
+					environment.setAllowRebuild( true );
+				}
+				functionalTest.setEnvironment( environment );
+				super.runTest( functionalTest, testResult );
 			}
-			functionalTest.setEnvironment( environment );
-			super.runTest( functionalTest, testResult );
+			finally {
+				functionalTest.setEnvironment( null );
+			}
 		}
-		finally {
-			functionalTest.setEnvironment( null );
-		}
 	}
 
 	protected void setUp() {
+		if ( settings == null ) {
+			return;
+		}
 		log.info( "Building aggregated execution environment" );
-		environment = new ExecutionEnvironment( settings );
-		environment.initialize();
+		try {
+			environment = new ExecutionEnvironment( settings );
+			environment.initialize();
+		}
+		catch( Throwable t ) {
+			environmentSetupError = t;
+		}
 	}
 
 	protected void tearDown() {




More information about the hibernate-commits mailing list