[webbeans-commits] Webbeans SVN: r1650 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup: manager and 1 other directory.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Sun Feb 22 18:03:13 EST 2009


Author: pete.muir at jboss.org
Date: 2009-02-22 18:03:11 -0500 (Sun, 22 Feb 2009)
New Revision: 1650

Modified:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/injectionpoint/InjectionPointTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/manager/ManagerTest.java
Log:
@Artifactify

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/injectionpoint/InjectionPointTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/injectionpoint/InjectionPointTest.java	2009-02-22 21:32:14 UTC (rev 1649)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/injectionpoint/InjectionPointTest.java	2009-02-22 23:03:11 UTC (rev 1650)
@@ -33,6 +33,7 @@
 import org.hibernate.tck.annotations.SpecAssertion;
 import org.hibernate.tck.annotations.SpecAssertions;
 import org.jboss.jsr299.tck.AbstractDeclarativeTest;
+import org.jboss.jsr299.tck.impl.packaging.Artifact;
 import org.jboss.jsr299.tck.literals.CurrentBinding;
 import org.testng.annotations.Test;
 
@@ -43,193 +44,179 @@
  * 
  * Spec version: PRD2
  */
+ at Artifact
 public class InjectionPointTest extends AbstractDeclarativeTest
 {
 
    @Test(groups = { "injectionPoint" })
    @SpecAssertion(section = "5.6", id = "a")
-   public void testGetBean()
+   public void testGetBean() throws Exception
    {
-      deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
 
       // Get an instance of the bean which has another bean injected into it
-      try
+      new RunInDependentContext()
       {
-         activateDependentContext();
-         FieldInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
-         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
-         assert beanWithInjectionPoint.getInjectedMetadata() != null;
-
-         Set<Bean<FieldInjectionPointBean>> resolvedBeans = getCurrentManager().resolveByType(FieldInjectionPointBean.class);
-         assert resolvedBeans.size() == 1;
-         assert beanWithInjectionPoint.getInjectedMetadata().getBean().equals(resolvedBeans.iterator().next());
-      }
-      finally
-      {
-         deactivateDependentContext();
-      }
+         
+         @Override
+         protected void execute() throws Exception
+         {
+            FieldInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+            BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+            assert beanWithInjectionPoint.getInjectedMetadata() != null;
+   
+            Set<Bean<FieldInjectionPointBean>> resolvedBeans = getCurrentManager().resolveByType(FieldInjectionPointBean.class);
+            assert resolvedBeans.size() == 1;
+            assert beanWithInjectionPoint.getInjectedMetadata().getBean().equals(resolvedBeans.iterator().next());
+         }
+      }.run();
    }
 
    @Test(groups = { "injectionPoint" })
    @SpecAssertion(section = "5.6", id = "ba")
-   public void testGetType()
+   public void testGetType() throws Exception
    {
-      deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
-
       // Get an instance of the bean which has another bean injected into it
-      try
+      new RunInDependentContext()
       {
-         activateDependentContext();
-         FieldInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
-         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
-         assert beanWithInjectionPoint.getInjectedMetadata() != null;
-         assert beanWithInjectionPoint.getInjectedMetadata().getType().equals(BeanWithInjectionPointMetadata.class);
-      }
-      finally
-      {
-         deactivateDependentContext();
-      }
+         
+         @Override
+         protected void execute() throws Exception
+         {
+            FieldInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+            BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+            assert beanWithInjectionPoint.getInjectedMetadata() != null;
+            assert beanWithInjectionPoint.getInjectedMetadata().getType().equals(BeanWithInjectionPointMetadata.class);
+         }
+      }.run();
    }
 
    @Test(groups = { "injectionPoint" })
    @SpecAssertion(section = "5.6", id = "bc")
-   public void testGetBindingTypes()
+   public void testGetBindingTypes() throws Exception
    {
-      deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
-
       // Get an instance of the bean which has another bean injected into it
-      try
+      new RunInDependentContext()
       {
-         activateDependentContext();
-         FieldInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
-         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
-         assert beanWithInjectionPoint.getInjectedMetadata() != null;
-         Set<Annotation> bindingTypes = beanWithInjectionPoint.getInjectedMetadata().getBindings();
-         assert bindingTypes.size() == 1;
-         assert Current.class.isAssignableFrom(bindingTypes.iterator().next().annotationType());
-      }
-      finally
-      {
-         deactivateDependentContext();
-      }
+         
+         @Override
+         protected void execute() throws Exception
+         {
+            FieldInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+            BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+            assert beanWithInjectionPoint.getInjectedMetadata() != null;
+            Set<Annotation> bindingTypes = beanWithInjectionPoint.getInjectedMetadata().getBindings();
+            assert bindingTypes.size() == 1;
+            assert Current.class.isAssignableFrom(bindingTypes.iterator().next().annotationType());
+         }
+      }.run();
    }
 
    @Test(groups = { "injectionPoint" })
    @SpecAssertion(section = "5.6", id = "ca")
