[jboss-cvs] JBossAS SVN: r69363 - in trunk/testsuite: src/main/org/jboss/test/deployers/web/test and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 25 20:17:09 EST 2008


Author: bstansberry at jboss.com
Date: 2008-01-25 20:17:09 -0500 (Fri, 25 Jan 2008)
New Revision: 69363

Added:
   trunk/testsuite/src/main/org/jboss/test/deployers/web/test/MissingDependencyWEBDeploymentUnitTestCase.java
   trunk/testsuite/src/resources/deployers/web1/WEB-INF/jboss-web.xml
Modified:
   trunk/testsuite/imports/sections/deployers.xml
   trunk/testsuite/src/resources/deployers/web1/WEB-INF/web.xml
Log:
[JBAS-4763] Add test that missing dependency prevents complete deployment

Modified: trunk/testsuite/imports/sections/deployers.xml
===================================================================
--- trunk/testsuite/imports/sections/deployers.xml	2008-01-26 01:15:37 UTC (rev 69362)
+++ trunk/testsuite/imports/sections/deployers.xml	2008-01-26 01:17:09 UTC (rev 69363)
@@ -268,6 +268,14 @@
             <include name="testdeployers-jbas4548-ds.xml"/>
          </fileset>
       </jar>
+   	
+   	<!-- JBAS-4763 -->
+
+      <jar destfile="${build.lib}/testdeployers-jbas4763.war">
+         <fileset dir="${build.resources}/deployers/jbas4763">
+            <include name="**/*.xml"/>
+         </fileset>
+      </jar>
       
    </target>
    

Added: trunk/testsuite/src/main/org/jboss/test/deployers/web/test/MissingDependencyWEBDeploymentUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/deployers/web/test/MissingDependencyWEBDeploymentUnitTestCase.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/deployers/web/test/MissingDependencyWEBDeploymentUnitTestCase.java	2008-01-26 01:17:09 UTC (rev 69363)
@@ -0,0 +1,92 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * 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.deployers.web.test;
+
+import java.util.Map;
+import java.util.Set;
+
+import junit.framework.Test;
+
+import org.jboss.deployers.client.spi.IncompleteDeploymentException;
+import org.jboss.deployers.client.spi.MissingDependency;
+import org.jboss.test.deployers.AbstractDeploymentTest;
+
+/**
+ * Test for JBAS-4763.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 58276 $
+ */
+public class MissingDependencyWEBDeploymentUnitTestCase extends AbstractDeploymentTest
+{
+   public static final String jbas4763Key        = "testdeployers-jbas4763";
+   public static final String jbas4763Deployment = jbas4763Key + ".war";
+   
+   /**
+    * Deploys a war with a non-existent dependency declared in jboss-web.xml,
+    * checking that the deployment is not fully completed.
+    * 
+    * @throws Exception
+    */
+   public void testWEBDeployment() throws Exception
+   {
+      // As of 2008/01/24 a call to isDeployed() will return true, but the AS 
+      // will list the WebModule created from the deployments as being incomplete.
+      // So, we test for that. If something changes and isDeployed() no longer
+      // returns true, that's a successful test outcome as well.
+      if (isDeployed(jbas4763Deployment))
+      {
+         // This is too white box; we are checking for our key in a context name
+         try 
+         {
+            this.invokeMainDeployer("checkIncompleteDeployments", new Object[]{}, new String[]{}, void.class);
+            fail("Call to checkComplete() did not throw exception");
+         }
+         catch (Throwable good)
+         {
+            while (!(good instanceof IncompleteDeploymentException) && good.getCause() != null)
+               good = good.getCause();
+            
+            assertTrue(good instanceof IncompleteDeploymentException);
+            
+            IncompleteDeploymentException ide = (IncompleteDeploymentException) good;
+            Map<String, Set<MissingDependency>> missing = ide.getIncompleteDeployments().getContextsMissingDependencies();
+            for (String deployment : missing.keySet())
+            {
+               if (deployment.indexOf(jbas4763Key) > -1)
+                  return;
+            }
+            fail("Contexts missing dependencies did not include " + jbas4763Key);
+         }
+      }      
+   }
+   
+   public MissingDependencyWEBDeploymentUnitTestCase(String test)
+   {
+      super(test);
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(MissingDependencyWEBDeploymentUnitTestCase.class, jbas4763Deployment);
+   }
+}

Added: trunk/testsuite/src/resources/deployers/web1/WEB-INF/jboss-web.xml
===================================================================
--- trunk/testsuite/src/resources/deployers/web1/WEB-INF/jboss-web.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/deployers/web1/WEB-INF/jboss-web.xml	2008-01-26 01:17:09 UTC (rev 69363)
@@ -0,0 +1,7 @@
+  <!DOCTYPE jboss-web PUBLIC
+    "-//JBoss//DTD Web Application 5.0//EN"
+    "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
+
+<jboss-web>
+   <depends>jboss.test:service=NonExistent</depends>
+</jboss-web>


Property changes on: trunk/testsuite/src/resources/deployers/web1/WEB-INF/jboss-web.xml
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/testsuite/src/resources/deployers/web1/WEB-INF/web.xml
===================================================================
--- trunk/testsuite/src/resources/deployers/web1/WEB-INF/web.xml	2008-01-26 01:15:37 UTC (rev 69362)
+++ trunk/testsuite/src/resources/deployers/web1/WEB-INF/web.xml	2008-01-26 01:17:09 UTC (rev 69363)
@@ -6,5 +6,5 @@
          xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
                              http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
 >
-  <display-name>web1</display-name>
+  <display-name>jbas4763</display-name>
 </web-app>




More information about the jboss-cvs-commits mailing list