[webbeans-commits] Webbeans SVN: r957 - in tck/trunk/impl/src/main/java/org/jboss/webbeans/tck: tests and 1 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Wed Jan 14 08:43:03 EST 2009


Author: pete.muir at jboss.org
Date: 2009-01-14 08:43:03 -0500 (Wed, 14 Jan 2009)
New Revision: 957

Removed:
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/TckUtils.java
Modified:
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/AbstractTest.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/CommonWebBeanTest.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/DefaultDeploymentTypeTest.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/DeploymentTypeTest.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/NameTest.java
Log:
remove TCKUtils, use WebBeansTCKImpl.configuration() instead

Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/TckUtils.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/TckUtils.java	2009-01-14 13:18:35 UTC (rev 956)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/TckUtils.java	2009-01-14 13:43:03 UTC (rev 957)
@@ -1,89 +0,0 @@
-package org.jboss.webbeans.tck.impl;
-
-import java.lang.reflect.Constructor;
-
-import org.jboss.webbeans.tck.api.Beans;
-import org.jboss.webbeans.tck.api.Contexts;
-import org.jboss.webbeans.tck.api.Managers;
-
-import org.jboss.webbeans.tck.impl.util.DeploymentProperties;
-import org.jboss.webbeans.tck.impl.util.Reflections;
-
-/**
- * 
- * @author Shane Bryzak
- * 
- */
-public class TckUtils
-{
-   private static DeploymentProperties deploymentProperties = new DeploymentProperties();
-   
-   public static Managers getManagers()
-   {
-      Managers managers = null;
-      
-      for (Class<? extends Managers> cls : deploymentProperties.getClasses(Managers.class.getName(), Managers.class))
-      {
-         Constructor<? extends Managers> constructor = Reflections.getConstructor(cls);
-         if (constructor != null)
-         {
-            try
-            {
-               managers = constructor.newInstance();
-            }
-            catch (Exception ex)
-            {
-               // Do something with the exception (log it?)
-            }
-         }
-      }
-      
-      return managers;
-   }
-   
-   public static Contexts getContexts()
-   {
-      Contexts contexts = null;
-      
-      for (Class<? extends Contexts> cls : deploymentProperties.getClasses(Contexts.class.getName(), Contexts.class))
-      {
-         Constructor<? extends Contexts> constructor = Reflections.getConstructor(cls);
-         if (constructor != null)
-         {
-            try
-            {
-               contexts = constructor.newInstance();
-            }
-            catch (Exception ex)
-            {
-               // Do something with the exception (log it?)
-            }
-         }
-      }
-      
-      return contexts;
-   }
-   
-   public static Beans getBeans()
-   {
-      Beans beans = null;
-      
-      for (Class<? extends Beans> cls : deploymentProperties.getClasses(Beans.class.getName(), Beans.class))
-      {
-         Constructor<? extends Beans> constructor = Reflections.getConstructor(cls);
-         if (constructor != null)
-         {
-            try
-            {
-               beans = constructor.newInstance();
-            }
-            catch (Exception ex)
-            {
-               // Do something with the exception (log it?)
-            }
-         }
-      }
-      
-      return beans;
-   }   
-}

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/AbstractTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/AbstractTest.java	2009-01-14 13:18:35 UTC (rev 956)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/AbstractTest.java	2009-01-14 13:43:03 UTC (rev 957)
@@ -1,5 +1,6 @@
 package org.jboss.webbeans.tck.tests;
 
+import static org.jboss.webbeans.tck.impl.WebBeansTCKImpl.configuration;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -14,8 +15,6 @@
 import javax.webbeans.manager.Bean;
 import javax.webbeans.manager.Manager;
 
-import org.jboss.webbeans.tck.impl.TckUtils;
-import org.jboss.webbeans.tck.impl.WebBeansTCKImpl;
 import org.jboss.webbeans.tck.impl.test.annotations.AnotherDeploymentType;
 import org.jboss.webbeans.tck.impl.test.annotations.HornedAnimalDeploymentType;
 import org.testng.annotations.BeforeMethod;
