[jboss-cvs] JBossAS SVN: r61080 - in trunk/ejb3/src/test/org/jboss/ejb3/test: clusteredentity/unit and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 5 09:41:38 EST 2007


Author: wolfc
Date: 2007-03-05 09:41:38 -0500 (Mon, 05 Mar 2007)
New Revision: 61080

Added:
   trunk/ejb3/src/test/org/jboss/ejb3/test/common/
   trunk/ejb3/src/test/org/jboss/ejb3/test/common/unit/
   trunk/ejb3/src/test/org/jboss/ejb3/test/common/unit/DBSetup.java
Removed:
   trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/DBSetup.java
Modified:
   trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EmbeddedIdClassloaderTestCase.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryRedeployUnitTestCase.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryUnitTestCase.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/unit/ExtendedPersistenceUnitTestCase.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/unit/ScopedExtendedPersistenceUnitTestCase.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/ExtendedPersistenceUnitTestCase.java
Log:
Moved DBSetup to common

Deleted: trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/DBSetup.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/DBSetup.java	2007-03-05 13:02:25 UTC (rev 61079)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/DBSetup.java	2007-03-05 14:41:38 UTC (rev 61080)
@@ -1,154 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.ejb3.test.clusteredentity.unit;
-
-import java.sql.DriverManager;
-import java.sql.Connection;
-import java.sql.Statement;
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Method;
-
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-
-/** A TestSetup that starts hypersonic before the testcase with a tcp
- * listening port at 1701.
- * 
- * @author Scott.Stark at jboss.org
- * @version $Revison:$
- */
-public class DBSetup extends TestSetup
-{
-   public DBSetup(Test test)
-   {
-      super(test);
-   }
-
-   protected void setUp() throws Exception
-   {
-         File hypersoniDir = new File("output/hypersonic");
-         if (!hypersoniDir.exists())
-         {
-            hypersoniDir.mkdirs();
-         }
-
-         if (!hypersoniDir.isDirectory())
-         {
-            throw new IOException("Failed to create directory: " + hypersoniDir);
-         }
-      
-         File dbPath = new File(hypersoniDir, "clusteredentity-db");
-
-         // Start DB in new thread, or else it will block us
-         DBThread serverThread = new DBThread(dbPath);
-         serverThread.start();
-         
-         int elapsed = 0;
-         while (!serverThread.isStarted() && elapsed < 15000)
-         {
-            try 
-            {
-               Thread.sleep(100);
-               elapsed += 100;
-            }
-            catch (InterruptedException ie)
-            {
-               System.out.println("Interrupted while waiting for Hypersonic");
-            }
-         }
-         
-         if (!serverThread.isStarted())
-            System.out.println("Hypersonic failed to start in a timely fashion");
-   }
-
-   protected void tearDown() throws Exception
-   {
-      Class.forName("org.hsqldb.jdbcDriver");
-      String dbURL = "jdbc:hsqldb:hsql://" + System.getProperty("jbosstest.server.host", "localhost") + ":1701";
-      Connection conn = DriverManager.getConnection(dbURL, "sa", "");
-      Statement statement = conn.createStatement();      
-      statement.executeQuery("SHUTDOWN COMPACT");
-      
-   }
-
-   public static void main(String[] args) throws Exception
-   {
-      DBSetup setup = new DBSetup(null);
-      setup.setUp();
-      Thread.sleep(120*1000);
-      setup.tearDown();
-   }
-   
-   class DBThread extends Thread
-   {
-      boolean started;
-      File dbPath;
-      
-      DBThread(File dbPath)
-      {
-         super("hypersonic");
-         this.dbPath = dbPath;
-      }
-      
-      boolean isStarted()
-      {
-         return started;
-      }
-      
-      public void run()
-      {
-         try
-         {
-            // Create startup arguments
-            String[] args = {
-                  "-database",
-                  dbPath.toString(),
-                  "-port",
-                  String.valueOf(1701),
-                  "-silent",
-                  "false",
-                  "-trace",
-                  "false",
-                  "-no_system_exit",
-                  "true",
-             };
-            System.out.println("Starting hsqldb");
-            // HACK Do this by reflection for now until we determine how 
-            // we want to handle this in EJB3
-            Class clazz = Thread.currentThread().getContextClassLoader().loadClass("org.hsqldb.Server");
-            Method main = clazz.getDeclaredMethod("main", new Class[] { String[].class });
-            main.invoke(null, new Object[] { args });
-//            org.hsqldb.Server.main(args);
-            System.out.println("Done");
-         }
-         catch (Exception e)
-         {
-            e.printStackTrace();
-         }
-         finally
-         {
-            started = true;
-         }
-      }
-   }
-}

Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EmbeddedIdClassloaderTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EmbeddedIdClassloaderTestCase.java	2007-03-05 13:02:25 UTC (rev 61079)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EmbeddedIdClassloaderTestCase.java	2007-03-05 14:41:38 UTC (rev 61080)
@@ -31,6 +31,7 @@
 import org.jboss.ejb3.test.clusteredentity.classloader.EntityQueryTest;
 import org.jboss.ejb3.test.clusteredentity.embeddedid.MusicianPK;
 import org.jboss.ejb3.test.clusteredentity.embeddedid.EmbeddedIdTest;