-   public void testGetMemberField()
+   public void testGetMemberField() throws Exception
    {
-      deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
-
       // Get an instance of the bean which has another bean injected into it
-      try
+      new RunInDependentContext()
       {
-         activateDependentContext();
-         FieldInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
-         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
-         assert beanWithInjectionPoint.getInjectedMetadata() != null;
-         assert Field.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getMember().getClass());
-      }
-      finally
-      {
-         deactivateDependentContext();
-      }
+         
+         @Override
+         protected void execute() throws Exception
+         {
+            FieldInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+            BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+            assert beanWithInjectionPoint.getInjectedMetadata() != null;
+            assert Field.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getMember().getClass());
+         }
+      }.run();
    }
 
    @Test(groups = { "injectionPoint" })
    @SpecAssertion(section = "5.6", id = "cb")
-   public void testGetMemberMethod()
+   public void testGetMemberMethod() throws Exception
    {
-      deployBeans(MethodInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
-
       // Get an instance of the bean which has another bean injected into it
-      try
+      new RunInDependentContext()
       {
-         activateDependentContext();
-         MethodInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(MethodInjectionPointBean.class, new CurrentBinding());
-         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
-         assert beanWithInjectionPoint.getInjectedMetadata() != null;
-         assert Method.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getMember().getClass());
-
-         // Since the type and bindings must correspond to the parameter, check
-         // them
-         assert beanWithInjectionPoint.getInjectedMetadata().getType().equals(BeanWithInjectionPointMetadata.class);
-         assert beanWithInjectionPoint.getInjectedMetadata().getBindings().contains(new CurrentBinding());
-      }
-      finally
-      {
-         deactivateDependentContext();
-      }
+         
+         @Override
+         protected void execute() throws Exception
+         {
+            MethodInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(MethodInjectionPointBean.class, new CurrentBinding());
+            BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+            assert beanWithInjectionPoint.getInjectedMetadata() != null;
+            assert Method.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getMember().getClass());
+   
+            // Since the type and bindings must correspond to the parameter, check
+            // them
+            assert beanWithInjectionPoint.getInjectedMetadata().getType().equals(BeanWithInjectionPointMetadata.class);
+            assert beanWithInjectionPoint.getInjectedMetadata().getBindings().contains(new CurrentBinding());
+         }
+      }.run();
    }
 
    @Test(groups = { "injectionPoint" })
    @SpecAssertion(section = "5.6", id = "cc")
-   public void testGetMemberConstructor()
+   public void testGetMemberConstructor() throws Exception
    {
-      deployBeans(ConstructorInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
-
       // Get an instance of the bean which has another bean injected into it
-      try
+      new RunInDependentContext()
       {
-         activateDependentContext();
-         ConstructorInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(ConstructorInjectionPointBean.class, new CurrentBinding());
-         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
-         assert beanWithInjectionPoint.getInjectedMetadata() != null;
-         assert Constructor.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getMember().getClass());
-
-         // Since the type and bindings must correspond to the parameter, check
-         // them
-         assert beanWithInjectionPoint.getInjectedMetadata().getType().equals(BeanWithInjectionPointMetadata.class);
-         assert beanWithInjectionPoint.getInjectedMetadata().getBindings().contains(new CurrentBinding());
-      }
-      finally
-      {
-         deactivateDependentContext();
-      }
+         
+         @Override
+         protected void execute() throws Exception
+         {
+            ConstructorInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(ConstructorInjectionPointBean.class, new CurrentBinding());
+            BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+            assert beanWithInjectionPoint.getInjectedMetadata() != null;
+            assert Constructor.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getMember().getClass());
+   
+            // Since the type and bindings must correspond to the parameter, check
+            // them
+            assert beanWithInjectionPoint.getInjectedMetadata().getType().equals(BeanWithInjectionPointMetadata.class);
+            assert beanWithInjectionPoint.getInjectedMetadata().getBindings().contains(new CurrentBinding());
+         }
+      }.run();
    }
 
    @Test(groups = { "injectionPoint" })
    @SpecAssertion(section = "5.6", id = "da")
-   public void testGetAnnotation()
+   public void testGetAnnotation() throws Exception
    {
-      deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
-
       // Get an instance of the bean which has another bean injected into it
-      try
+      new RunInDependentContext()
       {
-         activateDependentContext();
-         FieldInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
-         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
-         assert beanWithInjectionPoint.getInjectedMetadata() != null;
-         assert beanWithInjectionPoint.getInjectedMetadata().getAnnotation(AnimalStereotype.class) != null;
-      }
-      finally
-      {
-         deactivateDependentContext();
-      }
+         
+         @Override
+         protected void execute() throws Exception
+         {
+            FieldInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+            BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+            assert beanWithInjectionPoint.getInjectedMetadata() != null;
+            assert beanWithInjectionPoint.getInjectedMetadata().getAnnotation(AnimalStereotype.class) != null;
+         }
+      }.run();
    }
 
    @Test(groups = { "injectionPoint" })
    @SpecAssertion(section = "5.6", id = "dd")