@@ -31,18 +30,18 @@
    @BeforeMethod
    public final void before()
    {
-      manager = WebBeansTCKImpl.configuration().getManagers().createManager();
-      WebBeansTCKImpl.configuration().getManagers().setEnabledDeploymentTypes(Arrays.asList(Standard.class, Production.class, AnotherDeploymentType.class));
+      manager = configuration().getManagers().createManager();
+      configuration().getManagers().setEnabledDeploymentTypes(Arrays.asList(Standard.class, Production.class, AnotherDeploymentType.class));
    }
    
    public <T> Bean<T> getSimpleBean(Class<T> beanClass)
    {
-      return WebBeansTCKImpl.configuration().getBeans().createSimpleBean(beanClass);
+      return configuration().getBeans().createSimpleBean(beanClass);
    }
    
    public <T> Bean<?> getProducerMethodBean(Method method, Bean<?> producerBean)
    {
-      return WebBeansTCKImpl.configuration().getBeans().createProducerMethodBean(method, producerBean);
+      return configuration().getBeans().createProducerMethodBean(method, producerBean);
    }
 
    /*
@@ -76,7 +75,7 @@
    @SuppressWarnings("unchecked")
    protected void addStandardDeploymentTypesForTests()
    {
-      TckUtils.getManagers().setEnabledDeploymentTypes(Arrays.asList(Standard.class, Production.class, AnotherDeploymentType.class, HornedAnimalDeploymentType.class));
+      configuration().getManagers().setEnabledDeploymentTypes(Arrays.asList(Standard.class, Production.class, AnotherDeploymentType.class, HornedAnimalDeploymentType.class));
    }
 /*
    protected <T> void addToEjbCache(Class<T> clazz)

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/CommonWebBeanTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/CommonWebBeanTest.java	2009-01-14 13:18:35 UTC (rev 956)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/CommonWebBeanTest.java	2009-01-14 13:43:03 UTC (rev 957)
@@ -1,5 +1,7 @@
 package org.jboss.webbeans.tck.tests.definition;
 
+import static org.jboss.webbeans.tck.impl.WebBeansTCKImpl.configuration;
+
 import java.lang.reflect.Method;
 
 import javax.webbeans.Production;
@@ -8,7 +10,6 @@
 
 import org.jboss.webbeans.tck.impl.SpecAssertion;
 import org.jboss.webbeans.tck.impl.SpecVersion;
-import org.jboss.webbeans.tck.impl.TckUtils;
 import org.jboss.webbeans.tck.impl.test.beans.Animal;
 import org.jboss.webbeans.tck.impl.test.beans.DeadlyAnimal;
 import org.jboss.webbeans.tck.impl.test.beans.DeadlySpider;
@@ -24,36 +25,41 @@
  * This test class should be used for common assertions about Web Beans
  * 
  * @author Pete Muir
- *
+ * 
  */
 @SpecVersion("20081206")
