[Jboss-cvs] JBossAS SVN: r56524 - in trunk/testsuite/src: main/org/jboss/test/cluster/partition main/org/jboss/test/cluster/partition/test resources/cluster/partition

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Sep 2 00:20:57 EDT 2006


Author: bstansberry at jboss.com
Date: 2006-09-02 00:20:54 -0400 (Sat, 02 Sep 2006)
New Revision: 56524

Added:
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/AbstractHAPartitionStateTransfer.java
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/CustomStateHAPartitionStateTransfer.java
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/CustomStateHAPartitionStateTransferMBean.java
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/HAPartitionRecorder.java
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/HAPartitionRecorderMBean.java
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/HAPartitionStateTransferMBean.java
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/SimpleHAPartitionStateTransfer.java
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/SimpleHAPartitionStateTransferMBean.java
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/test/HAPartitionStateTransferTestCase.java
Removed:
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionRecorder.java
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionRecorderMBean.java
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/test/BadStateTransferTestCase.java
Modified:
   trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransfer.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/main/org/jboss/test/cluster/partition/StartupTestHAPartition.java
   trunk/testsuite/src/resources/cluster/partition/jboss-service.xml
Log:
[JBAS-3540] Streamable state transfer

Added: trunk/testsuite/src/main/org/jboss/test/cluster/partition/AbstractHAPartitionStateTransfer.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/AbstractHAPartitionStateTransfer.java	2006-09-02 04:20:19 UTC (rev 56523)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/AbstractHAPartitionStateTransfer.java	2006-09-02 04:20:54 UTC (rev 56524)
@@ -0,0 +1,41 @@
+package org.jboss.test.cluster.partition;
+
+import java.io.Serializable;
+
+import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.ha.jmx.HAServiceMBeanSupport;
+
+public abstract class AbstractHAPartitionStateTransfer 
+      extends HAServiceMBeanSupport
+      implements HAPartitionStateTransferMBean
+{  
+   private HAPartition haPartition;
+   private Object transferredState;
+
+   public void setCurrentState(Serializable newState)
+   {
+      this.transferredState = newState;
+   }
+
+   public Object getTransferredState()
+   {
+      return this.transferredState;
+   }
+
+   protected void setupPartition() throws Exception
+   {
+      if (haPartition == null)
+      {
+         super.setupPartition();
+         haPartition = getPartition();
+         haPartition.subscribeToStateTransferEvents(getServiceHAName(), this);
+      }
+   }
+
+   protected void createService() throws Exception
+   {
+      super.createService();
+      setupPartition();
+   }
+   
+}

Deleted: trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionRecorder.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionRecorder.java	2006-09-02 04:20:19 UTC (rev 56523)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionRecorder.java	2006-09-02 04:20:54 UTC (rev 56524)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.test.cluster.partition;
-
-/**
- * Caches an exception caught during startup of StartupTestHAPartition
- * making it available to the test fixture after the partition fails to deploy.
- * 
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision: 1.1 $
- */
-public class BadHAPartitionRecorder implements BadHAPartitionRecorderMBean
-{
-   private Exception startupException;
-   
-   public Exception getStartupException()
-   {
-      return startupException;
-   }
-   public void setStartupException(Exception startupException)
-   {
-      this.startupException = startupException;
-   }
-   
-   
-}

Deleted: trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionRecorderMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionRecorderMBean.java	2006-09-02 04:20:19 UTC (rev 56523)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionRecorderMBean.java	2006-09-02 04:20:54 UTC (rev 56524)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.test.cluster.partition;
-
-/**
- * Caches an exception caught during startup of StartupTestHAPartition
- * making it available to the test fixture after the partition fails to deploy.
- * 
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision: 1.1 $
- */
-public interface BadHAPartitionRecorderMBean
-{
-
-   Exception getStartupException();
-
-   void setStartupException(Exception startupException);
-
-}
\ No newline at end of file

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransfer.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransfer.java	2006-09-02 04:20:19 UTC (rev 56523)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransfer.java	2006-09-02 04:20:54 UTC (rev 56524)
@@ -23,9 +23,7 @@
 
 import java.io.Serializable;
 
-import org.jboss.ha.framework.interfaces.HAPartition;
 import org.jboss.ha.framework.interfaces.HAPartition.HAPartitionStateTransfer;
