[jboss-svn-commits] JBL Code SVN: r8780 - in labs/jbossesb/trunk/product/samples/trailblazer: esb/src/org/jboss/soa/esb/samples/trailblazer/util and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jan 9 14:33:24 EST 2007
Author: daniel.brum at jboss.com
Date: 2007-01-09 14:33:22 -0500 (Tue, 09 Jan 2007)
New Revision: 8780
Added:
labs/jbossesb/trunk/product/samples/trailblazer/esb/src/org/jboss/soa/esb/samples/trailblazer/util/TbBootStrapper.java
Removed:
labs/jbossesb/trunk/product/samples/trailblazer/loanbroker/
Modified:
labs/jbossesb/trunk/product/samples/trailblazer/build.xml
Log:
Modified: labs/jbossesb/trunk/product/samples/trailblazer/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer/build.xml 2007-01-09 19:13:58 UTC (rev 8779)
+++ labs/jbossesb/trunk/product/samples/trailblazer/build.xml 2007-01-09 19:33:22 UTC (rev 8780)
@@ -230,8 +230,8 @@
<!-- arg3 (if any) = location of the esb config file which describes the listener configurations for a NON-Message aware listener config (gateway)-->
<target name="runESB" depends="jar">
<echo>Running ESB Trailblazer listeners</echo>
- <java fork="yes" classname="org.jboss.soa.esb.samples.trailblazer.util.Launcher" failonerror="true"
- args="600 ${basedir}/esb/conf/jbossesb.xml">
+ <java fork="yes" classname="org.jboss.soa.esb.samples.trailblazer.util.TbBootStrapper" failonerror="true"
+ args="${org.jboss.soa.samples.trailblazer.home}/esb/conf/jbossesb.xml">
<classpath refid="org.jboss.esb.samples.trailblazer.esb.classpath.run"/>
</java>
</target>
Added: labs/jbossesb/trunk/product/samples/trailblazer/esb/src/org/jboss/soa/esb/samples/trailblazer/util/TbBootStrapper.java
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer/esb/src/org/jboss/soa/esb/samples/trailblazer/util/TbBootStrapper.java 2007-01-09 19:13:58 UTC (rev 8779)
+++ labs/jbossesb/trunk/product/samples/trailblazer/esb/src/org/jboss/soa/esb/samples/trailblazer/util/TbBootStrapper.java 2007-01-09 19:33:22 UTC (rev 8780)
@@ -0,0 +1,111 @@
+package org.jboss.soa.esb.samples.trailblazer.util;
+
+import java.io.File;
+import java.sql.Connection;
+import java.sql.Statement;
+
+import org.apache.log4j.xml.DOMConfigurator;
+import org.jboss.internal.soa.esb.persistence.format.db.DBConnectionManager;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.listeners.StandAloneBootStrapper;
+import org.jboss.soa.esb.testutils.HsqldbUtil;
+import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
+
+public class TbBootStrapper extends StandAloneBootStrapper {
+
+ private TbBootStrapper() throws Exception {super(null);}
+
+ public TbBootStrapper (String configName) throws Exception
+ {
+ super(configName, null);
+ }
+
+ public TbBootStrapper (String configName, String validationFileName) throws Exception
+ {
+ super(configName, validationFileName);
+ }
+
+ public void requestEnd()
+ {
+ super.requestEnd();
+ try { Thread.sleep(5000); }
+ catch (InterruptedException e) {}
+ try { runAfter(); }
+ catch (Exception e) {}
+ } //________________________________
+
+ /*
+ * Setup HSQLDB for the Registry and the MessageStore
+ */
+ protected void runBefore(){
+ //System.setProperty("com.arjuna.common.util.propertyservice.verbosePropertyManager", "on");
+ String baseDir="";
+ String productDir = "../../";
+ if (TestEnvironmentUtil.getUserDir("trailblazer").equals("trailblazer/")) {
+ baseDir = "product/samples/trailblazer/";
+ productDir = "product/";
+ }
+ DOMConfigurator.configure(baseDir + "log4j.xml");
+ String driver = Configuration.getStoreDriver();
+ System.out.println("Driver=" + driver);
+ if ("org.hsqldb.jdbcDriver".equals(driver)) {
+
+ //start hsqldb
+ try {
+ HsqldbUtil.startHsqldb(productDir + "build/hsqldb", "jbossesb");
+ String database = "hsqldb";
+
+ //message store db
+ String sqlDir = productDir + "install/message-store/sql/" + database + "/";
+ String sqlCreateCmd = TestEnvironmentUtil.readTextFile(new File(sqlDir + "create_database.sql"));
+ String sqlDropCmd = TestEnvironmentUtil.readTextFile(new File(sqlDir + "drop_database.sql"));
+
+ DBConnectionManager mgr = DBConnectionManager.getInstance();
+ Connection con = mgr.getConnection();
+
+ Statement stmnt = con.createStatement();
+ System.out.println("Dropping the message store schema if exists...");
+ stmnt.execute(sqlDropCmd);
+ System.out.println("Creating the message store schema...");
+ stmnt.execute(sqlCreateCmd);
+
+ //registry DB
+ sqlDir = productDir + "install/jUDDI-registry/sql/" + database + "/";
+ System.out.println("Dropping the registry schema if exists...");
+ sqlDropCmd = TestEnvironmentUtil.readTextFile(new File(sqlDir + "drop_database.sql"));
+ stmnt.execute(sqlDropCmd);
+ System.out.println("creating the registry schema...");
+ sqlCreateCmd = TestEnvironmentUtil.readTextFile(new File(sqlDir + "create_database.sql"));
+ stmnt.execute(sqlCreateCmd);
+ System.out.println("inserting registry publishers...");
+ String sqlInsertPubCmd = TestEnvironmentUtil.readTextFile(new File(sqlDir + "insert_publishers.sql"));
+ stmnt.execute(sqlInsertPubCmd);
+ stmnt.close();
+ con.close();
+ }catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ /*
+ * Shuts down the HSQLDB instance
+ */
+ protected void runAfter(){
+
+ //shutdown message store if using hsqldb
+ if (Configuration.getStoreDriver().equals("org.hsqldb.jdbcDriver")) {
+ try {
+ HsqldbUtil.stopHsqldb(Configuration.getStoreUrl(),
+ Configuration.getStoreUser(),Configuration.getStorePwd() );
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+
+
+}
More information about the jboss-svn-commits
mailing list