+import org.jboss.ejb3.test.common.unit.DBSetup;
 import org.jboss.test.JBossClusteredTestCase;
 import junit.framework.Test;
 import junit.framework.TestSuite;

Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryRedeployUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryRedeployUnitTestCase.java	2007-03-05 13:02:25 UTC (rev 61079)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryRedeployUnitTestCase.java	2007-03-05 14:41:38 UTC (rev 61080)
@@ -28,6 +28,7 @@
 import org.jboss.ejb3.test.clusteredentity.classloader.Account;
 import org.jboss.ejb3.test.clusteredentity.classloader.AccountHolderPK;
 import org.jboss.ejb3.test.clusteredentity.classloader.EntityQueryTest;
+import org.jboss.ejb3.test.common.unit.DBSetup;
 import org.jboss.jmx.adaptor.rmi.RMIAdaptor;
 
 import junit.framework.Test;

Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryUnitTestCase.java	2007-03-05 13:02:25 UTC (rev 61079)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryUnitTestCase.java	2007-03-05 14:41:38 UTC (rev 61080)
@@ -28,6 +28,7 @@
 import org.jboss.ejb3.test.clusteredentity.classloader.Account;
 import org.jboss.ejb3.test.clusteredentity.classloader.AccountHolderPK;
 import org.jboss.ejb3.test.clusteredentity.classloader.EntityQueryTest;
