[Jboss-cvs] JBossAS SVN: r56092 - in trunk/testsuite: imports/sections src/main/org/jboss/test/cluster/partition src/main/org/jboss/test/cluster/partition/test src/resources/cluster/partition
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Aug 18 22:23:55 EDT 2006
Author: bstansberry at jboss.com
Date: 2006-08-18 22:23:52 -0400 (Fri, 18 Aug 2006)
New Revision: 56092
Added:
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/BadHAPartitionState.java
trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateException.java
trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransfer.java
trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransferMBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/partition/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/main/org/jboss/test/cluster/partition/test/BadStateTransferTestCase.java
trunk/testsuite/src/resources/cluster/partition/jboss-service.xml
Modified:
trunk/testsuite/imports/sections/cluster.xml
Log:
[JBAS-2950] Test that state transfer failure aborts HAPartition start
Modified: trunk/testsuite/imports/sections/cluster.xml
===================================================================
--- trunk/testsuite/imports/sections/cluster.xml 2006-08-19 02:23:50 UTC (rev 56091)
+++ trunk/testsuite/imports/sections/cluster.xml 2006-08-19 02:23:52 UTC (rev 56092)
@@ -28,7 +28,16 @@
<include name="org/jboss/test/cluster/test/*_Stub.class"/>
</fileset>
</jar>
-
+
+ <jar destfile="${build.lib}/badstatetransfer.sar">
+ <metainf dir="${build.resources}/cluster/partition">
+ <include name="jboss-service.xml"/>
+ </metainf>
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/cluster/partition/*"/>
+ </fileset>
+ </jar>
+
<!-- build httpsessionreplication.jar -->
<war warfile="${build.lib}/http-sr.war"
webxml="${build.resources}/cluster/http/web.xml">
Added: trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionRecorder.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionRecorder.java 2006-08-19 02:23:50 UTC (rev 56091)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionRecorder.java 2006-08-19 02:23:52 UTC (rev 56092)
@@ -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 BadHAPartitionRecorder implements BadHAPartitionRecorderMBean
+{
+ private Exception startupException;
+
+ public Exception getStartupException()
+ {
+ return startupException;
+ }
+ public void setStartupException(Exception startupException)
+ {
+ this.startupException = startupException;
+ }
+
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionRecorderMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionRecorderMBean.java 2006-08-19 02:23:50 UTC (rev 56091)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionRecorderMBean.java 2006-08-19 02:23:52 UTC (rev 56092)
@@ -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 BadHAPartitionRecorderMBean
+{
+
+ Exception getStartupException();
+
+ void setStartupException(Exception startupException);
+
+}
\ No newline at end of file
Added: trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionState.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionState.java 2006-08-19 02:23:50 UTC (rev 56091)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionState.java 2006-08-19 02:23:52 UTC (rev 56092)
@@ -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.partition;
+
+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: 1.1 $
+ */
+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");
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateException.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateException.java 2006-08-19 02:23:50 UTC (rev 56091)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateException.java 2006-08-19 02:23:52 UTC (rev 56092)
@@ -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.partition;
+
+/**
+ * Exception thrown by BadHAPartition state upon deserialization.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1.1 $
+ */
+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);
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransfer.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransfer.java 2006-08-19 02:23:50 UTC (rev 56091)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransfer.java 2006-08-19 02:23:52 UTC (rev 56092)
@@ -0,0 +1,86 @@
+/*
+ * 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;
+
+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
+ * 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: 1.1 $
+ */
+public class BadHAPartitionStateTransfer
+ extends HAServiceMBeanSupport
+ implements HAPartitionStateTransfer, BadHAPartitionStateTransferMBean
+{
+ private HAPartition haPartition;
+ 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
+ }
+
+ 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;
+ }
+
+ public void setReturnState(boolean returnState)
+ {
+ this.returnState = returnState;
+ }
+
+
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransferMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransferMBean.java 2006-08-19 02:23:50 UTC (rev 56091)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/BadHAPartitionStateTransferMBean.java 2006-08-19 02:23:52 UTC (rev 56092)
@@ -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.partition;
+
+import org.jboss.ha.jmx.HAServiceMBean;
+
+/**
+ * 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: 1.1 $
+ */
+public interface BadHAPartitionStateTransferMBean extends HAServiceMBean
+{
+ public boolean getReturnState();
+
+ public void setReturnState(boolean returnState);
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartition.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartition.java 2006-08-19 02:23:50 UTC (rev 56091)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartition.java 2006-08-19 02:23:52 UTC (rev 56092)
@@ -0,0 +1,69 @@
+/*
+ * 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;
+
+import org.jboss.ha.framework.server.ClusterPartition;
+import org.jboss.ha.framework.server.HAPartitionImpl;
+
+/**
+ * ClusterPartition that uses StartupTestHAPartition as its HAPartition impl.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1.1 $
+ */
+public class StartupTestClusterPartition
+ extends ClusterPartition
+ implements StartupTestClusterPartitionMBean
+{
+ private StartupTestHAPartition startupPartition;
+ private BadHAPartitionRecorderMBean startupRecorder;
+
+ public StartupTestClusterPartition()
+ {
+ super();
+ }
+
+ public BadHAPartitionRecorderMBean getStartupRecorder()
+ {
+ return startupRecorder;
+ }
+
+ public void setStartupRecorder(BadHAPartitionRecorderMBean startupRecorder)
+ {
+ this.startupRecorder = startupRecorder;
+ }
+
+ /**
+ * Extension point meant for test cases; instantiates the HAPartition.
+ * Test cases can instantiate their own subclass of HAPartition impl.
+ */
+ protected HAPartitionImpl createPartition() throws Exception
+ {
+ startupPartition = new StartupTestHAPartition(startupRecorder, getPartitionName(), getChannel(), this.getDeadlockDetection(), getServer());
+ startupPartition.setStateTransferTimeout(this.getStateTransferTimeout());
+ startupPartition.setMethodCallTimeout(getMethodCallTimeout());
+ return startupPartition;
+ }
+
+
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartitionMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartitionMBean.java 2006-08-19 02:23:50 UTC (rev 56091)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestClusterPartitionMBean.java 2006-08-19 02:23:52 UTC (rev 56092)
@@ -0,0 +1,37 @@
+/*
+ * 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;
+
+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: 1.1 $
+ */
+public interface StartupTestClusterPartitionMBean extends ClusterPartitionMBean
+{
+ BadHAPartitionRecorderMBean getStartupRecorder();
+ void setStartupRecorder(BadHAPartitionRecorderMBean startupRecorder);
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestHAPartition.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestHAPartition.java 2006-08-19 02:23:50 UTC (rev 56091)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/StartupTestHAPartition.java 2006-08-19 02:23:52 UTC (rev 56092)
@@ -0,0 +1,62 @@
+/*
+ * 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;
+
+import javax.management.MBeanServer;
+
+import org.jboss.ha.framework.server.HAPartitionImpl;
+import org.jgroups.JChannel;
+
+/**
+ * HAPartitionImpl subclass that catches any exception thrown in startService(),
+ * storing it in a BadHAPartitionRecorder (where it subsequently can be evaluated
+ * by the test client) before throwing it on.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1.1 $
+ */
+public class StartupTestHAPartition extends HAPartitionImpl
+{
+ private BadHAPartitionRecorderMBean startupRecorder;
+
+ public StartupTestHAPartition(BadHAPartitionRecorderMBean recorder, String partitionName, JChannel channel, boolean deadlock_detection, MBeanServer server)
+ throws Exception
+ {
+ super(partitionName, channel, deadlock_detection, server);
+ this.startupRecorder = recorder;
+ }
+
+ public void startPartition() throws Exception
+ {
+ try
+ {
+ super.startPartition();
+ }
+ catch (Exception e)
+ {
+ startupRecorder.setStartupException(e);
+ throw e;
+ }
+ }
+
+
+}
Added: 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-19 02:23:50 UTC (rev 56091)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/partition/test/BadStateTransferTestCase.java 2006-08-19 02:23:52 UTC (rev 56092)
@@ -0,0 +1,114 @@
+/*
+ * 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
+ }
+
+
+}
Added: trunk/testsuite/src/resources/cluster/partition/jboss-service.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/partition/jboss-service.xml 2006-08-19 02:23:50 UTC (rev 56091)
+++ trunk/testsuite/src/resources/cluster/partition/jboss-service.xml 2006-08-19 02:23:52 UTC (rev 56092)
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Sample Clustering Service Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <!-- ClusterPartition requires a TreeCache for state management -->
+ <mbean code="org.jboss.cache.TreeCache"
+ name="jboss:service=ClusterTreeCache,partition=BadPartition">
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!--JGroups multiplexer is required for this cache -->
+ <depends>jgroups.mux:name=Multiplexer</depends>
+ <attribute name="MultiplexerService">jgroups.mux:name=Multiplexer</attribute>
+ <attribute name="MultiplexerStack">fc-fast-minimalthreads</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all nodes in clusters,
+ in order to find each other -->
+ <attribute name="ClusterName">BadPartition-TreeCache</attribute>
+
+
+ <attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
+
+ <!-- Valid isolation levels are
+ SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!-- Valid modes are LOCAL, REPL_ASYNC and REPL_SYNC -->
+ <attribute name="CacheMode">REPL_SYNC</attribute>
+
+ <!-- Just used for async repl: use a replication queue -->
+ <attribute name="UseReplQueue">false</attribute>
+
+ <!-- Replication interval for replication queue (in ms) -->
+ <attribute name="ReplQueueInterval">0</attribute>
+
+ <!-- Max number of elements which trigger replication -->
+ <attribute name="ReplQueueMaxElements">0</attribute>
+
+ <!-- Whether or not to fetch state on joining a cluster -->
+ <attribute name="FetchInMemoryState">true</attribute>
+
+ <!-- The max amount of time (in milliseconds) we wait until the
+ initial state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment -->
+ <attribute name="InitialStateRetrievalTimeout">5000</attribute>
+
+ <!-- Number of milliseconds to wait until all responses for a
+ synchronous call have been received. -->
+ <attribute name="SyncReplTimeout">10000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+ <!-- Name of the eviction policy class. Not supported now. -->
+ <attribute name="EvictionPolicyClass"></attribute>
+
+ </mbean>
+
+ <!-- ==================================================================== -->
+ <!-- Partition used for testing failure to receive state -->
+ <!-- ==================================================================== -->
+
+
+ <!-- Service to record and cache any failures in the partition -->
+ <mbean code="org.jboss.test.cluster.partition.BadHAPartitionRecorder"
+ name="jboss:service=BadProviderPartitionRecorder"/>
+
+ <mbean code="org.jboss.test.cluster.partition.StartupTestClusterPartition"
+ name="jboss:service=BadProviderPartition">
+
+ <depends optional-attribute-name="StartupRecorder"
+ proxy-type="attribute">jboss:service=BadProviderPartitionRecorder</depends>
+
+ <!-- ClusterPartition requires a TreeCache for state management -->
+ <depends optional-attribute-name="TreeCache"
+ proxy-type="attribute">jboss:service=ClusterTreeCache,partition=BadPartition</depends>
+
+ <!-- Name of the partition being built -->
+ <attribute name="PartitionName">BadProviderPartition</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.BadHAPartitionStateTransfer"
+ name="jboss.test:service=BadHAPartitionStateTransfer,returnState=false">
+
+ <depends optional-attribute-name="ClusterPartition"
+ proxy-type="attribute">jboss:service=BadProviderPartition</depends>
+
+ <attribute name="ReturnState">false</attribute>
+
+ </mbean>
+
+ <!-- ==================================================================== -->
+ <!-- Partition used for testing failure to integrate state -->
+ <!-- ==================================================================== -->
+
+
+ <!-- Service to record and cache any failures in the partition -->
+ <mbean code="org.jboss.test.cluster.partition.BadHAPartitionRecorder"
+ name="jboss:service=BadStatePartitionRecorder"/>
+
+ <mbean code="org.jboss.test.cluster.partition.StartupTestClusterPartition"
+ name="jboss:service=BadStatePartition">
+
+ <depends optional-attribute-name="StartupRecorder"
+ proxy-type="attribute">jboss:service=BadStatePartitionRecorder</depends>
+
+ <!-- ClusterPartition requires a TreeCache for state management -->
+ <depends optional-attribute-name="TreeCache"
+ proxy-type="attribute">jboss:service=ClusterTreeCache,partition=BadPartition</depends>
+
+ <!-- Name of the partition being built -->
+ <attribute name="PartitionName">BadStatePartition</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.BadHAPartitionStateTransfer"
+ name="jboss.test:service=BadHAPartitionStateTransfer,returnState=true">
+
+ <depends optional-attribute-name="ClusterPartition"
+ proxy-type="attribute">jboss:service=BadStatePartition</depends>
+
+ <attribute name="ReturnState">true</attribute>
+
+ </mbean>
+
+</server>
More information about the jboss-cvs-commits
mailing list