[webbeans-commits] Webbeans SVN: r2866 - in ri/trunk: jboss-tck-runner/src/test/java/org/jboss/webbeans and 5 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Tue Jun 23 10:18:45 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-06-23 10:18:45 -0400 (Tue, 23 Jun 2009)
New Revision: 2866

Added:
   ri/trunk/jboss-tck-runner/src/test/java/org/jboss/webbeans/tck/
   ri/trunk/jboss-tck-runner/src/test/java/org/jboss/webbeans/tck/jbossas/
   ri/trunk/jboss-tck-runner/src/test/java/org/jboss/webbeans/tck/jbossas/WebBeansProfileServiceDeploymentExceptionTransformer.java
Removed:
   ri/trunk/jboss-tck-runner/src/test/java/org/jboss/webbeans/WebBeansProfileServiceDeploymentExceptionTransformer.java
Modified:
   ri/trunk/jboss-tck-runner/src/main/resources/META-INF/jboss-test-harness.properties
   ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/ManagersImpl.java
   ri/trunk/tests/src/main/java/org/jboss/webbeans/test/harness/AbstractStandaloneContainersImpl.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/deploy/BeansXmlParserTest.java
Log:
further support for deployment errors

Modified: ri/trunk/jboss-tck-runner/src/main/resources/META-INF/jboss-test-harness.properties
===================================================================
--- ri/trunk/jboss-tck-runner/src/main/resources/META-INF/jboss-test-harness.properties	2009-06-23 10:23:28 UTC (rev 2865)
+++ ri/trunk/jboss-tck-runner/src/main/resources/META-INF/jboss-test-harness.properties	2009-06-23 14:18:45 UTC (rev 2866)
@@ -1 +1,2 @@
-org.jboss.testharness.api.TestLauncher=org.jboss.testharness.impl.runner.servlet.ServletTestLauncher
\ No newline at end of file
+org.jboss.testharness.api.TestLauncher=org.jboss.testharness.impl.runner.servlet.ServletTestLauncher
+org.jboss.testharness.container.deploymentExceptionTransformer=org.jboss.webbeans.tck.jbossas.WebBeansProfileServiceDeploymentExceptionTransformer

Deleted: ri/trunk/jboss-tck-runner/src/test/java/org/jboss/webbeans/WebBeansProfileServiceDeploymentExceptionTransformer.java
===================================================================
--- ri/trunk/jboss-tck-runner/src/test/java/org/jboss/webbeans/WebBeansProfileServiceDeploymentExceptionTransformer.java	2009-06-23 10:23:28 UTC (rev 2865)
+++ ri/trunk/jboss-tck-runner/src/test/java/org/jboss/webbeans/WebBeansProfileServiceDeploymentExceptionTransformer.java	2009-06-23 14:18:45 UTC (rev 2866)
@@ -1,52 +0,0 @@
-/*
- * 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.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans;
-
-import java.util.Map.Entry;
-
-import org.jboss.deployers.client.spi.IncompleteDeploymentException;
-import org.jboss.testharness.api.DeploymentException;
-import org.jboss.testharness.api.DeploymentExceptionTransformer;
-
-/**
- * An implementation which can transform deployment exceptions from JBoss AS
- * reported via the Profile Service
- * 
- * @author Pete Muir
- *
- */
-public class WebBeansProfileServiceDeploymentExceptionTransformer implements DeploymentExceptionTransformer
-{
-
-   public DeploymentException transform(DeploymentException exception)
-   {
-      Throwable failure = exception.getCause();
-      if (failure.getCause() instanceof IncompleteDeploymentException)
-      {
-         IncompleteDeploymentException incompleteDeploymentException = (IncompleteDeploymentException) failure.getCause();
-         for (Entry<String, Throwable> entry : incompleteDeploymentException.getIncompleteDeployments().getContextsInError().entrySet())
-         {
-            if (entry.getKey().endsWith(exception.getName() + "/_WebBeansBootstrapBean"))
-            {
-               return new DeploymentException(exception, entry.getValue());
-            }
-         }
-      }
-      return exception;
-   }
-
-}