-public class CommonWebBeanTest extends AbstractTest 
+public class CommonWebBeanTest extends AbstractTest
 {
-
-   // TODO This should actually somehow test the reverse - that the container throws a definition exception if any of these occur
    
-   @Test @SpecAssertion(section="2")
+   // TODO This should actually somehow test the reverse - that the container
+   // throws a definition exception if any of these occur
+   
+   @Test
+   @SpecAssertion(section = "2")
    public void testApiTypesNonEmpty()
    {
       Bean<?> model = getSimpleBean(RedSnapper.class);
       assert model.getTypes().size() > 0;
    }
    
-   @Test @SpecAssertion(section="2")
+   @Test
+   @SpecAssertion(section = "2")
    public void testBindingTypesNonEmpty()
    {
       Bean<?> model = getSimpleBean(RedSnapper.class);
-      assert TckUtils.getBeans().getBindings(model).size() > 0;
+      assert configuration().getBeans().getBindings(model).size() > 0;
    }
    
-   @Test @SpecAssertion(section="2")
+   @Test
+   @SpecAssertion(section = "2")
    public void testHasScopeType()
    {
       Bean<?> model = getSimpleBean(RedSnapper.class);
       assert model.getScopeType().equals(RequestScoped.class);
    }
    
-   @Test @SpecAssertion(section="2")
+   @Test
+   @SpecAssertion(section = "2")
    public void testHasDeploymentType()
    {
       Bean<?> model = getSimpleBean(RedSnapper.class);
@@ -61,7 +67,8 @@
    }
    
    @SuppressWarnings("unchecked")
-   @Test(groups="producerMethod") @SpecAssertion(section="5.2")
+   @Test(groups = "producerMethod")
+   @SpecAssertion(section = "5.2")
    public void testIsNullable() throws Exception
    {
       Bean<SpiderProducer> spiderProducerBean = getSimpleBean(SpiderProducer.class);
@@ -74,8 +81,8 @@
       assert spiderBean.isNullable();
    }
    
-   
-   @Test @SpecAssertion(section={"3.2.2", "2.2"})
+   @Test
+   @SpecAssertion(section = { "3.2.2", "2.2" })
    public void testApiTypes()
    {
       Bean<Tarantula> bean = getSimpleBean(Tarantula.class);
@@ -88,7 +95,8 @@
       assert bean.getTypes().contains(DeadlyAnimal.class);
    }
    
-   @Test @SpecAssertion(section="2.2")
+   @Test
+   @SpecAssertion(section = "2.2")
    public void testFinalApiType()
    {
       getSimpleBean(DependentFinalTuna.class);

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/DefaultDeploymentTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/DefaultDeploymentTypeTest.java	2009-01-14 13:18:35 UTC (rev 956)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/DefaultDeploymentTypeTest.java	2009-01-14 13:43:03 UTC (rev 957)
@@ -1,10 +1,11 @@
 package org.jboss.webbeans.tck.tests.definition;
 
+import static org.jboss.webbeans.tck.impl.WebBeansTCKImpl.configuration;
+
 import javax.webbeans.Production;
 import javax.webbeans.Standard;
 
 import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.impl.TckUtils;
 import org.jboss.webbeans.tck.tests.AbstractTest;
 import org.testng.annotations.Test;
 
@@ -21,9 +22,9 @@
    @Test @SpecAssertion(section={"2.5.6", "2.5.7"})
    public void testDefaultEnabledDeploymentTypes()
    {
-      assert TckUtils.getManagers().getEnabledDeploymentTypes().size() == 2;
-      assert TckUtils.getManagers().getEnabledDeploymentTypes().get(0).equals(Standard.class);
-      assert TckUtils.getManagers().getEnabledDeploymentTypes().get(1).equals(Production.class);
+      assert configuration().getManagers().getEnabledDeploymentTypes().size() == 2;
+      assert configuration().getManagers().getEnabledDeploymentTypes().get(0).equals(Standard.class);
+      assert configuration().getManagers().getEnabledDeploymentTypes().get(1).equals(Production.class);
    }
    
 }

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/DeploymentTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/DeploymentTypeTest.java	2009-01-14 13:18:35 UTC (rev 956)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/DeploymentTypeTest.java	2009-01-14 13:43:03 UTC (rev 957)
@@ -1,5 +1,7 @@
 package org.jboss.webbeans.tck.tests.definition;
 
+import static org.jboss.webbeans.tck.impl.WebBeansTCKImpl.configuration;
+
 import java.lang.reflect.Method;
 import java.util.Arrays;
 
@@ -12,7 +14,6 @@
 
 import org.jboss.webbeans.tck.impl.SpecAssertion;
 import org.jboss.webbeans.tck.impl.SpecVersion;
-import org.jboss.webbeans.tck.impl.TckUtils;
 import org.jboss.webbeans.tck.impl.test.annotations.AnotherDeploymentType;
 import org.jboss.webbeans.tck.impl.test.annotations.HornedAnimalDeploymentType;
 import org.jboss.webbeans.tck.impl.test.beans.BlackWidow;
@@ -113,7 +114,7 @@
    @Test(groups="beanLifecycle", expectedExceptions=UnsatisfiedDependencyException.class) @SpecAssertion(section="2.5.6")
    public void testBeanWithDisabledDeploymentTypeNotInstantiated()
    {
-      TckUtils.getManagers().setEnabledDeploymentTypes(
+      configuration().getManagers().setEnabledDeploymentTypes(
             Arrays.asList(Standard.class, AnotherDeploymentType.class, 
                   HornedAnimalDeploymentType.class));
       
@@ -126,20 +127,20 @@
    @Test @SpecAssertion(section={"2.5.6", "2.5.7"})
    public void testCustomDeploymentTypes()
    {
-      TckUtils.getManagers().setEnabledDeploymentTypes(
+      configuration().getManagers().setEnabledDeploymentTypes(
             Arrays.asList(Standard.class, AnotherDeploymentType.class, 
                   HornedAnimalDeploymentType.class));
-      assert TckUtils.getManagers().getEnabledDeploymentTypes().size() == 3;
-      assert TckUtils.getManagers().getEnabledDeploymentTypes().get(0).equals(Standard.class);
-      assert TckUtils.getManagers().getEnabledDeploymentTypes().get(1).equals(AnotherDeploymentType.class);
-      assert TckUtils.getManagers().getEnabledDeploymentTypes().get(2).equals(HornedAnimalDeploymentType.class);
+      assert configuration().getManagers().getEnabledDeploymentTypes().size() == 3;
+      assert configuration().getManagers().getEnabledDeploymentTypes().get(0).equals(Standard.class);
+      assert configuration().getManagers().getEnabledDeploymentTypes().get(1).equals(AnotherDeploymentType.class);
+      assert configuration().getManagers().getEnabledDeploymentTypes().get(2).equals(HornedAnimalDeploymentType.class);
    }
    
    @SuppressWarnings("unchecked")
    @Test(expectedExceptions=DeploymentException.class) @SpecAssertion(section="2.5.6")
    public void testStandardMustBeDeclared()
    {
-      TckUtils.getManagers().setEnabledDeploymentTypes(
+      configuration().getManagers().setEnabledDeploymentTypes(
             Arrays.asList(AnotherDeploymentType.class, HornedAnimalDeploymentType.class));
    }
    

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/NameTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/NameTest.java	2009-01-14 13:18:35 UTC (rev 956)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/NameTest.java	2009-01-14 13:43:03 UTC (rev 957)
@@ -1,11 +1,12 @@
 package org.jboss.webbeans.tck.tests.definition;
 
+import static org.jboss.webbeans.tck.impl.WebBeansTCKImpl.configuration;
+
 import javax.webbeans.DefinitionException;
 import javax.webbeans.manager.Bean;
 
 import org.jboss.webbeans.tck.impl.SpecAssertion;
 import org.jboss.webbeans.tck.impl.SpecVersion;
-import org.jboss.webbeans.tck.impl.TckUtils;
 import org.jboss.webbeans.tck.impl.test.beans.Haddock;
 import org.jboss.webbeans.tck.impl.test.beans.Minnow;
 import org.jboss.webbeans.tck.impl.test.beans.Moose;
@@ -112,7 +113,7 @@
    public void testSterotypeDefaultsName()
    {
       Bean<RedSnapper> model = getSimpleBean(RedSnapper.class);
-      assert TckUtils.getBeans().isBeanNameDefaulted(model);
+      assert configuration().getBeans().isBeanNameDefaulted(model);
       assert model.getName().equals("redSnapper");
    }
    




More information about the weld-commits mailing list