[jboss-cvs] JBossAS SVN: r108516 - in branches/JBPAPP_5_1/testsuite: imports/sections and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 12 01:59:25 EDT 2010
Author: pskopek at redhat.com
Date: 2010-10-12 01:59:25 -0400 (Tue, 12 Oct 2010)
New Revision: 108516
Added:
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ann/
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ann/clustered/
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ann/clustered/SimpleCounter.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ann/clustered/SimpleCounterBean.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ann/clustered/test/
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ann/clustered/test/Ejb3ClusteredAnnTestCase.java
Modified:
branches/JBPAPP_5_1/testsuite/build.xml
branches/JBPAPP_5_1/testsuite/imports/sections/cluster.xml
branches/JBPAPP_5_1/testsuite/src/resources/cc/testCaseMapping_2.0.xml
Log:
CC: test to check @Clustered annotation added
Modified: branches/JBPAPP_5_1/testsuite/build.xml
===================================================================
--- branches/JBPAPP_5_1/testsuite/build.xml 2010-10-12 05:57:40 UTC (rev 108515)
+++ branches/JBPAPP_5_1/testsuite/build.xml 2010-10-12 05:59:25 UTC (rev 108516)
@@ -1983,9 +1983,9 @@
<echo>Waiting for server to shutdown...</echo>
<server:stop name="cc"/>
- <antcall target="cc-tests-secured"/>
+ <!-- antcall target="cc-tests-secured"/ -->
- <!-- antcall target="cc-tests-cluster"/ -->
+ <antcall target="cc-tests-cluster"/>
<!-- TS crach-recovery with JMS -->
<!-- include name="org/jboss/test/jbossts/ASCrashRecovery01/TestWithJPA.class"/>
@@ -2080,7 +2080,8 @@
<delete dir="${jboss.dist}${/}server${/}cluster-*" quiet="true"/>
<patternset id="cc-cluster-tests.includes">
- <include name="org/jboss/test/cluster/defaultcfg/test/HAInvokerUnitTestCase.class"/>
+ <!-- include name="org/jboss/test/cluster/defaultcfg/test/HAInvokerUnitTestCase.class"/ -->
+ <include name="org/jboss/test/ann/clustered/test/Ejb3ClusteredAnnTestCase.class"/>
</patternset>
<property name="jboss.default.jgroups.stack" value="tcp"/>
Modified: branches/JBPAPP_5_1/testsuite/imports/sections/cluster.xml
===================================================================
--- branches/JBPAPP_5_1/testsuite/imports/sections/cluster.xml 2010-10-12 05:57:40 UTC (rev 108515)
+++ branches/JBPAPP_5_1/testsuite/imports/sections/cluster.xml 2010-10-12 05:59:25 UTC (rev 108516)
@@ -1091,6 +1091,13 @@
</fileset>
</jar>
-
+ <!-- @Clustered annotation test -->
+ <jar destfile="${build.lib}/clusterannottest.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/ann/clustered/*"/>
+ </fileset>
+ </jar>
+
+
</target>
-</project>
+</project>
\ No newline at end of file
Added: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ann/clustered/SimpleCounter.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ann/clustered/SimpleCounter.java (rev 0)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ann/clustered/SimpleCounter.java 2010-10-12 05:59:25 UTC (rev 108516)
@@ -0,0 +1,36 @@
+/*
+ * 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.ann.clustered;
+
+/**
+ * @author <a href="mailto:pskopekf at redhat.com">Peter Skopek</a>
+ * @version $Revision: $
+ */
+public interface SimpleCounter {
+
+ public static final String JNDI_BINDING = "SimpleCounter/Remote";
+
+ public void increment(int amount);
+ public int getCounterStatus();
+ public void resetCounter();
+
+}
Added: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ann/clustered/SimpleCounterBean.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ann/clustered/SimpleCounterBean.java (rev 0)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ann/clustered/SimpleCounterBean.java 2010-10-12 05:59:25 UTC (rev 108516)
@@ -0,0 +1,68 @@
+/*
+ * 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.ann.clustered;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateful;
+
+import org.jboss.ejb3.annotation.Clustered;
+import org.jboss.ejb3.annotation.RemoteBinding;
+
+/**
+ * @author <a href="mailto:pskopekf at redhat.com">Peter Skopek</a>
+ * @version $Revision: $
+ */
+ at Stateful
+ at Remote(SimpleCounter.class)
+ at RemoteBinding(jndiBinding=SimpleCounter.JNDI_BINDING)
+ at Clustered
+public class SimpleCounterBean implements SimpleCounter {
+
+ private int counter = 0;
+
+ /* (non-Javadoc)
+ * @see org.jboss.test.ann.clustered.SimpleCounter#getCounterStatus()
+ */
+ @Override
+ public int getCounterStatus() {
+ return counter;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.test.ann.clustered.SimpleCounter#increment(int)
+ */
+ @Override
+ public void increment(int amount) {
+
+ counter += amount;
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.test.ann.clustered.SimpleCounter#resetCounter()
+ */
+ @Override
+ public void resetCounter() {
+ counter = 0;
+ }
+
+}
Added: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ann/clustered/test/Ejb3ClusteredAnnTestCase.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ann/clustered/test/Ejb3ClusteredAnnTestCase.java (rev 0)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/ann/clustered/test/Ejb3ClusteredAnnTestCase.java 2010-10-12 05:59:25 UTC (rev 108516)
@@ -0,0 +1,135 @@
+/*
+ * 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.ann.clustered.test;
+
+import java.util.Properties;
+
+import javax.management.MBeanServerConnection;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+
+import org.jboss.test.JBossClusteredTestCase;
+import org.jboss.test.ann.clustered.SimpleCounter;
+
+/**
+ * @author <a href="mailto:pskopekf at redhat.com">Peter Skopek</a>
+ * @version $Revision: $
+ */
+public class Ejb3ClusteredAnnTestCase extends JBossClusteredTestCase {
+
+ public static final String DEPLOYMENT_NAME = "clusterannottest.jar";
+
+ public static int INCREMENT = 10;
+ public static int CYCLES = 50;
+
+ private static boolean deployed0_ = true;
+ private static boolean deployed1_ = true;
+
+ public Ejb3ClusteredAnnTestCase(String name) {
+ super(name);
+ }
+
+ public void testAppSetup() throws Exception {
+
+ String[] urls = getNamingURLs();
+ Properties env = new Properties();
+ env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
+ "org.jnp.interfaces.NamingContextFactory");
+ env.setProperty(Context.PROVIDER_URL, urls[0]);
+ Context ctx = new InitialContext(env);
+ getLog().debug("InitialContext URLs " + urls[0]);
+
+ SimpleCounter counter = (SimpleCounter) ctx
+ .lookup(SimpleCounter.JNDI_BINDING);
+ for (int i = 0; i < CYCLES; i++) {
+ counter.increment(INCREMENT);
+ }
+
+ assertTrue("Counter has to show " + CYCLES * INCREMENT
+ + ", but shows " + counter.getCounterStatus(), counter
+ .getCounterStatus() == CYCLES * INCREMENT);
+
+ }
+
+ public void testOneNodeFail() throws Exception {
+
+ MBeanServerConnection[] adaptors = getAdaptors();
+
+ String[] urls = getNamingURLs();
+ Properties env = new Properties();
+ env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
+ "org.jnp.interfaces.NamingContextFactory");
+ env.setProperty(Context.PROVIDER_URL, urls[0]);
+ Context ctx = new InitialContext(env);
+ getLog().debug("InitialContext URLs " + urls[0]);
+
+ SimpleCounter counter = (SimpleCounter) ctx
+ .lookup(SimpleCounter.JNDI_BINDING);
+ for (int i = 0; i < CYCLES; i++) {
+ counter.increment(INCREMENT);
+
+ if (i == CYCLES / 2) {
+ MBeanServerConnection adaptor = adaptors[0];
+ log.debug("Trying to undeploy " + DEPLOYMENT_NAME + " from " + adaptor);
+ undeploy(adaptors[0], DEPLOYMENT_NAME);
+ log.debug("Trying to undeployed " + DEPLOYMENT_NAME + " from " + adaptor);
+
+ sleep(2000);
+ }
+
+ }
+
+ assertTrue("Counter has to show " + CYCLES * INCREMENT + ", but shows "
+ + counter.getCounterStatus(),
+ counter.getCounterStatus() == CYCLES * INCREMENT);
+
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ configureCluster();
+ }
+
+ public static Test suite() throws Exception {
+ return JBossClusteredTestCase.getDeploySetup(
+ Ejb3ClusteredAnnTestCase.class, DEPLOYMENT_NAME);
+ }
+
+ protected void configureCluster() throws Exception {
+ MBeanServerConnection[] adaptors = getAdaptors();
+ if (!deployed0_) {
+ deploy(adaptors[0], DEPLOYMENT_NAME);
+ getLog().debug("Deployed " + DEPLOYMENT_NAME + " on server0");
+ deployed0_ = true;
+ }
+ if (!deployed1_) {
+ deploy(adaptors[1], DEPLOYMENT_NAME);
+ getLog().debug("Deployed " + DEPLOYMENT_NAME + " on server1");
+ deployed1_ = true;
+ }
+
+ sleep(2000);
+ }
+
+}
Modified: branches/JBPAPP_5_1/testsuite/src/resources/cc/testCaseMapping_2.0.xml
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/resources/cc/testCaseMapping_2.0.xml 2010-10-12 05:57:40 UTC (rev 108515)
+++ branches/JBPAPP_5_1/testsuite/src/resources/cc/testCaseMapping_2.0.xml 2010-10-12 05:59:25 UTC (rev 108516)
@@ -1629,6 +1629,17 @@
<TSFI>tsfi.cfg.deploy.admin.web.xml</TSFI>
</test>
</testCase>
+ <testCase name="org.jboss.test.ann.clustered.test.Ejb3ClusteredAnnTestCase">
+ <desc></desc>
+ <test name="testAppSetup">
+ <desc></desc>
+ <TSFI>tsfi.ann.Clustered</TSFI>
+ </test>
+ <test name="testOneNodeFail">
+ <desc></desc>
+ <TSFI>tsfi.ann.Clustered</TSFI>
+ </test>
+ </testCase>
</testSuite>
</cc:testCaseMapping>
More information about the jboss-cvs-commits
mailing list