Copied: ri/trunk/jboss-tck-runner/src/test/java/org/jboss/webbeans/tck/jbossas/WebBeansProfileServiceDeploymentExceptionTransformer.java (from rev 2864, ri/trunk/jboss-tck-runner/src/test/java/org/jboss/webbeans/WebBeansProfileServiceDeploymentExceptionTransformer.java)
===================================================================
--- ri/trunk/jboss-tck-runner/src/test/java/org/jboss/webbeans/tck/jbossas/WebBeansProfileServiceDeploymentExceptionTransformer.java	                        (rev 0)
+++ ri/trunk/jboss-tck-runner/src/test/java/org/jboss/webbeans/tck/jbossas/WebBeansProfileServiceDeploymentExceptionTransformer.java	2009-06-23 14:18:45 UTC (rev 2866)
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.tck.jbossas;
+
+import java.util.Map.Entry;
+
+import org.jboss.deployers.client.spi.IncompleteDeploymentException;
+import org.jboss.testharness.api.DeploymentException;
+import org.jboss.testharness.api.DeploymentExceptionTransformer;
+
+/**
+ * An implementation which can transform deployment exceptions from JBoss AS
+ * reported via the Profile Service
+ * 
+ * @author Pete Muir
+ *
+ */
+public class WebBeansProfileServiceDeploymentExceptionTransformer implements DeploymentExceptionTransformer
+{
+
+   public DeploymentException transform(DeploymentException exception)
+   {
+      Throwable failure = exception.getCause().getCause();
+      if (failure instanceof IncompleteDeploymentException)
+      {
+         IncompleteDeploymentException incompleteDeploymentException = (IncompleteDeploymentException) failure;
+         for (Entry<String, Throwable> entry : incompleteDeploymentException.getIncompleteDeployments().getContextsInError().entrySet())
+         {
+            if (entry.getKey().endsWith(exception.getName() + "/_WebBeansBootstrapBean"))
+            {
+               return new DeploymentException(exception, entry.getValue());
+            }
+         }
+      }
+      return exception;
+   }
+
+}


Property changes on: ri/trunk/jboss-tck-runner/src/test/java/org/jboss/webbeans/tck/jbossas/WebBeansProfileServiceDeploymentExceptionTransformer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/ManagersImpl.java
===================================================================
--- ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/ManagersImpl.java	2009-06-23 10:23:28 UTC (rev 2865)
+++ ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/ManagersImpl.java	2009-06-23 14:18:45 UTC (rev 2866)
@@ -14,12 +14,12 @@
 
 public class ManagersImpl implements Managers
 {
-   
+
    public BeanManager getManager()
    {
       return CurrentManager.rootManager();
    }
-   
+
    public void setEnabledDeploymentTypes(List<Class<? extends Annotation>> enabledDeploymentTypes)
    {
       CurrentManager.rootManager().setEnabledDeploymentTypes(enabledDeploymentTypes);
@@ -32,35 +32,45 @@
       return deploymentTypes;
    }
 
-   public boolean isDefinitionError(Throwable throwable)
+   public boolean isDefinitionError(org.jboss.testharness.api.DeploymentException deploymentException)
    {
-      if (throwable == null)
+      return isDefinitionException(deploymentException.getCause());
+   }
+
+   private boolean isDefinitionException(Throwable t)
+   {
+      if (t == null)
       {
          return false;
       }
-      else if (DefinitionException.class.isAssignableFrom(throwable.getClass()))
+      else if (DefinitionException.class.isAssignableFrom(t.getClass()))
       {
          return true;
       }
       else
       {
-         return isDefinitionError(throwable.getCause());
+         return isDefinitionException(t.getCause());
       }
    }
-   
-   public boolean isDeploymentError(Throwable throwable)
+
+   public boolean isDeploymentError(org.jboss.testharness.api.DeploymentException deploymentException)
    {
-      if (throwable == null)
+      return isDeploymentException(deploymentException.getCause());
+   }
+
+   public boolean isDeploymentException(Throwable t)
+   {
+      if (t == null)
       {
          return false;
       }
-      else if (DeploymentException.class.isAssignableFrom(throwable.getClass()))
+      else if (DeploymentException.class.isAssignableFrom(t.getClass()))
       {
          return true;
       }
       else
       {
-         return isDeploymentError(throwable.getCause());
+         return isDeploymentException(t.getCause());
       }
    }
 }