-import org.jboss.ha.jmx.HAServiceMBeanSupport;
 
 /**
  * HAPartitionStateTransfer impl that will return an object that
@@ -36,10 +34,9 @@
  * @version $Revision: 1.1 $
  */
 public class BadHAPartitionStateTransfer 
-      extends HAServiceMBeanSupport 
+      extends AbstractHAPartitionStateTransfer 
       implements HAPartitionStateTransfer, BadHAPartitionStateTransferMBean
 {   
-   private HAPartition haPartition;
    private boolean returnState;
 
    public Serializable getCurrentState()
@@ -55,22 +52,6 @@
       // no-op
    }
 
-   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 boolean getReturnState()
    {
       return returnState;

Added: trunk/testsuite/src/main/org/jboss/test/cluster/partition/CustomStateHAPartitionStateTransfer.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/CustomStateHAPartitionStateTransfer.java	2006-09-02 04:20:19 UTC (rev 56523)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/CustomStateHAPartitionStateTransfer.java	2006-09-02 04:20:54 UTC (rev 56524)
@@ -0,0 +1,27 @@
+package org.jboss.test.cluster.partition;
+
+import java.io.Serializable;
+
+public class CustomStateHAPartitionStateTransfer 
+   extends AbstractHAPartitionStateTransfer
+   implements CustomStateHAPartitionStateTransferMBean
+{
+   public static final String CUSTOM = "Custom";
+
+   public Serializable getCurrentState()
+   {
+      return new CustomState();
+   }
+   
+   private static class CustomState implements Serializable
+   {
+      /** The serialVersionUID */
+      private static final long serialVersionUID = 1L;
+      
+      public String toString()
+      {
+         return CUSTOM;
+      }
+   }
+
+}

Added: trunk/testsuite/src/main/org/jboss/test/cluster/partition/CustomStateHAPartitionStateTransferMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/CustomStateHAPartitionStateTransferMBean.java	2006-09-02 04:20:19 UTC (rev 56523)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/CustomStateHAPartitionStateTransferMBean.java	2006-09-02 04:20:54 UTC (rev 56524)
@@ -0,0 +1,6 @@
+package org.jboss.test.cluster.partition;
+
+public interface CustomStateHAPartitionStateTransferMBean extends HAPartitionStateTransferMBean
+{
+
+}

Copied: trunk/testsuite/src/main/org/jboss/test/cluster/partition/HAPartitionRecorder.java (from rev 56419, trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionRecorder.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionRecorder.java	2006-08-29 21:59:39 UTC (rev 56419)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/HAPartitionRecorder.java	2006-09-02 04:20:54 UTC (rev 56524)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.test.cluster.partition;
+
+/**
+ * Caches an exception caught during startup of StartupTestHAPartition
+ * making it available to the test fixture after the partition fails to deploy.
+ * 
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1.1 $
+ */
+public class HAPartitionRecorder implements HAPartitionRecorderMBean
+{
+   private Exception startupException;
+   
+   public Exception getStartupException()
+   {
+      return startupException;
+   }
+   public void setStartupException(Exception startupException)
+   {
+      this.startupException = startupException;
+   }
+   
+   
+}

Copied: trunk/testsuite/src/main/org/jboss/test/cluster/partition/HAPartitionRecorderMBean.java (from rev 56419, trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionRecorderMBean.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionRecorderMBean.java	2006-08-29 21:59:39 UTC (rev 56419)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/HAPartitionRecorderMBean.java	2006-09-02 04:20:54 UTC (rev 56524)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.test.cluster.partition;
+
+/**
+ * Caches an exception caught during startup of StartupTestHAPartition
+ * making it available to the test fixture after the partition fails to deploy.
+ * 
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1.1 $
+ */
+public interface HAPartitionRecorderMBean
+{
+
+   Exception getStartupException();
+
+   void setStartupException(Exception startupException);
+
+}
\ No newline at end of file

Added: trunk/testsuite/src/main/org/jboss/test/cluster/partition/HAPartitionStateTransferMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/HAPartitionStateTransferMBean.java	2006-09-02 04:20:19 UTC (rev 56523)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/HAPartitionStateTransferMBean.java	2006-09-02 04:20:54 UTC (rev 56524)
@@ -0,0 +1,10 @@
+package org.jboss.test.cluster.partition;
+
+import org.jboss.ha.framework.interfaces.HAPartition.HAPartitionStateTransfer;
+import org.jboss.ha.jmx.HAServiceMBean;
+
+public interface HAPartitionStateTransferMBean 
+      extends HAServiceMBean, HAPartitionStateTransfer
+{
+   Object getTransferredState();
+}

Added: trunk/testsuite/src/main/org/jboss/test/cluster/partition/SimpleHAPartitionStateTransfer.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/SimpleHAPartitionStateTransfer.java	2006-09-02 04:20:19 UTC (rev 56523)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/SimpleHAPartitionStateTransfer.java	2006-09-02 04:20:54 UTC (rev 56524)
@@ -0,0 +1,16 @@
+package org.jboss.test.cluster.partition;
+
+import java.io.Serializable;
+
+public class SimpleHAPartitionStateTransfer 
+   extends AbstractHAPartitionStateTransfer
+   implements SimpleHAPartitionStateTransferMBean
+{
+   public static final String SIMPLE = "Simple";
+   
+   public Serializable getCurrentState()
+   {
+      return SIMPLE;
+   }
+
+}

Added: trunk/testsuite/src/main/org/jboss/test/cluster/partition/SimpleHAPartitionStateTransferMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/SimpleHAPartitionStateTransferMBean.java	2006-09-02 04:20:19 UTC (rev 56523)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/SimpleHAPartitionStateTransferMBean.java	2006-09-02 04:20:54 UTC (rev 56524)
@@ -0,0 +1,7 @@
+package org.jboss.test.cluster.partition;
+
+public interface SimpleHAPartitionStateTransferMBean 
+   extends HAPartitionStateTransferMBean
+{
+
+}

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartition.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartition.java	2006-09-02 04:20:19 UTC (rev 56523)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartition.java	2006-09-02 04:20:54 UTC (rev 56524)
@@ -35,19 +35,19 @@
       implements StartupTestClusterPartitionMBean
 {
    private StartupTestHAPartition startupPartition;
-   private BadHAPartitionRecorderMBean startupRecorder;
+   private HAPartitionRecorderMBean startupRecorder;
    
    public StartupTestClusterPartition()
    {
       super();
    }  
    
-   public BadHAPartitionRecorderMBean getStartupRecorder()
+   public HAPartitionRecorderMBean getStartupRecorder()
    {
       return startupRecorder;
    }
 
-   public void setStartupRecorder(BadHAPartitionRecorderMBean startupRecorder)
+   public void setStartupRecorder(HAPartitionRecorderMBean startupRecorder)
    {
       this.startupRecorder = startupRecorder;
    }

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartitionMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartitionMBean.java	2006-09-02 04:20:19 UTC (rev 56523)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartitionMBean.java	2006-09-02 04:20:54 UTC (rev 56524)
@@ -31,7 +31,7 @@
  */
 public interface StartupTestClusterPartitionMBean extends ClusterPartitionMBean
 {   
-   BadHAPartitionRecorderMBean getStartupRecorder();
-   void setStartupRecorder(BadHAPartitionRecorderMBean startupRecorder);
+   HAPartitionRecorderMBean getStartupRecorder();
+   void setStartupRecorder(HAPartitionRecorderMBean startupRecorder);
 
 }

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestHAPartition.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestHAPartition.java	2006-09-02 04:20:19 UTC (rev 56523)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestHAPartition.java	2006-09-02 04:20:54 UTC (rev 56524)
@@ -36,9 +36,9 @@
  */
 public class StartupTestHAPartition extends HAPartitionImpl
 {
-   private BadHAPartitionRecorderMBean startupRecorder;
+   private HAPartitionRecorderMBean startupRecorder;
    
-   public StartupTestHAPartition(BadHAPartitionRecorderMBean recorder, String partitionName, JChannel channel, boolean deadlock_detection, MBeanServer server)
+   public StartupTestHAPartition(HAPartitionRecorderMBean recorder, String partitionName, JChannel channel, boolean deadlock_detection, MBeanServer server)
          throws Exception
    {
       super(partitionName, channel, deadlock_detection, server);

Deleted: trunk/testsuite/src/main/org/jboss/test/cluster/partition/test/BadStateTransferTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/test/BadStateTransferTestCase.java	2006-09-02 04:20:19 UTC (rev 56523)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/test/BadStateTransferTestCase.java	2006-09-02 04:20:54 UTC (rev 56524)
@@ -1,114 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.test.cluster.partition.test;
-
-import javax.management.ObjectName;
-
-import junit.framework.Test;
-
-import org.jboss.jmx.adaptor.rmi.RMIAdaptor;
-import org.jboss.test.JBossClusteredTestCase;
-import org.jboss.test.cluster.partition.BadHAPartitionStateException;
-
-/**
- * Test that HAPartition startup fails if the initial state transfer fails.
- * 
- * @author <a href="mailto://brian.stansberry@jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-public class BadStateTransferTestCase extends JBossClusteredTestCase
-{
-
-   public BadStateTransferTestCase(String name)
-   {
-      super(name);
-   }        
-
-   public static Test suite() throws Exception
-   {
-      Test t1 = JBossClusteredTestCase.getDeploySetup(BadStateTransferTestCase.class, "badstatetransfer.sar");
-      return t1;
-   } 
-
-   protected void setUp() throws Exception
-   {
-      super.setUp();
-   }
-
-   protected void tearDown() throws Exception
-   {
-      super.tearDown();
-   }
-   
-   public void testFailedStateProvider() throws Exception
-   {
-      RMIAdaptor[] adaptors = getAdaptors();
-      
-      ObjectName partition = new ObjectName("jboss:service=BadProviderPartitionRecorder");
-      
-      Exception e = (Exception) adaptors[1].getAttribute(partition, "StartupException");      
-
-      assertNotNull("Partition caught exception", e);
-      
-      Throwable parent = e;
-      Throwable cause = e.getCause();
-      while (cause != null)
-      {
-         parent = cause;
-         cause = parent.getCause();
-      }
-      
-      assertTrue("Correct type of Exception caught", parent instanceof IllegalStateException);
-   }
-
-   public void testBadStateIntegration() throws Exception
-   {
-      RMIAdaptor[] adaptors = getAdaptors();
-      
-      ObjectName partition = new ObjectName("jboss:service=BadStatePartitionRecorder");
-      
-      Exception e = (Exception) adaptors[1].getAttribute(partition, "StartupException");
-
-      assertNotNull("Partition caught exception", e);
-      
-      Throwable parent = e;
-      Throwable cause = e.getCause();
-      while (cause != null)
-      {
-         parent = cause;
-         cause = parent.getCause();
-      }
-      
-      assertTrue("Correct type of Exception caught", parent instanceof BadHAPartitionStateException);
-   }
-
-   /**
-    * In this subclass this is a no-op because we are deliberately
-    * deploying a sar that will fail in deployment
-    */
-   public void testServerFound() throws Exception
-   {
-      // do nothing
-   }
-   
-   
-}

Copied: trunk/testsuite/src/main/org/jboss/test/cluster/partition/test/HAPartitionStateTransferTestCase.java (from rev 56419, trunk/testsuite/src/main/org/jboss/test/cluster/partition/test/BadStateTransferTestCase.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/test/BadStateTransferTestCase.java	2006-08-29 21:59:39 UTC (rev 56419)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/test/HAPartitionStateTransferTestCase.java	2006-09-02 04:20:54 UTC (rev 56524)
@@ -0,0 +1,152 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.test.cluster.partition.test;
+
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+
+import org.jboss.jmx.adaptor.rmi.RMIAdaptor;
+import org.jboss.test.JBossClusteredTestCase;
+import org.jboss.test.cluster.partition.BadHAPartitionStateException;
+import org.jboss.test.cluster.partition.CustomStateHAPartitionStateTransfer;
+import org.jboss.test.cluster.partition.SimpleHAPartitionStateTransfer;
+
+/**
+ * Tests of HAPartitionImpl's state transfer.
+ * 
+ * @author <a href="mailto://brian.stansberry@jboss.com">Brian Stansberry</a>
+ * @version $Revision$
+ */
+public class HAPartitionStateTransferTestCase extends JBossClusteredTestCase
+{
+
+   public HAPartitionStateTransferTestCase(String name)
+   {
+      super(name);
+   }        
+
+   public static Test suite() throws Exception
+   {
+      Test t1 = JBossClusteredTestCase.getDeploySetup(HAPartitionStateTransferTestCase.class, "partitionstatetransfer.sar");
+      return t1;
+   } 
+
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+   }
+
+   protected void tearDown() throws Exception
+   {
+      super.tearDown();
+   }
+   
+   public void testFailedStateProvider() throws Exception
+   {
+      RMIAdaptor[] adaptors = getAdaptors();
+      
+      ObjectName partition = new ObjectName("jboss:service=BadProviderPartitionRecorder");
+      
+      Exception e = (Exception) adaptors[1].getAttribute(partition, "StartupException");      
+
+      assertNotNull("Partition caught exception", e);
+      
+      Throwable parent = e;
+      Throwable cause = e.getCause();
+      while (cause != null)
+      {
+         parent = cause;
+         cause = parent.getCause();
+      }
+      
+      assertTrue("Correct type of Exception caught", parent instanceof IllegalStateException);
+   }
+
+   public void testBadStateIntegration() throws Exception
+   {
+      RMIAdaptor[] adaptors = getAdaptors();
+      
+      ObjectName partition = new ObjectName("jboss:service=BadStatePartitionRecorder");
+      
+      Exception e = (Exception) adaptors[1].getAttribute(partition, "StartupException");
+
+      assertNotNull("Partition caught exception", e);
+      
+      Throwable parent = e;
+      Throwable cause = e.getCause();
+      while (cause != null)
+      {
+         parent = cause;
+         cause = parent.getCause();
+      }
+      
+      assertTrue("Correct type of Exception caught", parent instanceof BadHAPartitionStateException);
+   }
+   
+   public void testNoStateTransfer() throws Exception
+   {
+      RMIAdaptor[] adaptors = getAdaptors();
+      
+      ObjectName partition = new ObjectName("jboss:service=NoStatePartitionRecorder");
+      
+      Exception e = (Exception) adaptors[1].getAttribute(partition, "StartupException");
+
+      assertNull("Partition started successfully", e);
+      
+   }
+   
+   public void testGoodStateTransfer() throws Exception
+   {
+      RMIAdaptor[] adaptors = getAdaptors();
+      
+      ObjectName partition = new ObjectName("jboss:service=GoodStatePartitionRecorder");
+      
+      Exception e = (Exception) adaptors[1].getAttribute(partition, "StartupException");
+
+      assertNull("Partition started successfully", e);
+      
+      ObjectName simple = new ObjectName("jboss.test:service=SimpleHAPartitionStateTransfer");
+      
+      Object simpleState = adaptors[1].getAttribute(simple, "TransferredState");
+      
+      assertEquals("Got simple state", SimpleHAPartitionStateTransfer.SIMPLE, simpleState);
+      
+      ObjectName custom = new ObjectName("jboss.test:service=CustomStateHAPartitionStateTransfer");
+      
+      Object customState = adaptors[1].getAttribute(custom, "TransferredState");
+      
+      assertNotNull("Got custom state", customState);
+      assertEquals("Got correct custom state", CustomStateHAPartitionStateTransfer.CUSTOM, customState.toString());
+   }
+
+   /**
+    * In this subclass this is a no-op because we are deliberately
+    * deploying a sar that will fail in deployment
+    */
+   public void testServerFound() throws Exception
+   {
+      // do nothing
+   }
+   
+   
+}

Modified: trunk/testsuite/src/resources/cluster/partition/jboss-service.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/partition/jboss-service.xml	2006-09-02 04:20:19 UTC (rev 56523)
+++ trunk/testsuite/src/resources/cluster/partition/jboss-service.xml	2006-09-02 04:20:54 UTC (rev 56524)
@@ -10,7 +10,7 @@
 
    <!-- ClusterPartition requires a TreeCache for state management -->   
    <mbean code="org.jboss.cache.TreeCache"
-        name="jboss:service=ClusterTreeCache,partition=BadPartition">
+        name="jboss:service=ClusterTreeCache,partition=StateTransferTestPartition">
         <depends>jboss:service=Naming</depends>
         <depends>jboss:service=TransactionManager</depends>
         
@@ -73,7 +73,7 @@
 
     
    <!-- Service to record and cache any failures in the partition -->
-   <mbean code="org.jboss.test.cluster.partition.BadHAPartitionRecorder"
+   <mbean code="org.jboss.test.cluster.partition.HAPartitionRecorder"
      name="jboss:service=BadProviderPartitionRecorder"/>
      
    <mbean code="org.jboss.test.cluster.partition.StartupTestClusterPartition"
@@ -84,7 +84,7 @@
          
       <!-- ClusterPartition requires a TreeCache for state management -->
       <depends optional-attribute-name="TreeCache"
-         proxy-type="attribute">jboss:service=ClusterTreeCache,partition=BadPartition</depends>
+         proxy-type="attribute">jboss:service=ClusterTreeCache,partition=StateTransferTestPartition</depends>
        
       <!-- Name of the partition being built -->
       <attribute name="PartitionName">BadProviderPartition</attribute>
@@ -116,7 +116,7 @@
 
     
    <!-- Service to record and cache any failures in the partition -->
-   <mbean code="org.jboss.test.cluster.partition.BadHAPartitionRecorder"
+   <mbean code="org.jboss.test.cluster.partition.HAPartitionRecorder"
      name="jboss:service=BadStatePartitionRecorder"/>
 
    <mbean code="org.jboss.test.cluster.partition.StartupTestClusterPartition"
@@ -127,7 +127,7 @@
 
       <!-- ClusterPartition requires a TreeCache for state management -->
       <depends optional-attribute-name="TreeCache"
-         proxy-type="attribute">jboss:service=ClusterTreeCache,partition=BadPartition</depends>
+         proxy-type="attribute">jboss:service=ClusterTreeCache,partition=StateTransferTestPartition</depends>
        
       <!-- Name of the partition being built -->
       <attribute name="PartitionName">BadStatePartition</attribute>
@@ -153,4 +153,86 @@
       
    </mbean>
 
+   <!-- ==================================================================== -->
+   <!-- Partition used for testing no state                                  -->
+   <!-- ==================================================================== -->
+
+    
+   <!-- Service to record and cache any failures in the partition -->
+   <mbean code="org.jboss.test.cluster.partition.HAPartitionRecorder"
+     name="jboss:service=NoStatePartitionRecorder"/>
+
+   <mbean code="org.jboss.test.cluster.partition.StartupTestClusterPartition"
+      name="jboss:service=NoStatePartition">            
+
+      <depends optional-attribute-name="StartupRecorder"
+         proxy-type="attribute">jboss:service=NoStatePartitionRecorder</depends>
+
+      <!-- ClusterPartition requires a TreeCache for state management -->
+      <depends optional-attribute-name="TreeCache"
+         proxy-type="attribute">jboss:service=ClusterTreeCache,partition=StateTransferTestPartition</depends>
+       
+      <!-- Name of the partition being built -->
+      <attribute name="PartitionName">NoStatePartition</attribute>
+
+      <!-- The address used to determine the node name -->
+      <attribute name="NodeAddress">${jboss.bind.address}</attribute>
+
+      <!-- Determine if deadlock detection is enabled -->
+      <attribute name="DeadlockDetection">False</attribute>
+     
+      <!-- Keep this timeout short -->
+      <attribute name="StateTransferTimeout">2000</attribute>
+
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- Partition used for testing successful state transfer                 -->
+   <!-- ==================================================================== -->
+
+    
+   <!-- Service to record and cache any failures in the partition -->
+   <mbean code="org.jboss.test.cluster.partition.HAPartitionRecorder"
+     name="jboss:service=GoodStatePartitionRecorder"/>
+
+   <mbean code="org.jboss.test.cluster.partition.StartupTestClusterPartition"
+      name="jboss:service=GoodStatePartition">            
+
+      <depends optional-attribute-name="StartupRecorder"
+         proxy-type="attribute">jboss:service=GoodStatePartitionRecorder</depends>
+
+      <!-- ClusterPartition requires a TreeCache for state management -->
+      <depends optional-attribute-name="TreeCache"
+         proxy-type="attribute">jboss:service=ClusterTreeCache,partition=StateTransferTestPartition</depends>
+       
+      <!-- Name of the partition being built -->
+      <attribute name="PartitionName">GoodStatePartition</attribute>
+
+      <!-- The address used to determine the node name -->
+      <attribute name="NodeAddress">${jboss.bind.address}</attribute>
+
+      <!-- Determine if deadlock detection is enabled -->
+      <attribute name="DeadlockDetection">False</attribute>
+     
+      <!-- Keep this timeout short -->
+      <attribute name="StateTransferTimeout">2000</attribute>
+
+   </mbean>
+   
+   <mbean code="org.jboss.test.cluster.partition.SimpleHAPartitionStateTransfer"
+      name="jboss.test:service=SimpleHAPartitionStateTransfer">
+      
+      <depends optional-attribute-name="ClusterPartition"
+         proxy-type="attribute">jboss:service=GoodStatePartition</depends>
+      
+   </mbean>
+   
+   <mbean code="org.jboss.test.cluster.partition.CustomStateHAPartitionStateTransfer"
+      name="jboss.test:service=CustomStateHAPartitionStateTransfer">
+      
+      <depends optional-attribute-name="ClusterPartition"
+         proxy-type="attribute">jboss:service=GoodStatePartition</depends>
+      
+   </mbean>
+
 </server>




More information about the jboss-cvs-commits mailing list