[hornetq-commits] JBoss hornetq SVN: r8131 - trunk/tests/src/org/hornetq/tests/integration/replication.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Oct 20 11:54:03 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-10-20 11:54:02 -0400 (Tue, 20 Oct 2009)
New Revision: 8131

Modified:
   trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java
Log:
Fixing the test

Modified: trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java	2009-10-20 12:43:46 UTC (rev 8130)
+++ trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java	2009-10-20 15:54:02 UTC (rev 8131)
@@ -270,32 +270,19 @@
       Configuration config = createDefaultConfig(false);
 
       config.setBackup(true);
-      
-      final AtomicBoolean returnIntercept = new AtomicBoolean(true);
 
-      final Interceptor intercept = new Interceptor()
-      {
-
-         public boolean intercept(Packet packet, RemotingConnection connection) throws HornetQException
-         {
-            if (returnIntercept.get())
-            {
-               System.out.println("Returning true");
-            }
-            return returnIntercept.get();
-         }
-
-      };
-
+      ArrayList<String> intercepts = new ArrayList<String>();
+      
+      intercepts.add(TestInterceptor.class.getName());
+      
+      config.setInterceptorClassNames(intercepts);
+      
       HornetQServer server = new HornetQServerImpl(config);
 
       server.start();
 
-      final ArrayList<Interceptor> listInterceptor = new ArrayList<Interceptor>();
-      listInterceptor.add(intercept);
+      FailoverManager failoverManager = createFailoverManager();
 
-      FailoverManager failoverManager = createFailoverManager(listInterceptor);
-
       try
       {
          ReplicationManagerImpl manager = new ReplicationManagerImpl(failoverManager, executor);
@@ -304,7 +291,7 @@
          Journal replicatedJournal = new ReplicatedJournal((byte)1, new FakeJournal(), manager);
 
          Thread.sleep(100);
-         returnIntercept.set(false);
+         TestInterceptor.value.set(false);
 
          for (int i = 0; i < 500; i++)
          {
@@ -507,7 +494,18 @@
    // Private -------------------------------------------------------
 
    // Inner classes -------------------------------------------------
+   public static class TestInterceptor implements Interceptor
+   {
+      static AtomicBoolean value = new AtomicBoolean(true);
 
+      public boolean intercept(Packet packet, RemotingConnection connection) throws HornetQException
+      {
+         return value.get();
+      }
+
+   };
+
+
    static class FakeJournal implements Journal
    {
 



More information about the hornetq-commits mailing list