Modified: ri/trunk/tests/src/main/java/org/jboss/webbeans/test/harness/AbstractStandaloneContainersImpl.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/test/harness/AbstractStandaloneContainersImpl.java	2009-06-23 10:23:28 UTC (rev 2865)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/test/harness/AbstractStandaloneContainersImpl.java	2009-06-23 14:18:45 UTC (rev 2866)
@@ -9,10 +9,12 @@
 
 public abstract class AbstractStandaloneContainersImpl implements StandaloneContainers
 {
-   
+
+   private DeploymentException deploymentException;
+
    private MockServletLifecycle lifecycle;
-   
-   public void deploy(Iterable<Class<?>> classes, Iterable<URL> beansXml) throws DeploymentException
+
+   public boolean deploy(Iterable<Class<?>> classes, Iterable<URL> beansXml)
    {
       this.lifecycle = newLifecycle();
       lifecycle.initialize();
@@ -28,12 +30,14 @@
       }
       catch (Exception e) 
       {
-         throw new DeploymentException("Error deploying beans", e);
+         this.deploymentException = new DeploymentException("Error deploying beans", e);
+         return false;
       }
       lifecycle.beginSession();
       lifecycle.beginRequest();
+      return true;
    }
-   
+
    protected abstract MockServletLifecycle newLifecycle();
 
    public void deploy(Iterable<Class<?>> classes) throws DeploymentException
@@ -44,20 +48,26 @@
    public void cleanup()
    {
       // Np-op
-      
+
    }
-   
+
    public void setup()
    {
       // No-op
    }
 
+   public DeploymentException getDeploymentException()
+   {
+      return deploymentException;
+   }
+
    public void undeploy()
    {
       lifecycle.endRequest();
       lifecycle.endSession();
       lifecycle.endApplication();
       lifecycle = null;
+      deploymentException = null;
    }
-   
+
 }
\ No newline at end of file

Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/deploy/BeansXmlParserTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/deploy/BeansXmlParserTest.java	2009-06-23 10:23:28 UTC (rev 2865)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/deploy/BeansXmlParserTest.java	2009-06-23 14:18:45 UTC (rev 2866)
@@ -27,9 +27,9 @@
 )
 public class BeansXmlParserTest extends AbstractWebBeansTest
 {
-   
+
    // Quick unit tests for the parser
-   @Test
+   @Test(groups="incontainer-broken")
    public void testDefaultDeploymentTypes()
    {
       Iterable<URL> urls = getResources("default-beans.xml");
@@ -43,13 +43,13 @@
       assert i == 1;
       BeansXmlParser parser = new BeansXmlParser(new MockResourceLoader(), urls);
       parser.parse();
-      
+
       assert parser.getEnabledDeploymentTypes().size() == 2;
       assert parser.getEnabledDeploymentTypes().get(0).equals(Standard.class);
       assert parser.getEnabledDeploymentTypes().get(1).equals(Production.class);
    }
-   
-   @Test
+
+   @Test(groups="incontainer-broken")
    public void testUserDefinedDeploymentType()
    {
       Iterable<URL> urls = getResources("user-defined-beans.xml");
@@ -60,16 +60,16 @@
       assert parser.getEnabledDeploymentTypes().get(1).equals(Production.class);
       assert parser.getEnabledDeploymentTypes().get(2).equals(AnotherDeploymentType.class);
    }
-   
+
    /**
     * Test case for WBRI-21.
     */
-   @Test(expectedExceptions=DeploymentException.class, description="WBRI-21")
+   @Test(expectedExceptions=DeploymentException.class, description="WBRI-21", groups="incontainer-broken")
    public void testDuplicateDeployElement()
    {
       Iterable<URL> urls = getResources("duplicate-deployments-beans.xml");
       BeansXmlParser parser = new BeansXmlParser(new MockResourceLoader(), urls);
       parser.parse();
    }
-   
+
 }




More information about the weld-commits mailing list