[jboss-svn-commits] JBL Code SVN: r6826 - in labs/jbossesb/trunk/product/core: rosetta/tests/src/org/jboss/soa/esb/common/tests services/tests/src/org/jboss/soa/esb/services/registry

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Oct 16 14:47:36 EDT 2006


Author: kurt.stam at jboss.com
Date: 2006-10-16 14:47:32 -0400 (Mon, 16 Oct 2006)
New Revision: 6826

Added:
   labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/common/tests/TestUtil.java
Modified:
   labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/PublishOrgUnitTest.java
Log:
Adding jbossesb-unittest-properties.xml

Added: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/common/tests/TestUtil.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/common/tests/TestUtil.java	2006-10-16 18:36:13 UTC (rev 6825)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/common/tests/TestUtil.java	2006-10-16 18:47:32 UTC (rev 6826)
@@ -0,0 +1,33 @@
+package org.jboss.soa.esb.common.tests;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.Priority;
+
+public class TestUtil 
+{
+	static Logger log = Logger.getLogger(TestUtil.getPrefix());
+	/**
+	 * When performing file system interaction, the user.dir may differ (i.e. running the
+	 * tests from within eclipse).
+	 */
+	public static String getPrefix()
+	{
+		String prefix="";
+		String baseDir = System.getProperty("user.dir");
+		log.log(Priority.INFO, baseDir);
+		if (!baseDir.endsWith("product")) {
+			prefix = "product/";
+		}
+		return prefix;
+	}
+	/**
+	 * Sets the jbossesb-properties.xml to use for test
+	 */
+	public static void setESBPropertiesFileToUse()
+	{
+		//Set the jbossesb properties file in System, so we can pick up the one for testing
+		String jbossesbPropertiesFile = getPrefix() + "test/resources/jbossesb-unittest-properties.xml";
+		System.setProperty("org.jboss.soa.esb.propertyFile", jbossesbPropertiesFile);
+	}
+	
+}

Modified: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/PublishOrgUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/PublishOrgUnitTest.java	2006-10-16 18:36:13 UTC (rev 6825)
+++ labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/PublishOrgUnitTest.java	2006-10-16 18:47:32 UTC (rev 6826)
@@ -55,6 +55,7 @@
 import org.apache.log4j.Logger;
 import org.apache.log4j.Priority;
 import org.jboss.soa.esb.common.tests.HsqldbUtil;
+import org.jboss.soa.esb.common.tests.TestUtil;
 import org.jboss.soa.esb.services.util.FileUtil;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -187,9 +188,7 @@
 	@BeforeClass
 	public static void runBeforeAllTests() throws Exception {
 		try {
-			//Set the jbossesb properties file in System, so we can pick up the one for testing
-			String jbossesbPropertiesFile = getPrefix() + "test/resources/jbossesb-unittest-properties.xml";
-			System.setProperty("org.jboss.soa.esb.propertyFile", jbossesbPropertiesFile);
+			TestUtil.setESBPropertiesFileToUse();
 			//Set the juddi properties file in System so juddi will pick it up later and use the test values.
 			String juddiPropertiesFile = "/org/jboss/soa/esb/services/registry/juddi-unittest.properties";
 			System.setProperty("juddi.propertiesFile", juddiPropertiesFile);
@@ -206,13 +205,13 @@
 			if ("org.hsqldb.jdbcDriver".equals(mDbDriver)) {
 				database = "hsqldb";
 				//Bring up hsql on default port 9001
-				HsqldbUtil.startHsqldb(getPrefix() + "build/hsqltestdb", "juddi");
+				HsqldbUtil.startHsqldb(TestUtil.getPrefix() + "build/hsqltestdb", "juddi");
 			} else if ("com.mysql.jdbc.Driver".equals(mDbDriver)) {
 				database = "mysql";
 			} //add and test your own database..
 			
 			//Get the registry-schema create scripts
-			String sqlDir = getPrefix() + "install/jUDDI-registry/sql/" + database + "/";
+			String sqlDir = TestUtil.getPrefix() + "install/jUDDI-registry/sql/" + database + "/";
 			//Drop what is there now, if exists. We want to start fresh.
 			String sqlDropCmd      = FileUtil.readTextFile(new File(sqlDir + "drop_database.sql"));
 			String sqlCreateCmd    = FileUtil.readTextFile(new File(sqlDir + "create_database.sql"));
@@ -249,20 +248,6 @@
 			HsqldbUtil.stopHsqldb(mDbUrl, mDbUsername, mDbPassword);
 		}
 	}
-	/**
-	 * When performing file system interaction, the user.dir may differ (i.e. running the
-	 * tests from within eclipse).
-	 */
-	private static String getPrefix()
-	{
-		String prefix="";
-		String baseDir = System.getProperty("user.dir");
-		log.log(Priority.INFO, baseDir);
-		if (!baseDir.endsWith("product")) {
-			prefix = "product/";
-		}
-		return prefix;
-	}
 
 	public static junit.framework.Test suite() {
 		return new JUnit4TestAdapter(PublishOrgUnitTest.class);




More information about the jboss-svn-commits mailing list