[jboss-svn-commits] JBL Code SVN: r12336 - in labs/jbossesb/trunk: product/core/listeners/src/org/jboss/internal/soa/esb/dependencies and 51 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jun 5 13:18:30 EDT 2007
Author: kurt.stam at jboss.com
Date: 2007-06-05 13:18:29 -0400 (Tue, 05 Jun 2007)
New Revision: 12336
Added:
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/dependencies/DatabaseInitializer.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/dependencies/DatabaseInitializerMBean.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/persistence/
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/persistence/
labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/services/registry/MockRegistryImpl.java
labs/jbossesb/trunk/product/lib/ext/standalone/
labs/jbossesb/trunk/product/lib/ext/standalone/c3p0-0.9.1-pre9.jar
labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/
labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/c3p0-0.9.1-pre9.jar
labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/commons-io-1.3.jar
labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/commons-lang-2.1.jar
labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/hsqldb.jar
labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/jboss-system.jar
labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/jbossall-client.jar
labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/jbossts-common.jar
labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/junit-4.1.jar
labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/log4j.jar
labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/xercesImpl-2.7.1.jar
labs/jbossesb/trunk/product/services/jbossesb/lib/ext/jackrabbit-api-1.2.1.jar
labs/jbossesb/trunk/product/services/jbossesb/lib/ext/jackrabbit-core-1.2.1.jar
labs/jbossesb/trunk/product/services/jbossesb/lib/ext/jackrabbit-jcr-commons-1.2.1.jar
labs/jbossesb/trunk/product/services/jbossesb/lib/ext/jcr-1.0.jar
labs/jbossesb/trunk/product/services/jbossesb/lib/ext/lucene-core-2.0.0.jar
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/MessageStoreFactory.java
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRConnectionManager.java
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRMessageStoreImpl.java
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRNodeNames.java
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/soa/
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/soa/esb/
labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/jbossesb-service.xml
labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/
labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/hsqldb/
labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/hsqldb/create_database.sql
labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/hsqldb/drop_database.sql
labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/mysql/
labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/mysql/create_database.sql
labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/postgresql/
labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/postgresql/create_database.sql
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/actions/
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/actions/MessagePersisterTest.java
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/actions/MessagePersisterTest.xml
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/MessageStoreUnitTest.java
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreClient.java
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreTest.java
labs/jbossesb/trunk/product/services/jbossesb/src/test/resources/jbossesb-unittest-properties.xml
Removed:
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/dependencies/DatabaseInitializer.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/dependencies/DatabaseInitializerMBean.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/MessagePersister.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/persistence/
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/persistence/MessageStoreFactory.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/persistence/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/persistence/
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/persistence/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/esb/
labs/jbossesb/trunk/product/install/message-store/sql/
labs/jbossesb/trunk/product/lib/ext/c3p0-0.9.1-pre9.jar
labs/jbossesb/trunk/product/lib/ext/jackrabbit-api-1.2.1.jar
labs/jbossesb/trunk/product/lib/ext/jackrabbit-core-1.2.1.jar
labs/jbossesb/trunk/product/lib/ext/jackrabbit-jcr-commons-1.2.1.jar
labs/jbossesb/trunk/product/lib/ext/jcr-1.0.jar
labs/jbossesb/trunk/product/lib/ext/lucene-core-2.0.0.jar
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStorePlugin.java
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRConnectionManager.java
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRMessageStoreImpl.java
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRMessageStorePlugin.java
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRNodeNames.java
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/MessageStoreUnitTest.java
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreClient.java
labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreTest.java
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/MessagePersisterTest.java
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/MessagePersisterTest.xml
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/messagestore/
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/DbUtils.java
Modified:
labs/jbossesb/trunk/product/build-distr.xml
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ContentBasedRouter.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/spring/AbstractSpringActionUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/spring/MockSpringAction.java
labs/jbossesb/trunk/product/core/rosetta/build.xml
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Configuration.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Environment.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/ModulePropertyManager.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/persistence/MessageStore.java
labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/testutils/TestEnvironmentUtil.java
labs/jbossesb/trunk/product/install/conf/jbossesb-properties.xml
labs/jbossesb/trunk/product/install/jboss-service.xml
labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/META-INF/jboss-esb.xml
labs/jbossesb/trunk/product/services/jbossesb/src/test/resources/log4j.xml
Log:
JBESB-500 moving the message-store to jbossesb.esb
Modified: labs/jbossesb/trunk/product/build-distr.xml
===================================================================
--- labs/jbossesb/trunk/product/build-distr.xml 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/product/build-distr.xml 2007-06-05 17:18:29 UTC (rev 12336)
@@ -111,13 +111,6 @@
</fileset>
</copy>
- <mkdir dir="${build.dir}/jbossesb.sar/message-store-sql"/>
- <copy todir="${build.dir}/jbossesb.sar/message-store-sql">
- <fileset dir="${installation.files.dir}/message-store/sql">
- <include name="**/*.sql"/>
- </fileset>
- </copy>
-
<mkdir dir="${build.dir}/jbossesb.sar/lib"/>
<copy todir="${build.dir}/jbossesb.sar/lib">
<fileset dir="${lib.ext.dir}" includes="jbossts-common.jar"/>
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/dependencies/DatabaseInitializer.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/dependencies/DatabaseInitializer.java 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/dependencies/DatabaseInitializer.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -1,142 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.internal.soa.esb.dependencies;
-
-import java.net.URL;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import javax.naming.InitialContext;
-import javax.sql.DataSource;
-
-import org.jboss.soa.esb.listeners.config.Configuration;
-import org.jboss.system.ServiceMBeanSupport;
-
-/**
- * Initialize a given datasource
- *
- * Takes a list resources that are .sql files and checks to see if they have alrady been executed
- * on a given datasource by executing a sql query. If the sql query fails, then the .sql files are executed.
- *
- * @author <a href="bill at jboss.com">Bill Burke</a>
- * @version $Revision: 1.1 $
- */
-public class DatabaseInitializer extends ServiceMBeanSupport implements DatabaseInitializerMBean
-{
- private String datasource;
- private String sqlFiles;
- private String existsSql;
-
-
- public String getExistsSql()
- {
- return existsSql;
- }
-
- public void setExistsSql(String existsSql)
- {
- this.existsSql = existsSql;
- }
-
- public String getSqlFiles()
- {
- return sqlFiles;
- }
-
- public void setSqlFiles(String sqlFiles)
- {
- this.sqlFiles = sqlFiles;
- }
-
- public String getDatasource()
- {
- return datasource;
- }
-
- public void setDatasource(String datasource)
- {
- this.datasource = datasource;
- }
-
- protected void initDatabase() throws Exception
- {
- DataSource ds = (DataSource)new InitialContext().lookup(datasource);
- Connection conn = ds.getConnection();
- boolean load = false;
-
- Statement st = conn.createStatement();
- ResultSet rs = null;
- try
- {
- rs = st.executeQuery(existsSql.trim());
- rs.close();
- }
- catch (SQLException e)
- {
- load = true;
- }
- st.close();
- if (!load)
- {
- log.info(datasource + " datasource is already initialized");
- return;
- }
-
- log.info("Initializing " + datasource + " from listed sql files");
-
- String[] list = sqlFiles.split(",");
- for (String sql : list)
- {
- executeSql(sql.trim(), conn);
- }
- }
-
- public void executeSql(String resource, Connection conn)
- throws Exception
- {
- URL url = Thread.currentThread().getContextClassLoader().getResource(resource);
- String sql = Configuration.getStringFromStream(url.openStream());
- String[] statements = sql.split(";");
- for (String statement : statements)
- {
- Statement sqlStatement = conn.createStatement();
- try
- {
- sqlStatement.executeUpdate(statement);
- }
- finally
- {
- sqlStatement.close();
- }
- }
- }
-
-
- @Override
- protected void startService() throws Exception
- {
- initDatabase();
- super.startService();
- }
-}
Added: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/dependencies/DatabaseInitializer.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/dependencies/DatabaseInitializer.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/dependencies/DatabaseInitializer.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1,142 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.internal.soa.esb.dependencies;
+
+import java.net.URL;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+
+import org.jboss.soa.esb.listeners.config.Configuration;
+import org.jboss.system.ServiceMBeanSupport;
+
+/**
+ * Initialize a given datasource
+ *
+ * Takes a list resources that are .sql files and checks to see if they have alrady been executed
+ * on a given datasource by executing a sql query. If the sql query fails, then the .sql files are executed.
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class DatabaseInitializer extends ServiceMBeanSupport implements DatabaseInitializerMBean
+{
+ private String datasource;
+ private String sqlFiles;
+ private String existsSql;
+
+
+ public String getExistsSql()
+ {
+ return existsSql;
+ }
+
+ public void setExistsSql(String existsSql)
+ {
+ this.existsSql = existsSql;
+ }
+
+ public String getSqlFiles()
+ {
+ return sqlFiles;
+ }
+
+ public void setSqlFiles(String sqlFiles)
+ {
+ this.sqlFiles = sqlFiles;
+ }
+
+ public String getDatasource()
+ {
+ return datasource;
+ }
+
+ public void setDatasource(String datasource)
+ {
+ this.datasource = datasource;
+ }
+
+ protected void initDatabase() throws Exception
+ {
+ DataSource ds = (DataSource)new InitialContext().lookup(datasource);
+ Connection conn = ds.getConnection();
+ boolean load = false;
+
+ Statement st = conn.createStatement();
+ ResultSet rs = null;
+ try
+ {
+ rs = st.executeQuery(existsSql.trim());
+ rs.close();
+ }
+ catch (SQLException e)
+ {
+ load = true;
+ }
+ st.close();
+ if (!load)
+ {
+ log.info(datasource + " datasource is already initialized");
+ return;
+ }
+
+ log.info("Initializing " + datasource + " from listed sql files");
+
+ String[] list = sqlFiles.split(",");
+ for (String sql : list)
+ {
+ executeSql(sql.trim(), conn);
+ }
+ }
+
+ public void executeSql(String resource, Connection conn)
+ throws Exception
+ {
+ URL url = Thread.currentThread().getContextClassLoader().getResource(resource);
+ String sql = Configuration.getStringFromStream(url.openStream());
+ String[] statements = sql.split(";");
+ for (String statement : statements)
+ {
+ Statement sqlStatement = conn.createStatement();
+ try
+ {
+ sqlStatement.executeUpdate(statement);
+ }
+ finally
+ {
+ sqlStatement.close();
+ }
+ }
+ }
+
+
+ @Override
+ protected void startService() throws Exception
+ {
+ initDatabase();
+ super.startService();
+ }
+}
Property changes on: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/dependencies/DatabaseInitializer.java
___________________________________________________________________
Name: svn:eol-style
+ native
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/dependencies/DatabaseInitializerMBean.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/dependencies/DatabaseInitializerMBean.java 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/dependencies/DatabaseInitializerMBean.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -1,51 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.internal.soa.esb.dependencies;
-
-import org.jboss.system.ServiceMBean;
-
-/**
- * comment
- *
- * @author <a href="bill at jboss.com">Bill Burke</a>
- * @version $Revision: 1.1 $
- */
-public interface DatabaseInitializerMBean extends ServiceMBean
-{
- String getExistsSql()
- ;
-
- void setExistsSql(String existsSql)
- ;
-
- String getSqlFiles()
- ;
-
- void setSqlFiles(String sqlFiles)
- ;
-
- String getDatasource()
- ;
-
- void setDatasource(String datasource)
- ;
-}
Added: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/dependencies/DatabaseInitializerMBean.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/dependencies/DatabaseInitializerMBean.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/dependencies/DatabaseInitializerMBean.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1,51 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.internal.soa.esb.dependencies;
+
+import org.jboss.system.ServiceMBean;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public interface DatabaseInitializerMBean extends ServiceMBean
+{
+ String getExistsSql()
+ ;
+
+ void setExistsSql(String existsSql)
+ ;
+
+ String getSqlFiles()
+ ;
+
+ void setSqlFiles(String sqlFiles)
+ ;
+
+ String getDatasource()
+ ;
+
+ void setDatasource(String datasource)
+ ;
+}
Property changes on: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/internal/soa/esb/dependencies/DatabaseInitializerMBean.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ContentBasedRouter.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ContentBasedRouter.java 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ContentBasedRouter.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -46,9 +46,11 @@
*/
public class ContentBasedRouter extends AbstractActionPipelineProcessor
{
- public static final String ROUTE_TO_TAG = "route-to";
- public static final String OBJECT_PATH_TAG = "object-path";
- public static final String OBJECT_PATH = "path";
+ private static final String MESSAGE_PERSISTER_SERVICE_CATEGORY = "";
+ private static final String MESSAGE_PERSISTER_SERVICE_NAME = "";
+ public static final String ROUTE_TO_TAG = "route-to";
+ public static final String OBJECT_PATH_TAG = "object-path";
+ public static final String OBJECT_PATH = "path";
public static final String DEFAULT_CBR_CLASS = "org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter";
private Logger log = Logger.getLogger(this.getClass());
@@ -94,8 +96,8 @@
+ " are not in found in the destination names in the configuration "
+ _destinations.keySet() + ". Please fix your configuration.");
- MessageRouter.deliverMessage(MessagePersister.SERVICE_CATEGORY
- , MessagePersister.SERVICE_NAME
+ MessageRouter.deliverMessage(MESSAGE_PERSISTER_SERVICE_CATEGORY
+ , MESSAGE_PERSISTER_SERVICE_NAME
, message);
}
return message;
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/MessagePersister.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/MessagePersister.java 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/MessagePersister.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -1,107 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-/**
- * Routes the Message argument to a fixed list of services ([category,name])
- * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
- * @since Version 4.0
- */
-package org.jboss.soa.esb.actions;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.services.persistence.MessageStore;
-import org.jboss.soa.esb.services.persistence.MessageStoreException;
-import org.jboss.soa.esb.services.persistence.MessageStoreFactory;
-import org.jboss.soa.esb.services.persistence.MessageStoreType;
-import org.jboss.soa.esb.services.registry.RegistryException;
-import org.jboss.soa.esb.services.routing.MessageRouterException;
-
-public class MessagePersister extends AbstractActionPipelineProcessor
-{
- public final static String SERVICE_CATEGORY = "JBossESB-Internal";
- public final static String SERVICE_NAME = "DeadLetterService";
- public final static String MESSAGE_STORE_TYPE_ATTR = "message-store-type";
- public final static String CLASSIFICATION_ATTR = "classfication";
-
- protected ConfigTree config;
- protected MessageStore messageStore;
- private String classification;
- private Logger log = Logger.getLogger(this.getClass());
-
- public MessagePersister(ConfigTree config) throws ConfigurationException, RegistryException, MessageRouterException
- {
- this.config = config;
- }
- /**
- * Persists the message to the MessageStore
- */
- public Message process(Message message) throws ActionProcessingException
- {
- try {
- messageStore.addMessage(message, classification);
- } catch (MessageStoreException mse) {
- log.error("Could not store undeliverable message.", mse);
- }
- return message;
- }
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.actions.ActionLifecycle#initialise()
- */
- public void initialise() throws ActionLifecycleException {
- //Reading the config
- String messageStoreTypeValue = config.getAttribute(MESSAGE_STORE_TYPE_ATTR);
- try {
-
- URI messageStoreType = MessageStoreType.DEFAULT_TYPE;
- if (messageStoreTypeValue!=null) {
- messageStoreType = new URI(messageStoreTypeValue);
- }
- String classificationValue = config.getAttribute(CLASSIFICATION_ATTR);
- if (classificationValue!=null) {
- classification = classificationValue;
- }
- if (log.isDebugEnabled()) {
- log.debug("MessagePersister started with classification=" + classification
- + " and message-store-type=" + messageStoreType);
- }
- messageStore = MessageStoreFactory.getInstance().getMessageStore(messageStoreType);
- } catch (URISyntaxException e) {
- throw new ActionLifecycleException(
- "The message store type '" + messageStoreTypeValue + "' is not valid.", e);
- }
-
- }
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.actions.ActionLifecycle#destroy()
- */
- public void destroy() throws ActionLifecycleException {
- classification=null;
- }
-
-
-}
Modified: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/spring/AbstractSpringActionUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/spring/AbstractSpringActionUnitTest.java 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/spring/AbstractSpringActionUnitTest.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -21,13 +21,7 @@
import junit.framework.TestCase;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.actions.ActionLifecycleException;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.actions.ActionUtils;
import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
/**
Modified: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/spring/MockSpringAction.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/spring/MockSpringAction.java 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/spring/MockSpringAction.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -20,12 +20,8 @@
*/
package org.jboss.soa.esb.actions.spring;
-import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.actions.AbstractSpringAction;
-import org.jboss.soa.esb.actions.ActionLifecycleException;
import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Body;
-import org.jboss.soa.esb.message.Message;
/**
* Used to test Spring integration.
Modified: labs/jbossesb/trunk/product/core/rosetta/build.xml
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/build.xml 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/product/core/rosetta/build.xml 2007-06-05 17:18:29 UTC (rev 12336)
@@ -15,6 +15,7 @@
<path id="org.jboss.esb.rosetta.base.classpath">
<fileset dir="${org.jboss.esb.ext.lib.dir}" includes="*.jar"/>
+ <fileset dir="${org.jboss.esb.ext.lib.dir}/standalone" includes="*.jar"/>
</path>
<target name="org.jboss.esb.rosetta.init">
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Configuration.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Configuration.java 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Configuration.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -58,10 +58,6 @@
new KeyValuePair(Environment.PARAMS_REPOS_IMPL_CLASS, getParamRepositoryImplClass()),
new KeyValuePair(Environment.OBJECT_STORE_CONFIG_FILE, getObjStoreConfigFile()),
new KeyValuePair(Environment.ENCRYPT_FACTORY_CLASS, getEncryptionFactoryClass()),
- new KeyValuePair(Environment.DB_DRIVER, getDbDriver()),
- new KeyValuePair(Environment.DB_URL, getDbUrl()),
- new KeyValuePair(Environment.DB_USER, getDbUser()),
- new KeyValuePair(Environment.DB_PASSWORD, getDbPassword()),
new KeyValuePair(Environment.MSG_STORE_DB_CONNECTION_URL, getStoreUrl()),
new KeyValuePair(Environment.MSG_STORE_DB_JDBC_DRIVER, getStoreDriver()),
new KeyValuePair(Environment.MSG_STORE_DB_CONNECTION_USER, getStoreUser()),
@@ -71,7 +67,6 @@
new KeyValuePair(Environment.MSG_STORE_DB_POOL_INITIAL_SIZE,getStorePoolInitialSize()),
new KeyValuePair(Environment.MSG_STORE_DB_POOL_TEST_TABLE, getStorePoolTestTable()),
new KeyValuePair(Environment.MSG_STORE_DB_POOL_TIMEOUT_MILLIS,getStorePoolTimeoutMillis()),
- new KeyValuePair(Environment.MSG_STORE_CONN_FACTORY ,getStoreConnectionFactory()),
new KeyValuePair(Environment.MSG_STORE_DB_CONN_MANAGER ,getStoreDBConnectionManager()),
new KeyValuePair(Environment.MSG_STORE_DB_DATASOURCE_NAME ,getStoreDBDatasourceName())
};
@@ -212,30 +207,6 @@
.getName());
}
- public static String getDbDriver()
- {
- String property = ModulePropertyManager.getPropertyManager(ModulePropertyManager.CONNECTION_MODULE).getProperty(Environment.DB_DRIVER);
- return property;
- }
-
- public static String getDbUrl()
- {
- String property = ModulePropertyManager.getPropertyManager(ModulePropertyManager.CONNECTION_MODULE).getProperty(Environment.DB_URL);
- return property;
- }
-
- public static String getDbUser()
- {
- String property = ModulePropertyManager.getPropertyManager(ModulePropertyManager.CONNECTION_MODULE).getProperty(Environment.DB_USER);
- return property;
- }
-
- public static String getDbPassword()
- {
- String property = ModulePropertyManager.getPropertyManager(ModulePropertyManager.CONNECTION_MODULE).getProperty(Environment.DB_PASSWORD);
- return property;
- }
-
public static String getStoreUrl()
{
String property = ModulePropertyManager.getPropertyManager(ModulePropertyManager.DBSTORE_MODULE).getProperty(Environment.MSG_STORE_DB_CONNECTION_URL);
@@ -290,12 +261,6 @@
return property;
}
- public static String getStoreConnectionFactory()
- {
- String property = ModulePropertyManager.getPropertyManager(ModulePropertyManager.CORE_MODULE).getProperty(Environment.MSG_STORE_CONN_FACTORY);
- return property;
- }
-
public static String getStoreDBConnectionManager()
{
String property = ModulePropertyManager.getPropertyManager(ModulePropertyManager.DBSTORE_MODULE).getProperty(Environment.MSG_STORE_DB_CONN_MANAGER);
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Environment.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Environment.java 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Environment.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -87,13 +87,6 @@
* Property that holds directory to use with the helper EPRManager class.
*/
public static final String REGISTRY_FILE_HELPER_DIR = "org.jboss.soa.esb.registry.file.directory";
- /*
- * Connection specific properties
- */
- public static String DB_DRIVER = "org.jboss.esb.db.driver";
- public static String DB_URL = "org.jboss.esb.db.url";
- public static String DB_USER = "org.jboss.esb.db.user";
- public static String DB_PASSWORD = "org.jboss.esb.db.password";
/*
* Some default values.
@@ -109,7 +102,6 @@
/*
* DatabaseMessageStore Persistence Store properties.
*/
- public static final String MSG_STORE_CONN_FACTORY = "org.jboss.soa.esb.persistence.connection.factory";
public static final String MSG_STORE_DB_CONNECTION_URL = "org.jboss.soa.esb.persistence.db.connection.url";
public static final String MSG_STORE_DB_CONNECTION_USER = "org.jboss.soa.esb.persistence.db.user";
public static final String MSG_STORE_DB_CONNECTION_PWD = "org.jboss.soa.esb.persistence.db.pwd";
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/ModulePropertyManager.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/ModulePropertyManager.java 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/ModulePropertyManager.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -90,8 +90,6 @@
public static final String TRANSPORTS_MODULE = "transports";
public static final String DBSTORE_MODULE = "dbstore";
-
- public static final String ROUTER_MODULE = "messagerouting";
public static final String FILTER_MODULE = "filters";
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/persistence/MessageStore.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/persistence/MessageStore.java 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/persistence/MessageStore.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -24,11 +24,13 @@
import java.net.URI;
import java.util.Map;
+
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.urigen.MessageURIGenerator;
public interface MessageStore
{
+ public final static String DEFAULT = "org.jboss.internal.soa.esb.persistence.format.db.DBMessageStoreImpl";
public final static String DEFAULT_CLASSIFICATION = "STORE";
public final static String DLQ_CLASSIFICATION = "DLQ";
/**
Deleted: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/persistence/MessageStoreFactory.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/persistence/MessageStoreFactory.java 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/persistence/MessageStoreFactory.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -1,82 +0,0 @@
-package org.jboss.soa.esb.services.persistence;
-
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author mark.little at jboss.com
- */
-
-import java.lang.reflect.Constructor;
-import java.net.URI;
-
-import org.jboss.soa.esb.common.Configuration;
-import org.jboss.soa.esb.util.ClassUtil;
-
-
-
-
- at SuppressWarnings("unchecked")
-public abstract class MessageStoreFactory {
-
- private static MessageStoreFactory theFactory;
-
- static
- {
-
- try {
-// Class cls = Class.forName("org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl");
- Class cls = ClassUtil.forName(Configuration.getStoreConnectionFactory(), MessageStoreFactory.class);
- Constructor<MessageStoreFactory> c = cls.getConstructor(new Class[]{});
- theFactory = c.newInstance(new Object[]{});
- } catch (Exception e) {
- e.printStackTrace();
- }
-
-
- }
-
-
- /**
- * @return a default implementation.
- */
-
- public abstract MessageStore getMessageStore ();
-
- /**
- * @param type the unique identifier representing the type of this MessageStore.
- * @return the MessageStore, or <code>null</code> if no suitable store is available.
- */
-
- public abstract MessageStore getMessageStore (URI type);
-
-
- public static MessageStoreFactory getInstance ()
- {
- return theFactory;
- }
-
- /**
- * Reload the plugins.
- */
-
- public abstract void reset ();
-
-
-
-
-}
Modified: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/testutils/TestEnvironmentUtil.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/testutils/TestEnvironmentUtil.java 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/testutils/TestEnvironmentUtil.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -96,5 +96,21 @@
reader.close();
return sb.toString();
}
+
+ public static File findResourceDirectory(String dirPath)
+ {
+ String[] dirs = dirPath.split("/");
+ for (int i=1; i<dirs.length; i++) {
+ dirPath = ".";
+ for (int j=i; j<dirs.length; j++) {
+ dirPath += "/" + dirs[j];
+ }
+ File dir = new File(dirPath);
+ if (dir.exists()) {
+ return dir;
+ }
+ }
+ return null;
+ }
}
Added: labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/services/registry/MockRegistryImpl.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/services/registry/MockRegistryImpl.java (rev 0)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/services/registry/MockRegistryImpl.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1,258 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.internal.soa.esb.services.registry;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.services.registry.Registry;
+import org.jboss.soa.esb.services.registry.RegistryException;
+/**
+ * Mock class for the Registry.
+ * If need be we can extract the interface from here, add a factory and have JAXR as a plugin, allowing
+ * for other RegistryAPIs.
+ *
+ * @author Kurt Stam
+ */
+public class MockRegistryImpl implements Registry
+{
+ private static Map<String,Category> categories = new HashMap<String,Category>();
+
+ /**
+ * Publish an EPR to the Registry
+ */
+ protected Service registerService(String categoryName, String serviceName, String serviceDescription)
+ {
+ Category category = categories.get(categoryName);
+ if (category==null) {
+ category = new Category();
+ categories.put(categoryName, category);
+ }
+ Service service = new Service();
+ service.setName(serviceName);
+ service.setDescription(serviceDescription);
+ category.getServices().add(service);
+ return service;
+ }
+ /**
+ * Remove an EPR from the Registry
+ */
+ @SuppressWarnings("unchecked")
+ public void unRegisterService(String categoryName, String serviceName) throws RegistryException
+ {
+ Category category = categories.get(categoryName);
+ if (category==null) {
+ throw new RegistryException("Service not found");
+ } else {
+ List<Service> services = category.getServices();
+ for (Service service : services) {
+ if (serviceName.equals(service.getName())) {
+ services.remove(service);
+ }
+ }
+ }
+ }
+ /**
+ * Publish an EPR to the Registry
+ */
+ public void registerEPR(String categoryName, String serviceName, String serviceDescription, EPR epr, String eprDescription)
+ throws RegistryException
+ {
+ Service service = registerService(categoryName, serviceName, serviceDescription);
+ ServiceBinding serviceBinding = new ServiceBinding();
+ serviceBinding.setDescription(eprDescription);
+ serviceBinding.setEpr(epr);
+ service.getServiceBindings().add(serviceBinding);
+ }
+ /**
+ * Remove an EPR from the Registry
+ */
+ public void unRegisterEPR(String category, String serviceName, EPR toBeDeletedEPR) throws RegistryException{
+ //first find the ServiceBindings for this service
+ Service service = findService(category, serviceName);
+ List<ServiceBinding> serviceBindings = service.getServiceBindings();
+ for (ServiceBinding binding : serviceBindings) {
+ if (toBeDeletedEPR.equals(binding.getEpr())) {
+ serviceBindings.remove(binding);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ * @return collection services
+ */
+ public Collection<String> findAllServices() throws RegistryException
+ {
+ Collection<String> serviceNames = new ArrayList<String>();
+ for (Category category : categories.values()) {
+ for (Service service : category.getServices()) {
+ serviceNames.add(service.name);
+ }
+ }
+ return serviceNames;
+ }
+ /**
+ * Find Services based on a category ("transformation").
+ *
+ * @param serviceType
+ * @return collection services
+ */
+ public Collection<String> findServices(String categoryName) throws RegistryException
+ {
+ Collection<String> serviceNames = new ArrayList<String>();
+ Category category = categories.get(categoryName);
+ if (category==null) {
+ throw new RegistryException("No category called " + categoryName + " exist");
+ }
+ for (Service service : category.getServices()) {
+ serviceNames.add(service.name);
+ }
+ return serviceNames;
+ }
+ /**
+ *
+ * @param service
+ * @return
+ */
+ public Collection<EPR> findEPRs(String categoryName, String serviceName) throws RegistryException
+ {
+ Collection<EPR> eprs = new ArrayList<EPR>();
+ Service service = findService(categoryName, serviceName);
+ for (ServiceBinding serviceBinding : service.serviceBindings) {
+ eprs.add(serviceBinding.getEpr());
+ }
+ return eprs;
+ }
+ /**
+ *
+ * @param service
+ * @return
+ */
+ public EPR findEPR(String categoryName, String serviceName) throws RegistryException
+ {
+ Service service = findService(categoryName, serviceName);
+ for (ServiceBinding serviceBinding : service.serviceBindings) {
+ //return the first one in the list
+ return serviceBinding.getEpr();
+ }
+ return null;
+ }
+ /**
+ *
+ * @param category
+ * @param serviceName
+ * @return Service
+ */
+ protected synchronized static Service findService(String categoryName, String serviceName) throws RegistryException
+ {
+ Category category = categories.get(categoryName);
+ for (Service service : category.getServices()) {
+ if (serviceName.equals(service.getName())) {
+ return service;
+ }
+ }
+ throw new RegistryException("No service called " + serviceName + " exists in category " + categoryName);
+ }
+ /**
+ * Finds all services for a given category.
+ * @param category
+ * @param serviceName
+ * @return Service
+ */
+ protected synchronized static Collection<Service> findServicesForCategory(String categoryName)
+ {
+ Category category = categories.get(categoryName);
+ return category.getServices();
+ }
+
+ class Category
+ {
+ List<Service> services = new ArrayList<Service>();
+
+ public List<Service> getServices() {
+ return services;
+ }
+ public void setServices(List<Service> services) {
+ this.services = services;
+ }
+ }
+
+ class Service
+ {
+ String name;
+ String description;
+ List<ServiceBinding> serviceBindings = new ArrayList<ServiceBinding>();
+
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public List<ServiceBinding> getServiceBindings() {
+ return serviceBindings;
+ }
+ public void setServiceBindings(List<ServiceBinding> serviceBindings) {
+ this.serviceBindings = serviceBindings;
+ }
+ }
+
+ class ServiceBinding
+ {
+ String name;
+ String description;
+ EPR epr;
+
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public EPR getEpr() {
+ return epr;
+ }
+ public void setEpr(EPR epr) {
+ this.epr = epr;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ }
+
+}
+
+
Property changes on: labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/services/registry/MockRegistryImpl.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/install/conf/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/trunk/product/install/conf/jbossesb-properties.xml 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/product/install/conf/jbossesb-properties.xml 2007-06-05 17:18:29 UTC (rev 12336)
@@ -63,11 +63,11 @@
<properties name="dbstore">
<!-- connection manager type -->
- <property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.soa.esb.persistence.manager.StandaloneConnectionManager"/>
- <!-- property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.soa.esb.persistence.manager.J2eeConnectionManager"/ -->
+ <!-- <property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.soa.esb.persistence.manager.StandaloneConnectionManager"/> -->
+ <property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.soa.esb.persistence.manager.J2eeConnectionManager"/>
<!-- this property is only used if using the j2ee connection manager -->
- <property name="org.jboss.soa.esb.persistence.db.datasource.name" value="java:/JBossesbDS"/>
+ <property name="org.jboss.soa.esb.persistence.db.datasource.name" value="java:/JBossESBDS"/>
<!-- standalone connection pooling settings -->
<property name="org.jboss.soa.esb.persistence.db.connection.url" value="jdbc:hsqldb:hsql://localhost:9001/jbossesb"/>
Modified: labs/jbossesb/trunk/product/install/jboss-service.xml
===================================================================
--- labs/jbossesb/trunk/product/install/jboss-service.xml 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/product/install/jboss-service.xml 2007-06-05 17:18:29 UTC (rev 12336)
@@ -14,15 +14,6 @@
</attribute>
<depends>jboss.jca:service=DataSourceBinding,name=juddiDB</depends>
</mbean>
- <mbean code="org.jboss.internal.soa.esb.dependencies.DatabaseInitializer"
- name="jboss.esb:service=MessageStoreDatabaseInitializer">
- <attribute name="Datasource">java:/JBossESBDS</attribute>
- <attribute name="ExistsSql">select * from message</attribute>
- <attribute name="SqlFiles">
- message-store-sql/hsqldb/create_database.sql
- </attribute>
- <depends>jboss.jca:service=DataSourceBinding,name=JBossESBDS</depends>
- </mbean>
<mbean code="org.jboss.internal.soa.esb.dependencies.JuddiRMIService"
name="jboss.esb:service=JuddiRMI"
description="Juddi RMI Service">
@@ -32,6 +23,5 @@
name="jboss.esb:service=ESBDeployer">
<depends>jboss.esb:service=ESBRegistry</depends>
<depends>jboss.esb:service=JuddiRMI</depends>
- <depends>jboss.jca:service=DataSourceBinding,name=JBossESBDS</depends>
</mbean>
</server>
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/lib/ext/c3p0-0.9.1-pre9.jar
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/trunk/product/lib/ext/jackrabbit-api-1.2.1.jar
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/trunk/product/lib/ext/jackrabbit-core-1.2.1.jar
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/trunk/product/lib/ext/jackrabbit-jcr-commons-1.2.1.jar
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/trunk/product/lib/ext/jcr-1.0.jar
===================================================================
(Binary files differ)
Deleted: labs/jbossesb/trunk/product/lib/ext/lucene-core-2.0.0.jar
===================================================================
(Binary files differ)
Added: labs/jbossesb/trunk/product/lib/ext/standalone/c3p0-0.9.1-pre9.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/lib/ext/standalone/c3p0-0.9.1-pre9.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/c3p0-0.9.1-pre9.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/c3p0-0.9.1-pre9.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/commons-io-1.3.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/commons-io-1.3.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/commons-lang-2.1.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/commons-lang-2.1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/hsqldb.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/hsqldb.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/jboss-system.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/jboss-system.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/jbossall-client.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/jbossall-client.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/jbossts-common.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/jbossts-common.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/junit-4.1.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/junit-4.1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/log4j.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/log4j.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/xercesImpl-2.7.1.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/build-time/xercesImpl-2.7.1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/jackrabbit-api-1.2.1.jar (from rev 12266, labs/jbossesb/trunk/product/lib/ext/jackrabbit-api-1.2.1.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/jackrabbit-core-1.2.1.jar (from rev 12266, labs/jbossesb/trunk/product/lib/ext/jackrabbit-core-1.2.1.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/jackrabbit-jcr-commons-1.2.1.jar (from rev 12266, labs/jbossesb/trunk/product/lib/ext/jackrabbit-jcr-commons-1.2.1.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/jcr-1.0.jar (from rev 12266, labs/jbossesb/trunk/product/lib/ext/jcr-1.0.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/services/jbossesb/lib/ext/lucene-core-2.0.0.jar (from rev 12266, labs/jbossesb/trunk/product/lib/ext/lucene-core-2.0.0.jar)
===================================================================
(Binary files differ)
Added: labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/MessageStoreFactory.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/MessageStoreFactory.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/MessageStoreFactory.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1,104 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author daniel.brum at jboss.com
+ */
+
+
+package org.jboss.internal.soa.esb.persistence.format;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.services.persistence.MessageStore;
+import org.jboss.soa.esb.util.ClassUtil;
+/**
+ *
+ * @author kurt.stam at jboss.com
+ *
+ */
+public class MessageStoreFactory {
+
+ private final ConcurrentHashMap<String, MessageStore> messageStores = new ConcurrentHashMap<String, MessageStore>();
+ private static MessageStoreFactory theFactory;
+ private static Logger _log = Logger.getLogger(MessageStoreFactory.class);
+
+ public MessageStoreFactory() {
+ reset();
+ }
+ /**
+ * Returns a the default MessageStore implementation (Database).
+ * @return MessageStore
+ */
+ public MessageStore getMessageStore() {
+ return getMessageStore(MessageStore.DEFAULT);
+ }
+ /**
+ * Returns an instance of a MessageStore, of the type 'className'. Multiple instances of the same
+ * type of MessageStore will be created for different sets of properties.
+ *
+ * @param className - classname of the message store.
+ * @return MessageStore
+ */
+ public MessageStore getMessageStore(String className) {
+ if (className == null) {
+ className = MessageStore.DEFAULT;
+ }
+ String messageStoreKey = className;
+ MessageStore messageStore = messageStores.get(messageStoreKey);
+ if (messageStore == null) {
+ messageStore = getMessageStoreInstance(className);
+ messageStores.put(messageStoreKey, messageStore);
+ }
+ return messageStore;
+ }
+
+ public void reset ()
+ {
+ messageStores.clear();
+ }
+ /**
+ * Instantiates a
+ * @param className
+ * @return
+ */
+ private MessageStore getMessageStoreInstance(String className)
+ {
+ MessageStore messageStore=null;
+ try {
+ Class messageStoreClass = ClassUtil.forName(className, getClass());
+ messageStore = (MessageStore) messageStoreClass.newInstance();
+ } catch (ClassNotFoundException ex) {
+ _log.error(ex.getMessage(), ex);
+ } catch (IllegalAccessException ex) {
+ _log.error(ex.getMessage(), ex);
+ } catch (InstantiationException ex) {
+ _log.error(ex.getMessage(), ex);
+ }
+ return messageStore;
+ }
+
+ public static MessageStoreFactory getInstance()
+ {
+ if (theFactory==null) {
+ theFactory = new MessageStoreFactory();
+ }
+ return theFactory;
+ }
+
+}
Property changes on: labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/MessageStoreFactory.java
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db (from rev 12266, labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/persistence/format/db)
Deleted: labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java 2007-05-31 16:56:22 UTC (rev 12266)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -1,338 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author daniel.brum at jboss.com
- */
-
-package org.jboss.internal.soa.esb.persistence.format.db;
-
-import java.io.Serializable;
-import java.net.URI;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.message.urigen.DefaultMessageURIGenerator;
-import org.jboss.internal.soa.esb.persistence.manager.ConnectionManager;
-import org.jboss.internal.soa.esb.thirdparty.Base64;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.urigen.MessageURIGenerator;
-import org.jboss.soa.esb.persistence.manager.ConnectionManagerException;
-import org.jboss.soa.esb.persistence.manager.ConnectionManagerFactory;
-import org.jboss.soa.esb.services.persistence.MessageStore;
-import org.jboss.soa.esb.services.persistence.MessageStoreException;
-import org.jboss.soa.esb.util.Util;
-
-public class DBMessageStoreImpl implements MessageStore
-{
- private static Logger logger = Logger.getLogger(DBMessageStoreImpl.class);
-
- protected ConnectionManager mgr = null;
-
- protected Connection conn = null;
-
- protected ResultSet rs = null;
-
- protected PreparedStatement ps = null;
-
- protected MessageURIGenerator uriGenerator = new DefaultMessageURIGenerator();
-
- public DBMessageStoreImpl()
- {
- try {
- mgr = ConnectionManagerFactory.getConnectionManager();
- } catch (ConnectionManagerException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.services.persistence.MessageStore#getMessageURIGenerator()
- */
- public MessageURIGenerator getMessageURIGenerator() {
- return uriGenerator;
- }
-
- /**
- * add's a @Message to the database persistence store
- * will set the 'delivered' flag to TRUE by default - assuming that the @Message has been delivered
- */
- public synchronized URI addMessage (Message message, String classification) throws MessageStoreException
- {
-
- // String messageString = null;
- URI uid = null;
-
- try
- {
- conn = mgr.getConnection();
-
- uid = uriGenerator.generateMessageURI(message);
-
- String messageString = Base64.encodeObject(Util.serialize(message));
-
- // insert into the database
- String sql = "insert into message(uuid, type, message, delivered, classification) values(?,?,?,?,?)";
- ps = conn.prepareStatement(sql);
- ps.setString(1, uid.toString());
- ps.setString(2, message.getType().toString());
- ps.setString(3, messageString);
- ps.setString(4, "TRUE");
- ps.setString(5, classification);
- ps.execute();
-
- }
- catch (Exception e)
- {
- logger.error(e);
- throw new MessageStoreException(e);
- }
- finally
- {
- release();
- }
-
- return uid;
- }
-
- /**
- * return a @Message based on the passed in key in the form of a JBoss ESB @URI
- * format for URI: "urn:jboss/esb/message/UID#" + UUID.randomUUID()" - see the method in this class @addMessage
- */
- public synchronized Message getMessage (URI uid)
- throws MessageStoreException
- {
-
- String sql = "select uuid,type,message from message where uuid=?";
- Message message = null;
-
- try
- {
- conn = mgr.getConnection();
- ps = conn.prepareStatement(sql);
- ps.setString(1, uid.toString());
-
- rs = ps.executeQuery();
- if (!rs.next())
- throw new MessageStoreException("Non existing Message for UUID: " + uid);
-
- message = Util.deserialize((Serializable) Base64.decodeToObject(rs
- .getString(3)));
-
- }
- catch (SQLException e)
- {
- throw new MessageStoreException(e);
- }
- catch (Exception e)
- {
- logger.error(e);
- throw new MessageStoreException(e);
- }
- finally
- {
- release();
- }
-
- return message;
-
- }
-
- /**
- *
- * @param uid - key for message to set undelivered flag on
- * @throws MessageStoreException
- */
- public void setUndelivered(URI uid) throws MessageStoreException{
- String sql = "update message set delivered = 'FALSE' where uuid=?";
-
- try
- {
- conn = mgr.getConnection();
-
- ps = conn.prepareStatement(sql);
- ps.setString(1, uid.toString());
- ps.execute();
-
- }
- catch (Exception e)
- {
- logger.error(e);
- throw new MessageStoreException(e);
- }
- finally
- {
- release();
- }
-
- }
-
- public void setDelivered(URI uid) throws MessageStoreException{
- String sql = "update message set delivered = 'TRUE' where uuid=?";
-
- try
- {
- conn = mgr.getConnection();
-
- ps = conn.prepareStatement(sql);
- ps.setString(1, "FALSE");
- ps.execute();
-
- }
- catch (Exception e)
- {
- logger.error(e);
- throw new MessageStoreException(e);
- }
- finally
- {
- release();
- }
-
- }
-
- /**
- * This method can be used to retrieve a collection of all the undelivered (delivered=FALSE) from the message-store
- * You should test for 'null' on the return type to see if any messages exist in the collection
- * @return Map<URI, Message> - a collection of all the undelivered messages in the message-store
- * @throws MessageStoreException
- */
- public Map<URI, Message> getUndeliveredMessages(String classification) throws MessageStoreException {
- HashMap<URI, Message> messages = new HashMap<URI, Message>();
- String sql = "select uuid from message where delivered='FALSE'";
- if (classification!=null) {
- sql += " and classification='" + classification + "'";
- }
-
- try
- {
- conn = mgr.getConnection();
- Statement stmt;
- ResultSet rs;
- stmt = conn.createStatement();
- rs = stmt.executeQuery(sql);
-
- while (rs.next()) {
- URI uid = new URI(rs.getString(1));
- Message msg = getMessage(uid);
- messages.put(uid, msg);
- }
- rs.close();
- stmt.close();
-
- }
- catch (Exception e)
- {
- logger.error(e);
- throw new MessageStoreException(e);
- }
- finally
- {
- release();
- }
- logger.info("retrieved " + messages.size() + " undelivered messages");
- return messages;
-
- }
-
- /**
- * This method can be used to retrieve a collection of all from the message-store
- * You should test for 'null' on the return type to see if any messages exist in the collection
- * @return Map<URI, Message> - a collection of all the undelivered messages in the message-store
- * @throws MessageStoreException
- */
- public Map<URI, Message> getAllMessages(String classification) throws MessageStoreException {
- HashMap<URI, Message> messages = new HashMap<URI, Message>();
- String sql = "select uuid from message";
- if (classification!=null) {
- sql += " where classification='" + classification + "'";
- }
-
- try
- {
- conn = mgr.getConnection();
- Statement stmt;
- ResultSet rs;
- stmt = conn.createStatement();
- rs = stmt.executeQuery(sql);
-
- while (rs.next()) {
- URI uid = new URI(rs.getString(1));
- Message msg = getMessage(uid);
- messages.put(uid, msg);
- }
- rs.close();
- stmt.close();
-
- }
- catch (Exception e)
- {
- logger.error(e);
- throw new MessageStoreException(e);
- }
- finally
- {
- release();
- }
- logger.info("retrieved " + messages.size() + " undelivered messages");
- return messages;
-
- }
-
- private void release ()
- {
-
- if (conn != null)
- {
- if (rs != null)
- {
- try
- {
- rs.close();
- }
- catch (Exception e)
- {
- }
- }
-
- try
- {
- ps.close();
- }
- catch (Exception e1)
- {
- }
-
- try
- {
- conn.close();
- }
- catch (Exception e2)
- {
- }
- }
- }
-
-}
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java (from rev 12335, labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1,316 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author daniel.brum at jboss.com
+ */
+
+package org.jboss.internal.soa.esb.persistence.format.db;
+
+import java.io.Serializable;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.message.urigen.DefaultMessageURIGenerator;
+import org.jboss.internal.soa.esb.persistence.manager.ConnectionManager;
+import org.jboss.internal.soa.esb.thirdparty.Base64;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.urigen.MessageURIGenerator;
+import org.jboss.soa.esb.persistence.manager.ConnectionManagerException;
+import org.jboss.soa.esb.persistence.manager.ConnectionManagerFactory;
+import org.jboss.soa.esb.services.persistence.MessageStore;
+import org.jboss.soa.esb.services.persistence.MessageStoreException;
+import org.jboss.soa.esb.util.Util;
+
+public class DBMessageStoreImpl implements MessageStore
+{
+ private static Logger logger = Logger.getLogger(DBMessageStoreImpl.class);
+
+ protected ConnectionManager mgr = null;
+
+ protected Connection conn = null;
+
+ //protected ResultSet rs = null;
+
+ //protected PreparedStatement ps = null;
+
+ protected MessageURIGenerator uriGenerator = new DefaultMessageURIGenerator();
+
+ public DBMessageStoreImpl()
+ {
+ try {
+ mgr = ConnectionManagerFactory.getConnectionManager();
+ } catch (ConnectionManagerException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.soa.esb.services.persistence.MessageStore#getMessageURIGenerator()
+ */
+ public MessageURIGenerator getMessageURIGenerator() {
+ return uriGenerator;
+ }
+
+ /**
+ * add's a @Message to the database persistence store
+ * will set the 'delivered' flag to TRUE by default - assuming that the @Message has been delivered
+ */
+ public synchronized URI addMessage (Message message, String classification) throws MessageStoreException
+ {
+ // String messageString = null;
+ URI uid = null;
+ try{
+ conn = mgr.getConnection();
+
+ uid = uriGenerator.generateMessageURI(message);
+
+ String messageString = Base64.encodeObject(Util.serialize(message));
+
+ // insert into the database
+ String sql = "insert into message(uuid, type, message, delivered, classification) values(?,?,?,?,?)";
+ PreparedStatement ps = conn.prepareStatement(sql);
+ ps.setString(1, uid.toString());
+ ps.setString(2, message.getType().toString());
+ ps.setString(3, messageString);
+ ps.setString(4, "TRUE");
+ ps.setString(5, classification);
+ ps.execute();
+ ps.close();
+
+ }
+ catch (Exception e)
+ {
+ logger.error(e);
+ throw new MessageStoreException(e);
+ }
+ finally
+ {
+ release();
+ }
+
+ return uid;
+ }
+
+ /**
+ * return a @Message based on the passed in key in the form of a JBoss ESB @URI
+ * format for URI: "urn:jboss/esb/message/UID#" + UUID.randomUUID()" - see the method in this class @addMessage
+ */
+ public synchronized Message getMessage (URI uid)
+ throws MessageStoreException
+ {
+
+ String sql = "select uuid,type,message from message where uuid=?";
+ Message message = null;
+
+ try
+ {
+ conn = mgr.getConnection();
+ PreparedStatement ps = conn.prepareStatement(sql);
+ ps.setString(1, uid.toString());
+
+ ResultSet rs = ps.executeQuery();
+ if (!rs.next())
+ throw new MessageStoreException("Non existing Message for UUID: " + uid);
+
+ message = Util.deserialize((Serializable) Base64.decodeToObject(rs
+ .getString(3)));
+
+ }
+ catch (SQLException e)
+ {
+ throw new MessageStoreException(e);
+ }
+ catch (Exception e)
+ {
+ logger.error(e);
+ throw new MessageStoreException(e);
+ }
+ finally
+ {
+ release();
+ }
+
+ return message;
+
+ }
+
+ /**
+ *
+ * @param uid - key for message to set undelivered flag on
+ * @throws MessageStoreException
+ */
+ public void setUndelivered(URI uid) throws MessageStoreException{
+ String sql = "update message set delivered = 'FALSE' where uuid=?";
+
+ try
+ {
+ conn = mgr.getConnection();
+
+ PreparedStatement ps = conn.prepareStatement(sql);
+ ps.setString(1, uid.toString());
+ ps.execute();
+
+ }
+ catch (Exception e)
+ {
+ logger.error(e);
+ throw new MessageStoreException(e);
+ }
+ finally
+ {
+ release();
+ }
+
+ }
+
+ public void setDelivered(URI uid) throws MessageStoreException{
+ String sql = "update message set delivered = 'TRUE' where uuid=?";
+
+ try
+ {
+ conn = mgr.getConnection();
+
+ PreparedStatement ps = conn.prepareStatement(sql);
+ ps.setString(1, "FALSE");
+ ps.execute();
+
+ }
+ catch (Exception e)
+ {
+ logger.error(e);
+ throw new MessageStoreException(e);
+ }
+ finally
+ {
+ release();
+ }
+
+ }
+
+ /**
+ * This method can be used to retrieve a collection of all the undelivered (delivered=FALSE) from the message-store
+ * You should test for 'null' on the return type to see if any messages exist in the collection
+ * @return Map<URI, Message> - a collection of all the undelivered messages in the message-store
+ * @throws MessageStoreException
+ */
+ public Map<URI, Message> getUndeliveredMessages(String classification) throws MessageStoreException {
+ HashMap<URI, Message> messages = new HashMap<URI, Message>();
+ String sql = "select uuid from message where delivered='FALSE'";
+ if (classification!=null) {
+ sql += " and classification='" + classification + "'";
+ }
+
+ try
+ {
+ conn = mgr.getConnection();
+ Statement stmt;
+ ResultSet rs;
+ stmt = conn.createStatement();
+ rs = stmt.executeQuery(sql);
+
+ while (rs.next()) {
+ URI uid = new URI(rs.getString(1));
+ Message msg = getMessage(uid);
+ messages.put(uid, msg);
+ }
+ rs.close();
+ stmt.close();
+
+ }
+ catch (Exception e)
+ {
+ logger.error(e);
+ throw new MessageStoreException(e);
+ }
+ finally
+ {
+ release();
+ }
+ logger.info("retrieved " + messages.size() + " undelivered messages");
+ return messages;
+
+ }
+
+ /**
+ * This method can be used to retrieve a collection of all from the message-store
+ * You should test for 'null' on the return type to see if any messages exist in the collection
+ * @return Map<URI, Message> - a collection of all the undelivered messages in the message-store
+ * @throws MessageStoreException
+ */
+ public Map<URI, Message> getAllMessages(String classification) throws MessageStoreException {
+ HashMap<URI, Message> messages = new HashMap<URI, Message>();
+ String sql = "select uuid from message";
+ if (classification!=null) {
+ sql += " where classification='" + classification + "'";
+ }
+
+ try
+ {
+ conn = mgr.getConnection();
+ Statement stmt;
+ ResultSet rs;
+ stmt = conn.createStatement();
+ rs = stmt.executeQuery(sql);
+
+ while (rs.next()) {
+ URI uid = new URI(rs.getString(1));
+ Message msg = getMessage(uid);
+ messages.put(uid, msg);
+ }
+ rs.close();
+ stmt.close();
+
+ }
+ catch (Exception e)
+ {
+ logger.error(e);
+ throw new MessageStoreException(e);
+ }
+ finally
+ {
+ release();
+ }
+ logger.info("retrieved " + messages.size() + " undelivered messages");
+ return messages;
+
+ }
+
+ private void release ()
+ {
+
+ if (conn != null)
+ {
+ try
+ {
+ conn.close();
+ }
+ catch (Exception e2)
+ {
+ }
+ }
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStorePlugin.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStorePlugin.java 2007-05-31 16:56:22 UTC (rev 12266)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStorePlugin.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author daniel.brum at jboss.com
- */
-
-package org.jboss.internal.soa.esb.persistence.format.db;
-
-import java.net.URI;
-
-import org.jboss.internal.soa.esb.persistence.format.MessageStorePlugin;
-import org.jboss.soa.esb.services.persistence.MessageStore;
-import org.jboss.soa.esb.services.persistence.MessageStoreType;
-
-/**
- * @author dbrum
- *
- */
-public class DBMessageStorePlugin implements MessageStorePlugin {
-
-
- public MessageStore getMessageStore() {
- return new DBMessageStoreImpl();
- }
-
-
- public URI getType() {
- return MessageStoreType.DATABASE;
- }
-
-}
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr (from rev 12266, labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/persistence/format/jcr)
Deleted: labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRConnectionManager.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/persistence/format/jcr/JCRConnectionManager.java 2007-05-31 16:56:22 UTC (rev 12266)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRConnectionManager.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -1,167 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author derek.adams at sapience360.com
- */
-
-package org.jboss.internal.soa.esb.persistence.format.jcr;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Properties;
-
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.SimpleCredentials;
-import javax.naming.Context;
-import javax.naming.NamingException;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.jackrabbit.core.TransientRepository;
-import org.apache.jackrabbit.core.config.RepositoryConfig;
-import org.jboss.soa.esb.common.Configuration;
-import org.jboss.soa.esb.helpers.NamingContext;
-import org.jboss.system.server.ServerConfig;
-import org.jboss.system.server.ServerConfigLocator;
-
-/**
- * Manages connections to a JSR 170 content repository.
- *
- * @author Derek Adams
- */
-public class JCRConnectionManager {
-
- /** Singleton instance */
- private static JCRConnectionManager instance;
-
- /** Repository instance */
- private Repository repository;
-
- /** Repository session */
- private Session session;
-
- /**
- * Singleton constructor.
- */
- private JCRConnectionManager() {
- }
-
- /**
- * Get the singleton manager instance.
- *
- * @return
- */
- public static JCRConnectionManager getInstance() {
- if (instance == null) {
- instance = new JCRConnectionManager();
- }
- return instance;
- }
-
- /**
- * Initialize the repository.
- *
- * @param config
- * @param home
- * @return
- * @throws RepositoryException
- */
- protected Repository initRepository(File config, File home) throws RepositoryException {
- RepositoryConfig rconfig = RepositoryConfig.create(config.getPath(), home.getPath());
- try {
- return new TransientRepository(rconfig);
- } catch (IOException e) {
- throw new RepositoryException(e);
- }
- }
-
- /**
- * Get the repository instance.
- *
- * @return
- */
- protected Repository getRepository() throws RepositoryException {
- if (repository == null) {
- // If JNDI path specified, load the repository from JNDI.
- if (!StringUtils.isEmpty(Configuration.getJcrStoreJNDIPath())) {
- Properties environment = new Properties();
- environment.setProperty(Context.PROVIDER_URL, Configuration.getJndiServerURL());
- environment.setProperty(Context.INITIAL_CONTEXT_FACTORY,
- Configuration.getJndiServerContextFactory());
- environment.setProperty(Context.URL_PKG_PREFIXES,
- Configuration.getJndiServerPkgPrefix());
- Context context = NamingContext.getServerContext(environment);
- try {
- repository = (Repository) context.lookup(Configuration.getJcrStoreJNDIPath());
- } catch (NamingException e) {
- throw new RepositoryException(e);
- }
- }
- // If no JNDI path is specified, init the repository with default
- // settings based on the respository.xml in the conf directory.
- else {
- try {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- URL url = loader.getResource("repository.xml");
- URI uri = new URI(url.toString());
- File repositoryConfig = new File(uri);
- ServerConfig config = ServerConfigLocator.locate();
- File dataDir = config.getServerDataDir();
- File repositoryFolder = new File(dataDir, "repository");
- repository = initRepository(repositoryConfig, repositoryFolder);
- } catch (URISyntaxException e) {
- throw new RepositoryException(e);
- }
- }
- }
- return repository;
- }
-
- /**
- * Open a session on the repository.
- *
- * @return
- * @throws RepositoryException
- */
- public Session newRepositorySession() throws RepositoryException {
- String username = Configuration.getJcrStoreUsername();
- String password = Configuration.getJcrStorePassword();
- if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {
- throw new RepositoryException(
- "JCR username and password must be specified in configuration.");
- }
- return getRepository().login(new SimpleCredentials(username, password.toCharArray()));
- }
-
- /**
- * Get the existing repository session or create a new one.
- *
- * @return
- * @throws RepositoryException
- */
- public Session getSharedSession() throws RepositoryException {
- if (session == null) {
- session = newRepositorySession();
- }
- return session;
- }
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRConnectionManager.java (from rev 12335, labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/persistence/format/jcr/JCRConnectionManager.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRConnectionManager.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRConnectionManager.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1,167 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author derek.adams at sapience360.com
+ */
+
+package org.jboss.internal.soa.esb.persistence.format.jcr;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Properties;
+
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.jackrabbit.core.TransientRepository;
+import org.apache.jackrabbit.core.config.RepositoryConfig;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.helpers.NamingContext;
+import org.jboss.system.server.ServerConfig;
+import org.jboss.system.server.ServerConfigLocator;
+
+/**
+ * Manages connections to a JSR 170 content repository.
+ *
+ * @author Derek Adams
+ */
+public class JCRConnectionManager {
+
+ /** Singleton instance */
+ private static JCRConnectionManager instance;
+
+ /** Repository instance */
+ private Repository repository;
+
+ /** Repository session */
+ private Session session;
+
+ /**
+ * Singleton constructor.
+ */
+ private JCRConnectionManager() {
+ }
+
+ /**
+ * Get the singleton manager instance.
+ *
+ * @return
+ */
+ public static JCRConnectionManager getInstance() {
+ if (instance == null) {
+ instance = new JCRConnectionManager();
+ }
+ return instance;
+ }
+
+ /**
+ * Initialize the repository.
+ *
+ * @param config
+ * @param home
+ * @return
+ * @throws RepositoryException
+ */
+ protected Repository initRepository(File config, File home) throws RepositoryException {
+ RepositoryConfig rconfig = RepositoryConfig.create(config.getPath(), home.getPath());
+ try {
+ return new TransientRepository(rconfig);
+ } catch (IOException e) {
+ throw new RepositoryException(e);
+ }
+ }
+
+ /**
+ * Get the repository instance.
+ *
+ * @return
+ */
+ protected Repository getRepository() throws RepositoryException {
+ if (repository == null) {
+ // If JNDI path specified, load the repository from JNDI.
+ if (!StringUtils.isEmpty(Configuration.getJcrStoreJNDIPath())) {
+ Properties environment = new Properties();
+ environment.setProperty(Context.PROVIDER_URL, Configuration.getJndiServerURL());
+ environment.setProperty(Context.INITIAL_CONTEXT_FACTORY,
+ Configuration.getJndiServerContextFactory());
+ environment.setProperty(Context.URL_PKG_PREFIXES,
+ Configuration.getJndiServerPkgPrefix());
+ Context context = NamingContext.getServerContext(environment);
+ try {
+ repository = (Repository) context.lookup(Configuration.getJcrStoreJNDIPath());
+ } catch (NamingException e) {
+ throw new RepositoryException(e);
+ }
+ }
+ // If no JNDI path is specified, init the repository with default
+ // settings based on the respository.xml in the conf directory.
+ else {
+ try {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ URL url = loader.getResource("repository.xml");
+ URI uri = new URI(url.toString());
+ File repositoryConfig = new File(uri);
+ ServerConfig config = ServerConfigLocator.locate();
+ File dataDir = config.getServerDataDir();
+ File repositoryFolder = new File(dataDir, "repository");
+ repository = initRepository(repositoryConfig, repositoryFolder);
+ } catch (URISyntaxException e) {
+ throw new RepositoryException(e);
+ }
+ }
+ }
+ return repository;
+ }
+
+ /**
+ * Open a session on the repository.
+ *
+ * @return
+ * @throws RepositoryException
+ */
+ public Session newRepositorySession() throws RepositoryException {
+ String username = Configuration.getJcrStoreUsername();
+ String password = Configuration.getJcrStorePassword();
+ if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {
+ throw new RepositoryException(
+ "JCR username and password must be specified in configuration.");
+ }
+ return getRepository().login(new SimpleCredentials(username, password.toCharArray()));
+ }
+
+ /**
+ * Get the existing repository session or create a new one.
+ *
+ * @return
+ * @throws RepositoryException
+ */
+ public Session getSharedSession() throws RepositoryException {
+ if (session == null) {
+ session = newRepositorySession();
+ }
+ return session;
+ }
+}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRMessageStoreImpl.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/persistence/format/jcr/JCRMessageStoreImpl.java 2007-05-31 16:56:22 UTC (rev 12266)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRMessageStoreImpl.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -1,273 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author derek.adams at sapience360.com
- */
-
-package org.jboss.internal.soa.esb.persistence.format.jcr;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.net.URI;
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.Property;
-import javax.jcr.PropertyIterator;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.Value;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.message.urigen.JcrMessageURIGenerator;
-import org.jboss.soa.esb.common.Configuration;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.message.properties.MessagePropertyFacade;
-import org.jboss.soa.esb.message.urigen.MessageURIGenerator;
-import org.jboss.soa.esb.message.urigen.URIGenerationException;
-import org.jboss.soa.esb.services.persistence.MessageStore;
-import org.jboss.soa.esb.services.persistence.MessageStoreException;
-
-/**
- * Message store that persists messages to a JSR 170 content repository.
- *
- * @author Derek Adams
- */
-public class JCRMessageStoreImpl implements MessageStore {
-
- /** Static logger instance */
- private static Logger LOGGER = Logger.getLogger(JCRMessageStoreImpl.class);
-
- /** Generator for JCR-specific message URIs */
- protected MessageURIGenerator uriGenerator = new JcrMessageURIGenerator();
-
- /** Root node under which JCR messages are stored (lazy-loaded) */
- protected Node messageStoreRootNode;
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.soa.esb.services.persistence.MessageStore#addMessage(org.jboss.soa.esb.message.Message)
- */
- public URI addMessage(Message message, String classification) throws MessageStoreException {
- try {
- Session session = JCRConnectionManager.getInstance().newRepositorySession();
- Node root = getMessageStoreRootNode(session);
- URI uid = saveMessage(root, message);
- session.save();
- return uid;
- } catch (RepositoryException e) {
- throw new MessageStoreException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.soa.esb.services.persistence.MessageStore#getMessage(java.net.URI)
- */
- public Message getMessage(URI uri) throws MessageStoreException {
- try {
- Session session = JCRConnectionManager.getInstance().newRepositorySession();
- Node root = getMessageStoreRootNode(session);
- return loadMessage(root, uri);
- } catch (RepositoryException e) {
- throw new MessageStoreException(e);
- }
- }
-
- /**
- * Save a message to the content repository.
- *
- * @param message
- * @return
- * @throws RepositoryException
- */
- protected URI saveMessage(Node root, Message message) throws RepositoryException {
- try {
- URI messageURI = uriGenerator.generateMessageURI(message);
- MessagePropertyFacade msgProps = new MessagePropertyFacade(message);
- msgProps.setMessageId(messageURI.toString());
- Node messageNode = root.addNode(messageURI.toString());
- Node bodyNode = messageNode.addNode(JCRNodeNames.BODY_NODE_NAME);
- if (message.getBody().getByteArray() != null) {
- ByteArrayInputStream stream = new ByteArrayInputStream(
- message.getBody().getByteArray());
- bodyNode.setProperty(JCRNodeNames.BODY_CONTENT_PROP_NAME, stream);
- }
- for (String propName : message.getProperties().getNames()) {
- Object propObj = message.getProperties().getProperty(propName);
- if (propObj instanceof String) {
- messageNode.setProperty(propName, (String) propObj);
- } else if (propObj instanceof Calendar) {
- messageNode.setProperty(propName, (Calendar) propObj);
- } else if (propObj instanceof Boolean) {
- messageNode.setProperty(propName, (Boolean) propObj);
- } else if (propObj instanceof Long) {
- messageNode.setProperty(propName, (Long) propObj);
- }
- }
- if (LOGGER.isInfoEnabled()) {
- LOGGER.info("Saved node to content repository:");
- dumpNodeToLog(messageNode);
- }
- return messageURI;
- } catch (URIGenerationException e) {
- throw new RepositoryException(e);
- }
- }
-
- /**
- * Load a message from the content repository.
- *
- * @param root
- * @param uri
- * @return
- * @throws RepositoryException
- */
- protected Message loadMessage(Node root, URI uri) throws RepositoryException {
- try {
- Node messageNode = root.getNode(uri.toString());
- Node bodyNode = messageNode.getNode(JCRNodeNames.BODY_NODE_NAME);
- Property bodyContents = bodyNode.getProperty(JCRNodeNames.BODY_CONTENT_PROP_NAME);
- Message message = MessageFactory.getInstance().getMessage();
- if (bodyContents != null) {
- byte[] contentBytes = IOUtils.toByteArray(bodyContents.getStream());
- message.getBody().setByteArray(contentBytes);
- }
- if (LOGGER.isInfoEnabled()) {
- LOGGER.info("Loaded node from content repository:");
- dumpNodeToLog(messageNode);
- }
- return message;
- } catch (IOException e) {
- throw new RepositoryException(e);
- }
- }
-
- /**
- * Dumps the contents of a JCR node to the logger.
- *
- * @param node
- * @throws RepositoryException
- */
- protected void dumpNodeToLog(Node node) throws RepositoryException {
- LOGGER.info(node.getPath());
- if (node.getName().equals("jcr:system")) {
- return;
- }
-
- // Display all node properties.
- PropertyIterator properties = node.getProperties();
- while (properties.hasNext()) {
- Property property = properties.nextProperty();
- if (property.getDefinition().isMultiple()) {
- Value[] values = property.getValues();
- for (int i = 0; i < values.length; i++) {
- LOGGER.info(property.getPath() + " = " + values[i].getString());
- }
- } else {
- LOGGER.info(property.getPath() + " = " + property.getString());
- }
- }
-
- // Recurse into subnodes.
- NodeIterator nodes = node.getNodes();
- while (nodes.hasNext()) {
- dumpNodeToLog(nodes.nextNode());
- }
- }
-
- /**
- * Get the root node under which messages are stored. Create the root path
- * if needed.
- *
- * @param session
- * @return
- * @throws RepositoryException
- */
- protected Node getMessageStoreRootNode(Session session) throws RepositoryException {
- if (messageStoreRootNode == null) {
- if (StringUtils.isEmpty(Configuration.getJcrStoreRootNodePath())) {
- throw new RepositoryException("JCR root node path not specified in configuration.");
- }
- Node current = session.getRootNode();
- String[] nodeNames = Configuration.getJcrStoreRootNodePath().split("/");
- for (String nodeName : nodeNames) {
- try {
- current = current.getNode(nodeName);
- } catch (PathNotFoundException e) {
- current = current.addNode(nodeName);
- }
- }
- session.save();
- messageStoreRootNode = current;
- }
- return messageStoreRootNode;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.soa.esb.services.persistence.MessageStore#getMessageURIGenerator()
- */
- public MessageURIGenerator getMessageURIGenerator() {
- return uriGenerator;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.soa.esb.services.persistence.MessageStore#getUndeliveredMessages()
- */
- public Map<URI, Message> getUndeliveredMessages(String classification) throws MessageStoreException {
- return new HashMap<URI, Message>();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.soa.esb.services.persistence.MessageStore#getUndeliveredMessages()
- */
- public Map<URI, Message> getAllMessages(String classification) throws MessageStoreException {
- return new HashMap<URI, Message>();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.soa.esb.services.persistence.MessageStore#setDelivered(java.net.URI)
- */
- public void setDelivered(URI uid) throws MessageStoreException {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.soa.esb.services.persistence.MessageStore#setUndelivered(java.net.URI)
- */
- public void setUndelivered(URI uid) throws MessageStoreException {
- }
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRMessageStoreImpl.java (from rev 12335, labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/persistence/format/jcr/JCRMessageStoreImpl.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRMessageStoreImpl.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRMessageStoreImpl.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1,273 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author derek.adams at sapience360.com
+ */
+
+package org.jboss.internal.soa.esb.persistence.format.jcr;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.Property;
+import javax.jcr.PropertyIterator;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.Value;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.message.urigen.JcrMessageURIGenerator;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.message.properties.MessagePropertyFacade;
+import org.jboss.soa.esb.message.urigen.MessageURIGenerator;
+import org.jboss.soa.esb.message.urigen.URIGenerationException;
+import org.jboss.soa.esb.services.persistence.MessageStore;
+import org.jboss.soa.esb.services.persistence.MessageStoreException;
+
+/**
+ * Message store that persists messages to a JSR 170 content repository.
+ *
+ * @author Derek Adams
+ */
+public class JCRMessageStoreImpl implements MessageStore {
+
+ /** Static logger instance */
+ private static Logger LOGGER = Logger.getLogger(JCRMessageStoreImpl.class);
+
+ /** Generator for JCR-specific message URIs */
+ protected MessageURIGenerator uriGenerator = new JcrMessageURIGenerator();
+
+ /** Root node under which JCR messages are stored (lazy-loaded) */
+ protected Node messageStoreRootNode;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.services.persistence.MessageStore#addMessage(org.jboss.soa.esb.message.Message)
+ */
+ public URI addMessage(Message message, String classification) throws MessageStoreException {
+ try {
+ Session session = JCRConnectionManager.getInstance().newRepositorySession();
+ Node root = getMessageStoreRootNode(session);
+ URI uid = saveMessage(root, message);
+ session.save();
+ return uid;
+ } catch (RepositoryException e) {
+ throw new MessageStoreException(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.services.persistence.MessageStore#getMessage(java.net.URI)
+ */
+ public Message getMessage(URI uri) throws MessageStoreException {
+ try {
+ Session session = JCRConnectionManager.getInstance().newRepositorySession();
+ Node root = getMessageStoreRootNode(session);
+ return loadMessage(root, uri);
+ } catch (RepositoryException e) {
+ throw new MessageStoreException(e);
+ }
+ }
+
+ /**
+ * Save a message to the content repository.
+ *
+ * @param message
+ * @return
+ * @throws RepositoryException
+ */
+ protected URI saveMessage(Node root, Message message) throws RepositoryException {
+ try {
+ URI messageURI = uriGenerator.generateMessageURI(message);
+ MessagePropertyFacade msgProps = new MessagePropertyFacade(message);
+ msgProps.setMessageId(messageURI.toString());
+ Node messageNode = root.addNode(messageURI.toString());
+ Node bodyNode = messageNode.addNode(JCRNodeNames.BODY_NODE_NAME);
+ if (message.getBody().getByteArray() != null) {
+ ByteArrayInputStream stream = new ByteArrayInputStream(
+ message.getBody().getByteArray());
+ bodyNode.setProperty(JCRNodeNames.BODY_CONTENT_PROP_NAME, stream);
+ }
+ for (String propName : message.getProperties().getNames()) {
+ Object propObj = message.getProperties().getProperty(propName);
+ if (propObj instanceof String) {
+ messageNode.setProperty(propName, (String) propObj);
+ } else if (propObj instanceof Calendar) {
+ messageNode.setProperty(propName, (Calendar) propObj);
+ } else if (propObj instanceof Boolean) {
+ messageNode.setProperty(propName, (Boolean) propObj);
+ } else if (propObj instanceof Long) {
+ messageNode.setProperty(propName, (Long) propObj);
+ }
+ }
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("Saved node to content repository:");
+ dumpNodeToLog(messageNode);
+ }
+ return messageURI;
+ } catch (URIGenerationException e) {
+ throw new RepositoryException(e);
+ }
+ }
+
+ /**
+ * Load a message from the content repository.
+ *
+ * @param root
+ * @param uri
+ * @return
+ * @throws RepositoryException
+ */
+ protected Message loadMessage(Node root, URI uri) throws RepositoryException {
+ try {
+ Node messageNode = root.getNode(uri.toString());
+ Node bodyNode = messageNode.getNode(JCRNodeNames.BODY_NODE_NAME);
+ Property bodyContents = bodyNode.getProperty(JCRNodeNames.BODY_CONTENT_PROP_NAME);
+ Message message = MessageFactory.getInstance().getMessage();
+ if (bodyContents != null) {
+ byte[] contentBytes = IOUtils.toByteArray(bodyContents.getStream());
+ message.getBody().setByteArray(contentBytes);
+ }
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("Loaded node from content repository:");
+ dumpNodeToLog(messageNode);
+ }
+ return message;
+ } catch (IOException e) {
+ throw new RepositoryException(e);
+ }
+ }
+
+ /**
+ * Dumps the contents of a JCR node to the logger.
+ *
+ * @param node
+ * @throws RepositoryException
+ */
+ protected void dumpNodeToLog(Node node) throws RepositoryException {
+ LOGGER.info(node.getPath());
+ if (node.getName().equals("jcr:system")) {
+ return;
+ }
+
+ // Display all node properties.
+ PropertyIterator properties = node.getProperties();
+ while (properties.hasNext()) {
+ Property property = properties.nextProperty();
+ if (property.getDefinition().isMultiple()) {
+ Value[] values = property.getValues();
+ for (int i = 0; i < values.length; i++) {
+ LOGGER.info(property.getPath() + " = " + values[i].getString());
+ }
+ } else {
+ LOGGER.info(property.getPath() + " = " + property.getString());
+ }
+ }
+
+ // Recurse into subnodes.
+ NodeIterator nodes = node.getNodes();
+ while (nodes.hasNext()) {
+ dumpNodeToLog(nodes.nextNode());
+ }
+ }
+
+ /**
+ * Get the root node under which messages are stored. Create the root path
+ * if needed.
+ *
+ * @param session
+ * @return
+ * @throws RepositoryException
+ */
+ protected Node getMessageStoreRootNode(Session session) throws RepositoryException {
+ if (messageStoreRootNode == null) {
+ if (StringUtils.isEmpty(Configuration.getJcrStoreRootNodePath())) {
+ throw new RepositoryException("JCR root node path not specified in configuration.");
+ }
+ Node current = session.getRootNode();
+ String[] nodeNames = Configuration.getJcrStoreRootNodePath().split("/");
+ for (String nodeName : nodeNames) {
+ try {
+ current = current.getNode(nodeName);
+ } catch (PathNotFoundException e) {
+ current = current.addNode(nodeName);
+ }
+ }
+ session.save();
+ messageStoreRootNode = current;
+ }
+ return messageStoreRootNode;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.services.persistence.MessageStore#getMessageURIGenerator()
+ */
+ public MessageURIGenerator getMessageURIGenerator() {
+ return uriGenerator;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.services.persistence.MessageStore#getUndeliveredMessages()
+ */
+ public Map<URI, Message> getUndeliveredMessages(String classification) throws MessageStoreException {
+ return new HashMap<URI, Message>();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.services.persistence.MessageStore#getUndeliveredMessages()
+ */
+ public Map<URI, Message> getAllMessages(String classification) throws MessageStoreException {
+ return new HashMap<URI, Message>();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.services.persistence.MessageStore#setDelivered(java.net.URI)
+ */
+ public void setDelivered(URI uid) throws MessageStoreException {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.services.persistence.MessageStore#setUndelivered(java.net.URI)
+ */
+ public void setUndelivered(URI uid) throws MessageStoreException {
+ }
+}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRMessageStorePlugin.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/persistence/format/jcr/JCRMessageStorePlugin.java 2007-05-31 16:56:22 UTC (rev 12266)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRMessageStorePlugin.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author derek.adams at sapience360.com
- */
-
-package org.jboss.internal.soa.esb.persistence.format.jcr;
-
-import java.net.URI;
-
-import org.jboss.internal.soa.esb.persistence.format.MessageStorePlugin;
-import org.jboss.soa.esb.services.persistence.MessageStore;
-import org.jboss.soa.esb.services.persistence.MessageStoreType;
-
-/**
- * Plugin that returns a message store capable of storing messages in a JCR
- * repository.
- *
- * @author Derek Adams
- */
-public class JCRMessageStorePlugin implements MessageStorePlugin {
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.internal.soa.esb.persistence.format.MessageStorePlugin#getMessageStore()
- */
- public MessageStore getMessageStore() {
- return new JCRMessageStoreImpl();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.internal.soa.esb.persistence.format.MessageStorePlugin#getType()
- */
- public URI getType() {
- return MessageStoreType.JCR;
- }
-}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRNodeNames.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/persistence/format/jcr/JCRNodeNames.java 2007-05-31 16:56:22 UTC (rev 12266)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRNodeNames.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author derek.adams at sapience360.com
- */
-
-package org.jboss.internal.soa.esb.persistence.format.jcr;
-
-/**
- * Constants for JCR message store node names.
- *
- * @author Derek Adams
- */
-public interface JCRNodeNames {
-
- /** Constant for the body node name */
- public static final String BODY_NODE_NAME = "Body";
-
- /** Constant for the body content property name */
- public static final String BODY_CONTENT_PROP_NAME = "Content";
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRNodeNames.java (from rev 12335, labs/jbossesb/trunk/product/core/services/src/org/jboss/internal/soa/esb/persistence/format/jcr/JCRNodeNames.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRNodeNames.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRNodeNames.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author derek.adams at sapience360.com
+ */
+
+package org.jboss.internal.soa.esb.persistence.format.jcr;
+
+/**
+ * Constants for JCR message store node names.
+ *
+ * @author Derek Adams
+ */
+public interface JCRNodeNames {
+
+ /** Constant for the body node name */
+ public static final String BODY_NODE_NAME = "Body";
+
+ /** Constant for the body content property name */
+ public static final String BODY_CONTENT_PROP_NAME = "Content";
+}
\ No newline at end of file
Modified: labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/META-INF/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/META-INF/jboss-esb.xml 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/META-INF/jboss-esb.xml 2007-06-05 17:18:29 UTC (rev 12336)
@@ -30,7 +30,7 @@
<action name="PersistAction"
class="org.jboss.soa.esb.actions.MessagePersister" >
<property name="classfication" value="DLQ"/>
- <property name="message-store-type" value="urn:jboss/esb/persistence/type/DATABASE"/>
+ <property name="message-store-class" value="org.jboss.internal.soa.esb.persistence.format.db.DBMessageStoreImpl"/>
</action>
<action name="notificationAction"
class="org.jboss.soa.esb.actions.Notifier">
Added: labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/jbossesb-service.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/jbossesb-service.xml (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/jbossesb-service.xml 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+ <mbean code="org.jboss.internal.soa.esb.dependencies.DatabaseInitializer"
+ name="jboss.esb:service=MessageStoreDatabaseInitializer">
+ <attribute name="Datasource">java:/JBossESBDS</attribute>
+ <attribute name="ExistsSql">select * from message</attribute>
+ <attribute name="SqlFiles">
+ message-store-sql/hsqldb/create_database.sql
+ </attribute>
+ <depends>jboss.jca:service=DataSourceBinding,name=JBossESBDS</depends>
+ </mbean>
+</server>
\ No newline at end of file
Property changes on: labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/jbossesb-service.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/hsqldb/create_database.sql
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/hsqldb/create_database.sql (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/hsqldb/create_database.sql 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1,10 @@
+
+CREATE TABLE message
+(
+ uuid VARCHAR NOT NULL,
+ type VARCHAR NOT NULL,
+ message VARCHAR NOT NULL,
+ delivered VARCHAR NOT NULL,
+ classification VARCHAR,
+ CONSTRAINT pk_uid PRIMARY KEY (uuid)
+);
Added: labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/hsqldb/drop_database.sql
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/hsqldb/drop_database.sql (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/hsqldb/drop_database.sql 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1 @@
+DROP TABLE message IF EXISTS;
Added: labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/mysql/create_database.sql
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/mysql/create_database.sql (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/mysql/create_database.sql 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1,15 @@
+CREATE DATABASE jbossesb;
+
+GRANT ALL PRIVILEGES ON jbossesb.* TO 'jbossesb' IDENTIFIED BY 'jbossesb';
+
+USE jbossesb;
+
+CREATE TABLE message
+(
+ uuid varchar(128) NOT NULL,
+ type varchar(128) NOT NULL,
+ message text(4000) NOT NULL,
+ delivered varchar(10) NOT NULL,
+ classification varchar(10),
+ PRIMARY KEY (`uuid`)
+);
Added: labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/postgresql/create_database.sql
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/postgresql/create_database.sql (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-sql/postgresql/create_database.sql 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1,19 @@
+-- Database: jbossesb
+
+-- DROP DATABASE jbossesb;
+
+CREATE DATABASE jbossesb
+WITH OWNER = postgres
+ENCODING = 'SQL_ASCII'
+TABLESPACE = pg_default;
+
+
+CREATE TABLE message
+(
+ uuid text NOT NULL,
+ "type" text NOT NULL,
+ message text NOT NULL,
+ delivered text NOT NULL,
+ classification text,
+ CONSTRAINT pk_uid PRIMARY KEY (uuid)
+);
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/actions/MessagePersisterTest.java (from rev 12266, labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/MessagePersisterTest.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/actions/MessagePersisterTest.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/actions/MessagePersisterTest.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1,166 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.esb.persistence.actions;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.Statement;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Map;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.xml.DOMConfigurator;
+import org.jboss.internal.soa.esb.persistence.format.MessageStoreFactory;
+import org.jboss.internal.soa.esb.persistence.manager.ConnectionManager;
+import org.jboss.soa.esb.actions.MessagePersister;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.messagestore.MessageStoreTest;
+import org.jboss.soa.esb.persistence.manager.ConnectionManagerFactory;
+import org.jboss.soa.esb.services.persistence.MessageStore;
+import org.jboss.soa.esb.testutils.HsqldbUtil;
+import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
+import org.jboss.soa.esb.util.ClassUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.mchange.v2.c3p0.util.TestUtils;
+
+/**
+ * Testing the MessagePersister.
+ *
+ * @author <a href="mailto:kurt.stam at redhat.com">Kurt Stam</a>
+ *
+ */
+public class MessagePersisterTest
+{
+ private static Logger logger = Logger.getLogger(MessageStoreTest.class);
+ /**
+ * Testing the MessagePersister.
+ */
+ @Test
+ public void sendMessage()
+ {
+ try
+ {
+ Date now = new Date();
+ String body = "<message>First Message " + now + " </message>";
+ Message msg = MessageFactory.getInstance().getMessage();
+ msg.getBody().setByteArray(body.getBytes());
+
+
+ InputStream inputStream = ClassUtil.getResourceAsStream("MessagePersisterTest.xml", this.getClass());
+ ConfigTree config = ConfigTree.fromInputStream(inputStream);
+
+ MessagePersister persister = new MessagePersister(config);
+ persister.initialise();
+ persister.process(msg);
+
+ //now we can check the messageStore to see if our message made it in there.
+ System.out.println("Reading the messages in the messageStore");
+
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ Map<URI, Message> messages = store.getAllMessages("TEST");
+ messages = store.getAllMessages("TEST");
+ Iterator<Message> iter=messages.values().iterator();
+ while (iter.hasNext()) {
+ Message message=iter.next();
+ String bodyFromStore = new String(message.getBody().getByteArray());
+ System.out.println("Body=" + bodyFromStore);
+ }
+ System.out.println("Getting message for classification TEST:" + messages);
+ assertEquals(1, messages.size());
+
+ //Now check if it is the same message
+ Message message=messages.values().iterator().next();
+ String bodyFromStore = new String(message.getBody().getByteArray());
+ assertEquals(body, bodyFromStore);
+ }
+ catch (Exception re)
+ {
+ re.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(MessagePersisterTest.class);
+ }
+
+ @BeforeClass
+ public static void runBeforeAllTests()
+ {
+ try {
+ File testResourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/test/resources/");
+ System.out.println("Current dir=" + testResourceDir.getCanonicalPath());
+ DOMConfigurator.configure(testResourceDir.getCanonicalPath() + "/log4j.xml");
+ File buildDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/build/");
+ File resourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/main/resources/");
+ System.setProperty("org.jboss.soa.esb.propertyFile", "jbossesb-unittest-properties.xml");
+ if ("org.hsqldb.jdbcDriver".equals(Configuration.getStoreDriver())) {
+ HsqldbUtil.startHsqldb(buildDir + "/hsqltestdb", "jbossesb");
+
+ //Drop what is there now, if exists. We want to start fresh.
+ String sqlCreateCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/hsqldb/create_database.sql"));
+ String sqlDropCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getAbsolutePath() + "/message-store-sql/hsqldb/drop_database.sql"));
+
+ ConnectionManager mgr = ConnectionManagerFactory.getConnectionManager();
+ mgr.init();
+ Connection con = mgr.getConnection();
+ Statement stmnt = con.createStatement();
+ System.out.println("Dropping the schema if exist");
+ stmnt.execute(sqlDropCmd);
+ System.out.println("Creating the message store schema");
+ stmnt.execute(sqlCreateCmd);
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ System.out.println("We should stop testing, since we don't have a db.");
+ assertTrue(false);
+ }
+
+ }
+
+ @AfterClass
+ public static void runAfterAllTests() throws Exception{
+ Thread.sleep(2000);
+ if (Configuration.getStoreDriver().equals("org.hsqldb.jdbcDriver")) {
+ HsqldbUtil.stopHsqldb(Configuration.getStoreUrl(),
+ Configuration.getStoreUser(),Configuration.getStorePwd() );
+ }
+ }
+
+}
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/actions/MessagePersisterTest.xml (from rev 12266, labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/MessagePersisterTest.xml)
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/actions/MessagePersisterTest.xml (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/actions/MessagePersisterTest.xml 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1,6 @@
+<action
+ name="PersistAction"
+ class="org.jboss.soa.esb.actions.MessagePersister"
+ classfication="TEST"
+ message-store-class="org.jboss.internal.soa.esb.persistence.format.db.DBMessageStoreImpl"/>
+
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests (from rev 12266, labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/esb/persistence/tests)
Deleted: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/MessageStoreUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/esb/persistence/tests/MessageStoreUnitTest.java 2007-05-31 16:56:22 UTC (rev 12266)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/MessageStoreUnitTest.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -1,316 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author daniel.brum at jboss.com
- */
-
-package org.jboss.soa.esb.esb.persistence.tests;
-
-/**
- * @author dbrum
- *
- *
- */
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.net.URI;
-import java.sql.Connection;
-import java.sql.Statement;
-import java.util.Map;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.persistence.manager.ConnectionManager;
-import org.jboss.soa.esb.common.Configuration;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.persistence.manager.ConnectionManagerException;
-import org.jboss.soa.esb.persistence.manager.ConnectionManagerFactory;
-import org.jboss.soa.esb.services.persistence.MessageStore;
-import org.jboss.soa.esb.services.persistence.MessageStoreFactory;
-import org.jboss.soa.esb.services.persistence.MessageStoreType;
-import org.jboss.soa.esb.testutils.HsqldbUtil;
-import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class MessageStoreUnitTest
-{
-
- private static Logger log = Logger.getLogger(MessageStoreUnitTest.class);
-
- @Test
- public void testDefaultMessageStore ()
- {
- MessageStore store = MessageStoreFactory.getInstance()
- .getMessageStore();
- assertEquals((store != null), true);
- }
-
- @Test
- public void testURIMessageStore ()
- {
- // only DB supported for now
- MessageStore store1 = MessageStoreFactory.getInstance().getMessageStore(MessageStoreType.DATABASE);
- assertEquals((store1 != null), true);
- }
-
- @Test
- public void testSettingUndeliverable () throws Exception
- {
- //test setting one message to undelivered status
-// add new messages
- Message msg = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
- assertEquals((msg != null), true);
-
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore(MessageStoreType.DATABASE);
- assertEquals((store != null), true);
-
- URI uid = store.addMessage(msg, MessageStore.DEFAULT_CLASSIFICATION);
- store.setUndelivered(uid);
-
- }
-
- @Test
- public void testSettingDeliverable() throws Exception
- {
- //test setting one message to delivered status
-// add new messages
- Message msg = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
- assertEquals((msg != null), true);
-
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore(MessageStoreType.DATABASE);
- assertEquals((store != null), true);
-
- URI uid = store.addMessage(msg,MessageStore.DEFAULT_CLASSIFICATION);
- store.setDelivered(uid);
-
- }
-
- @Test
- public void testManyUndeliveredMessages() throws Exception {
- Message msg1, msg2, msg3, msg4;
- msg1 = MessageFactory.getInstance().getMessage(
- MessageType.JBOSS_XML);
- msg2 = MessageFactory.getInstance().getMessage(
- MessageType.JAVA_SERIALIZED);
- msg3 = MessageFactory.getInstance().getMessage(
- MessageType.JBOSS_XML);
- msg4 = MessageFactory.getInstance().getMessage(
- MessageType.JAVA_SERIALIZED);
-
- assertEquals((msg1 != null), true);
- assertEquals((msg2 != null), true);
- assertEquals((msg3 != null), true);
- assertEquals((msg4 != null), true);
-
-
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore(
- MessageStoreType.DATABASE);
- assertEquals((store != null), true);
-
- URI uid1 = store.addMessage(msg1,MessageStore.DEFAULT_CLASSIFICATION);
- URI uid2 = store.addMessage(msg2,MessageStore.DEFAULT_CLASSIFICATION);
- URI uid3 = store.addMessage(msg3,MessageStore.DEFAULT_CLASSIFICATION);
- URI uid4 = store.addMessage(msg4,MessageStore.DEFAULT_CLASSIFICATION);
-
- store.setUndelivered(uid1);
- store.setUndelivered(uid2);
- store.setUndelivered(uid3);
- store.setUndelivered(uid4);
-
- Map<URI, Message> messages = store.getUndeliveredMessages(MessageStore.DEFAULT_CLASSIFICATION);
- assertEquals((messages != null), true);
-
- }
-
- @Test
- public void testStoreAndRetrieve () throws Exception
- {
- // add new messages
- Message msg1 = MessageFactory.getInstance().getMessage(
- MessageType.JBOSS_XML);
- Message msg2 = MessageFactory.getInstance().getMessage(
- MessageType.JAVA_SERIALIZED);
- assertEquals((msg1 != null), true);
- assertEquals((msg2 != null), true);
-
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore(
- MessageStoreType.DATABASE);
- assertEquals((store != null), true);
-
- // set some properties inside the Message
- msg1.getProperties().setProperty("prop1", "val1");
- msg2.getProperties().setProperty("prop1", "val1");
- msg1.getProperties().setProperty("prop2", "val2");
- msg2.getProperties().setProperty("prop2", "val2");
-
- // set the body inside the Message
- msg1.getBody().setByteArray(("TEST BODY").getBytes());
- msg2.getBody().setByteArray(("TEST BODY").getBytes());
-
- // set some object attachments inside the Message
- msg1.getAttachment().addItem(new String("TEST ATTACHMENT1"));
- msg1.getAttachment().addItem(new String("TEST ATTACHMENT2"));
- msg2.getAttachment().addItem(new String("TEST ATTACHMENT1"));
- msg2.getAttachment().addItem(new String("TEST ATTACHMENT2"));
-
- // keep track of the UID to use in retrieving the Message
- URI uid1 = null;
- uid1 = store.addMessage(msg1, MessageStore.DEFAULT_CLASSIFICATION);
-// System.out.println(uid1);
- assertEquals((uid1 != null), true);
-
- URI uid2 = null;
- uid2 = store.addMessage(msg2,MessageStore.DEFAULT_CLASSIFICATION);
-// System.out.println(uid2);
- assertEquals((uid2 != null), true);
-
- // now retrieve the messages
- try
- {
- Message msgIn1 = store.getMessage(uid1);
- assertEquals((msgIn1 != null), true);
-
- Message msgIn2 = store.getMessage(uid2);
- assertEquals((msgIn2 != null), true);
- }
- catch (Exception e)
- {
- log.error( e );
- }
- }
-
- @Test
- public void testDBConnectionManager ()
- {
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore(
- MessageStoreType.DATABASE);
- assertEquals((store != null), true);
- ConnectionManager mgr=null;
- try {
- mgr = ConnectionManagerFactory.getConnectionManager();
- } catch (ConnectionManagerException e) {
- // TODO Auto-generated catch block
-// e.printStackTrace();
- }
- assertEquals((mgr != null), true);
- }
-
- @BeforeClass
- public static void runBeforeAllTests ()
- {
- TestEnvironmentUtil.setESBPropertiesFileToUse();
- log.debug(Configuration.dump());
- try
- {
- if (Configuration.getStoreDriver().equals("org.hsqldb.jdbcDriver"))
- {
- HsqldbUtil.startHsqldb(
- TestEnvironmentUtil.getUserDir() + "build/hsqltestdb",
- "juddi");
- // Get the registry-schema create scripts
- String database = "hsqldb";
- String sqlDir = TestEnvironmentUtil.getUserDir() + "install/message-store/sql/" + database + "/";
- // Drop what is there now, if exists. We want to start fresh.
- String sqlCreateCmd = MessageStoreUnitTest
- .readTextFile(new File(sqlDir + "create_database.sql"));
- String sqlDropCmd = MessageStoreUnitTest.readTextFile(new File(
- sqlDir + "drop_database.sql"));
-
- try
- {
- Class.forName(Configuration.getStoreDriver());
- }
- catch (Exception e)
- {
- log.error("ERROR: failed to load " + database + " JDBC driver.", e);
- return;
- }
-
- ConnectionManager mgr = ConnectionManagerFactory.getConnectionManager();
- assertEquals((mgr != null), true);
- Connection con = mgr.getConnection();
- Statement stmnt = con.createStatement();
- log.debug("Dropping the schema if exist");
- stmnt.execute(sqlDropCmd);
- log.debug("Creating the message store schema");
- stmnt.execute(sqlCreateCmd);
- }
- }
- catch (Exception e)
- {
- log.error("We should stop testing, since we don't have a db.", e);
- assertTrue(false);
- }
- }
-
- @AfterClass
- public static void runAfterAllTests ()
- {
- try
- {
- if (Configuration.getStoreDriver().equals("org.hsqldb.jdbcDriver"))
- HsqldbUtil.stopHsqldb(Configuration.getStoreUrl(),
- Configuration.getStoreUser(), Configuration
- .getStorePwd());
- }
- catch (Exception e)
- { //
- log.error( e );
- }
- }
-
- /**
- * Read the file into a String.
- *
- * @param file -
- * the file to be read
- * @return String with the content of the file
- * @throws IOException -
- * when we can't read the file
- */
- public static String readTextFile (File file) throws IOException
- {
- StringBuffer sb = new StringBuffer(1024);
- BufferedReader reader = new BufferedReader(new FileReader(file
- .getPath()));
- char[] chars = new char[1];
- while ((reader.read(chars)) > -1)
- {
- sb.append(String.valueOf(chars));
- chars = new char[1];
- }
- reader.close();
- return sb.toString();
- }
-
- public static junit.framework.Test suite ()
- {
- return new JUnit4TestAdapter(MessageStoreUnitTest.class);
- }
-
-}
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/MessageStoreUnitTest.java (from rev 12335, labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/esb/persistence/tests/MessageStoreUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/MessageStoreUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/esb/persistence/tests/MessageStoreUnitTest.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1,300 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author daniel.brum at jboss.com
+ */
+
+package org.jboss.soa.esb.esb.persistence.tests;
+
+/**
+ * @author dbrum
+ *
+ *
+ */
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.Statement;
+import java.util.Map;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.xml.DOMConfigurator;
+import org.jboss.internal.soa.esb.persistence.format.MessageStoreFactory;
+import org.jboss.internal.soa.esb.persistence.manager.ConnectionManager;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.soa.esb.persistence.manager.ConnectionManagerException;
+import org.jboss.soa.esb.persistence.manager.ConnectionManagerFactory;
+import org.jboss.soa.esb.services.persistence.MessageStore;
+import org.jboss.soa.esb.testutils.HsqldbUtil;
+import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.mchange.v2.c3p0.util.TestUtils;
+
+public class MessageStoreUnitTest
+{
+
+ private static Logger log = Logger.getLogger(MessageStoreUnitTest.class);
+
+ @Test
+ public void testDefaultMessageStore ()
+ {
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ assertEquals((store != null), true);
+ }
+
+ @Test
+ public void testURIMessageStore ()
+ {
+ // only DB supported for now
+ MessageStore store1 = MessageStoreFactory.getInstance().getMessageStore();
+ assertEquals((store1 != null), true);
+ }
+
+ @Test
+ public void testSettingUndeliverable () throws Exception
+ {
+ //test setting one message to undelivered status
+// add new messages
+ Message msg = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
+ assertEquals((msg != null), true);
+
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ assertEquals((store != null), true);
+
+ URI uid = store.addMessage(msg, MessageStore.DEFAULT_CLASSIFICATION);
+ store.setUndelivered(uid);
+
+ }
+
+ @Test
+ public void testSettingDeliverable() throws Exception
+ {
+ //test setting one message to delivered status
+// add new messages
+ Message msg = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
+ assertEquals((msg != null), true);
+
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ assertEquals((store != null), true);
+
+ URI uid = store.addMessage(msg,MessageStore.DEFAULT_CLASSIFICATION);
+ store.setDelivered(uid);
+
+ }
+
+ @Test
+ public void testManyUndeliveredMessages() throws Exception {
+ Message msg1, msg2, msg3, msg4;
+ msg1 = MessageFactory.getInstance().getMessage(
+ MessageType.JBOSS_XML);
+ msg2 = MessageFactory.getInstance().getMessage(
+ MessageType.JAVA_SERIALIZED);
+ msg3 = MessageFactory.getInstance().getMessage(
+ MessageType.JBOSS_XML);
+ msg4 = MessageFactory.getInstance().getMessage(
+ MessageType.JAVA_SERIALIZED);
+
+ assertEquals((msg1 != null), true);
+ assertEquals((msg2 != null), true);
+ assertEquals((msg3 != null), true);
+ assertEquals((msg4 != null), true);
+
+
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ assertEquals((store != null), true);
+
+ URI uid1 = store.addMessage(msg1,MessageStore.DEFAULT_CLASSIFICATION);
+ URI uid2 = store.addMessage(msg2,MessageStore.DEFAULT_CLASSIFICATION);
+ URI uid3 = store.addMessage(msg3,MessageStore.DEFAULT_CLASSIFICATION);
+ URI uid4 = store.addMessage(msg4,MessageStore.DEFAULT_CLASSIFICATION);
+
+ store.setUndelivered(uid1);
+ store.setUndelivered(uid2);
+ store.setUndelivered(uid3);
+ store.setUndelivered(uid4);
+
+ Map<URI, Message> messages = store.getUndeliveredMessages(MessageStore.DEFAULT_CLASSIFICATION);
+ assertEquals((messages != null), true);
+
+ }
+
+ @Test
+ public void testStoreAndRetrieve () throws Exception
+ {
+ // add new messages
+ Message msg1 = MessageFactory.getInstance().getMessage(
+ MessageType.JBOSS_XML);
+ Message msg2 = MessageFactory.getInstance().getMessage(
+ MessageType.JAVA_SERIALIZED);
+ assertEquals((msg1 != null), true);
+ assertEquals((msg2 != null), true);
+
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ assertEquals((store != null), true);
+
+ // set some properties inside the Message
+ msg1.getProperties().setProperty("prop1", "val1");
+ msg2.getProperties().setProperty("prop1", "val1");
+ msg1.getProperties().setProperty("prop2", "val2");
+ msg2.getProperties().setProperty("prop2", "val2");
+
+ // set the body inside the Message
+ msg1.getBody().setByteArray(("TEST BODY").getBytes());
+ msg2.getBody().setByteArray(("TEST BODY").getBytes());
+
+ // set some object attachments inside the Message
+ msg1.getAttachment().addItem(new String("TEST ATTACHMENT1"));
+ msg1.getAttachment().addItem(new String("TEST ATTACHMENT2"));
+ msg2.getAttachment().addItem(new String("TEST ATTACHMENT1"));
+ msg2.getAttachment().addItem(new String("TEST ATTACHMENT2"));
+
+ // keep track of the UID to use in retrieving the Message
+ URI uid1 = null;
+ uid1 = store.addMessage(msg1, MessageStore.DEFAULT_CLASSIFICATION);
+// System.out.println(uid1);
+ assertEquals((uid1 != null), true);
+
+ URI uid2 = null;
+ uid2 = store.addMessage(msg2,MessageStore.DEFAULT_CLASSIFICATION);
+// System.out.println(uid2);
+ assertEquals((uid2 != null), true);
+
+ // now retrieve the messages
+ try
+ {
+ Message msgIn1 = store.getMessage(uid1);
+ assertEquals((msgIn1 != null), true);
+
+ Message msgIn2 = store.getMessage(uid2);
+ assertEquals((msgIn2 != null), true);
+ }
+ catch (Exception e)
+ {
+ log.error( e );
+ }
+ }
+
+ @Test
+ public void testDBConnectionManager ()
+ {
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ assertEquals((store != null), true);
+ ConnectionManager mgr=null;
+ try {
+ mgr = ConnectionManagerFactory.getConnectionManager();
+ } catch (ConnectionManagerException e) {
+ // TODO Auto-generated catch block
+// e.printStackTrace();
+ }
+ assertEquals((mgr != null), true);
+ }
+
+ @BeforeClass
+ public static void runBeforeAllTests()
+ {
+ try {
+ File testResourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/test/resources/");
+ System.out.println("Current dir=" + testResourceDir.getCanonicalPath());
+ DOMConfigurator.configure(testResourceDir.getCanonicalPath() + "/log4j.xml");
+ File buildDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/build/");
+ File resourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/main/resources/");
+ System.setProperty("org.jboss.soa.esb.propertyFile", "jbossesb-unittest-properties.xml");
+ if ("org.hsqldb.jdbcDriver".equals(Configuration.getStoreDriver())) {
+ HsqldbUtil.startHsqldb(buildDir + "/hsqltestdb", "jbossesb");
+
+ //Drop what is there now, if exists. We want to start fresh.
+ String sqlCreateCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/hsqldb/create_database.sql"));
+ String sqlDropCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getAbsolutePath() + "/message-store-sql/hsqldb/drop_database.sql"));
+
+ ConnectionManager mgr = ConnectionManagerFactory.getConnectionManager();
+ mgr.init();
+ Connection con = mgr.getConnection();
+ Statement stmnt = con.createStatement();
+ System.out.println("Dropping the schema if exist");
+ stmnt.execute(sqlDropCmd);
+ System.out.println("Creating the message store schema");
+ stmnt.execute(sqlCreateCmd);
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ System.out.println("We should stop testing, since we don't have a db.");
+ assertTrue(false);
+ }
+
+ }
+ @AfterClass
+ public static void runAfterAllTests ()
+ {
+
+ try
+ {
+ if (Configuration.getStoreDriver().equals("org.hsqldb.jdbcDriver"))
+ HsqldbUtil.stopHsqldb(Configuration.getStoreUrl(),
+ Configuration.getStoreUser(), Configuration
+ .getStorePwd());
+ }
+ catch (Exception e)
+ { //
+ log.error( e );
+ }
+ }
+
+ /**
+ * Read the file into a String.
+ *
+ * @param file -
+ * the file to be read
+ * @return String with the content of the file
+ * @throws IOException -
+ * when we can't read the file
+ */
+ public static String readTextFile (File file) throws IOException
+ {
+ StringBuffer sb = new StringBuffer(1024);
+ BufferedReader reader = new BufferedReader(new FileReader(file
+ .getPath()));
+ char[] chars = new char[1];
+ while ((reader.read(chars)) > -1)
+ {
+ sb.append(String.valueOf(chars));
+ chars = new char[1];
+ }
+ reader.close();
+ return sb.toString();
+ }
+
+ public static junit.framework.Test suite ()
+ {
+ return new JUnit4TestAdapter(MessageStoreUnitTest.class);
+ }
+
+}
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore (from rev 12266, labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/messagestore)
Deleted: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreClient.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/messagestore/MessageStoreClient.java 2007-05-31 16:56:22 UTC (rev 12266)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreClient.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -1,109 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author daniel.brum at jboss.com
- */
-
-package org.jboss.soa.esb.messagestore;
-
-import java.net.URI;
-import java.util.Random;
-import java.util.Vector;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.services.persistence.MessageStore;
-import org.jboss.soa.esb.services.persistence.MessageStoreFactory;
-import org.jboss.soa.esb.services.persistence.MessageStoreType;
-
-/**
- * @author dbrum
- *
- */
-public class MessageStoreClient implements Runnable
-{
-
- private static Logger logger = Logger.getLogger(MessageStoreTest.class);
-
- public void run ()
- {
- long startTime = System.currentTimeMillis();
-
- int requestors = 1000; // number of persist calls to make
- Vector<URI> writeList = new Vector<URI>();
-
- // get the database store
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore(
- MessageStoreType.DATABASE);
-
- // messages to persist
- Message msg[] = { MessageFactory.getInstance().getMessage(
- MessageType.JBOSS_XML), MessageFactory.getInstance()
- .getMessage(MessageType.JAVA_SERIALIZED) };
-
- // set some content inside the Messages
- for (int x = 0; x < msg.length; x++)
- {
- msg[x].getBody().setByteArray("TEST BODY".getBytes());
- msg[x].getProperties().setProperty("prop" + x, "val" + x);
- msg[x].getAttachment().addItem(new String("TEST ATTACHMENT"));
- }
-
- // loop through adding the messages
-
- Random rndMsg = new Random();
- for (int x = 0; x <= requestors; x++)
- {
- try
- {
- URI uid = store.addMessage(msg[rndMsg.nextInt(2)], MessageStore.DEFAULT_CLASSIFICATION);
- if (uid != null) writeList.add(uid);
- else
- System.err
- .println("null was found... not adding uid to list...");
- }
- catch (Exception ex)
- {
- logger.error("Adding message failed.", ex);
- }
- }
-
- logger
- .info("total messages persisted to db: " + (writeList.size() - 1));
-
- // loop back reading the messages from the db
- Vector<Message> readList = new Vector<Message>();
- for (int x = 0; x < writeList.size(); x++)
- {
- try
- {
- readList.add(store.getMessage(writeList.get(x)));
- }
- catch (Exception e)
- {
- logger.error(e);
- }
- }
- logger.info("total messages read from db: " + (readList.size() - 1));
- logger.info("time to finish write/read for this client: " + (System
- .currentTimeMillis() - startTime) + " milliseconds.");
-
- }
-}
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreClient.java (from rev 12335, labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/messagestore/MessageStoreClient.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreClient.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreClient.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author daniel.brum at jboss.com
+ */
+
+package org.jboss.soa.esb.messagestore;
+
+import java.net.URI;
+import java.util.Random;
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.persistence.format.MessageStoreFactory;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.soa.esb.services.persistence.MessageStore;
+
+/**
+ * @author dbrum
+ *
+ */
+public class MessageStoreClient implements Runnable
+{
+
+ private static Logger logger = Logger.getLogger(MessageStoreTest.class);
+
+ public void run ()
+ {
+ long startTime = System.currentTimeMillis();
+
+ int requestors = 1000; // number of persist calls to make
+ Vector<URI> writeList = new Vector<URI>();
+
+ // get the database store
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+
+ // messages to persist
+ Message msg[] = { MessageFactory.getInstance().getMessage(
+ MessageType.JBOSS_XML), MessageFactory.getInstance()
+ .getMessage(MessageType.JAVA_SERIALIZED) };
+
+ // set some content inside the Messages
+ for (int x = 0; x < msg.length; x++)
+ {
+ msg[x].getBody().setByteArray("TEST BODY".getBytes());
+ msg[x].getProperties().setProperty("prop" + x, "val" + x);
+ msg[x].getAttachment().addItem(new String("TEST ATTACHMENT"));
+ }
+
+ // loop through adding the messages
+
+ Random rndMsg = new Random();
+ for (int x = 0; x <= requestors; x++)
+ {
+ try
+ {
+ URI uid = store.addMessage(msg[rndMsg.nextInt(2)], MessageStore.DEFAULT_CLASSIFICATION);
+ if (uid != null) writeList.add(uid);
+ else
+ System.err
+ .println("null was found... not adding uid to list...");
+ }
+ catch (Exception ex)
+ {
+ logger.error("Adding message failed.", ex);
+ }
+ }
+
+ logger
+ .info("total messages persisted to db: " + (writeList.size() - 1));
+
+ // loop back reading the messages from the db
+ Vector<Message> readList = new Vector<Message>();
+ for (int x = 0; x < writeList.size(); x++)
+ {
+ try
+ {
+ readList.add(store.getMessage(writeList.get(x)));
+ }
+ catch (Exception e)
+ {
+ logger.error(e);
+ }
+ }
+ logger.info("total messages read from db: " + (readList.size() - 1));
+ logger.info("time to finish write/read for this client: " + (System
+ .currentTimeMillis() - startTime) + " milliseconds.");
+
+ }
+}
Deleted: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/messagestore/MessageStoreTest.java 2007-05-31 16:56:22 UTC (rev 12266)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreTest.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -1,157 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author daniel.brum at jboss.com
- */
-
-package org.jboss.soa.esb.messagestore;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.net.URI;
-import java.sql.Connection;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.xml.DOMConfigurator;
-import org.jboss.internal.soa.esb.persistence.manager.ConnectionManager;
-import org.jboss.soa.esb.common.Configuration;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.message.format.MessageType;
-import org.jboss.soa.esb.persistence.manager.ConnectionManagerFactory;
-import org.jboss.soa.esb.services.persistence.MessageStore;
-import org.jboss.soa.esb.services.persistence.MessageStoreFactory;
-import org.jboss.soa.esb.services.persistence.MessageStoreType;
-import org.jboss.soa.esb.testutils.HsqldbUtil;
-import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * @author dbrum
- *
- */
-public class MessageStoreTest {
- private static Logger logger = Logger.getLogger(MessageStoreTest.class);
-
- @Test
- public void testMultiClientLoad() throws Exception {
- int clients = 5;
- Thread[] xx = new Thread[clients];
- for (int i=0; i<clients; i++) {
- xx[i] = new Thread(new MessageStoreClient());
- }
- for (int i=0; i<clients; i++) {
- xx[i].start();
- }
- //clean up the threads
- for (int i=0; i<clients; i++) {
- xx[i] = null;
- }
- }
-
- @Test
- public void testSingleLoad() throws Exception {
- long startTime=System.currentTimeMillis();
- int requestors = 1000; //number of persist calls to make
- List<URI> uriList = new ArrayList<URI>();
- //get the database store
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore(MessageStoreType.DATABASE);
- //messages to persist
- Message msg[] = { MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML),
- MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED)};
- //set some content inside the Messages
- for (int x=0; x<msg.length; x++) {
- msg[x].getBody().setByteArray("TEST BODY".getBytes());
- msg[x].getProperties().setProperty("prop"+x, "val"+x);
- msg[x].getAttachment().addItem(new String("TEST ATTACHMENT"));
- }
- //loop through adding the messages
- Random rndMsg = new Random();
- for (int x=0; x<=requestors; x++) {
- URI uid = store.addMessage(msg[rndMsg.nextInt(2)], MessageStore.DEFAULT_CLASSIFICATION);
- if (uid == null)
- System.out.println("null returned from addMessage() call to uid");
- else
- uriList.add(uid);
- }
- logger.info("total messages persisted to db: " + (uriList.size()-1));
- //loop back reading the messages from the db
- List<Message> messages = new ArrayList<Message>();
- for (int x=0; x<uriList.size(); x++) {
- messages.add(store.getMessage(uriList.get(x)));
- }
- logger.info("total messages read from db: " + (uriList.size()));
- logger.info("time to finish write/read for this client: " + (System.currentTimeMillis() - startTime) + " milliseconds.");
- }
-
- @BeforeClass
- public static void runBeforeAllTests()
- {
- try {
- DOMConfigurator.configure(TestEnvironmentUtil.getUserDir("product","../product") + "etc/test/resources/log4j.xml");
- TestEnvironmentUtil.setESBPropertiesFileToUse("product","../product");
- if (Configuration.getStoreDriver().equals("org.hsqldb.jdbcDriver")) {
- HsqldbUtil.startHsqldb(TestEnvironmentUtil.getUserDir("product") + "build/hsqltestdb", "juddi");
- //Get the registry-schema create scripts
- String database = "hsqldb";
- logger.info("TestUtil.getPrefixForQA() returns: " + TestEnvironmentUtil.getUserDir("product"));
- String sqlDir = TestEnvironmentUtil.getUserDir("product","../product") + "install/message-store/sql/" + database + "/";
- //Drop what is there now, if exists. We want to start fresh.
- String sqlCreateCmd = TestEnvironmentUtil.readTextFile(new File(sqlDir + "create_database.sql"));
- String sqlDropCmd = TestEnvironmentUtil.readTextFile(new File(sqlDir + "drop_database.sql"));
-
- ConnectionManager mgr = ConnectionManagerFactory.getConnectionManager();
- Connection con = mgr.getConnection();
- Statement stmnt = con.createStatement();
- System.out.println("Dropping the schema if exist");
- stmnt.execute(sqlDropCmd);
- System.out.println("Creating the message store schema");
- stmnt.execute(sqlCreateCmd);
- }
- } catch (Throwable e) {
- e.printStackTrace();
- System.out.println("We should stop testing, since we don't have a db.");
- assertTrue(false);
- }
-
- }
-
- @AfterClass
- public static void runAfterAllTests() throws Exception{
- Thread.sleep(2000);
- if (Configuration.getStoreDriver().equals("org.hsqldb.jdbcDriver")) {
- HsqldbUtil.stopHsqldb(Configuration.getStoreUrl(),
- Configuration.getStoreUser(),Configuration.getStorePwd() );
- }
- }
-
- public static junit.framework.Test suite() {
- return new JUnit4TestAdapter(MessageStoreTest.class);
- }
-
-
-}
Copied: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreTest.java (from rev 12335, labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/messagestore/MessageStoreTest.java)
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreTest.java (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreTest.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1,161 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author daniel.brum at jboss.com
+ */
+
+package org.jboss.soa.esb.messagestore;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.xml.DOMConfigurator;
+import org.jboss.internal.soa.esb.persistence.format.MessageStoreFactory;
+import org.jboss.internal.soa.esb.persistence.manager.ConnectionManager;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.soa.esb.persistence.manager.ConnectionManagerFactory;
+import org.jboss.soa.esb.services.persistence.MessageStore;
+import org.jboss.soa.esb.testutils.HsqldbUtil;
+import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.mchange.v2.c3p0.util.TestUtils;
+
+/**
+ * @author dbrum
+ *
+ */
+public class MessageStoreTest {
+ private static Logger logger = Logger.getLogger(MessageStoreTest.class);
+
+
+ @Test
+ public void testMultiClientLoad() throws Exception {
+ int clients = 5;
+ Thread[] xx = new Thread[clients];
+ for (int i=0; i<clients; i++) {
+ xx[i] = new Thread(new MessageStoreClient());
+ }
+ for (int i=0; i<clients; i++) {
+ xx[i].start();
+ }
+ //clean up the threads
+ for (int i=0; i<clients; i++) {
+ xx[i] = null;
+ }
+ }
+
+ @Test
+ public void testSingleLoad() throws Exception {
+ long startTime=System.currentTimeMillis();
+ int requestors = 1000; //number of persist calls to make
+ List<URI> uriList = new ArrayList<URI>();
+ //get the database store
+ MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
+ //messages to persist
+ Message msg[] = { MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML),
+ MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED)};
+ //set some content inside the Messages
+ for (int x=0; x<msg.length; x++) {
+ msg[x].getBody().setByteArray("TEST BODY".getBytes());
+ msg[x].getProperties().setProperty("prop"+x, "val"+x);
+ msg[x].getAttachment().addItem(new String("TEST ATTACHMENT"));
+ }
+ //loop through adding the messages
+ Random rndMsg = new Random();
+ for (int x=0; x<=requestors; x++) {
+ URI uid = store.addMessage(msg[rndMsg.nextInt(2)], MessageStore.DEFAULT_CLASSIFICATION);
+ if (uid == null)
+ System.out.println("null returned from addMessage() call to uid");
+ else
+ uriList.add(uid);
+ }
+ logger.info("total messages persisted to db: " + (uriList.size()-1));
+ //loop back reading the messages from the db
+ List<Message> messages = new ArrayList<Message>();
+ for (int x=0; x<uriList.size(); x++) {
+ messages.add(store.getMessage(uriList.get(x)));
+ }
+ logger.info("total messages read from db: " + (uriList.size()));
+ logger.info("time to finish write/read for this client: " + (System.currentTimeMillis() - startTime) + " milliseconds.");
+ }
+
+ @BeforeClass
+ public static void runBeforeAllTests()
+ {
+ try {
+ File testResourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/test/resources/");
+ System.out.println("Current dir=" + testResourceDir.getCanonicalPath());
+ DOMConfigurator.configure(testResourceDir.getCanonicalPath() + "/log4j.xml");
+ File buildDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/build/");
+ File resourceDir = TestEnvironmentUtil.findResourceDirectory("./product/services/jbossesb/src/main/resources/");
+ System.setProperty("org.jboss.soa.esb.propertyFile", "jbossesb-unittest-properties.xml");
+ if ("org.hsqldb.jdbcDriver".equals(Configuration.getStoreDriver())) {
+ HsqldbUtil.startHsqldb(buildDir + "/hsqltestdb", "jbossesb");
+
+ //Drop what is there now, if exists. We want to start fresh.
+ String sqlCreateCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getCanonicalPath() + "/message-store-sql/hsqldb/create_database.sql"));
+ String sqlDropCmd = TestEnvironmentUtil.readTextFile(new File(resourceDir.getAbsolutePath() + "/message-store-sql/hsqldb/drop_database.sql"));
+
+ ConnectionManager mgr = ConnectionManagerFactory.getConnectionManager();
+ mgr.init();
+ Connection con = mgr.getConnection();
+ Statement stmnt = con.createStatement();
+ System.out.println("Dropping the schema if exist");
+ stmnt.execute(sqlDropCmd);
+ System.out.println("Creating the message store schema");
+ stmnt.execute(sqlCreateCmd);
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ System.out.println("We should stop testing, since we don't have a db.");
+ assertTrue(false);
+ }
+ }
+
+ @AfterClass
+ public static void runAfterAllTests() throws Exception{
+ Thread.sleep(2000);
+ System.out.println("Stopping");
+ if (Configuration.getStoreDriver().equals("org.hsqldb.jdbcDriver")) {
+ HsqldbUtil.stopHsqldb(Configuration.getStoreUrl(),
+ Configuration.getStoreUser(),Configuration.getStorePwd() );
+ }
+ }
+
+ public static junit.framework.Test suite() {
+ return new JUnit4TestAdapter(MessageStoreTest.class);
+ }
+
+
+}
Added: labs/jbossesb/trunk/product/services/jbossesb/src/test/resources/jbossesb-unittest-properties.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/resources/jbossesb-unittest-properties.xml (rev 0)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/resources/jbossesb-unittest-properties.xml 2007-06-05 17:18:29 UTC (rev 12336)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright 2006, JBoss Inc., and others contributors as indicated
+ by the @authors tag. All rights reserved.
+ See the copyright.txt in the distribution for a
+ full listing of individual contributors.
+ This copyrighted material is made available to anyone wishing to use,
+ modify, copy, or redistribute it subject to the terms and conditions
+ of the GNU Lesser General Public License, v. 2.1.
+ This program is distributed in the hope that it will be useful, but WITHOUT A
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public License,
+ v.2.1 along with this distribution; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ (C) 2005-2006,
+ @author JBoss Inc.
+-->
+<!-- $Id: jbossesb-unittest-properties.xml $ -->
+<!--
+ These options are described in the JBossESB manual.
+ Defaults are provided here for convenience only.
+
+ Please read through this file prior to using the system, and consider
+ updating the specified entries.
+-->
+<esb
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
+ <properties name="core">
+ <property name="org.jboss.soa.esb.jndi.server.context.factory" value="org.jnp.interfaces.NamingContextFactory"/>
+ <property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
+ <property name="org.jboss.soa.esb.persistence.connection.factory" value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
+ </properties>
+ <properties name="registry">
+ <property name="org.jboss.soa.esb.registry.queryManagerURI" value="org.apache.juddi.registry.local.InquiryService#inquire"/>
+ <property name="org.jboss.soa.esb.registry.lifeCycleManagerURI" value="org.apache.juddi.registry.local.PublishService#publish"/>
+ <property name="org.jboss.soa.esb.registry.implementationClass" value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
+ <property name="org.jboss.soa.esb.registry.factoryClass" value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
+ <property name="org.jboss.soa.esb.registry.user" value="jbossesb"/>
+ <property name="org.jboss.soa.esb.registry.password" value="password"/>
+ <!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
+ <property name="org.jboss.soa.esb.scout.proxy.transportClass" value="org.apache.ws.scout.transport.LocalTransport"/>
+ </properties>
+ <properties name="transports" depends="core">
+ <property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
+ <property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
+ <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
+ <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
+ <property name="org.jboss.soa.esb.ftp.localdir" value="/tmp"/>
+ <property name="org.jboss.soa.esb.ftp.remotedir" value="/tmp"/>
+ </properties>
+ <properties name="connection">
+ <property name="min-pool-size" value="5"/>
+ <property name="max-pool=size" value="10"/>
+ <property name="blocking-timeout-millis" value="5000"/>
+ <property name="abandoned-connection-timeout" value="10000"/>
+ <property name="abandoned-connection-time-interval" value="30000"/>
+ </properties>
+ <properties name="dbstore">
+
+ <!-- connection manager type -->
+ <property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.soa.esb.persistence.manager.StandaloneConnectionManager"/>
+ <!-- property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.soa.esb.persistence.manager.J2eeConnectionManager"/ -->
+
+ <!-- this property is only used if using the j2ee connection manager -->
+ <property name="org.jboss.soa.esb.persistence.db.datasource.name" value="java:/JBossesbDS"/>
+
+ <!-- standalone connection pooling settings -->
+ <property name="org.jboss.soa.esb.persistence.db.connection.url" value="jdbc:hsqldb:hsql://localhost:9001/jbossesb"/>
+ <property name="org.jboss.soa.esb.persistence.db.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
+ <property name="org.jboss.soa.esb.persistence.db.user" value="sa"/>
+ <property name="org.jboss.soa.esb.persistence.db.pwd" value=""/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.initial.size" value="2"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.min.size" value="2"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.max.size" value="5"/>
+ <!--table managed by pool to test for valid connections - created by pool automatically -->
+ <property name="org.jboss.soa.esb.persistence.db.pool.test.table" value="pooltest"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis" value="5000"/>
+
+ </properties>
+ <properties name="filters">
+ <property name="org.jboss.soa.esb.courier.filter.1" value="org.jboss.internal.soa.esb.message.metadata.MetaDataFilter"/>
+ </properties>
+</esb>
Property changes on: labs/jbossesb/trunk/product/services/jbossesb/src/test/resources/jbossesb-unittest-properties.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/services/jbossesb/src/test/resources/log4j.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/resources/log4j.xml 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/resources/log4j.xml 2007-06-05 17:18:29 UTC (rev 12336)
@@ -41,17 +41,20 @@
<priority value="ERROR"/>
</category>
<category name="org.jboss">
- <priority value="WARN"/>
+ <priority value="INFO"/>
</category>
<category name="org.jboss.soa.esb">
- <priority value="ERROR"/>
+ <priority value="INFO"/>
</category>
<category name="org.jboss.internal.soa.esb">
- <priority value="ERROR"/>
+ <priority value="INFO"/>
</category>
<category name="org.apache">
<priority value="ERROR"/>
</category>
+ <category name="com">
+ <priority value="ERROR"/>
+ </category>
<category name="org.jboss.soa.esb.services.jbpm">
<priority value="DEBUG"/>
</category>
Deleted: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/MessagePersisterTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/MessagePersisterTest.java 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/MessagePersisterTest.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -1,298 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.actions;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.URI;
-import java.sql.DriverManager;
-import java.sql.Statement;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.xml.DOMConfigurator;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.addressing.MalformedEPRException;
-import org.jboss.soa.esb.common.Configuration;
-import org.jboss.soa.esb.couriers.Courier;
-import org.jboss.soa.esb.couriers.CourierException;
-import org.jboss.soa.esb.couriers.CourierFactory;
-import org.jboss.soa.esb.listeners.StandAloneBootStrapper;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.services.persistence.MessageStore;
-import org.jboss.soa.esb.services.persistence.MessageStoreFactory;
-import org.jboss.soa.esb.services.persistence.MessageStoreType;
-import org.jboss.soa.esb.services.registry.Registry;
-import org.jboss.soa.esb.services.registry.RegistryException;
-import org.jboss.soa.esb.services.registry.RegistryFactory;
-import org.jboss.soa.esb.testutils.FileUtil;
-import org.jboss.soa.esb.testutils.HsqldbUtil;
-import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Testing the MessagePersister.
- *
- * @author <a href="mailto:kurt.stam at redhat.com">Kurt Stam</a>
- *
- */
-public class MessagePersisterTest
-{
- private static Logger logger = Logger.getLogger(MessagePersisterTest.class);
-
- private static StandAloneBootStrapper _boot = null;
-
- private static String mDbDriver;
-
- private static String mDbUrl;
-
- private static String mDbUsername;
-
- private static String mDbPassword;
-
- private static final String SERVICE_CATEGORY_NAME = "Persistance";
-
- private static final String SERVICE_NAME = "persister";
-
- /**
- * Testing the MessagePersister.
- */
- @Test
- public void sendMessage()
- {
- try
- {
- Date now = new Date();
- String body = "<message>First Message " + now + " </message>";
- sendMessage(body);
- //now we can check the messageStore to see if our message made it in there.
- System.out.println("Reading the messages in the messageStore");
- Thread.sleep(1000);
- MessageStore store = MessageStoreFactory.getInstance().getMessageStore(MessageStoreType.DATABASE);
- Map<URI, Message> messages = store.getAllMessages("TEST");
- messages = store.getAllMessages("TEST");
- Iterator<Message> iter=messages.values().iterator();
- while (iter.hasNext()) {
- Message message=iter.next();
- String bodyFromStore = new String(message.getBody().getByteArray());
- System.out.println("Body=" + bodyFromStore);
- }
- System.out.println("Getting message for classification TEST:" + messages);
- assertEquals(1, messages.size());
-
- //Now check if it is the same message
- Message message=messages.values().iterator().next();
- String bodyFromStore = new String(message.getBody().getByteArray());
- assertEquals(body, bodyFromStore);
- }
- catch (Exception re)
- {
- re.printStackTrace();
- assertTrue(false);
- }
- }
-
- /**
- * Sends a message to the CbrJmsQueueListener.
- *
- * @param body -
- * a String containing the body of the message.
- * @throws RegistryException
- * @throws CourierException
- * @throws MalformedEPRException
- */
-
- private static void sendMessage(String body) throws RegistryException, CourierException, MalformedEPRException
- {
- Message msg = MessageFactory.getInstance().getMessage();
- msg.getBody().setByteArray(body.getBytes());
-
- Registry registry = RegistryFactory.getRegistry();
- EPR epr = registry.findEPR(SERVICE_CATEGORY_NAME,
- SERVICE_NAME);
- Courier courier = CourierFactory.getCourier(epr);
- courier.deliver(msg);
- }
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(MessagePersisterTest.class);
- }
-
- @BeforeClass
- public static void runBeforeAllTests()
- {
- System.setProperty("com.arjuna.common.util.propertyservice.verbosePropertyManager", "on");
- try
- {
- DOMConfigurator.configure(TestEnvironmentUtil.getUserDir("product",
- "../product")
- + "etc/test/resources/log4j.xml");
- TestEnvironmentUtil.setESBPropertiesFileToUse("product",
- "../product");
-
- logger.info(Configuration.dump());
-
- logger.info(Configuration.getRegistryImplementationClass());
- // 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-qatest.properties";
- System.setProperty("juddi.propertiesFile", juddiPropertiesFile);
- // Read this properties file to get the db connection string
- Properties props = new Properties();
- InputStream inStream = Class.class
- .getResourceAsStream(juddiPropertiesFile);
- props.load(inStream);
- mDbDriver = props.getProperty("juddi.jdbcDriver");
- mDbUrl = props.getProperty("juddi.jdbcUrl");
- mDbUsername = props.getProperty("juddi.jdbcUsername");
- mDbPassword = props.getProperty("juddi.jdbcPassword");
-
- String database = "not tested yet";
- if ("org.hsqldb.jdbcDriver".equals(mDbDriver))
- {
- database = "hsqldb";
- // Bring up hsql on default port 9001
- HsqldbUtil.startHsqldb(TestEnvironmentUtil.getUserDir(
- "product", "../product")
- + "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 = TestEnvironmentUtil.getUserDir("product",
- "../product")
- + "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"));
- String sqlInsertPubCmd = FileUtil.readTextFile(new File(sqlDir
- + "insert_publishers.sql"));
- //Add the messageStore table
- sqlDir = TestEnvironmentUtil.getUserDir("product","../product") + "install/message-store/sql/" + database + "/";
- String sqlCreateCmd2 = FileUtil.readTextFile(new File(sqlDir
- + "create_database.sql"));
- String sqlDropCmd2 = FileUtil.readTextFile(new File(sqlDir + "drop_database.sql"));
-
- try
- {
- Class.forName(mDbDriver);
- }
- catch (Exception e)
- {
- System.out.println("ERROR: failed to load " + database
- + " JDBC driver.");
- e.printStackTrace();
- return;
- }
- java.sql.Connection con = DriverManager.getConnection(mDbUrl,
- mDbUsername, mDbPassword);
- Statement stmnt = con.createStatement();
- System.out.println("Dropping the schema if exist");
- stmnt.execute(sqlDropCmd);
- stmnt.execute(sqlDropCmd2);
- System.out.println("Creating the juddi-schema");
- stmnt.execute(sqlCreateCmd);
- System.out.println("Adding the jbossesb publisher");
- stmnt.execute(sqlInsertPubCmd);
- System.out.println("Adding the messageStore table");
- stmnt.execute(sqlCreateCmd2);
-
- // Now we can bring up the MessageStore Service
- String deploymentConfigFile = TestEnvironmentUtil.getUserDir("qa")
- + "junit/src/org/jboss/soa/esb/actions/MessagePersisterTest.xml";
- String validationFileName = TestEnvironmentUtil.getUserDir(
- "product", "../product")
- + "etc/schemas/xml/jbossesb-1.0.1.xsd";
- // Make sure this file exists
- File validationFile = new File(validationFileName);
- if (!validationFile.exists())
- {
- System.err.println("Validation file "
- + validationFile.getAbsolutePath() + " does not exist");
- assertTrue(false);
- }
- _boot = new StandAloneBootStrapper(deploymentConfigFile,
- validationFileName);
-
- logger
- .info("Testing to see if we can instantiate and start ListenerManager");
- }
- catch (Throwable e)
- {
- e.printStackTrace();
- System.out
- .println("We should stop testing, since we don't have a db.");
- assertTrue(false);
- }
-
- }
-
- /**
- * Shutdown the database
- *
- * @throws Exception
- */
- @AfterClass
- public static void runAfterAllTests() throws Exception
- {
- Thread.sleep(2000);
- // Increase Sleep for debugging
- _boot.requestEnd();
- // Give the esb time to finish
- Thread.sleep(2000);
- // Cleaning up the generated files
- String listenerConfigFile = TestEnvironmentUtil.getUserDir("qa")
- + "junit/src/org/jboss/soa/esb/actions/jbossesb-listener.xml";
- File listenerFile = new File(listenerConfigFile);
- if (listenerFile.exists())
- listenerFile.delete();
- String gatewayConfigFile = TestEnvironmentUtil.getUserDir("qa")
- + "junit/src/org/jboss/soa/esb/actions/jbossesb-gateway.xml";
- File gatewayFile = new File(gatewayConfigFile);
- if (gatewayFile.exists())
- gatewayFile.delete();
-
- if ("org.hsqldb.jdbcDriver".equals(mDbDriver))
- {
- HsqldbUtil.stopHsqldb(mDbUrl, mDbUsername, mDbPassword);
- }
- }
-
-}
Deleted: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/MessagePersisterTest.xml
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/MessagePersisterTest.xml 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/MessagePersisterTest.xml 2007-06-05 17:18:29 UTC (rev 12336)
@@ -1,41 +0,0 @@
-<?xml version = "1.0" encoding = "UTF-8"?>
-<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd"
-parameterReloadSecs="10">
-
- <providers>
- <jms-provider name="localhost"
- connection-factory="ConnectionFactory"
- jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
- jndi-URL="localhost" >
-
- <jms-bus busid="QueueA">
- <jms-message-filter
- dest-type="QUEUE"
- dest-name="queue/A"
- />
- </jms-bus>
- </jms-provider>
- </providers>
- <services>
- <service
- category="Persistance"
- name="persister"
- description="Stores messages to persist store">
- <listeners>
- <jms-listener name="MessagePersisterListenQueue" busidref="QueueA"
- maxThreads="1">
- </jms-listener>
- </listeners>
- <actions>
- <action name="PersistAction"
- class="org.jboss.soa.esb.actions.MessagePersister" >
- <property name="classfication" value="TEST"/>
- <property name="message-store-type" value="urn:jboss/esb/persistence/type/DATABASE"/>
- </action>
- <action name="print-after" class="org.jboss.soa.esb.actions.SystemPrintln">
- <property name="message" value="message was presisted" />
- </action>
- </actions>
- </service>
- </services>
-</jbossesb>
Deleted: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/DbUtils.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/DbUtils.java 2007-06-05 14:30:08 UTC (rev 12335)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/DbUtils.java 2007-06-05 17:18:29 UTC (rev 12336)
@@ -1,330 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.soa.esb.util;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.Properties;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.common.Configuration;
-
-/**
- * Database Utilitise.
- *
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public abstract class DbUtils
-{
-
- private static Logger logger = Logger.getLogger(DbUtils.class);
-
- public static String dbDriver = Configuration.getDbDriver();
-
- public static String dbUrl = Configuration.getDbUrl();
-
- public static String dbUser = Configuration.getDbUser();
-
- public static String dbPassword = Configuration.getDbPassword();
-
- private static Properties properties = new Properties();
-
-// static
-// {
-// properties.put(ConnectionProperties.DRIVER_CLASSNAME, dbDriver);
-// properties.put(ConnectionProperties.CONNECTION_URL, dbUrl);
-// properties.put(ConnectionProperties.USERNAME, dbUser);
-// properties.put(ConnectionProperties.PASSWORD, dbPassword);
-// }
-
- /**
- * Execute an SQL statement. <p/> Calls
- * {@link Statement#execute(java.lang.String)}. Manages getting and
- * cleaning up of all DB resources needed to execute the SQL.
- *
- * @param sql
- * SQL to Execute.
- * @return The return value from {@link Statement#execute(java.lang.String)}.
- */
- public static boolean execute(String sql)
- {
- DbResources dbResources = null;
-
- try
- {
- dbResources = new DbResources();
- return dbResources.stat.execute(sql);
- } catch (SQLException e)
- {
- TestCaseUtils.logAndFail("SQL execution failed: " + sql, logger, e);
- } finally
- {
- dbResources.close();
- }
-
- return false;
- }
-
- /**
- * Execute an SQL statement. <p/> Calls
- * {@link Statement#executeQuery(java.lang.String)}. Manages getting and
- * cleaning up of all DB resources needed to execute the SQL.
- *
- * @param query
- * SQL to Execute.
- * @return Returns a Proxied {@link ResultSet} object which manages closing
- * of all associated DB resources on the call to
- * {@link ResultSet#close()} to the returned {@link ResultSet}
- * object.
- */
- public static ResultSet executeQuery(String query)
- {
- DbResources dbResources = null;
- ResultSet resultSet = null;
-
- try
- {
- dbResources = new DbResources();
- resultSet = dbResources.stat.executeQuery(query);
-
- // Proxy the calls to the ResultSet object so we can close the
- // DbResources
- // when the call to close the resultset is made.
- return (ResultSet) Proxy.newProxyInstance(ResultSet.class
- .getClassLoader(), new Class[]
- { ResultSet.class }, new ResultSetInvocationHandler(resultSet,
- dbResources));
- } catch (SQLException e)
- {
- // Close the ResultSet and DbResources objects...
- closeResultSet(resultSet);
- dbResources.close();
- TestCaseUtils.logAndFail("SQL execution failed: " + query, logger,
- e);
- }
-
- return null;
- }
-
- /**
- * Execute an SQL statement. <p/> Calls
- * {@link Statement#executeUpdate(java.lang.String)}. Manages getting and
- * cleaning up of all DB resources needed to execute the SQL.
- *
- * @param sql
- * SQL to Execute.
- * @return The return value from
- * {@link Statement#executeUpdate(java.lang.String)}.
- */
- public static int executeUpdate(String sql)
- {
- DbResources dbResources = null;
-
- try
- {
- dbResources = new DbResources();
- return dbResources.stat.executeUpdate(sql);
- } catch (SQLException e)
- {
- // Close the DbResources objects...
- dbResources.close();
- TestCaseUtils.logAndFail("SQL execution failed: " + sql, logger, e);
- }
-
- return 0;
- }
-
- /**
- * Convienience method for closing a DB ResultSet. <p/> Handles Exceptions
- * etc.
- *
- * @param resultSet
- * The ResultSet to close.
- */
- public static void closeResultSet(ResultSet resultSet)
- {
- if (resultSet != null)
- {
- try
- {
- resultSet.close();
- } catch (SQLException e)
- {
- TestCaseUtils.logAndFail("Failed to close resultset.", logger,
- e);
- }
- }
- }
-
- /**
- * Assert that the specified query does not return an empty resultset.
- *
- * @param query
- * The query to execute.
- * @param maxWait
- * The maximum length of time (ms) to wait for the query to
- * return a non-empty resultset.
- */
- public static void assertNonEmptyResultSet(String query, int maxWait)
- {
- long endTime = System.currentTimeMillis() + maxWait;
-
- while (System.currentTimeMillis() < endTime)
- {
- ResultSet resSet = executeQuery(query);
-
- try
- {
- if (resSet.next())
- {
- // There were rows in the resultset...
- return;
- }
- Thread.sleep(500);
- } catch (Exception e)
- {
- TestCaseUtils.logAndFail("Error while executing SQL query ["
- + query + "].", logger, e);
- } finally
- {
- closeResultSet(resSet);
- }
- }
- TestCaseUtils.logAndFail("SQL query [" + query
- + "] failed to return a non-empty resultset. Waited for "
- + maxWait + "ms.", logger, null);
- }
-
- /**
- * ResultSet Proxying InvocationHandler. <p/> This class is used simply to
- * "catch" the close method call on the ResultSet so we can also close the
- * underlying DbResources.
- *
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
- private static class ResultSetInvocationHandler implements
- InvocationHandler
- {
- private ResultSet resultSet;
-
- private DbResources dbResources;
-
- private ResultSetInvocationHandler(ResultSet resultSet,
- DbResources dbResources)
- {
- this.resultSet = resultSet;
- this.dbResources = dbResources;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- if (method.getName().equals("close"))
- {
- try
- {
- // Caught the call to close the resultset - close the
- // associated DbResources too!
- return method.invoke(resultSet, args);
- } catch (Exception e)
- {
- TestCaseUtils.logAndFail(
- "Failed to close database Resultset. Connection Properties: "
- + properties, logger, e);
- } finally
- {
- dbResources.close();
- }
- }
-
- // Call to something other than the "close" method.
- return method.invoke(resultSet, args);
- }
- }
-
- /**
- * Container Object for a "standard" set of DB resources. <p/> Provides
- * convienience methods closing the resources etc.
- *
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
- private static class DbResources
- {
- private Connection con = null;
-
- private Statement stat = null;
-
- private DbResources()
- {
- try
- {
- // Register the driver..
- ClassUtil.forName(dbDriver, getClass());
- // Create the connection...
- con = DriverManager.getConnection(dbUrl, dbUser, dbPassword);
- // Create a regular statement for execution...
- stat = con.createStatement();
- } catch (Exception e)
- {
- TestCaseUtils.logAndFail(
- "Failed to connect to database. Connection Properties: "
- + properties, logger, e);
- }
- }
-
- private void close()
- {
- try
- {
- if (stat != null)
- {
- stat.close();
- }
- } catch (SQLException e)
- {
- TestCaseUtils.logAndFail(
- "Failed to close database Statement. Connection Properties: "
- + properties, logger, e);
- } finally
- {
- if (con != null)
- {
- try
- {
- con.close();
- } catch (SQLException e)
- {
- TestCaseUtils.logAndFail(
- "Failed to close database Connection. Connection Properties: "
- + properties, logger, e);
- }
- }
- }
- }
- }
-}
More information about the jboss-svn-commits
mailing list