package org.jboss.webbeans.tck;

import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.List;

import javax.enterprise.inject.spi.BeanManager;

import org.jboss.jsr299.tck.spi.Managers;
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.DefinitionException;
import org.jboss.webbeans.WebBean;

public class ManagersImpl implements Managers
{
   
   public BeanManager getManager()
   {
      return CurrentManager.rootManager();
   }
   
   public void setEnabledDeploymentTypes(List<Class<? extends Annotation>> enabledDeploymentTypes)
   {
      CurrentManager.rootManager().setEnabledDeploymentTypes(enabledDeploymentTypes);
   }

   public List<Class<? extends Annotation>> getEnabledDeploymentTypes()
   {
      List<Class<? extends Annotation>> deploymentTypes = new ArrayList<Class<? extends Annotation>>(CurrentManager.rootManager().getEnabledDeploymentTypes());
      deploymentTypes.remove(WebBean.class);
      return deploymentTypes;
   }

   public boolean isDefinitionError(Throwable throwable)
   {
      if (throwable == null)
      {
         return false;
      }
      else if (DefinitionException.class.isAssignableFrom(throwable.getClass()))
      {
         return true;
      }
      else
      {
         return isDefinitionError(throwable.getCause());
      }
   }
   
}

@@ -294,24 +294,71 @@
 nException;%0A
+import org.jboss.webbeans.DeploymentException;%0A
 import org.j
@@ -1381,10 +1381,348 @@
   %7D%0A   %0A
+   public boolean isDeploymentError(Throwable throwable)%0A   %7B%0A      if (throwable == null)%0A      %7B%0A         return false;%0A      %7D%0A      else if (DeploymentException.class.isAssignableFrom(throwable.getClass()))%0A      %7B%0A         return true;%0A      %7D%0A      else%0A      %7B%0A         return isDeploymentError(throwable.getCause());%0A      %7D%0A   %7D%0A
 %7D%0A

add the DeploymentError exception category to the TCK harness