[jboss-cvs] JBossAS SVN: r74463 - in trunk/testsuite: src/main/org/jboss/test/profileservice and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jun 12 00:56:11 EDT 2008
Author: scott.stark at jboss.org
Date: 2008-06-12 00:56:10 -0400 (Thu, 12 Jun 2008)
New Revision: 74463
Added:
trunk/testsuite/src/main/org/jboss/test/profileservice/war/
trunk/testsuite/src/main/org/jboss/test/profileservice/war/EchoServlet.java
trunk/testsuite/src/resources/profileservice/testEarDeployment-application.xml
trunk/testsuite/src/resources/profileservice/testWarDeployment-web.xml
Modified:
trunk/testsuite/imports/sections/profileservice.xml
trunk/testsuite/src/main/org/jboss/test/profileservice/sar/BasicBean.java
trunk/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java
Log:
JBAS-5370, Complete basic deployment types testing
Modified: trunk/testsuite/imports/sections/profileservice.xml
===================================================================
--- trunk/testsuite/imports/sections/profileservice.xml 2008-06-12 04:25:55 UTC (rev 74462)
+++ trunk/testsuite/imports/sections/profileservice.xml 2008-06-12 04:56:10 UTC (rev 74463)
@@ -36,6 +36,26 @@
<include name="testSarDeployment-service.xml"/>
</zipfileset>
</jar>
+ <!-- build testWarDeployment.war -->
+ <jar destfile="${build.lib}/testWarDeployment.war">
+ <zipfileset dir="${build.classes}" prefix="WEB-INF/classes">
+ <include name="org/jboss/test/profileservice/war/**"/>
+ </zipfileset>
+ <zipfileset dir="${build.resources}/profileservice/" fullpath="WEB-INF/web.xml">
+ <include name="testWarDeployment-web.xml"/>
+ </zipfileset>
+ </jar>
+ <!-- build testEarDeployment.ear -->
+ <jar destfile="${build.lib}/testEarDeployment.ear">
+ <fileset dir="${build.lib}">
+ <include name="testEjb2xDeployment.jar"/>
+ <include name="testWarDeployment.war"/>
+ </fileset>
+ <zipfileset dir="${build.resources}/profileservice/" fullpath="META-INF/application.xml">
+ <include name="testEarDeployment-application.xml"/>
+ </zipfileset>
+ </jar>
+
</target>
</project>
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/sar/BasicBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/sar/BasicBean.java 2008-06-12 04:25:55 UTC (rev 74462)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/sar/BasicBean.java 2008-06-12 04:56:10 UTC (rev 74463)
@@ -25,7 +25,25 @@
* @author Scott.Stark at jboss.org
* @version $Revision:$
*/
-public class BasicBean
+public class BasicBean implements BasicBeanMBean
{
+ public String getAttr1()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void op1()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setAttr1(String value)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
}
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java 2008-06-12 04:25:55 UTC (rev 74462)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java 2008-06-12 04:56:10 UTC (rev 74463)
@@ -71,7 +71,47 @@
DeploymentManager deployMgr = getDeploymentManager();
URL contentURL = super.getDeployURL("testWarDeployment.war");
assertNotNull(contentURL);
- deployMgr.distribute("testWarDeployment.war", DeploymentPhase.APPLICATION, contentURL);
+ DeploymentProgress progress = deployMgr.distribute("testWarDeployment.war", DeploymentPhase.APPLICATION, contentURL);
+ progress.addProgressListener(this);
+ progress.run();
+ DeploymentStatus status = progress.getDeploymentStatus();
+ assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+ // It should not be running yet
+ assertFalse("DeploymentStatus.isRunning", status.isRunning());
+ assertFalse("DeploymentStatus.isFailed", status.isFailed());
+
+ // Now start the deployment
+ String[] names = {"testWarDeployment.war"};
+ progress = deployMgr.start(DeploymentPhase.APPLICATION, names);
+ progress.addProgressListener(this);
+ progress.run();
+ status = progress.getDeploymentStatus();
+ log.info(status);
+ assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+ assertTrue("DeploymentStatus.isRunning", status.isRunning());
+ assertFalse("DeploymentStatus.isFailed", status.isFailed());
+ // Check for a ManagedDeployment with a war deployment type
+ ManagementView mgtView = super.getManagementView();
+ ManagedDeployment war = mgtView.getDeployment("testWarDeployment.war", DeploymentPhase.APPLICATION);
+ assertNotNull(war);
+ log.info("Found war deployment: "+war);
+ assertTrue(war.getTypes().contains("war"));
+ // Validate the servlet, TODO...
+
+ // Stop/remove the deployment
+ progress = deployMgr.stop(DeploymentPhase.APPLICATION, names);
+ progress.addProgressListener(this);
+ progress.run();
+ status = progress.getDeploymentStatus();
+ assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+ assertFalse("DeploymentStatus.isFailed", status.isFailed());
+
+ progress = deployMgr.undeploy(DeploymentPhase.APPLICATION, names);
+ progress.addProgressListener(this);
+ progress.run();
+ status = progress.getDeploymentStatus();
+ assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+ assertFalse("DeploymentStatus.isFailed", status.isFailed());
}
public void testEjb3xDeployment()
throws Exception
@@ -118,7 +158,7 @@
String entry1 = (String) bean.getEnvEntry("entry1");
assertEquals("entry1Value", entry1);
- // Remove the deployment
+ // Stop/remove the deployment
progress = deployMgr.stop(DeploymentPhase.APPLICATION, names);
progress.addProgressListener(this);
progress.run();
@@ -133,13 +173,63 @@
assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
assertFalse("DeploymentStatus.isFailed", status.isFailed());
}
+
public void testEarDeployment()
throws Exception
{
+ URL contentURL = super.getDeployURL("testEarDeployment.ear");
+
+ // Distribute the content
DeploymentManager deployMgr = getDeploymentManager();
- URL contentURL = super.getDeployURL("testEarDeployment.ear");
- deployMgr.distribute("testEarDeployment.ear", DeploymentPhase.APPLICATION, contentURL);
+ DeploymentProgress progress = deployMgr.distribute("testEarDeployment.ear", DeploymentPhase.APPLICATION, contentURL);
+ progress.addProgressListener(this);
+ progress.run();
+ DeploymentStatus status = progress.getDeploymentStatus();
+ assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+ // It should not be running yet
+ assertFalse("DeploymentStatus.isRunning", status.isRunning());
+ assertFalse("DeploymentStatus.isFailed", status.isFailed());
+
+ // Now start the deployment
+ String[] names = {"testEarDeployment.ear"};
+ progress = deployMgr.start(DeploymentPhase.APPLICATION, names);
+ progress.addProgressListener(this);
+ progress.run();
+ status = progress.getDeploymentStatus();
+ log.info(status);
+ assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+ assertTrue("DeploymentStatus.isRunning", status.isRunning());
+ assertFalse("DeploymentStatus.isFailed", status.isFailed());
+ // Check for a ManagedDeployment
+ ManagementView mgtView = super.getManagementView();
+ ManagedDeployment ear = mgtView.getDeployment("testEarDeployment.ear", DeploymentPhase.APPLICATION);
+ assertNotNull(ear);
+ assertTrue(ear.getTypes().contains("ear"));
+
+ // Validate the ejb
+ InitialContext ic = new InitialContext();
+ BeanHome home = (BeanHome) ic.lookup("DeployUnitTestCase-testEjb2xDeployment");
+ BeanRemote bean = home.create();
+ String entry1 = (String) bean.getEnvEntry("entry1");
+ assertEquals("entry1Value", entry1);
+ // TODO, validate the war
+
+ // Stop/remove the deployment
+ progress = deployMgr.stop(DeploymentPhase.APPLICATION, names);
+ progress.addProgressListener(this);
+ progress.run();
+ status = progress.getDeploymentStatus();
+ assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+ assertFalse("DeploymentStatus.isFailed", status.isFailed());
+
+ progress = deployMgr.undeploy(DeploymentPhase.APPLICATION, names);
+ progress.addProgressListener(this);
+ progress.run();
+ status = progress.getDeploymentStatus();
+ assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+ assertFalse("DeploymentStatus.isFailed", status.isFailed());
}
+
public void testMCBeansDeployment()
throws Exception
{
@@ -162,24 +252,76 @@
progress.addProgressListener(this);
progress.run();
status = progress.getDeploymentStatus();
+ log.info(status);
assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
assertTrue("DeploymentStatus.isRunning", status.isRunning());
assertFalse("DeploymentStatus.isFailed", status.isFailed());
- // Check for a
+ // Check for a ManagedDeployment
ManagementView mgtView = super.getManagementView();
ManagedDeployment beans = mgtView.getDeployment("testMCBeansDeployment.beans", DeploymentPhase.APPLICATION);
assertNotNull(beans);
assertTrue(beans.getTypes().contains("beans"));
- // Remove the deployment
- deployMgr.undeploy(DeploymentPhase.APPLICATION, names);
+ // Stop/remove the deployment
+ progress = deployMgr.stop(DeploymentPhase.APPLICATION, names);
+ progress.addProgressListener(this);
+ progress.run();
+ status = progress.getDeploymentStatus();
+ assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+ assertFalse("DeploymentStatus.isFailed", status.isFailed());
+ progress = deployMgr.undeploy(DeploymentPhase.APPLICATION, names);
+ progress.addProgressListener(this);
+ progress.run();
+ status = progress.getDeploymentStatus();
+ assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+ assertFalse("DeploymentStatus.isFailed", status.isFailed());
}
public void testSarDeployment()
throws Exception
{
+ URL contentURL = super.getDeployURL("testSarDeployment.sar");
+
+ // Distribute the content
DeploymentManager deployMgr = getDeploymentManager();
- URL contentURL = super.getDeployURL("testSarDeployment.sar");
- deployMgr.distribute("testSarDeployment.sar", DeploymentPhase.APPLICATION, contentURL);
+ DeploymentProgress progress = deployMgr.distribute("testSarDeployment.sar", DeploymentPhase.APPLICATION, contentURL);
+ progress.addProgressListener(this);
+ progress.run();
+ DeploymentStatus status = progress.getDeploymentStatus();
+ assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+ // It should not be running yet
+ assertFalse("DeploymentStatus.isRunning", status.isRunning());
+ assertFalse("DeploymentStatus.isFailed", status.isFailed());
+
+ // Now start the deployment
+ String[] names = {"testSarDeployment.sar"};
+ progress = deployMgr.start(DeploymentPhase.APPLICATION, names);
+ progress.addProgressListener(this);
+ progress.run();
+ status = progress.getDeploymentStatus();
+ log.info(status);
+ assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+ assertTrue("DeploymentStatus.isRunning", status.isRunning());
+ assertFalse("DeploymentStatus.isFailed", status.isFailed());
+ // Check for a ManagedDeployment
+ ManagementView mgtView = super.getManagementView();
+ ManagedDeployment sar = mgtView.getDeployment("testSarDeployment.sar", DeploymentPhase.APPLICATION);
+ assertNotNull(sar);
+ assertTrue(sar.getTypes().contains("sar"));
+
+ // Stop/remove the deployment
+ progress = deployMgr.stop(DeploymentPhase.APPLICATION, names);
+ progress.addProgressListener(this);
+ progress.run();
+ status = progress.getDeploymentStatus();
+ assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+ assertFalse("DeploymentStatus.isFailed", status.isFailed());
+
+ progress = deployMgr.undeploy(DeploymentPhase.APPLICATION, names);
+ progress.addProgressListener(this);
+ progress.run();
+ status = progress.getDeploymentStatus();
+ assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+ assertFalse("DeploymentStatus.isFailed", status.isFailed());
}
}
Added: trunk/testsuite/src/main/org/jboss/test/profileservice/war/EchoServlet.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/war/EchoServlet.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/war/EchoServlet.java 2008-06-12 04:56:10 UTC (rev 74463)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * 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.profileservice.war;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.logging.Logger;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class EchoServlet extends HttpServlet
+{
+ private static final long serialVersionUID = 1;
+ static Logger log = Logger.getLogger(EchoServlet.class);
+
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException
+ {
+ response.setContentType("text/html");
+ PrintWriter out = response.getWriter();
+ out.println("<html>");
+ out.println("<head><title>EchoServlet</title></head>");
+ out.println("<body><h1>ParameterMap</h1><pre>");
+ out.println(request.getParameterMap());
+ out.println("</pre></body>");
+ out.println("</html>");
+ out.close();
+ }
+
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException
+ {
+ processRequest(request, response);
+ }
+
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException
+ {
+ processRequest(request, response);
+ }
+
+}
Added: trunk/testsuite/src/resources/profileservice/testEarDeployment-application.xml
===================================================================
--- trunk/testsuite/src/resources/profileservice/testEarDeployment-application.xml (rev 0)
+++ trunk/testsuite/src/resources/profileservice/testEarDeployment-application.xml 2008-06-12 04:56:10 UTC (rev 74463)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application version="1.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/application_1_4.xsd">
+ <description>ProfileService ear deployment test</description>
+ <display-name>testEarDeployment</display-name>
+
+ <module>
+ <web>
+ <web-uri>testWarDeployment.war</web-uri>
+ <context-root>/testWarDeployment-ear</context-root>
+ </web>
+ </module>
+ <module>
+ <ejb>testEjb2xDeployment.jar</ejb>
+ </module>
+</application>
Added: trunk/testsuite/src/resources/profileservice/testWarDeployment-web.xml
===================================================================
--- trunk/testsuite/src/resources/profileservice/testWarDeployment-web.xml (rev 0)
+++ trunk/testsuite/src/resources/profileservice/testWarDeployment-web.xml 2008-06-12 04:56:10 UTC (rev 74463)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ metadata-complete="true">
+
+ <description>ProfileService war deployemnt test</description>
+
+ <servlet>
+ <servlet-name>EchoServlet</servlet-name>
+ <servlet-class>org.jboss.test.profileservice.war.EchoServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>EchoServlet</servlet-name>
+ <url-pattern>/EchoServlet</url-pattern>
+ </servlet-mapping>
+
+ <!-- The Welcome File List -->
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+
+</web-app>
More information about the jboss-cvs-commits
mailing list