[jboss-cvs] JBossAS SVN: r103865 - in trunk/testsuite/src: resources/cluster/drm and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Apr 12 21:55:01 EDT 2010


Author: bstansberry at jboss.com
Date: 2010-04-12 21:55:00 -0400 (Mon, 12 Apr 2010)
New Revision: 103865

Modified:
   trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/DRMTestCase.java
   trunk/testsuite/src/resources/cluster/drm/drm-test-stacks.xml
Log:
Simplify testIsMasterReplica
Don't need to extend JBossClusteredTestCase

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/DRMTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/DRMTestCase.java	2010-04-13 01:33:33 UTC (rev 103864)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/DRMTestCase.java	2010-04-13 01:55:00 UTC (rev 103865)
@@ -44,10 +44,10 @@
 import org.jboss.ha.framework.server.HAPartitionCacheHandlerImpl;
 import org.jboss.ha.framework.server.JChannelFactory;
 import org.jboss.logging.Logger;
-import org.jboss.test.JBossClusteredTestCase;
 import org.jboss.ha.framework.server.ClusterNodeFactory;
 import org.jboss.test.cluster.testutil.TestClusterNodeFactory;
 import org.jboss.test.cluster.hapartition.drm.MockHAPartition;
+import org.jgroups.Channel;
 import org.jgroups.stack.GossipRouter;
 import org.jgroups.stack.IpAddress;
 
@@ -60,8 +60,10 @@
  * @author  <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
  * @version $Revision$
  */
-public class DRMTestCase extends JBossClusteredTestCase
+public class DRMTestCase extends junit.framework.TestCase
 {  
+   private static final Logger log = Logger.getLogger(DRMTestCase.class);
+   
    private static final String SERVICEA = "serviceA";
    private static final String SERVICEB = "serviceB"; 
    
@@ -474,16 +476,25 @@
       }
       
    }
+   
+   static class InjectedChannelClusterPartition extends ClusterPartition
+   {
+      private final Channel inj_channel;
+      
+      InjectedChannelClusterPartition(Channel channel)
+      {
+         this.inj_channel = channel;
+      }
+      
+      protected Channel createChannel()
+      {
+         return inj_channel;
+      }
+   }
 
    private static Object lock = new Object();
    private static int LOOP_COUNT = 30;
    private final ClusterNodeFactory factory = new TestClusterNodeFactory();
-   
-   public static Test suite() throws Exception
-   {
-      Test t1 = getDeploySetup(DRMTestCase.class, "drm-tests.sar");
-      return t1;
-   }
 
    public DRMTestCase(String name)
    {
@@ -529,32 +540,14 @@
          factory1.setNodeName("node1");
          factory1.setExposeChannels(false);
          factory1.setExposeProtocols(false);
+         factory1.setAddMissingSingletonName(false);
          factory1.create();
          factory1.start();
-
-         Configuration cacheConfig1 = new Configuration();
-         cacheConfig1.setMultiplexerStack(stackName);
-         cacheConfig1.setCacheMode("REPL_SYNC");
          
-         DependencyInjectedConfigurationRegistry registry1 = new DependencyInjectedConfigurationRegistry();
-         registry1.registerConfiguration("config1", cacheConfig1);         
-         
-         CacheManager cacheManager1 = new CacheManager(registry1, factory1);
-         cacheManager1.start();
-         
-         HAPartitionCacheHandlerImpl cacheHandler1 = new HAPartitionCacheHandlerImpl();
-         cacheHandler1.setCacheManager(cacheManager1);
-         cacheHandler1.setCacheConfigName("config1");
-         
-         DistributedStateImpl ds1 = new DistributedStateImpl();
-         ds1.setCacheHandler(cacheHandler1);
-         
-         partition1 = new ClusterPartition();
+         partition1 = new InjectedChannelClusterPartition(factory1.createChannel(stackName));
          partition1.setPartitionName(partitionName);
-         partition1.setCacheHandler(cacheHandler1);
          partition1.setStateTransferTimeout(30000);
          partition1.setMethodCallTimeout(60000);
-         partition1.setDistributedStateImpl(ds1);
          partition1.setBindIntoJndi(false);
          
          partition1.create();         
@@ -576,29 +569,10 @@
          factory2.create();
          factory2.start();
          
-         Configuration cacheConfig2 = new Configuration();
-         cacheConfig2.setMultiplexerStack(stackName);
-         cacheConfig2.setCacheMode("REPL_SYNC");
-         
-         DependencyInjectedConfigurationRegistry registry2 = new DependencyInjectedConfigurationRegistry();
-         registry2.registerConfiguration("config2", cacheConfig2);         
-         
-         CacheManager cacheManager2 = new CacheManager(registry2, factory2);
-         cacheManager2.start();
-         
-         HAPartitionCacheHandlerImpl cacheHandler2 = new HAPartitionCacheHandlerImpl();
-         cacheHandler2.setCacheManager(cacheManager2);
-         cacheHandler2.setCacheConfigName("config2");
-         
-         DistributedStateImpl ds2 = new DistributedStateImpl();
-         ds2.setCacheHandler(cacheHandler2);
-         
-         partition2 = new ClusterPartition();
+         partition2 = new InjectedChannelClusterPartition(factory2.createChannel(stackName));
          partition2.setPartitionName(partitionName);
-         partition2.setCacheHandler(cacheHandler2);
          partition2.setStateTransferTimeout(30000);
          partition2.setMethodCallTimeout(60000);
-         partition2.setDistributedStateImpl(ds2);
          partition2.setBindIntoJndi(false);
          
          partition2.create();         
@@ -1196,7 +1170,7 @@
          }
          
          // Let the asynchronous notification thread catch up
-         sleep(25);
+         Thread.sleep(25);
          
          // Confirm all lists presented to the listener were properly ordered
          assertTrue("Listener saw no misordered lists", listener.clean);
@@ -1274,7 +1248,7 @@
          }
          
          // Let the asynchronous notification thread catch up
-         sleep(25);
+         Thread.sleep(25);
          
          // Confirm all lists presented to the listener were properly ordered
          assertTrue("Listener saw no misordered lists", listener.clean);

Modified: trunk/testsuite/src/resources/cluster/drm/drm-test-stacks.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/drm/drm-test-stacks.xml	2010-04-13 01:33:33 UTC (rev 103864)
+++ trunk/testsuite/src/resources/cluster/drm/drm-test-stacks.xml	2010-04-13 01:55:00 UTC (rev 103865)
@@ -7,7 +7,7 @@
     <stack name="tunnel1"
            description="Used with a GossipRouter">
         <config>
-            <TUNNEL singleton_name="tunnel1" router_port="12001" router_host="127.0.0.1"/>
+            <TUNNEL router_port="12001" router_host="127.0.0.1"/>
             <PING timeout="2000"
                   num_initial_members="3"
                   gossip_refresh="10000"
@@ -37,7 +37,7 @@
     <stack name="tunnel2"
            description="Used with a GossipRouter">
         <config>
-            <TUNNEL singleton_name="tunnel2" router_port="12001" router_host="127.0.0.1"/>
+            <TUNNEL router_port="12001" router_host="127.0.0.1"/>
             <PING timeout="2000"
                   num_initial_members="3"
                   gossip_refresh="10000"




More information about the jboss-cvs-commits mailing list