[jboss-cvs] JBossAS SVN: r111871 - in branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite: imports and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jul 28 12:07:47 EDT 2011
Author: csams
Date: 2011-07-28 12:07:47 -0400 (Thu, 28 Jul 2011)
New Revision: 111871
Added:
branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/imports/config/tests-jbpapp6913.xml
branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/main/org/jboss/test/jmx/test/JVMShutdownExitTestCase.java
branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/main/org/jboss/test/jmx/test/JVMShutdownHaltTestCase.java
branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/main/org/jboss/test/jmx/test/JVMShutdownShutdownTestCase.java
branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/main/org/jboss/test/jmx/test/ServerProxyHandler.java
branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/resources/jbpapp6913/
branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/resources/jbpapp6913/jmx-console-users.properties
Modified:
branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/build.xml
branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/imports/config/configs.xml
branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/imports/server-config.xml
Log:
JBPAPP-6913 testsuite changes
Modified: branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/build.xml
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/build.xml 2011-07-28 15:11:16 UTC (rev 111870)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/build.xml 2011-07-28 16:07:47 UTC (rev 111871)
@@ -1630,6 +1630,13 @@
<antcall target="jars" inheritRefs="true"/>
</target>
+ <target name="jbpapp6913" description="Execute jbpapp6913."
+ depends="maybejars,create-profiles-for-ewp">
+ <record name="${basedir}/output/jbpapp6913-tests.log" append="no" action="start" loglevel="info"/>
+ <property name="nojars" value="true"/>
+ <antcall target="tests-jbpapp6913" />
+ </target>
+
<!--
This is an ugly hack, but our only option. In EWP, there's nothing like
the "all" profile. So, we take "production", which contains "everything" for
@@ -1681,6 +1688,7 @@
<record name="${basedir}/output/tests.log" append="no" action="start" loglevel="info"/>
<property name="nojars" value="true"/>
<antcall target="jboss-minimal-tests" />
+ <antcall target="tests-jbpapp6913" />
<antcall target="jboss-all-config-tests"/>
<antcall target="tests-profileservice"/>
<antcall target="tests-bootstrap-dependencies"/>
Modified: branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/imports/config/configs.xml
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/imports/config/configs.xml 2011-07-28 15:11:16 UTC (rev 111870)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/imports/config/configs.xml 2011-07-28 16:07:47 UTC (rev 111871)
@@ -15,4 +15,5 @@
<import file="tests-password-mask.xml"/>
<import file="tests-crash-recovery.xml"/>
<import file="tests-secured.xml"/>
+<import file="tests-jbpapp6913.xml"/>
</project>
Added: branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/imports/config/tests-jbpapp6913.xml
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/imports/config/tests-jbpapp6913.xml (rev 0)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/imports/config/tests-jbpapp6913.xml 2011-07-28 16:07:47 UTC (rev 111871)
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+
+<!--
+ | Targets that run the Secured Mask tests
+-->
+
+<project name="jbpapp6913.tests" xmlns:server="http://jboss.org/ns/test/ant/server">
+
+ <!--
+ | Define the Pattern Sets Here
+ -->
+ <patternset id="jbpapp6913.includes-1">
+ <include name="org/jboss/test/jmx/test/JVMShutdownShutdownTestCase.class"/>
+ </patternset>
+
+ <patternset id="jbpapp6913.includes-2">
+ <include name="org/jboss/test/jmx/test/JVMShutdownExitTestCase.class"/>
+ </patternset>
+
+ <patternset id="jbpapp6913.includes-3">
+ <include name="org/jboss/test/jmx/test/JVMShutdownHaltTestCase.class"/>
+ </patternset>
+
+ <!--
+ | Targets
+ -->
+ <target name="tests-jbpapp6913" description="Runs JBPAPP-6913 JVMShutdown tests">
+
+ <delete dir="${jboss.dist}/server/jbpapp6913" />
+ <create-config baseconf="default" newconf="jbpapp6913">
+ <patternset>
+ <include name="**/*"/>
+ </patternset>
+ </create-config>
+
+ <copy file="${source.resources}/jbpapp6913/jmx-console-users.properties" overwrite="true" todir="${jboss.dist}/server/jbpapp6913/conf/props/" />
+
+ <server:start name="jbpapp6913"/>
+ <run-junit junit.patternset="jbpapp6913.includes-1"/>
+
+ <server:start name="jbpapp6913"/>
+ <run-junit junit.patternset="jbpapp6913.includes-2"/>
+
+ <server:start name="jbpapp6913"/>
+ <run-junit junit.patternset="jbpapp6913.includes-3"/>
+
+ </target>
+</project>
+
Modified: branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/imports/server-config.xml
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/imports/server-config.xml 2011-07-28 15:11:16 UTC (rev 111870)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/imports/server-config.xml 2011-07-28 16:07:47 UTC (rev 111871)
@@ -103,8 +103,20 @@
<sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
<sysproperty key="xb.builder.useUnorderedSequence" value="true" />
</server>
-<!-- Configured for tests-secured, full run.conf JAVA_OPTS are not needed
--->
+
+ <server name="jbpapp6913" host="${node0}">
+ <jvmarg value="-Xms128m" />
+ <jvmarg value="-Xmx512m" />
+ <jvmarg value="-XX:MaxPermSize=512m" />
+ <jvmarg value="-XX:+HeapDumpOnOutOfMemoryError" />
+ <jvmarg value="-XX:-UseGCOverheadLimit" />
+ <sysproperty key="java.net.preferIPv4Stack" value="true" />
+ <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
+ <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
+ <sysproperty key="xb.builder.useUnorderedSequence" value="true" />
+ </server>
+
+<!-- Configured for tests-secured, full run.conf JAVA_OPTS are not needed -->
<server name="production" host="${node0}">
<jvmarg value="-Xms256m" />
<jvmarg value="-Xmx768m" />
Added: branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/main/org/jboss/test/jmx/test/JVMShutdownExitTestCase.java
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/main/org/jboss/test/jmx/test/JVMShutdownExitTestCase.java (rev 0)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/main/org/jboss/test/jmx/test/JVMShutdownExitTestCase.java 2011-07-28 16:07:47 UTC (rev 111871)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.jmx.test;
+
+
+import java.lang.reflect.Proxy;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import junit.framework.*;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.system.server.jmx.JVMShutdown;
+import org.jboss.system.server.jmx.JVMShutdownMBean;
+import org.jboss.mx.util.ObjectNameFactory;
+
+import org.jboss.security.SecurityAssociation;
+import org.jboss.security.SimplePrincipal;
+
+/** Tests of JVMShutdown
+ *
+ * @author <a href="mailto:csams at redhat.com">Chris Sams </a>
+ */
+public class JVMShutdownExitTestCase
+ extends JBossTestCase
+{
+
+ private final ObjectName serverJMXName = ObjectNameFactory.create("jboss.system:type=JVMShutdown");
+ private final String adapterName = "jmx/rmi/RMIAdaptor";
+ public JVMShutdownExitTestCase(String name)
+ {
+ super(name);
+ SecurityAssociation.setPrincipal(new SimplePrincipal("admin"));
+ SecurityAssociation.setCredential("admin");
+ }
+
+ public void testExit() throws Exception
+ {
+ JVMShutdownMBean server = getJVMShutdown();
+ server.exit(3);
+ assertTrue("test:name=JVMShutdownExit", isShutDown());
+ Thread.sleep(5000);
+ }
+
+ protected boolean isShutDown() throws Exception
+ {
+ //keep looking up until it fails.. we take this to mean the server shut down
+ InitialContext ic = new InitialContext();
+ boolean hasShutDown = false;
+ int i = 0;
+ while(i < 10 && !hasShutDown)
+ {
+ try
+ {
+ Object obj = ic.lookup(adapterName);
+ Thread.sleep(1000);
+ }catch(Exception e)
+ {
+ hasShutDown = true;
+ }
+ i++;
+ }
+ return hasShutDown;
+ }
+
+ protected JVMShutdownMBean getJVMShutdown() throws Exception
+ {
+ InitialContext ic = new InitialContext();
+ MBeanServerConnection adaptor = (MBeanServerConnection)ic.lookup(adapterName);
+ ServerProxyHandler handler = new ServerProxyHandler(adaptor, serverJMXName);
+ Class<?>[] ifaces = {JVMShutdownMBean.class};
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ JVMShutdownMBean server = (JVMShutdownMBean) Proxy.newProxyInstance(tcl, ifaces, handler);
+ return server;
+ }
+
+
+}
Added: branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/main/org/jboss/test/jmx/test/JVMShutdownHaltTestCase.java
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/main/org/jboss/test/jmx/test/JVMShutdownHaltTestCase.java (rev 0)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/main/org/jboss/test/jmx/test/JVMShutdownHaltTestCase.java 2011-07-28 16:07:47 UTC (rev 111871)
@@ -0,0 +1,101 @@
+/*
+ * 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.jmx.test;
+
+
+import java.lang.reflect.Proxy;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.system.server.jmx.JVMShutdown;
+import org.jboss.system.server.jmx.JVMShutdownMBean;
+import org.jboss.mx.util.ObjectNameFactory;
+
+import org.jboss.security.SecurityAssociation;
+import org.jboss.security.SimplePrincipal;
+
+/** Tests of JVMShutdown
+ *
+ * @author <a href="mailto:csams at redhat.com">Chris Sams </a>
+ */
+public class JVMShutdownHaltTestCase
+ extends JBossTestCase
+{
+
+ private final ObjectName serverJMXName = ObjectNameFactory.create("jboss.system:type=JVMShutdown");
+ private final String adapterName = "jmx/rmi/RMIAdaptor";
+
+ public JVMShutdownHaltTestCase(String name)
+ {
+ super(name);
+ SecurityAssociation.setPrincipal(new SimplePrincipal("admin"));
+ SecurityAssociation.setCredential("admin");
+ }
+
+ public void testHalt() throws Exception
+ {
+ JVMShutdownMBean server = getJVMShutdown();
+ server.halt(3);
+ assertTrue("test:name=JVMShutdownHalt", isShutDown());
+ Thread.sleep(5000);
+ }
+
+ protected boolean isShutDown() throws Exception
+ {
+ //keep looking up until it fails.. we take this to mean the server shut down
+ InitialContext ic = new InitialContext();
+ boolean hasShutDown = false;
+ int i = 0;
+ while(i < 10 && !hasShutDown)
+ {
+ try
+ {
+ Object obj = ic.lookup(adapterName);
+ Thread.sleep(1000);
+ }catch(Exception e)
+ {
+ hasShutDown = true;
+ }
+ i++;
+ }
+ return hasShutDown;
+ }
+
+ protected JVMShutdownMBean getJVMShutdown() throws Exception
+ {
+ InitialContext ic = new InitialContext();
+ MBeanServerConnection adaptor = (MBeanServerConnection)ic.lookup(adapterName);
+ ServerProxyHandler handler = new ServerProxyHandler(adaptor, serverJMXName);
+ Class<?>[] ifaces = {JVMShutdownMBean.class};
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ JVMShutdownMBean server = (JVMShutdownMBean) Proxy.newProxyInstance(tcl, ifaces, handler);
+ return server;
+ }
+
+}
Added: branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/main/org/jboss/test/jmx/test/JVMShutdownShutdownTestCase.java
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/main/org/jboss/test/jmx/test/JVMShutdownShutdownTestCase.java (rev 0)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/main/org/jboss/test/jmx/test/JVMShutdownShutdownTestCase.java 2011-07-28 16:07:47 UTC (rev 111871)
@@ -0,0 +1,101 @@
+/*
+ * 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.jmx.test;
+
+
+import java.lang.reflect.Proxy;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import junit.framework.*;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.system.server.jmx.JVMShutdown;
+import org.jboss.system.server.jmx.JVMShutdownMBean;
+import org.jboss.mx.util.ObjectNameFactory;
+
+import org.jboss.security.SecurityAssociation;
+import org.jboss.security.SimplePrincipal;
+
+/** Tests of JVMShutdown
+ *
+ * @author <a href="mailto:csams at redhat.com">Chris Sams </a>
+ */
+public class JVMShutdownShutdownTestCase
+ extends JBossTestCase
+{
+
+ private final ObjectName serverJMXName = ObjectNameFactory.create("jboss.system:type=JVMShutdown");
+ private final String adapterName = "jmx/rmi/RMIAdaptor";
+ public JVMShutdownShutdownTestCase(String name)
+ {
+ super(name);
+ SecurityAssociation.setPrincipal(new SimplePrincipal("admin"));
+ SecurityAssociation.setCredential("admin");
+ }
+
+ public void testShutdown() throws Exception
+ {
+ JVMShutdownMBean server = getJVMShutdown();
+ server.shutdown();
+
+ assertTrue("test:name=JVMShutdownShutdown", isShutDown());
+ Thread.sleep(5000);
+ }
+
+ protected boolean isShutDown() throws Exception
+ {
+ //keep looking up until it fails.. we take this to mean the server shut down
+ InitialContext ic = new InitialContext();
+ boolean hasShutDown = false;
+ int i = 0;
+ while(i < 10 && !hasShutDown)
+ {
+ try
+ {
+ Object obj = ic.lookup(adapterName);
+ Thread.sleep(1000);
+ }catch(Exception e)
+ {
+ hasShutDown = true;
+ }
+ i++;
+ }
+ return hasShutDown;
+ }
+
+ protected JVMShutdownMBean getJVMShutdown() throws Exception
+ {
+ InitialContext ic = new InitialContext();
+ MBeanServerConnection adaptor = (MBeanServerConnection)ic.lookup(adapterName);
+ ServerProxyHandler handler = new ServerProxyHandler(adaptor, serverJMXName);
+ Class<?>[] ifaces = {JVMShutdownMBean.class};
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ JVMShutdownMBean server = (JVMShutdownMBean) Proxy.newProxyInstance(tcl, ifaces, handler);
+ return server;
+ }
+
+}
Added: branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/main/org/jboss/test/jmx/test/ServerProxyHandler.java
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/main/org/jboss/test/jmx/test/ServerProxyHandler.java (rev 0)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/main/org/jboss/test/jmx/test/ServerProxyHandler.java 2011-07-28 16:07:47 UTC (rev 111871)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.jmx.test;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.UndeclaredThrowableException;
+
+import java.util.ArrayList;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+public class ServerProxyHandler implements InvocationHandler
+{
+ ObjectName serverName;
+ MBeanServerConnection server;
+ ServerProxyHandler(MBeanServerConnection server, ObjectName serverName)
+ {
+ this.server = server;
+ this.serverName = serverName;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable
+ {
+ String methodName = method.getName();
+ Class[] sigTypes = method.getParameterTypes();
+ ArrayList<String> sigStrings = new ArrayList<String>();
+ for(int s = 0; s < sigTypes.length; s ++)
+ sigStrings.add(sigTypes[s].getName());
+ String[] sig = new String[sigTypes.length];
+ sigStrings.toArray(sig);
+ Object value = null;
+ try
+ {
+ value = server.invoke(serverName, methodName, args, sig);
+ }
+ catch(UndeclaredThrowableException e)
+ {
+ System.out.println("getUndeclaredThrowable: "+e.getUndeclaredThrowable());
+ throw e.getUndeclaredThrowable();
+ }
+ return value;
+ }
+}
Added: branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/resources/jbpapp6913/jmx-console-users.properties
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/resources/jbpapp6913/jmx-console-users.properties (rev 0)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6913/testsuite/src/resources/jbpapp6913/jmx-console-users.properties 2011-07-28 16:07:47 UTC (rev 111871)
@@ -0,0 +1 @@
+admin=admin
More information about the jboss-cvs-commits
mailing list