-   public void testGetAnnotations()
+   public void testGetAnnotations() throws Exception
    {
-      deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
-
       // Get an instance of the bean which has another bean injected into it
-      try
+      new RunInDependentContext()
       {
-         activateDependentContext();
-         FieldInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
-         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
-         assert beanWithInjectionPoint.getInjectedMetadata() != null;
-         Set<Annotation> annotations = new HashSet<Annotation>(Arrays.asList(beanWithInjectionPoint.getInjectedMetadata().getAnnotations()));
-         assert annotations.size() > 0;
-         assert annotations.contains(new CurrentBinding());
-         assert annotations.contains(new AnimalStereotypeAnnotationLiteral());
-      }
-      finally
-      {
-         deactivateDependentContext();
-      }
+         
+         @Override
+         protected void execute() throws Exception
+         {
+            FieldInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+            BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+            assert beanWithInjectionPoint.getInjectedMetadata() != null;
+            Set<Annotation> annotations = new HashSet<Annotation>(Arrays.asList(beanWithInjectionPoint.getInjectedMetadata().getAnnotations()));
+            assert annotations.size() > 0;
+            assert annotations.contains(new CurrentBinding());
+            assert annotations.contains(new AnimalStereotypeAnnotationLiteral());
+         }
+      }.run();
    }
 
    @Test(groups = { "injectionPoint" })
@@ -239,8 +226,6 @@
    })
    public void testStandardDeployment() throws Exception
    {
-      deployBeans();
-
       new RunInDependentContext()
       {
          
@@ -258,8 +243,6 @@
    @SpecAssertion(section = "5.6.1", id = "zb")
    public void testDependentScope() throws Exception
    {
-      deployBeans();
-
       new RunInDependentContext()
       {
          
@@ -277,23 +260,21 @@
    @SpecAssertions({
       @SpecAssertion(section = "5.6.1", id = "zc")
    })
-   public void testApiTypeInjectionPoint()
+   public void testApiTypeInjectionPoint()  throws Exception
    {
-      deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
-
       // Get an instance of the bean which has another bean injected into it
-      try
+      new RunInDependentContext()
       {
-         activateDependentContext();
-         FieldInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
-         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
-         assert beanWithInjectionPoint.getInjectedMetadata() != null;
-         assert InjectionPoint.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getClass());
-      }
-      finally
-      {
-         deactivateDependentContext();
-      }
+         
+         @Override
+         protected void execute() throws Exception
+         {
+            FieldInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+            BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+            assert beanWithInjectionPoint.getInjectedMetadata() != null;
+            assert InjectionPoint.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getClass());
+         }
+      }.run();
    }
 
    @Test(groups = { "injectionPoint" })
@@ -301,22 +282,19 @@
       @SpecAssertion(section = "5.6.1", id = "zd"),
       @SpecAssertion(section = "5.6.1", id = "a")
    })
-   public void testCurrentBinding()
+   public void testCurrentBinding() throws Exception
    {
-      deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
-
       // Get an instance of the bean which has another bean injected into it
-      try
+      new RunInDependentContext()
       {
-         activateDependentContext();
-         FieldInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
-         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
-         assert beanWithInjectionPoint.getInjectedMetadata() != null;
-         assert beanWithInjectionPoint.getInjectedMetadata().getBindings().contains(new CurrentBinding());
-      }
-      finally
-      {
-         deactivateDependentContext();
-      }
+         @Override
+         protected void execute() throws Exception
+         {
+            FieldInjectionPointBean beanWithInjectedBean = getCurrentManager().getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+            BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+            assert beanWithInjectionPoint.getInjectedMetadata() != null;
+            assert beanWithInjectionPoint.getInjectedMetadata().getBindings().contains(new CurrentBinding());
+         }
+      }.run();
    }
 }

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/manager/ManagerTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/manager/ManagerTest.java	2009-02-22 21:32:14 UTC (rev 1649)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/lookup/manager/ManagerTest.java	2009-02-22 23:03:11 UTC (rev 1650)
@@ -2,6 +2,7 @@
 
 import org.hibernate.tck.annotations.SpecAssertion;
 import org.jboss.jsr299.tck.AbstractDeclarativeTest;
+import org.jboss.jsr299.tck.impl.packaging.Artifact;
 import org.testng.annotations.Test;
 
 /**
@@ -9,13 +10,13 @@
  * Spec version: PRD2
  *
  */
+ at Artifact
 public class ManagerTest extends AbstractDeclarativeTest
 {
    @Test(groups={"manager", "injection", "deployment"}) 
    @SpecAssertion(section="5.7.2", id = "a")
    public void testInjectingManager() throws Exception
    {
-      deployBeans(FishFarmOffice.class);
       new RunInDependentContext()
       {
          




More information about the weld-commits mailing list