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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jun 22 18:30:48 EDT 2007


Author: bstansberry at jboss.com
Date: 2007-06-22 18:30:48 -0400 (Fri, 22 Jun 2007)
New Revision: 63619

Modified:
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/AbstractHAPartitionStateTransfer.java
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransfer.java
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransferMBean.java
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/HAPartitionStateTransferMBean.java
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartition.java
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartitionMBean.java
   trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml
Log:
Convert HAPartitionStateTransferTestCast to a pojo basis

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/partition/AbstractHAPartitionStateTransfer.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/AbstractHAPartitionStateTransfer.java	2007-06-22 21:44:57 UTC (rev 63618)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/AbstractHAPartitionStateTransfer.java	2007-06-22 22:30:48 UTC (rev 63619)
@@ -3,14 +3,15 @@
 import java.io.Serializable;
 
 import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.ha.framework.server.ClusterPartitionMBean;
 import org.jboss.ha.jmx.HAServiceMBeanSupport;
 
 public abstract class AbstractHAPartitionStateTransfer 
-      extends HAServiceMBeanSupport
       implements HAPartitionStateTransferMBean
 {  
-   private HAPartition haPartition;
+//   private HAPartition haPartition;
    private Object transferredState;
+   private String serviceHAName;
 
    public void setCurrentState(Serializable newState)
    {
@@ -21,21 +22,48 @@
    {
       return this.transferredState;
    }
+   
+   
 
-   protected void setupPartition() throws Exception
+//   protected void setupPartition() throws Exception
+//   {
+//      if (haPartition == null)
+//      {
+//         super.setupPartition();
+//         haPartition = getPartition();
+//         haPartition.subscribeToStateTransferEvents(getServiceHAName(), this);
+//      }
+//   }
+//
+//   protected void createService() throws Exception
+//   {
+//      super.createService();
+//      setupPartition();
+//   }
+
+   public String getServiceHAName()
    {
-      if (haPartition == null)
-      {
-         super.setupPartition();
-         haPartition = getPartition();
-         haPartition.subscribeToStateTransferEvents(getServiceHAName(), this);
-      }
+      return serviceHAName;
    }
 
-   protected void createService() throws Exception
+   public void setServiceHAName(String serviceHAName)
    {
-      super.createService();
-      setupPartition();
+      this.serviceHAName = serviceHAName;
    }
+
+   public Serializable getCurrentState()
+   {
+      return null;
+   }
+
+//   @Override
+//   public void setClusterPartition(ClusterPartitionMBean clusterPartition)
+//   {
+//      super.setClusterPartition(clusterPartition);
+//      haPartition = clusterPartition.getHAPartition();
+//      haPartition.subscribeToStateTransferEvents(getServiceHAName(), this);
+//   }
    
+   
+   
 }

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransfer.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransfer.java	2007-06-22 21:44:57 UTC (rev 63618)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransfer.java	2007-06-22 22:30:48 UTC (rev 63619)
@@ -23,8 +23,6 @@
 
 import java.io.Serializable;
 
-import org.jboss.ha.framework.interfaces.HAPartition.HAPartitionStateTransfer;
-
 /**
  * HAPartitionStateTransfer impl that will return an object that
  * throws an exception when deserialized.  Tests what happens when
@@ -35,7 +33,7 @@
  */
 public class BadHAPartitionStateTransfer 
       extends AbstractHAPartitionStateTransfer 
-      implements HAPartitionStateTransfer, BadHAPartitionStateTransferMBean
+      implements BadHAPartitionStateTransferMBean
 {   
    private boolean returnState;
 

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransferMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransferMBean.java	2007-06-22 21:44:57 UTC (rev 63618)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransferMBean.java	2007-06-22 22:30:48 UTC (rev 63619)
@@ -21,7 +21,6 @@
  */
 package org.jboss.test.cluster.partition;
 
-import org.jboss.ha.jmx.HAServiceMBean;
 
 /**
  * HAPartitionStateTransfer impl that will return an object that
@@ -31,7 +30,8 @@
  * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
  * @version $Revision: 1.1 $
  */
-public interface BadHAPartitionStateTransferMBean extends HAServiceMBean
+public interface BadHAPartitionStateTransferMBean 
+   extends HAPartitionStateTransferMBean
 {
    public boolean getReturnState();
 

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/partition/HAPartitionStateTransferMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/HAPartitionStateTransferMBean.java	2007-06-22 21:44:57 UTC (rev 63618)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/HAPartitionStateTransferMBean.java	2007-06-22 22:30:48 UTC (rev 63619)
@@ -4,7 +4,10 @@
 import org.jboss.ha.jmx.HAServiceMBean;
 
 public interface HAPartitionStateTransferMBean 
-      extends HAServiceMBean, HAPartitionStateTransfer
+      extends HAPartitionStateTransfer
 {
    Object getTransferredState();
+   
+   String getServiceHAName();
+   void setServiceHAName(String name);
 }

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartition.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartition.java	2007-06-22 21:44:57 UTC (rev 63618)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartition.java	2007-06-22 22:30:48 UTC (rev 63619)
@@ -21,6 +21,8 @@
  */
 package org.jboss.test.cluster.partition;
 
+import java.util.List;
+
 import org.jboss.ha.framework.server.ClusterPartition;
 import org.jboss.ha.framework.server.ClusterPartitionConfig;
 
@@ -35,6 +37,7 @@
       implements StartupTestClusterPartitionMBean
 {
    private HAPartitionRecorderMBean startupRecorder;
+   private List<HAPartitionStateTransferMBean> stateTransferTargets;
    
    public StartupTestClusterPartition(ClusterPartitionConfig config)
    {
@@ -51,17 +54,33 @@
       this.startupRecorder = startupRecorder;
    }
 
-   public void create() throws Exception
+   public void start() throws Exception
    {
       try
       {
-         super.create();
+         super.start();
       }
       catch (Exception e)
       {
          startupRecorder.setStartupException(e);
          throw e;
       }
+   }
+
+   public List<HAPartitionStateTransferMBean> getStateTransferTargets()
+   {
+      return stateTransferTargets;
+   }
+
+   public void setStateTransferTargets(List<HAPartitionStateTransferMBean> targets)
+   {
+      this.stateTransferTargets = targets;
+      for (HAPartitionStateTransferMBean target : targets)
+      {
+         this.subscribeToStateTransferEvents(target.getServiceHAName(), target);
+//         target.setClusterPartition(this);
+      }
+      
    }  
    
    

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartitionMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartitionMBean.java	2007-06-22 21:44:57 UTC (rev 63618)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartitionMBean.java	2007-06-22 22:30:48 UTC (rev 63619)
@@ -21,6 +21,9 @@
  */
 package org.jboss.test.cluster.partition;
 
+import java.util.List;
+
+import org.jboss.ha.framework.interfaces.HAPartition.HAPartitionStateTransfer;
 import org.jboss.ha.framework.server.ClusterPartitionMBean;
 
 /**
@@ -34,4 +37,6 @@
    HAPartitionRecorderMBean getStartupRecorder();
    void setStartupRecorder(HAPartitionRecorderMBean startupRecorder);
 
+   List<HAPartitionStateTransferMBean> getStateTransferTargets();
+   void setStateTransferTargets(List<HAPartitionStateTransferMBean> targets);
 }

Modified: trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml	2007-06-22 21:44:57 UTC (rev 63618)
+++ trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml	2007-06-22 22:30:48 UTC (rev 63619)
@@ -15,12 +15,12 @@
    -->
    
    <!-- First we create a Configuration object for the cache -->
-   <bean name="BadHAPartitionCacheConfig" 
+   <bean name="HAPartitionStateTransferTestCacheConfig" 
    		class="org.jboss.cache.config.Configuration">
         
         <!-- Externally injected services -->  
         <property name="runtimeConfig">
-           <bean name="BadHAPartitionCacheRuntimeConfig" class="org.jboss.cache.config.RuntimeConfig">
+           <bean name="HAPartitionStateTransferTestCacheRuntimeConfig" class="org.jboss.cache.config.RuntimeConfig">
               <property name="transactionManager"><inject bean="jboss:service=TransactionManager" property="TransactionManager"/></property>
               <property name="muxChannelFactory"><inject bean="JChannelFactory"/></property>
            </bean>
@@ -72,18 +72,18 @@
 
     </bean>
    
-   <bean name="BadHAPartitionCacheFactory" class ="org.jboss.cache.DefaultCacheFactory">
+   <bean name="HAPartitionStateTransferTestCacheFactory" class ="org.jboss.cache.DefaultCacheFactory">
       <constructor factoryClass="org.jboss.cache.DefaultCacheFactory" factoryMethod="getInstance"/>
    </bean>
    
    <!-- Now we use the above configuration to construct the cache itself -->
-   <bean name="BadHAPartitionCache" class="org.jboss.cache.CacheImpl">
+   <bean name="HAPartitionStateTransferTestCache" class="org.jboss.cache.CacheImpl">
    
       <depends>jboss:service=Naming</depends>
       
       <constructor factoryMethod="createCache">
-         <factory bean="BadHAPartitionCacheFactory"/>
-         <parameter class="org.jboss.cache.config.Configuration"><inject bean="BadHAPartitionCacheConfig"/></parameter>
+         <factory bean="HAPartitionStateTransferTestCacheFactory"/>
+         <parameter class="org.jboss.cache.config.Configuration"><inject bean="HAPartitionStateTransferTestCacheConfig"/></parameter>
          <parameter class="boolean">false</parameter>
       </constructor>
       
@@ -101,13 +101,17 @@
          
    <bean name="BadProviderPartition"
    		 class="org.jboss.test.cluster.partition.StartupTestClusterPartition">     
-   		 
+   	
+   	<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=BadProviderPartition", exposedInterface=org.jboss.ha.framework.server.ClusterPartitionMBean.class)</annotation>
+   	
+   	<!--demand state="Start">BadHAPartitionStateTransfer,returnState=false</demand-->
+   	
    	<constructor>
    	   <parameter>
             <bean name="BadProviderPartitionConfig" class="org.jboss.ha.framework.server.ClusterPartitionConfig">   
                
                <!-- ClusterPartition requires a Cache for state management -->
-               <property name="clusteredCache"><inject bean="BadHAPartitionCache"/></property>
+               <property name="clusteredCache"><inject bean="HAPartitionStateTransferTestCache"/></property>
                
                <!--property name="distributedState"><inject bean="DistributedState"/></property-->
                 
@@ -135,16 +139,26 @@
       
       <property name="startupRecorder"><inject bean="BadProviderPartitionRecorder"/></property>
       
+      <property name="stateTransferTargets">
+         <list>
+           <!--inject bean="BadHAPartitionStateTransfer,returnState=false" state="Configured"/-->
+           <inject bean="BadHAPartitionStateTransfer,returnState=false"/>
+         </list>
+      </property>
+      
    </bean>
    
    <bean name="BadHAPartitionStateTransfer,returnState=false"
          class="org.jboss.test.cluster.partition.BadHAPartitionStateTransfer">
          
-      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.ha:service=BadHAPartitionStateTransfer,returnState=false", exposedInterface=org.jboss.test.cluster.partition.BadHAPartitionStateTransferMBean.class, registerDirectly=true)</annotation>       
+      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.test:service=BadHAPartitionStateTransfer,returnState=false", exposedInterface=org.jboss.test.cluster.partition.BadHAPartitionStateTransferMBean.class, registerDirectly=true)</annotation>       
       
-      <property name="clusterPartition"><inject bean="BadProviderPartition"/></property>
+      <supply>BadHAPartitionStateTransfer,returnState=false</supply>
+   	
+   	  <!--property name="clusterPartition"><inject bean="BadProviderPartition" state="Instantiated"/></property-->
          
       <property name="returnState">false</property>
+      <property name="serviceHAName">BadHAPartitionStateTransfer,returnState=false</property>
       
    </bean>
 
@@ -160,13 +174,17 @@
          
    <bean name="BadStatePartition"
    		 class="org.jboss.test.cluster.partition.StartupTestClusterPartition">     
-   		 
+
+   	<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=BadStatePartition", exposedInterface=org.jboss.ha.framework.server.ClusterPartitionMBean.class)</annotation>
+   	
+   	<!--demand state="Start">BadHAPartitionStateTransfer,returnState=true</demand-->
+   	
    	<constructor>
    	   <parameter>
             <bean name="BadStatePartitionConfig" class="org.jboss.ha.framework.server.ClusterPartitionConfig">   
                
                <!-- ClusterPartition requires a Cache for state management -->
-               <property name="clusteredCache"><inject bean="BadHAPartitionCache"/></property>
+               <property name="clusteredCache"><inject bean="HAPartitionStateTransferTestCache"/></property>
                
                <!--property name="distributedState"><inject bean="DistributedState"/></property-->
                 
@@ -194,16 +212,26 @@
       
       <property name="startupRecorder"><inject bean="BadStatePartitionRecorder"/></property>
       
+      <property name="stateTransferTargets">
+         <list>
+           <!--inject bean="BadHAPartitionStateTransfer,returnState=true" state="Configured"/-->
+           <inject bean="BadHAPartitionStateTransfer,returnState=true"/>
+         </list>
+      </property>
+      
    </bean>
    
    <bean name="BadHAPartitionStateTransfer,returnState=true"
          class="org.jboss.test.cluster.partition.BadHAPartitionStateTransfer">
       
-      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.ha:service=BadHAPartitionStateTransfer,returnState=true", exposedInterface=org.jboss.test.cluster.partition.BadHAPartitionStateTransferMBean.class, registerDirectly=true)</annotation>       
+      <supply>BadHAPartitionStateTransfer,returnState=true</supply>
       
-      <property name="clusterPartition"><inject bean="BadStatePartition"/></property>
+      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.test:service=BadHAPartitionStateTransfer,returnState=true", exposedInterface=org.jboss.test.cluster.partition.BadHAPartitionStateTransferMBean.class, registerDirectly=true)</annotation>       
+      
+      <!--property name="clusterPartition"><inject bean="BadStatePartition" state="Instantiated"/></property-->
          
       <property name="returnState">true</property>
+      <property name="serviceHAName">BadHAPartitionStateTransfer,returnState=true</property>
       
    </bean>
 
@@ -219,13 +247,15 @@
          
    <bean name="NoStatePartition"
    		 class="org.jboss.test.cluster.partition.StartupTestClusterPartition">     
+
+   	<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=NoStatePartition", exposedInterface=org.jboss.ha.framework.server.ClusterPartitionMBean.class)</annotation>
    		 
    	<constructor>
    	   <parameter>
-            <bean name="BadStatePartitionConfig" class="org.jboss.ha.framework.server.ClusterPartitionConfig">   
+            <bean name="NoStatePartitionConfig" class="org.jboss.ha.framework.server.ClusterPartitionConfig">   
                
                <!-- ClusterPartition requires a Cache for state management -->
-               <property name="clusteredCache"><inject bean="BadHAPartitionCache"/></property>
+               <property name="clusteredCache"><inject bean="HAPartitionStateTransferTestCache"/></property>
                
                <!--property name="distributedState"><inject bean="DistributedState"/></property-->
                 
@@ -236,7 +266,7 @@
                <property name="nodeAddress">${jboss.bind.address}</property>
          
                <!-- Inject the naming service port as an aid in creating a nodeUniqueId.  Not needed if nodeUniqueId is set -->
-               <property name="namingServicePort"><inject bean="jboss:service=Naming" property="port"/></property>
+               <property name="namingServicePort"><inject bean="jboss:service=Naming" property="Port"/></property>
                
                <!-- Determine if deadlock detection is enabled -->
                <property name="deadlockDetection">false</property>
@@ -267,13 +297,20 @@
          
    <bean name="GoodStatePartition"
    		 class="org.jboss.test.cluster.partition.StartupTestClusterPartition">     
-   		 
+
+   	<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=GoodStatePartition", exposedInterface=org.jboss.ha.framework.server.ClusterPartitionMBean.class)</annotation>
+    
+    <!--demand state="Start">SimpleHAPartitionStateTransfer</demand-->
+    <depends>SimpleHAPartitionStateTransfer</depends>
+    <!--demand state="Start">CustomStateHAPartitionStateTransfer</demand-->
+    <depends>CustomStateHAPartitionStateTransfer</depends>
+    
    	<constructor>
    	   <parameter>
-            <bean name="BadStatePartitionConfig" class="org.jboss.ha.framework.server.ClusterPartitionConfig">   
+            <bean name="GoodStatePartitionConfig" class="org.jboss.ha.framework.server.ClusterPartitionConfig">   
                
                <!-- ClusterPartition requires a Cache for state management -->
-               <property name="clusteredCache"><inject bean="BadHAPartitionCache"/></property>
+               <property name="clusteredCache"><inject bean="HAPartitionStateTransferTestCache"/></property>
                
                <!--property name="distributedState"><inject bean="DistributedState"/></property-->
                 
@@ -284,7 +321,7 @@
                <property name="nodeAddress">${jboss.bind.address}</property>
          
                <!-- Inject the naming service port as an aid in creating a nodeUniqueId.  Not needed if nodeUniqueId is set -->
-               <property name="namingServicePort"><inject bean="jboss:service=Naming" property="port"/></property>
+               <property name="namingServicePort"><inject bean="jboss:service=Naming" property="Port"/></property>
                
                <!-- Determine if deadlock detection is enabled -->
                <property name="deadlockDetection">false</property>
@@ -301,15 +338,39 @@
       
       <property name="startupRecorder"><inject bean="GoodStatePartitionRecorder"/></property>
       
+      <property name="stateTransferTargets">
+         <list>
+           <!--inject bean="SimpleHAPartitionStateTransfer" state="Configured"/>
+           <inject bean="CustomStateHAPartitionStateTransfer" state="Configured"/-->
+           <inject bean="SimpleHAPartitionStateTransfer" state="Configured"/>
+           <inject bean="CustomStateHAPartitionStateTransfer" state="Configured"/>
+         </list>
+      </property>
+      
    </bean>
    
+   <bean name="SimpleHAPartitionStateTransfer"
+         class="org.jboss.test.cluster.partition.SimpleHAPartitionStateTransfer">
+      
+      <supply>SimpleHAPartitionStateTransfer</supply>
+      
+      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.test:service=SimpleHAPartitionStateTransfer", exposedInterface=org.jboss.test.cluster.partition.SimpleHAPartitionStateTransferMBean.class, registerDirectly=true)</annotation>       
+      
+      <!--property name="clusterPartition"><inject bean="GoodStatePartition" state="Instantiated"/></property-->
+      <property name="serviceHAName">SimpleHAPartitionStateTransfer</property>
+      
+   </bean>
+   
    <bean name="CustomStateHAPartitionStateTransfer"
          class="org.jboss.test.cluster.partition.CustomStateHAPartitionStateTransfer">
       
-      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.ha:service=CustomStateHAPartitionStateTransfer", exposedInterface=org.jboss.test.cluster.partition.CustomStateHAPartitionStateTransferMBean.class, registerDirectly=true)</annotation>       
+      <supply>CustomStateHAPartitionStateTransfer</supply>
       
-      <property name="clusterPartition"><inject bean="GoodStatePartition"/></property>
+      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.test:service=CustomStateHAPartitionStateTransfer", exposedInterface=org.jboss.test.cluster.partition.CustomStateHAPartitionStateTransferMBean.class, registerDirectly=true)</annotation>       
       
+      <!--property name="clusterPartition"><inject bean="GoodStatePartition" state="Instantiated"/></property-->
+      <property name="serviceHAName">CustomStateHAPartitionStateTransfer</property>
+      
    </bean>
 
 </deployment>




More information about the jboss-cvs-commits mailing list