+import org.jboss.ejb3.test.common.unit.DBSetup;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;

Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/unit/ExtendedPersistenceUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/unit/ExtendedPersistenceUnitTestCase.java	2007-03-05 13:02:25 UTC (rev 61079)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/unit/ExtendedPersistenceUnitTestCase.java	2007-03-05 14:41:38 UTC (rev 61080)
@@ -31,7 +31,7 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.jboss.ejb3.test.clusteredentity.unit.DBSetup;
+import org.jboss.ejb3.test.common.unit.DBSetup;
 import org.jboss.ejb3.test.stateful.nested.base.xpc.Customer;
 import org.jboss.ejb3.test.stateful.nested.base.xpc.NestedXPCMonitor;
 import org.jboss.ejb3.test.stateful.nested.base.xpc.ShoppingCart;

Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/unit/ScopedExtendedPersistenceUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/unit/ScopedExtendedPersistenceUnitTestCase.java	2007-03-05 13:02:25 UTC (rev 61079)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/unit/ScopedExtendedPersistenceUnitTestCase.java	2007-03-05 14:41:38 UTC (rev 61080)
@@ -24,7 +24,7 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.jboss.ejb3.test.clusteredentity.unit.DBSetup;
+import org.jboss.ejb3.test.common.unit.DBSetup;
 
 /**
  * Tests for extended persistence under clustering with a scoped classloader.

Copied: trunk/ejb3/src/test/org/jboss/ejb3/test/common/unit/DBSetup.java (from rev 61079, trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/DBSetup.java)
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/common/unit/DBSetup.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/common/unit/DBSetup.java	2007-03-05 14:41:38 UTC (rev 61080)
@@ -0,0 +1,154 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.ejb3.test.common.unit;
+
+import java.sql.DriverManager;
+import java.sql.Connection;
+import java.sql.Statement;
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Method;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+/** A TestSetup that starts hypersonic before the testcase with a tcp
+ * listening port at 1701.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revison:$
+ */
+public class DBSetup extends TestSetup
+{
+   public DBSetup(Test test)
+   {
+      super(test);
+   }
+
+   protected void setUp() throws Exception
+   {
+         File hypersoniDir = new File("output/hypersonic");
+         if (!hypersoniDir.exists())
+         {
+            hypersoniDir.mkdirs();
+         }
+
+         if (!hypersoniDir.isDirectory())
+         {
+            throw new IOException("Failed to create directory: " + hypersoniDir);
+         }
+      
+         File dbPath = new File(hypersoniDir, "clusteredentity-db");
+
+         // Start DB in new thread, or else it will block us
+         DBThread serverThread = new DBThread(dbPath);
+         serverThread.start();
+         
+         int elapsed = 0;
+         while (!serverThread.isStarted() && elapsed < 15000)
+         {
+            try 
+            {
+               Thread.sleep(100);
+               elapsed += 100;
+            }
+            catch (InterruptedException ie)
+            {
+               System.out.println("Interrupted while waiting for Hypersonic");
+            }
+         }
+         
+         if (!serverThread.isStarted())
+            System.out.println("Hypersonic failed to start in a timely fashion");
+   }
+
+   protected void tearDown() throws Exception
+   {
+      Class.forName("org.hsqldb.jdbcDriver");
+      String dbURL = "jdbc:hsqldb:hsql://" + System.getProperty("jbosstest.server.host", "localhost") + ":1701";
+      Connection conn = DriverManager.getConnection(dbURL, "sa", "");
+      Statement statement = conn.createStatement();      
+      statement.executeQuery("SHUTDOWN COMPACT");
+      
+   }
+
+   public static void main(String[] args) throws Exception
+   {
+      DBSetup setup = new DBSetup(null);
+      setup.setUp();
+      Thread.sleep(120*1000);
+      setup.tearDown();
+   }
+   
+   class DBThread extends Thread
+   {
+      boolean started;
+      File dbPath;
+      
+      DBThread(File dbPath)
+      {
+         super("hypersonic");
+         this.dbPath = dbPath;
+      }
+      
+      boolean isStarted()
+      {
+         return started;
+      }
+      
+      public void run()
+      {
+         try
+         {
+            // Create startup arguments
+            String[] args = {
+                  "-database",
+                  dbPath.toString(),
+                  "-port",
+                  String.valueOf(1701),
+                  "-silent",
+                  "false",
+                  "-trace",
+                  "false",
+                  "-no_system_exit",
+                  "true",
+             };
+            System.out.println("Starting hsqldb");
+            // HACK Do this by reflection for now until we determine how 
+            // we want to handle this in EJB3
+            Class clazz = Thread.currentThread().getContextClassLoader().loadClass("org.hsqldb.Server");
+            Method main = clazz.getDeclaredMethod("main", new Class[] { String[].class });
+            main.invoke(null, new Object[] { args });
+//            org.hsqldb.Server.main(args);
+            System.out.println("Done");
+         }
+         catch (Exception e)
+         {
+            e.printStackTrace();
+         }
+         finally
+         {
+            started = true;
+         }
+      }
+   }
+}

Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/ExtendedPersistenceUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/ExtendedPersistenceUnitTestCase.java	2007-03-05 13:02:25 UTC (rev 61079)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/ExtendedPersistenceUnitTestCase.java	2007-03-05 14:41:38 UTC (rev 61080)
@@ -24,7 +24,7 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.jboss.ejb3.test.clusteredentity.unit.DBSetup;
+import org.jboss.ejb3.test.common.unit.DBSetup;
 import org.jboss.test.JBossTestCase;
 
 /**




More information about the jboss-cvs-commits mailing list