[jboss-cvs] JBossAS SVN: r64235 - in trunk/testsuite/src/main/org/jboss/test/cluster: hapartition and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jul 23 23:15:36 EDT 2007


Author: bstansberry at jboss.com
Date: 2007-07-23 23:15:36 -0400 (Mon, 23 Jul 2007)
New Revision: 64235

Added:
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/drm/
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/drm/DRMUser.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/drm/IReplicants.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/ds/
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/ds/DistributedStateUser.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/ds/IDistributedState.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/Person.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/PersonQuery.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/RPCUser.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/RPCUserMBean.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/AbstractHAPartitionStateTransfer.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionState.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionStateException.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionStateTransfer.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionStateTransferMBean.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/CustomStateHAPartitionStateTransfer.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/CustomStateHAPartitionStateTransferMBean.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/HAPartitionRecorder.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/HAPartitionRecorderMBean.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/HAPartitionStateTransferMBean.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/SimpleHAPartitionStateTransfer.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/SimpleHAPartitionStateTransferMBean.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/StartupTestClusterPartition.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/StartupTestClusterPartitionMBean.java
Log:
[JBAS-4552] Move cluster tests into cluster package
[JBAS-4553] Reorg cluster tests to prevent unnecessary repetition


Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/drm/DRMUser.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/drm/DRMUser.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/drm/DRMUser.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,133 @@
+/*
+  * 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.hapartition.drm;
+
+import java.io.Serializable;
+import java.util.List;
+import javax.management.Notification;
+import javax.naming.InitialContext;
+
+import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
+import org.jboss.ha.framework.interfaces.DistributedReplicantManager.ReplicantListener;
+import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.JBossNotificationBroadcasterSupport;
+
+/** Tests of the DistributedReplicantManager aspect of the HAPartition service.
+
+   @author Scott.Stark at jboss.org
+   @version $Revision$
+*/
+public class DRMUser extends JBossNotificationBroadcasterSupport
+   implements IReplicants, ReplicantListener
+{
+   protected static Logger log = Logger.getLogger(DRMUser.class);
+
+   protected DistributedReplicantManager drm;
+   protected String category = "DRMUser";
+   protected String partitionName = "DefaultPartition";
+   protected long sequence;
+
+   public String getPartitionName()
+   {
+      return partitionName;
+   }
+   public void setPartitionName(String partitionName)
+   {
+      this.partitionName = partitionName;
+   }
+
+   public String getCategory()
+   {
+      return category;
+   }
+   public void setCategory(String category)
+   {
+      this.category = category;
+   }
+
+   public void start() throws Exception
+   {
+      // Lookup the parition
+      InitialContext ctx = new InitialContext();
+      String jndiName = "/HAPartition/" + partitionName;
+      HAPartition partition = (HAPartition) ctx.lookup(jndiName);
+      drm = partition.getDistributedReplicantManager();
+      log.debug("Obtained DistributedReplicantManager from partition="+partitionName);
+      drm.registerListener(category, this);
+      // Bind the jboss.bind.address value into the DRM
+      String address = System.getProperty("jboss.bind.address");
+      drm.add(category, address);
+      log.info("Added: "+address+" under key: "+category);
+   }
+   public void stop() throws Exception
+   {
+      drm.remove(category);
+      drm.unregisterListener(category, this);
+   }
+
+   public Serializable lookupLocalReplicant()
+   {
+      return drm.lookupLocalReplicant(category);
+   }
+   public Serializable lookupLocalReplicant(String key)
+   {
+      return drm.lookupLocalReplicant(key);      
+   }
+
+   public List lookupReplicants()
+   {
+      return drm.lookupReplicants(category);
+   }
+   public List lookupReplicants(String key)
+   {
+      return drm.lookupReplicants(key);
+   }
+   public void add(String key, Serializable data)
+      throws Exception
+   {
+      drm.add(key, data);
+   }
+   public void remove(String key)
+      throws Exception
+   {
+      drm.remove(key);
+   }
+   private synchronized long nextSequence()
+   {
+      return sequence ++;
+   }
+
+   public void replicantsChanged(String key, List newReplicants, int newReplicantsViewId)
+   {
+      NotifyData data = new NotifyData();
+      data.key = key;
+      data.newReplicants = newReplicants;
+      data.newReplicantsViewId = newReplicantsViewId;
+      String address = System.getProperty("jboss.bind.address");
+      long id = nextSequence();
+      Notification msg = new Notification("replicantsChanged", this, id, address);
+      msg.setUserData(data);
+      log.info("replicantsChanged, "+msg);
+      super.sendNotification(msg);
+   }
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/drm/DRMUser.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/drm/IReplicants.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/drm/IReplicants.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/drm/IReplicants.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,59 @@
+/*
+  * 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.hapartition.drm;
+
+import java.io.Serializable;
+import java.util.List;
+
+/** The public DistributedReplicantManager user service interface
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revison:$
+ */
+public interface IReplicants
+{
+   public static class NotifyData implements Serializable
+   {
+      static final long serialVersionUID = -1698998375571817852L;
+      public Serializable key;
+      public List newReplicants;
+      public int newReplicantsViewId;
+      public String toString()
+      {
+         StringBuffer tmp = new StringBuffer();
+         tmp.append("key:");
+         tmp.append(key);
+         tmp.append(", newReplicants:");
+         tmp.append(newReplicants);
+         return tmp.toString();
+      }
+   }
+
+   public Serializable lookupLocalReplicant();
+   public Serializable lookupLocalReplicant(String key);
+   public List lookupReplicants();
+   public List lookupReplicants(String key);
+   public void add(String key, Serializable data)
+      throws Exception;
+   public void remove(String key)
+      throws Exception;
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/drm/IReplicants.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/ds/DistributedStateUser.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/ds/DistributedStateUser.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/ds/DistributedStateUser.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,214 @@
+/*
+  * 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.hapartition.ds;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Iterator;
+import javax.management.Notification;
+import javax.naming.InitialContext;
+
+import org.jboss.ha.framework.interfaces.DistributedState;
+import org.jboss.ha.framework.interfaces.DistributedState.DSListenerEx;
+import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.JBossNotificationBroadcasterSupport;
+
+/** Tests of the DistributedState service  
+
+    @author <a href="mailto:Scott.Stark at jboss.org">Scott Stark</a>.
+    @version $Revision$
+*/
+public class DistributedStateUser extends JBossNotificationBroadcasterSupport
+   implements IDistributedState, DSListenerEx
+{
+   public static final String NOTIFY_CHANGE = "valueHasChanged";
+   public static final String NOTIFY_REMOVAL = "keyHasBeenRemoved";
+   
+   protected static Logger log = Logger.getLogger(DistributedStateUser.class);
+
+   protected DistributedState entryMap;
+   protected String category;
+   protected String partitionName;
+   protected long sequence;
+
+   public String getPartitionName()
+   {
+      return partitionName;
+   }
+   public void setPartitionName(String partitionName)
+   {
+      this.partitionName = partitionName;
+   }
+
+   public String getCategory()
+   {
+      return category;
+   }
+   public void setCategory(String category)
+   {
+      this.category = category;
+   }
+
+   public void start() throws Exception
+   {
+      // Lookup the partition
+      InitialContext ctx = new InitialContext();
+      String jndiName = "/HAPartition/" + partitionName;
+      HAPartition partition = (HAPartition) ctx.lookup(jndiName);
+      this.entryMap = partition.getDistributedStateService();
+      log.debug("Obtained DistributedState from partition="+partitionName);
+      entryMap.registerDSListenerEx(category, this);
+   }
+   public void stop()
+   {
+      entryMap.unregisterDSListenerEx(category, this);
+      flush();
+   }
+
+   public Serializable get(Serializable key)
+   {
+      Serializable value = entryMap.get(category, key);
+      log.debug("Get: "+key+", value: "+value);
+      return value;
+   }
+
+   public void put(Serializable key, Serializable value)
+      throws Exception
+   {
+      entryMap.set(category, key, value, false);
+      log.debug("Put: "+key+", value: "+value);
+   }
+
+   public void remove(Serializable key)
+      throws Exception
+   {
+      Object value = entryMap.remove(category, key, false);
+      log.debug("Removed: "+key+", value: "+value);
+   }
+   
+   public Collection listAllCategories()
+   {
+      // return results as a vector to avoid hashmap.keyset serialization error
+      Collection cats = entryMap.getAllCategories();
+      if (cats == null || cats.isEmpty()) {
+         return new java.util.Vector();
+      }
+      java.util.Vector vcats = new java.util.Vector();
+      java.util.Iterator iter = cats.iterator();
+      while (iter.hasNext())
+         vcats.add(iter.next());
+      return vcats;
+   }
+   
+   public Collection listAllKeys(String category)
+   {
+      // return results as a vector to avoid hashmap.keyset serialization error
+      Collection keys = entryMap.getAllKeys(category);
+      if (keys == null || keys.isEmpty()) {
+         return new java.util.Vector();
+      }
+      java.util.Vector vkeys = new java.util.Vector();
+      java.util.Iterator iter = keys.iterator();
+      while (iter.hasNext())
+         vkeys.add(iter.next());
+      return vkeys;
+   }
+   
+   public Collection listAllValues(String category)
+   {
+      // return results as a vector to avoid hashmap.keyset serialization error
+      Collection vals = entryMap.getAllKeys(category);
+      if (vals == null || vals.isEmpty()) {
+         return new java.util.Vector();
+      }
+      java.util.Vector vvals = new java.util.Vector();
+      java.util.Iterator iter = vals.iterator();
+      while (iter.hasNext())
+         vvals.add(iter.next());
+      return vvals;
+   }
+
+   /** Remove all entries from the cache.
+    */
+   public void flush()
+   {
+      Collection keys = entryMap.getAllKeys(category);
+      if(keys == null ) return;
+      // Notify the entries of their removal
+      Iterator iter = keys.iterator();
+      while( iter.hasNext() )
+      {
+         Serializable key = (Serializable) iter.next();
+         try
+         {
+            entryMap.remove(category, key);
+         }
+         catch(Exception e)
+         {
+            log.debug("Failed to remove: "+key, e);
+         }
+      }
+   }
+
+   public int size()
+   {
+      return entryMap.getAllKeys(category).size();
+   }
+
+   public void valueHasChanged(String category, Serializable key,
+      Serializable value, boolean locallyModified)
+   {
+      NotifyData data = new NotifyData();
+      data.category = category;
+      data.key = key;
+      data.value = value;
+      data.locallyModified = locallyModified;
+      String address = System.getProperty("jboss.bind.address");
+      long id = nextSequence();
+      Notification msg = new Notification(NOTIFY_CHANGE, this, id, address);
+      msg.setUserData(data);
+      log.debug("valueHasChanged, "+msg);
+      super.sendNotification(msg);
+   }
+
+   public void keyHasBeenRemoved(String category, Serializable key,
+      Serializable previousContent, boolean locallyModified)
+   {
+      NotifyData data = new NotifyData();
+      data.category = category;
+      data.key = key;
+      data.value = previousContent;
+      data.locallyModified = locallyModified;
+      String address = System.getProperty("jboss.bind.address");
+      long id = nextSequence();
+      Notification msg = new Notification(NOTIFY_REMOVAL, this, id, address);
+      msg.setUserData(data);
+      log.debug("keyHasBeenRemoved, "+msg);
+      super.sendNotification(msg);
+   }
+
+   private synchronized long nextSequence()
+   {
+      return sequence ++;
+   }
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/ds/DistributedStateUser.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/ds/IDistributedState.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/ds/IDistributedState.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/ds/IDistributedState.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,67 @@
+/*
+  * 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.hapartition.ds;
+
+import java.io.Serializable;
+import java.util.Collection;
+
+/** The public DistributedStateUser interface
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revison:$
+ */
+public interface IDistributedState
+{
+   public static class NotifyData implements Serializable
+   {
+      public String category;
+      public Serializable key;
+      public Serializable value;
+      public boolean locallyModified;
+      public String toString()
+      {
+         StringBuffer tmp = new StringBuffer();
+         tmp.append("category:");
+         tmp.append(category);
+         tmp.append(", key:");
+         tmp.append(key);
+         tmp.append(", value:");
+         tmp.append(value);
+         tmp.append(", locallyModified:");
+         tmp.append(locallyModified);
+         return tmp.toString();
+      }
+   }
+   public Serializable get(Serializable key);
+   public void put(Serializable key, Serializable value)
+      throws Exception;
+   public void remove(Serializable key)
+      throws Exception;
+   
+   public Collection listAllCategories();
+   public Collection listAllKeys(String category);
+   public Collection listAllValues(String category);
+
+   public void flush();
+   public int size();
+
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/ds/IDistributedState.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/Person.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/Person.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/Person.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.test.cluster.hapartition.rpc;
+
+import java.io.Serializable;
+import java.util.Calendar;
+
+public class Person implements Serializable
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 1L;
+
+   private Calendar dob;
+   private String name;
+   private String address;
+   private String city;
+   private String state;
+   private String postal;
+   private String employer;
+   private boolean notified = false;
+    
+   private Person() {}
+    
+   public Person(String name)
+   {
+      this.name = name;
+   }
+    
+   public void setAddress(String address, String city, String state, String postal)
+   {
+      this.address = address;
+      this.city = city;
+      this.state = state;
+      this.postal = postal;
+   }
+    
+   public void setDob(Calendar dob)
+   {
+      this.dob = dob;
+   }
+    
+    public Calendar getDob()
+    {
+       return dob;
+    }
+    
+    public String getName()
+    {
+       return name;
+    }
+    
+    public String getAddress()
+    {
+       return address;
+    }
+    
+    public String getCity()
+    {
+       return city;
+    }
+    
+    public String getState()
+    {
+       return state;
+    }
+    
+    public String getPostal()
+    {
+       return postal;
+    }
+    
+    public void setEmployer(String employer)
+    {
+       this.employer = employer;
+    }
+    
+    public String getEmployer()
+    {
+       return employer;
+    }
+    
+    public int getAge()
+    {
+       Calendar today = Calendar.getInstance();
+       int age = today.get(Calendar.YEAR) - dob.get(Calendar.YEAR);
+       dob.add(Calendar.YEAR, age);        
+       if (today.before(dob))
+       {
+          age--;
+       }
+       return age;
+    }
+    
+    public void setNotified(boolean notified)
+    {
+       this.notified = notified;
+    }
+    
+    public boolean getNotified()
+    {
+       return notified;
+    }
+    
+    public String toString()
+    {
+       StringBuffer sb = new StringBuffer();
+       sb.append("name: " + name);
+       if (dob != null)
+       {
+          sb.append("; dob: " + dob.getTime());
+       }
+       sb.append("; address: " + address + ", " + city + ", " + state + " " + postal);
+       sb.append("; employer: " + employer);
+        
+       return sb.toString();
+    }
+}
\ No newline at end of file


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/Person.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/PersonQuery.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/PersonQuery.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/PersonQuery.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.test.cluster.hapartition.rpc;
+
+import java.io.Serializable;
+
+/*
+ * trivial custom class to be used as parameter
+ */
+public class PersonQuery implements Serializable
+{  
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 1L;
+   
+   private String city = null;
+   private String state = null;
+   private String employer = null;
+   
+   public PersonQuery() {}
+
+   public void setCity(String city)
+   {
+      this.city = city;
+   }
+   
+   public String getCity()
+   {
+      return city;
+   }
+   
+   public void setState(String state)
+   {
+      this.state = state;
+   }
+   
+   public String getState()
+   {
+      return state;
+   }
+   
+   public void setEmployer(String employer)
+   {
+      this.employer = employer;
+   }
+   
+   public String getEmployer()
+   {
+      return employer;
+   }
+   
+   public boolean isMatch(Person person)
+   {
+      if (city != null && !city.equalsIgnoreCase(person.getCity()))
+         return false;
+      if (state != null && !state.equalsIgnoreCase(person.getState()))
+         return false;
+      if (employer != null && !employer.equalsIgnoreCase(person.getEmployer()))
+         return false;
+      
+      return true;
+   }
+   
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/PersonQuery.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/RPCUser.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/RPCUser.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/RPCUser.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,150 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, 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.hapartition.rpc;
+
+import javax.naming.InitialContext;
+import java.util.ArrayList;
+import java.util.GregorianCalendar;
+
+import org.jboss.ha.framework.interfaces.ClusterNode;
+import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.logging.Logger;
+import org.jboss.system.ServiceMBeanSupport;
+
+/** Tests of clustered RPC calls
+*
+* @author Jerry Gauthier
+* @version $Revision$
+*/
+public class RPCUser extends ServiceMBeanSupport implements RPCUserMBean
+{  
+   protected static Logger log = Logger.getLogger(RPCUser.class);
+   private static final String JNDI_PARTITION = "/HAPartition/";
+   private static final String METHOD_GET_PERSON = "getPerson";
+   private static final String METHOD_GET_PERSON_MATCH = "getPersonMatch";
+   private static final String METHOD_NOTIFY_PERSON = "notifyPerson";
+
+   protected String rpcServiceName;
+   protected HAPartition partition = null;
+   private Person myPerson = null;
+
+   public String getPartitionName()
+   {
+      return (partition == null) ? null : partition.getPartitionName();
+   }
+   
+   public HAPartition getHAPartition()
+   {
+      return partition;
+   }
+   
+   public void setHAPartition(HAPartition partition)
+   {
+      this.partition = partition;
+   }
+   
+   public void startService() throws Exception
+   {
+      rpcServiceName = this.serviceName.toString();
+      log.debug("RPCTestCase.startService() - " + rpcServiceName);
+      
+      if (partition == null)
+         throw new IllegalStateException("RPCUser partition is null");
+
+      ClusterNode me = partition.getClusterNode();
+      ClusterNode[] nodes = partition.getClusterNodes();
+      boolean isFirstNode = (nodes != null && nodes[0].equals(me));
+      
+      // register the service with the partition
+      // note that "OneNode" services are only registered on the first node
+      if (rpcServiceName.indexOf("OneNode") < 0 || isFirstNode)
+      {
+         // ClassLoader services register with a classloader reference
+         if (rpcServiceName.indexOf("ClassLoader") >= 0)
+            partition.registerRPCHandler(rpcServiceName, this, Thread.currentThread().getContextClassLoader());
+         else
+            partition.registerRPCHandler(rpcServiceName, this);
+      }
+      
+      // add a different person to each of the two nodes
+      Person p;
+      if (isFirstNode)
+      {
+         p = new Person("John White");
+         p.setAddress("Main Street", "Boston", "MA", "02101");
+         p.setDob(new GregorianCalendar(1965, GregorianCalendar.MARCH, 30));
+         p.setEmployer("WidgetsRUs");
+      }
+      else
+      {
+         p = new Person("Jane Brown");
+         p.setAddress("High Street", "Cambridge", "MA", "02141");
+         p.setDob(new GregorianCalendar(1970, GregorianCalendar.JULY, 15));
+         p.setEmployer("AcmeLtd");
+      }
+      myPerson = p;
+       
+   }   
+  
+   public ArrayList runRetrieveAll() throws Exception
+   {
+      return partition.callMethodOnCluster(rpcServiceName, METHOD_GET_PERSON, null, null, false);
+   }
+   
+   public ArrayList runRetrieveQuery(PersonQuery query) throws Exception
+   {
+      Object[] parms = new Object[]{query};
+      Class[] types = new Class[]{PersonQuery.class};
+      return partition.callMethodOnCluster(rpcServiceName, METHOD_GET_PERSON_MATCH, parms, types, false);
+   }
+   
+   public ArrayList runRetrieveFromCoordinator() throws Exception
+   {
+      return partition.callMethodOnCoordinatorNode(rpcServiceName, METHOD_GET_PERSON, null, null, false);
+   }
+   
+   public void runNotifyAllAsynch() throws Exception
+   {
+      Object[] parms = new Object[]{Boolean.TRUE};
+      Class[] types = new Class[]{Boolean.class};
+      partition.callAsynchMethodOnCluster(rpcServiceName, METHOD_NOTIFY_PERSON, parms, types, false);
+   }
+   
+   public Person getPerson()
+   {
+      return myPerson;
+   }
+   
+   public Person getPersonMatch(PersonQuery query)
+   {
+      if (query.isMatch(myPerson))
+         return myPerson;
+      else
+         return null;
+   }
+   
+   public void notifyPerson(Boolean notify)
+   {
+      myPerson.setNotified(notify.booleanValue());
+   }
+
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/RPCUser.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/RPCUserMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/RPCUserMBean.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/RPCUserMBean.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.test.cluster.hapartition.rpc;
+
+import java.util.ArrayList;
+
+import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.system.ServiceMBean;
+
+public interface RPCUserMBean extends ServiceMBean {
+    
+    public ArrayList runRetrieveAll() throws Exception;
+    public ArrayList runRetrieveQuery(PersonQuery query) throws Exception;
+    public ArrayList runRetrieveFromCoordinator() throws Exception;
+    public void runNotifyAllAsynch() throws Exception;
+    public HAPartition getHAPartition();
+    public void setHAPartition(HAPartition partition);
+    public String getPartitionName();
+    
+}
+


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/RPCUserMBean.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/AbstractHAPartitionStateTransfer.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/AbstractHAPartitionStateTransfer.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/AbstractHAPartitionStateTransfer.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,69 @@
+package org.jboss.test.cluster.hapartition.state;
+
+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 
+      implements HAPartitionStateTransferMBean
+{  
+//   private HAPartition haPartition;
+   private Object transferredState;
+   private String serviceHAName;
+
+   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();
+//   }
+
+   public String getServiceHAName()
+   {
+      return serviceHAName;
+   }
+
+   public void setServiceHAName(String serviceHAName)
+   {
+      this.serviceHAName = serviceHAName;
+   }
+
+   public Serializable getCurrentState()
+   {
+      return null;
+   }
+
+//   @Override
+//   public void setClusterPartition(ClusterPartitionMBean clusterPartition)
+//   {
+//      super.setClusterPartition(clusterPartition);
+//      haPartition = clusterPartition.getHAPartition();
+//      haPartition.subscribeToStateTransferEvents(getServiceHAName(), this);
+//   }
+   
+   
+   
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/AbstractHAPartitionStateTransfer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionState.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionState.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionState.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,44 @@
+/*
+ * 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.hapartition.state;
+
+import java.io.IOException;
+import java.io.Serializable;
+
+/**
+ * Object that will throw an exception upon deserialization, allowing
+ * a test of a failure to deserialize a state transfer.
+ * 
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision$
+ */
+public class BadHAPartitionState implements Serializable
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 0L;
+
+   private void readObject(java.io.ObjectInputStream in)
+         throws IOException, ClassNotFoundException
+   {
+      throw new BadHAPartitionStateException("BadHAPartitionState cannot be deserialized");
+   }
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionState.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionStateException.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionStateException.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionStateException.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,55 @@
+/*
+ * 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.hapartition.state;
+
+/**
+ * Exception thrown by BadHAPartition state upon deserialization.
+ * 
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision$
+ */
+public class BadHAPartitionStateException extends RuntimeException
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 0L;
+
+   public BadHAPartitionStateException()
+   {
+      super();
+   }
+
+   public BadHAPartitionStateException(String message)
+   {
+      super(message);
+   }
+
+   public BadHAPartitionStateException(Throwable cause)
+   {
+      super(cause);
+   }
+
+   public BadHAPartitionStateException(String message, Throwable cause)
+   {
+      super(message, cause);
+   }
+
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionStateException.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionStateTransfer.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionStateTransfer.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionStateTransfer.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,65 @@
+/*
+ * 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.hapartition.state;
+
+import java.io.Serializable;
+
+/**
+ * HAPartitionStateTransfer impl that will return an object that
+ * throws an exception when deserialized.  Tests what happens when
+ * there is failure handling the state transfer on the recipient side.
+ * 
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision$
+ */
+public class BadHAPartitionStateTransfer 
+      extends AbstractHAPartitionStateTransfer 
+      implements BadHAPartitionStateTransferMBean
+{   
+   private boolean returnState;
+
+   public Serializable getCurrentState()
+   {
+      if (returnState)
+         return new BadHAPartitionState();
+      
+      throw new BadHAPartitionStateException("Configured not to return state");
+   }
+
+   public void setCurrentState(Serializable newState)
+   {
+      // no-op
+   }
+
+   public boolean getReturnState()
+   {
+      return returnState;
+   }
+
+   public void setReturnState(boolean returnState)
+   {
+      this.returnState = returnState;
+   }
+   
+   
+
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionStateTransfer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionStateTransferMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionStateTransferMBean.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionStateTransferMBean.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,40 @@
+/*
+ * 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.hapartition.state;
+
+
+/**
+ * HAPartitionStateTransfer impl that will return an object that
+ * throws an exception when deserialized.  Tests what happens when
+ * there is failure handling the state transfer on the recipient side.
+ * 
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision$
+ */
+public interface BadHAPartitionStateTransferMBean 
+   extends HAPartitionStateTransferMBean
+{
+   public boolean getReturnState();
+
+   public void setReturnState(boolean returnState);
+
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/BadHAPartitionStateTransferMBean.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/CustomStateHAPartitionStateTransfer.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/CustomStateHAPartitionStateTransfer.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/CustomStateHAPartitionStateTransfer.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,27 @@
+package org.jboss.test.cluster.hapartition.state;
+
+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;
+      }
+   }
+
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/CustomStateHAPartitionStateTransfer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/CustomStateHAPartitionStateTransferMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/CustomStateHAPartitionStateTransferMBean.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/CustomStateHAPartitionStateTransferMBean.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,6 @@
+package org.jboss.test.cluster.hapartition.state;
+
+public interface CustomStateHAPartitionStateTransferMBean extends HAPartitionStateTransferMBean
+{
+
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/CustomStateHAPartitionStateTransferMBean.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/HAPartitionRecorder.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/HAPartitionRecorder.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/HAPartitionRecorder.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -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.hapartition.state;
+
+/**
+ * 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$
+ */
+public class HAPartitionRecorder implements HAPartitionRecorderMBean
+{
+   private Exception startupException;
+   
+   public Exception getStartupException()
+   {
+      return startupException;
+   }
+   public void setStartupException(Exception startupException)
+   {
+      this.startupException = startupException;
+   }
+   
+   
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/HAPartitionRecorder.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/HAPartitionRecorderMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/HAPartitionRecorderMBean.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/HAPartitionRecorderMBean.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -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.hapartition.state;
+
+/**
+ * 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$
+ */
+public interface HAPartitionRecorderMBean
+{
+
+   Exception getStartupException();
+
+   void setStartupException(Exception startupException);
+
+}
\ No newline at end of file


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/HAPartitionRecorderMBean.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/HAPartitionStateTransferMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/HAPartitionStateTransferMBean.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/HAPartitionStateTransferMBean.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,13 @@
+package org.jboss.test.cluster.hapartition.state;
+
+import org.jboss.ha.framework.interfaces.HAPartition.HAPartitionStateTransfer;
+import org.jboss.ha.jmx.HAServiceMBean;
+
+public interface HAPartitionStateTransferMBean 
+      extends HAPartitionStateTransfer
+{
+   Object getTransferredState();
+   
+   String getServiceHAName();
+   void setServiceHAName(String name);
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/HAPartitionStateTransferMBean.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/SimpleHAPartitionStateTransfer.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/SimpleHAPartitionStateTransfer.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/SimpleHAPartitionStateTransfer.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,16 @@
+package org.jboss.test.cluster.hapartition.state;
+
+import java.io.Serializable;
+
+public class SimpleHAPartitionStateTransfer 
+   extends AbstractHAPartitionStateTransfer
+   implements SimpleHAPartitionStateTransferMBean
+{
+   public static final String SIMPLE = "Simple";
+   
+   public Serializable getCurrentState()
+   {
+      return SIMPLE;
+   }
+
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/SimpleHAPartitionStateTransfer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/SimpleHAPartitionStateTransferMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/SimpleHAPartitionStateTransferMBean.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/SimpleHAPartitionStateTransferMBean.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,7 @@
+package org.jboss.test.cluster.hapartition.state;
+
+public interface SimpleHAPartitionStateTransferMBean 
+   extends HAPartitionStateTransferMBean
+{
+
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/SimpleHAPartitionStateTransferMBean.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/StartupTestClusterPartition.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/StartupTestClusterPartition.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/StartupTestClusterPartition.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,88 @@
+/*
+ * 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.hapartition.state;
+
+import java.util.List;
+
+import org.jboss.ha.framework.server.ClusterPartition;
+import org.jboss.ha.framework.server.ClusterPartitionConfig;
+
+/**
+ * ClusterPartition that uses StartupTestHAPartition as its HAPartition impl.
+ * 
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision$
+ */
+public class StartupTestClusterPartition 
+      extends ClusterPartition
+      implements StartupTestClusterPartitionMBean
+{
+   private HAPartitionRecorderMBean startupRecorder;
+   private List<HAPartitionStateTransferMBean> stateTransferTargets;
+   
+   public StartupTestClusterPartition(ClusterPartitionConfig config)
+   {
+      super(config);
+   }  
+   
+   public HAPartitionRecorderMBean getStartupRecorder()
+   {
+      return startupRecorder;
+   }
+
+   public void setStartupRecorder(HAPartitionRecorderMBean startupRecorder)
+   {
+      this.startupRecorder = startupRecorder;
+   }
+
+   public void start() throws Exception
+   {
+      try
+      {
+         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);
+      }
+      
+   }  
+   
+   
+
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/StartupTestClusterPartition.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/StartupTestClusterPartitionMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/StartupTestClusterPartitionMBean.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/StartupTestClusterPartitionMBean.java	2007-07-24 03:15:36 UTC (rev 64235)
@@ -0,0 +1,42 @@
+/*
+ * 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.hapartition.state;
+
+import java.util.List;
+
+import org.jboss.ha.framework.interfaces.HAPartition.HAPartitionStateTransfer;
+import org.jboss.ha.framework.server.ClusterPartitionMBean;
+
+/**
+ * ClusterPartition that uses StartupTestHAPartition as its HAPartition impl.
+ * 
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision$
+ */
+public interface StartupTestClusterPartitionMBean extends ClusterPartitionMBean
+{   
+   HAPartitionRecorderMBean getStartupRecorder();
+   void setStartupRecorder(HAPartitionRecorderMBean startupRecorder);
+
+   List<HAPartitionStateTransferMBean> getStateTransferTargets();
+   void setStateTransferTargets(List<HAPartitionStateTransferMBean> targets);
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/state/StartupTestClusterPartitionMBean.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list