[hornetq-commits] JBoss hornetq SVN: r10981 - in branches/HORNETQ-720_Replication/tests: unit-tests/src/test/java/org/hornetq/tests/util and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jul 13 11:36:01 EDT 2011


Author: borges
Date: 2011-07-13 11:36:01 -0400 (Wed, 13 Jul 2011)
New Revision: 10981

Modified:
   branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/util/NonSerializableFactory.java
   branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/util/ServiceTestBase.java
Log:
Reduce visibility.

Modified: branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/util/NonSerializableFactory.java
===================================================================
--- branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/util/NonSerializableFactory.java	2011-07-13 15:35:14 UTC (rev 10980)
+++ branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/util/NonSerializableFactory.java	2011-07-13 15:36:01 UTC (rev 10981)
@@ -32,11 +32,12 @@
  * used by the default context when running in embedded local configuration
  * @author <a href="ataylor at redhat.com">Andy Taylor</a>
  */
-public class NonSerializableFactory implements ObjectFactory
+public final class NonSerializableFactory implements ObjectFactory
 {
 
-   public NonSerializableFactory()
+   private NonSerializableFactory()
    {
+      // Utility
    }
 
    public static void unbind(final Context ctx, final String strName) throws NamingException

Modified: branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/util/ServiceTestBase.java
===================================================================
--- branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/util/ServiceTestBase.java	2011-07-13 15:35:14 UTC (rev 10980)
+++ branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/util/ServiceTestBase.java	2011-07-13 15:36:01 UTC (rev 10981)
@@ -38,6 +38,7 @@
 import org.hornetq.core.remoting.impl.invm.InVMRegistry;
 import org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory;
 import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
+import org.hornetq.core.server.HornetQComponent;
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.core.server.HornetQServers;
 import org.hornetq.core.server.NodeManager;
@@ -96,6 +97,35 @@
       }
    }
 
+   protected final static void waitForComponent(final HornetQComponent component, final long seconds) throws Exception
+   {
+      long time = System.currentTimeMillis();
+      long toWait = seconds * 1000;
+      while (!component.isStarted())
+      {
+         try
+         {
+            Thread.sleep(50);
+         }
+         catch (InterruptedException e)
+         {
+            // ignore
+         }
+         if (System.currentTimeMillis() > (time + toWait))
+         {
+            fail("component did not start within timeout of " + seconds);
+         }
+      }
+   }
+
+   protected final void stopComponent(HornetQComponent component) throws Exception
+   {
+      if (component == null)
+         return;
+      if (component.isStarted())
+         component.stop();
+   }
+
    protected static Map<String, Object> generateParams(final int node, final boolean netty)
    {
       Map<String, Object> params = new HashMap<String, Object>();



More information about the hornetq-commits mailing list