[jboss-cvs] JBossAS SVN: r63798 - in branches/Branch_4_2/testsuite: src/main/org/jboss/test/tm and 8 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jul 3 10:51:23 EDT 2007
Author: adrian at jboss.org
Date: 2007-07-03 10:51:23 -0400 (Tue, 03 Jul 2007)
New Revision: 63798
Added:
branches/Branch_4_2/testsuite/src/main/org/jboss/test/tm/test/WebBMTCleanUpUnitTestCase.java
branches/Branch_4_2/testsuite/src/main/org/jboss/test/tm/webmbean/
branches/Branch_4_2/testsuite/src/main/org/jboss/test/tm/webmbean/WebTest.java
branches/Branch_4_2/testsuite/src/main/org/jboss/test/tm/webmbean/WebTestMBean.java
branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/
branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/sar/
branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/sar/META-INF/
branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/sar/META-INF/jboss-service.xml
branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/war/
branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/war/WEB-INF/
branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/war/WEB-INF/web.xml
branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/war/test1.jsp
branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/war/test2.jsp
Modified:
branches/Branch_4_2/testsuite/imports/sections/tm.xml
Log:
[JBAS-4488] - Test BMT Cleanup for Webapps
Modified: branches/Branch_4_2/testsuite/imports/sections/tm.xml
===================================================================
--- branches/Branch_4_2/testsuite/imports/sections/tm.xml 2007-07-03 13:47:08 UTC (rev 63797)
+++ branches/Branch_4_2/testsuite/imports/sections/tm.xml 2007-07-03 14:51:23 UTC (rev 63798)
@@ -48,5 +48,23 @@
<include name="org/jboss/test/tm/interfaces/**"/>
</fileset>
</jar>
+
+ <!-- build webbmtcleanuptest.sar -->
+ <jar destfile="${build.lib}/webbmtcleanuptest.war">
+ <fileset dir="${build.resources}/tm/webbmtcleanup/war">
+ <include name="**"/>
+ </fileset>
+ </jar>
+ <jar destfile="${build.lib}/webbmtcleanuptest.sar">
+ <metainf dir="${build.resources}/tm/webbmtcleanup/sar/META-INF">
+ <include name="*.xml"/>
+ </metainf>
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/tm/webmbean/**"/>
+ </fileset>
+ <fileset dir="${build.lib}">
+ <include name="webbmtcleanuptest.war"/>
+ </fileset>
+ </jar>
</target>
</project>
Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/tm/test/WebBMTCleanUpUnitTestCase.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/tm/test/WebBMTCleanUpUnitTestCase.java (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/tm/test/WebBMTCleanUpUnitTestCase.java 2007-07-03 14:51:23 UTC (rev 63798)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.tm.test;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.JBossTestSetup;
+
+/**
+ * Tests for BMT CleanUp in a webapp
+ *
+ * @author adrian at jboss.com
+ * @version $Revision: 60501 $
+ */
+public class WebBMTCleanUpUnitTestCase extends JBossTestCase
+{
+ public WebBMTCleanUpUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite() throws Exception
+ {
+ return new JBossTestSetup(getDeploySetup(WebBMTCleanUpUnitTestCase.class, "webbmtcleanuptest.sar"));
+ }
+
+ public void test() throws Exception
+ {
+ MBeanServerConnection server = getServer();
+ ObjectName name = new ObjectName("jboss.test:test=webbmtcleanuptest");
+ server.invoke(name, "test", null, null);
+ }
+}
Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/tm/webmbean/WebTest.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/tm/webmbean/WebTest.java (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/tm/webmbean/WebTest.java 2007-07-03 14:51:23 UTC (rev 63798)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.tm.webmbean;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.catalina.connector.Connector;
+import org.apache.coyote.memory.MemoryProtocolHandler;
+import org.apache.tomcat.util.buf.ByteChunk;
+import org.jboss.system.ServiceMBeanSupport;
+
+/**
+ * Server Side Web test.
+ *
+ * @author adrian at jboss.org
+ * @version $Revision: 57211 $
+ */
+public class WebTest extends ServiceMBeanSupport implements WebTestMBean
+{
+ public void test() throws Exception
+ {
+ MBeanServer server = getServer();
+ ObjectName name = new ObjectName("jboss.web:type=Service,serviceName=jboss.web");
+ Connector connector = new Connector("org.apache.coyote.memory.MemoryProtocolHandler");
+ MemoryProtocolHandler handler = (MemoryProtocolHandler) connector.getProtocolHandler();
+ server.invoke(name, "addConnector", new Object[] { connector }, new String[] { Connector.class.getName() });
+ try
+ {
+ ByteChunk input = new ByteChunk(1024);
+ ByteChunk output = new ByteChunk(1024);
+ org.apache.coyote.Request req = new org.apache.coyote.Request();
+ req.decodedURI().setString("/jmx-console/test1.jsp");
+ req.method().setString("GET");
+ org.apache.coyote.Response resp = new org.apache.coyote.Response();
+ handler.process(req, input, resp, output);
+ if (resp.getStatus() != 200)
+ throw new Error(output.toString());
+
+ input = new ByteChunk(1024);
+ output = new ByteChunk(1024);
+ req = new org.apache.coyote.Request();
+ req.decodedURI().setString("/jmx-console/test2.jsp");
+ req.method().setString("GET");
+ resp = new org.apache.coyote.Response();
+ handler.process(req, input, resp, output);
+ if (resp.getStatus() != 200)
+ throw new Error(output.toString());
+ }
+ finally
+ {
+ try
+ {
+ connector.stop();
+ }
+ finally
+ {
+ connector.destroy();
+ }
+ }
+ }
+}
Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/tm/webmbean/WebTestMBean.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/tm/webmbean/WebTestMBean.java (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/tm/webmbean/WebTestMBean.java 2007-07-03 14:51:23 UTC (rev 63798)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.tm.webmbean;
+
+import org.jboss.system.ServiceMBean;
+
+/**
+ * @author adrian at jboss.org
+ * @version $Revision: 57211 $
+ */
+public interface WebTestMBean extends ServiceMBean
+{
+ void test() throws Exception;
+}
Added: branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/sar/META-INF/jboss-service.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/sar/META-INF/jboss-service.xml (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/sar/META-INF/jboss-service.xml 2007-07-03 14:51:23 UTC (rev 63798)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+ <mbean code="org.jboss.test.tm.webmbean.WebTest"
+ name="jboss.test:test=webbmtcleanuptest"/>
+</server>
Added: branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/war/WEB-INF/web.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/war/WEB-INF/web.xml (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/war/WEB-INF/web.xml 2007-07-03 14:51:23 UTC (rev 63798)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+</web-app>
+
Added: branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/war/test1.jsp
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/war/test1.jsp (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/war/test1.jsp 2007-07-03 14:51:23 UTC (rev 63798)
@@ -0,0 +1,8 @@
+<%@page contentType="text/html"
+ import="javax.naming.*,javax.transaction.*"
+%>
+<%
+ InitialContext ctx = new InitialContext();
+ UserTransaction ut = (UserTransaction) ctx.lookup("java:/comp/UserTransaction");
+ ut.begin();
+%>
Added: branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/war/test2.jsp
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/war/test2.jsp (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/tm/webbmtcleanup/war/test2.jsp 2007-07-03 14:51:23 UTC (rev 63798)
@@ -0,0 +1,9 @@
+<%@page contentType="text/html"
+ import="javax.naming.*,javax.transaction.*"
+%>
+<%
+ InitialContext ctx = new InitialContext();
+ UserTransaction ut = (UserTransaction) ctx.lookup("java:/comp/UserTransaction");
+ ut.begin();
+ ut.commit();
+%>
More information about the jboss-cvs-commits
mailing list