[jboss-cvs] JBoss Messaging SVN: r2234 - trunk/tests/src/org/jboss/test/messaging/tools/jmx.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Feb 9 06:27:27 EST 2007
Author: timfox
Date: 2007-02-09 06:27:27 -0500 (Fri, 09 Feb 2007)
New Revision: 2234
Modified:
trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
Log:
Fix the drop tables
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java 2007-02-09 11:25:39 UTC (rev 2233)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java 2007-02-09 11:27:27 UTC (rev 2234)
@@ -1398,97 +1398,147 @@
protected void dropAllTables() throws Exception
{
- try
- {
- log.info("DROPPING ALL TABLES FROM DATABASE!");
+ log.info("DROPPING ALL TABLES FROM DATABASE!");
- InitialContext ctx = new InitialContext();
+ InitialContext ctx = new InitialContext();
- TransactionManager mgr = (TransactionManager)ctx.lookup(TransactionManagerService.JNDI_NAME);
- DataSource ds = (DataSource)ctx.lookup("java:/DefaultDS");
+ TransactionManager mgr = (TransactionManager)ctx.lookup(TransactionManagerService.JNDI_NAME);
+ DataSource ds = (DataSource)ctx.lookup("java:/DefaultDS");
- javax.transaction.Transaction txOld = mgr.suspend();
- mgr.begin();
+ javax.transaction.Transaction txOld = mgr.suspend();
+ mgr.begin();
- Connection conn = ds.getConnection();
+ Connection conn = ds.getConnection();
+
+ String sql = null;
+
+ PreparedStatement ps = null;
- String sql = "DROP TABLE JBM_POSTOFFICE";
- PreparedStatement ps = conn.prepareStatement(sql);
-
+ try
+ {
+ sql = "DROP TABLE JBM_POSTOFFICE";
+
+ ps = conn.prepareStatement(sql);
+
ps.executeUpdate();
-
+
log.debug("JBM_POSTOFFICE: dropped ");
-
+
ps.close();
+ }
+ catch (SQLException e)
+ {
+ log.error("Failed to drop table", e);
+ }
+ try
+ {
sql = "DROP TABLE JBM_MSG_REF";
+
ps = conn.prepareStatement(sql);
-
+
ps.executeUpdate();
-
+
log.debug("JBM_MSG_REF: dropped ");
-
+
ps.close();
+ }
+ catch (SQLException e)
+ {
+ log.error("Failed to drop table", e);
+ }
+ try
+ {
sql = "DROP TABLE JBM_MSG";
ps = conn.prepareStatement(sql);
-
+
ps.executeUpdate();
-
+
log.debug("JBM_MSG: dropped ");
-
+
ps.close();
+ }
+ catch (SQLException e)
+ {
+ log.error("Failed to drop table", e);
+ }
+ try
+ {
sql = "DROP TABLE JBM_TX";
ps = conn.prepareStatement(sql);
-
+
ps.executeUpdate();
-
+
log.debug("JBM_TX: dropped ");
-
+
ps.close();
+ }
+ catch (SQLException e)
+ {
+ log.error("Failed to drop table", e);
+ }
+ try
+ {
sql = "DROP TABLE JBM_COUNTER";
ps = conn.prepareStatement(sql);
-
+
ps.executeUpdate();
-
+
log.debug("JBM_COUNTER: dropped ");
-
+
ps.close();
+ }
+ catch (SQLException e)
+ {
+ log.error("Failed to drop table", e);
+ }
+ try
+ {
sql = "DROP TABLE JBM_USER";
ps = conn.prepareStatement(sql);
-
+
ps.executeUpdate();
-
+
log.debug("JBM_USER: dropped ");
-
+ ps.close();
+ }
+ catch (SQLException e)
+ {
+ log.error("Failed to drop table", e);
+ }
+
+ try
+ {
sql = "DROP TABLE JBM_ROLE";
ps = conn.prepareStatement(sql);
-
+
ps.executeUpdate();
-
+
log.debug("JBM_ROLE: dropped ");
-
+
ps.close();
- conn.close();
+ }
+ catch (SQLException e)
+ {
+ log.error("Failed to drop table", e);
+ }
+
+ conn.close();
- mgr.commit();
+ mgr.commit();
- log.debug("committed");
+ log.debug("committed");
- if (txOld != null)
- {
- mgr.resume(txOld);
- }
-
- log.debug("done with the database");
- }
- catch (SQLException e)
+ if (txOld != null)
{
- // Ignore - tables might not exist
+ mgr.resume(txOld);
}
+
+ log.debug("done with the database");
}
private void startMultiplexer() throws Exception
More information about the jboss-cvs-commits
mailing list