[jboss-cvs] JBossAS SVN: r100299 - in trunk/testsuite: src/main/org/jboss/test/cluster/defaultcfg/test and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Feb 2 15:40:04 EST 2010
Author: bstansberry at jboss.com
Date: 2010-02-02 15:40:03 -0500 (Tue, 02 Feb 2010)
New Revision: 100299
Added:
trunk/testsuite/src/main/org/jboss/test/cluster/hasingleton/HASingletonMBeanExample.java
trunk/testsuite/src/main/org/jboss/test/cluster/hasingleton/HASingletonMBeanExampleMBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/hasingleton/HASingletonPojoExample.java
Modified:
trunk/testsuite/imports/sections/cluster.xml
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/HASingletonControllerBeanUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/HASingletonElectionPolicyTestCase.java
trunk/testsuite/src/resources/cluster/hasingleton/electionpolicy/ha-electionpolicy-jboss-beans.xml
trunk/testsuite/src/resources/cluster/hasingleton/ha-singleton-jboss-beans.xml
Log:
[JBAS-7687] Don't use examples from cluster module; it makes the eclipse classpath a pain
Modified: trunk/testsuite/imports/sections/cluster.xml
===================================================================
--- trunk/testsuite/imports/sections/cluster.xml 2010-02-02 20:30:37 UTC (rev 100298)
+++ trunk/testsuite/imports/sections/cluster.xml 2010-02-02 20:40:03 UTC (rev 100299)
@@ -95,15 +95,25 @@
file="${build.resources}/cluster/hasingleton/deployer/test-deploy-hasingleton-jboss-beans.xml"
overwrite="true"/>
- <!--beans for testing HASingletonElectionPolicy -->
- <copy todir="${build.lib}"
- file="${build.resources}/cluster/hasingleton/electionpolicy/ha-electionpolicy-jboss-beans.xml"
- overwrite="true"/>
-
+ <!--sar for testing HASingletonElectionPolicy -->
+ <jar destfile="${build.lib}/ha-singleton-election.sar">
+ <metainf dir="${build.resources}/cluster/hasingleton/electionpolicy">
+ <include name="ha-electionpolicy-jboss-beans.xml"/>
+ </metainf>
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/cluster/hasingleton/*Example*.class"/>
+ </fileset>
+ </jar>
+
<!--beans for testing HASingletonControllerBeanUnitTestCase -->
- <copy todir="${build.lib}"
- file="${build.resources}/cluster/hasingleton/ha-singleton-jboss-beans.xml"
- overwrite="true"/>
+ <jar destfile="${build.lib}/ha-singleton-pojo.sar">
+ <metainf dir="${build.resources}/cluster/hasingleton/">
+ <include name="ha-singleton-jboss-beans.xml"/>
+ </metainf>
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/cluster/hasingleton/*Example*.class"/>
+ </fileset>
+ </jar>
<!--beans for testing HAServiceUnitTestCase, HASingletonUnitTestCase -->
<jar destfile="${build.lib}/ha-service.sar">
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/HASingletonControllerBeanUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/HASingletonControllerBeanUnitTestCase.java 2010-02-02 20:30:37 UTC (rev 100298)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/HASingletonControllerBeanUnitTestCase.java 2010-02-02 20:40:03 UTC (rev 100299)
@@ -31,8 +31,8 @@
import junit.framework.Test;
-import org.jboss.ha.singleton.examples.HASingletonPojoExample;
import org.jboss.test.JBossClusteredTestCase;
+import org.jboss.test.cluster.hasingleton.HASingletonPojoExample;
/**
* HASingletonControllerBeanUnitTestCase.
@@ -50,7 +50,7 @@
public static Test suite() throws Exception
{
- return getDeploySetup(HASingletonControllerBeanUnitTestCase.class, "ha-singleton-jboss-beans.xml");
+ return getDeploySetup(HASingletonControllerBeanUnitTestCase.class, "ha-singleton-pojo.sar");
}
public void testBeanDeployment() throws Exception
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/HASingletonElectionPolicyTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/HASingletonElectionPolicyTestCase.java 2010-02-02 20:30:37 UTC (rev 100298)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/HASingletonElectionPolicyTestCase.java 2010-02-02 20:40:03 UTC (rev 100299)
@@ -31,8 +31,8 @@
import junit.framework.Test;
-import org.jboss.ha.singleton.examples.HASingletonPojoExample;
import org.jboss.test.JBossClusteredTestCase;
+import org.jboss.test.cluster.hasingleton.HASingletonPojoExample;
/**
* Unit tests for HASingletonElectionPolicy.
@@ -58,7 +58,7 @@
public static Test suite() throws Exception
{
// Refer to jboss-service.xml under resources/ha/electionpolicy
- return getDeploySetup(HASingletonElectionPolicyTestCase.class, "ha-electionpolicy-jboss-beans.xml");
+ return getDeploySetup(HASingletonElectionPolicyTestCase.class, "ha-singleton-election.sar");
}
public void testMBeanElectionPolicy() throws Exception
Copied: trunk/testsuite/src/main/org/jboss/test/cluster/hasingleton/HASingletonMBeanExample.java (from rev 100296, trunk/cluster/src/examples/org/jboss/ha/singleton/examples/HASingletonMBeanExample.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hasingleton/HASingletonMBeanExample.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hasingleton/HASingletonMBeanExample.java 2010-02-02 20:40:03 UTC (rev 100299)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.hasingleton;
+
+import org.jboss.logging.Logger;
+
+/**
+ * <p>
+ * An sample singleton MBean.
+ * </p>
+ *
+ * @author Ivelin Ivanov <ivelin at apache.org>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class HASingletonMBeanExample
+ implements HASingletonMBeanExampleMBean
+{
+ private static Logger log = Logger.getLogger(HASingletonMBeanExample.class);
+ private boolean isMasterNode = false;
+
+ public void startSingleton()
+ {
+ isMasterNode = true;
+ log.info("Notified to start as singleton");
+ }
+
+ public boolean isMasterNode()
+ {
+ return isMasterNode;
+ }
+
+ public void stopSingleton( String gracefulShutdown )
+ {
+ isMasterNode = false;
+ log.info("Notified to stop as singleton with argument: " + gracefulShutdown);
+ }
+
+}
Copied: trunk/testsuite/src/main/org/jboss/test/cluster/hasingleton/HASingletonMBeanExampleMBean.java (from rev 100296, trunk/cluster/src/examples/org/jboss/ha/singleton/examples/HASingletonMBeanExampleMBean.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hasingleton/HASingletonMBeanExampleMBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hasingleton/HASingletonMBeanExampleMBean.java 2010-02-02 20:40:03 UTC (rev 100299)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.hasingleton;
+
+/**
+ *
+ * Sample Singleton MBean interface
+ *
+ * @author Ivelin Ivanov <ivelin at apache.org>
+ *
+ */
+public interface HASingletonMBeanExampleMBean
+{
+
+ /**
+ *
+ * @return true if the node that this MBean is registered with
+ * is the master node for the singleton service
+ *
+ */
+ public boolean isMasterNode();
+
+ /**
+ *
+ * Invoked when this mbean is elected to run the singleton service,
+ * or in other words when this node is elected for master.
+ *
+ */
+ public void startSingleton();
+
+ /**
+ *
+ * Invoked when this mbean is elected to no longer run the singleton service,
+ * or in other words when this node is elected for slave.
+ *
+ * @param String gracefulShutdown is an example argument passed on singleton stop
+ *
+ */
+ public void stopSingleton( String gracefulShutdown );
+
+
+}
Copied: trunk/testsuite/src/main/org/jboss/test/cluster/hasingleton/HASingletonPojoExample.java (from rev 100280, trunk/cluster/src/examples/org/jboss/ha/singleton/examples/HASingletonPojoExample.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hasingleton/HASingletonPojoExample.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hasingleton/HASingletonPojoExample.java 2010-02-02 20:40:03 UTC (rev 100299)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.hasingleton;
+
+import java.io.Serializable;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.logging.Logger;
+import org.jboss.naming.Util;
+
+/**
+ * Ha Singleton Pojo example.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class HASingletonPojoExample implements Serializable
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 6823691561869778917L;
+
+ private static Logger log = Logger.getLogger(HASingletonPojoExample.class);
+
+ private final String jndiName;
+
+ private boolean isMasterNode;
+
+ public HASingletonPojoExample(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
+ public void startSingleton() throws NamingException
+ {
+ isMasterNode = true;
+
+ InitialContext ctx = new InitialContext();
+ Util.rebind(ctx, jndiName, this);
+
+ log.info("Notified to start as singleton and bound to jndi under " + jndiName);
+ }
+
+ public boolean isMasterNode()
+ {
+ return isMasterNode;
+ }
+
+ public void stopSingleton() throws NamingException
+ {
+ isMasterNode = false;
+
+ InitialContext ctx = new InitialContext();
+ Util.unbind(ctx, jndiName);
+
+ log.info("Notified to stop as singleton and unbound from jndi under " + jndiName);
+ }
+
+}
Modified: trunk/testsuite/src/resources/cluster/hasingleton/electionpolicy/ha-electionpolicy-jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/hasingleton/electionpolicy/ha-electionpolicy-jboss-beans.xml 2010-02-02 20:30:37 UTC (rev 100298)
+++ trunk/testsuite/src/resources/cluster/hasingleton/electionpolicy/ha-electionpolicy-jboss-beans.xml 2010-02-02 20:40:03 UTC (rev 100299)
@@ -7,9 +7,9 @@
<!-- ==================================================================== -->
<!-- First HASingleton, Election policy is to choose the oldest node as master -->
- <bean class="org.jboss.ha.singleton.examples.HASingletonMBeanExample"
+ <bean class="org.jboss.test.cluster.hasingleton.HASingletonMBeanExample"
name="HASingletonMBeanExample_1">
- <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.examples:service=HASingletonMBeanExample_1", exposedInterface=org.jboss.ha.singleton.examples.HASingletonMBeanExampleMBean.class, registerDirectly=true)</annotation>
+ <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.examples:service=HASingletonMBeanExample_1", exposedInterface=org.jboss.test.cluster.hasingleton.HASingletonMBeanExampleMBean.class, registerDirectly=true)</annotation>
</bean>
<bean class="org.jboss.ha.singleton.HASingletonElectionPolicySimple"
@@ -31,9 +31,9 @@
</bean>
<!-- Second HASingleton, Election policy is to choose the youngest node as master -->
- <bean class="org.jboss.ha.singleton.examples.HASingletonMBeanExample"
+ <bean class="org.jboss.test.cluster.hasingleton.HASingletonMBeanExample"
name="HASingletonMBeanExample_2">
- <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.examples:service=HASingletonMBeanExample_2", exposedInterface=org.jboss.ha.singleton.examples.HASingletonMBeanExampleMBean.class, registerDirectly=true)</annotation>
+ <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.examples:service=HASingletonMBeanExample_2", exposedInterface=org.jboss.test.cluster.hasingleton.HASingletonMBeanExampleMBean.class, registerDirectly=true)</annotation>
</bean>
<bean class="org.jboss.ha.singleton.HASingletonElectionPolicySimple"
@@ -55,9 +55,9 @@
</bean>
<!-- Third HASingleton, Election policy is to choose the 2nd oldest node as master -->
- <bean class="org.jboss.ha.singleton.examples.HASingletonMBeanExample"
+ <bean class="org.jboss.test.cluster.hasingleton.HASingletonMBeanExample"
name="HASingletonMBeanExample_3">
- <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.examples:service=HASingletonMBeanExample_3", exposedInterface=org.jboss.ha.singleton.examples.HASingletonMBeanExampleMBean.class, registerDirectly=true)</annotation>
+ <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.examples:service=HASingletonMBeanExample_3", exposedInterface=org.jboss.test.cluster.hasingleton.HASingletonMBeanExampleMBean.class, registerDirectly=true)</annotation>
</bean>
<bean class="org.jboss.ha.singleton.HASingletonElectionPolicySimple"
@@ -79,9 +79,9 @@
</bean>
<!-- Fourth HASingleton, No election policy defined. By default, the oldest node is selected -->
- <bean class="org.jboss.ha.singleton.examples.HASingletonMBeanExample"
+ <bean class="org.jboss.test.cluster.hasingleton.HASingletonMBeanExample"
name="HASingletonMBeanExample_4">
- <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.examples:service=HASingletonMBeanExample_4", exposedInterface=org.jboss.ha.singleton.examples.HASingletonMBeanExampleMBean.class, registerDirectly=true)</annotation>
+ <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.examples:service=HASingletonMBeanExample_4", exposedInterface=org.jboss.test.cluster.hasingleton.HASingletonMBeanExampleMBean.class, registerDirectly=true)</annotation>
</bean>
<bean class="org.jboss.ha.singleton.HASingletonController"
@@ -97,9 +97,9 @@
</bean>
<!-- 5th HASingleton, PreferredMaster set to localhost:0. Election policy is to choose the oldest node as master -->
- <bean class="org.jboss.ha.singleton.examples.HASingletonMBeanExample"
+ <bean class="org.jboss.test.cluster.hasingleton.HASingletonMBeanExample"
name="HASingletonMBeanExample_5">
- <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.examples:service=HASingletonMBeanExample_5", exposedInterface=org.jboss.ha.singleton.examples.HASingletonMBeanExampleMBean.class, registerDirectly=true)</annotation>
+ <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.examples:service=HASingletonMBeanExample_5", exposedInterface=org.jboss.test.cluster.hasingleton.HASingletonMBeanExampleMBean.class, registerDirectly=true)</annotation>
</bean>
<bean class="org.jboss.ha.singleton.PreferredMasterElectionPolicy"
@@ -122,9 +122,9 @@
</bean>
<!-- 6th HASingleton, PreferredMaster set to localhost:0. Election policy is to choose the youngest node as master -->
- <bean class="org.jboss.ha.singleton.examples.HASingletonMBeanExample"
+ <bean class="org.jboss.test.cluster.hasingleton.HASingletonMBeanExample"
name="HASingletonMBeanExample_6">
- <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.examples:service=HASingletonMBeanExample_6", exposedInterface=org.jboss.ha.singleton.examples.HASingletonMBeanExampleMBean.class, registerDirectly=true)</annotation>
+ <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.examples:service=HASingletonMBeanExample_6", exposedInterface=org.jboss.test.cluster.hasingleton.HASingletonMBeanExampleMBean.class, registerDirectly=true)</annotation>
</bean>
<bean class="org.jboss.ha.singleton.PreferredMasterElectionPolicy"
@@ -151,7 +151,7 @@
<!-- ==================================================================== -->
<!-- First HASingleton, Election policy is to choose the oldest node as master -->
- <bean class="org.jboss.ha.singleton.examples.HASingletonPojoExample"
+ <bean class="org.jboss.test.cluster.hasingleton.HASingletonPojoExample"
name="HASingletonPojoExample_1">
<constructor><parameter>test/cluster/hasingleton/simplepojo/1</parameter></constructor>
</bean>
@@ -167,7 +167,7 @@
</bean>
<!-- Second HASingleton, Election policy is to choose the youngest node as master -->
- <bean class="org.jboss.ha.singleton.examples.HASingletonPojoExample"
+ <bean class="org.jboss.test.cluster.hasingleton.HASingletonPojoExample"
name="HASingletonPojoExample_2">
<constructor><parameter>test/cluster/hasingleton/simplepojo/2</parameter></constructor>
</bean>
@@ -183,7 +183,7 @@
</bean>
<!-- Third HASingleton, Election policy is to choose the 2nd oldest node as master -->
- <bean class="org.jboss.ha.singleton.examples.HASingletonPojoExample"
+ <bean class="org.jboss.test.cluster.hasingleton.HASingletonPojoExample"
name="HASingletonPojoExample_3">
<constructor><parameter>test/cluster/hasingleton/simplepojo/3</parameter></constructor>
</bean>
@@ -199,7 +199,7 @@
</bean>
<!-- Fourth HASingleton, No election policy defined. By default, the oldest node is selected -->
- <bean class="org.jboss.ha.singleton.examples.HASingletonPojoExample"
+ <bean class="org.jboss.test.cluster.hasingleton.HASingletonPojoExample"
name="HASingletonPojoExample_4">
<constructor><parameter>test/cluster/hasingleton/simplepojo/4</parameter></constructor>
</bean>
@@ -214,7 +214,7 @@
</bean>
<!-- 5th HASingleton, PreferredMaster set to localhost:0. Election policy is to choose the oldest node as master -->
- <bean class="org.jboss.ha.singleton.examples.HASingletonPojoExample"
+ <bean class="org.jboss.test.cluster.hasingleton.HASingletonPojoExample"
name="HASingletonPojoExample_5">
<constructor><parameter>test/cluster/hasingleton/simplepojo/5</parameter></constructor>
</bean>
@@ -231,7 +231,7 @@
<!-- 6th HASingleton, Election policy is to choose the youngest node as master -->
- <bean class="org.jboss.ha.singleton.examples.HASingletonPojoExample"
+ <bean class="org.jboss.test.cluster.hasingleton.HASingletonPojoExample"
name="HASingletonPojoExample_6">
<constructor><parameter>test/cluster/hasingleton/simplepojo/6</parameter></constructor>
</bean>
Modified: trunk/testsuite/src/resources/cluster/hasingleton/ha-singleton-jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/hasingleton/ha-singleton-jboss-beans.xml 2010-02-02 20:30:37 UTC (rev 100298)
+++ trunk/testsuite/src/resources/cluster/hasingleton/ha-singleton-jboss-beans.xml 2010-02-02 20:40:03 UTC (rev 100299)
@@ -2,7 +2,7 @@
<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <bean class="org.jboss.ha.singleton.examples.HASingletonPojoExample"
+ <bean class="org.jboss.test.cluster.hasingleton.HASingletonPojoExample"
name="SimpleHaSingletonPojo">
<constructor><parameter>test/cluster/hasingleton/simplepojo</parameter></constructor>
More information about the jboss-cvs-commits
mailing list