[webbeans-commits] Webbeans SVN: r2788 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck: tests/event and 1 other directory.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Mon Jun 8 13:25:31 EDT 2009


Author: dallen6
Date: 2009-06-08 13:25:30 -0400 (Mon, 08 Jun 2009)
New Revision: 2788

Modified:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java
Log:
Some minor test modifications/improvements

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java	2009-06-08 16:26:44 UTC (rev 2787)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java	2009-06-08 17:25:30 UTC (rev 2788)
@@ -145,31 +145,26 @@
       return annotationTypeList.size() == 0;
    }
    
-   @Deprecated
    public <T> Set<Bean<T>> getBeans(Class<T> type, Annotation... bindings)
    {
       return (Set<Bean<T>>)(Set)getCurrentManager().getBeans(type, bindings);
    }
    
-   @Deprecated
    public <T> Set<Bean<T>> getBeans(TypeLiteral<T> type, Annotation... bindings)
    {
       return (Set<Bean<T>>)(Set)getCurrentManager().getBeans(type.getType(), bindings);
    }
 
-   @Deprecated
    public <T> T getInstanceByType(Class<T> beanType, Annotation... bindings) 
    {
       return OldSPIBridge.getInstanceByType(getCurrentManager(), beanType, bindings);
    }
    
-   @Deprecated
    public <T> T getInstanceByType(TypeLiteral<T> beanType, Annotation... bindings) 
    {
       return OldSPIBridge.getInstanceByType(getCurrentManager(), beanType, bindings);
    }
       
-   @Deprecated
    public Object getInstanceByName(String name)
    {
       return OldSPIBridge.getInstanceByName(getCurrentManager(), name);

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java	2009-06-08 16:26:44 UTC (rev 2787)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java	2009-06-08 17:25:30 UTC (rev 2788)
@@ -18,7 +18,6 @@
 import org.hibernate.tck.annotations.SpecAssertion;
 import org.hibernate.tck.annotations.SpecAssertions;
 import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.jsr299.tck.impl.OldSPIBridge;
 import org.jboss.jsr299.tck.literals.AnyBinding;
 import org.jboss.testharness.impl.packaging.Artifact;
 import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
@@ -360,7 +359,7 @@
          @Override
          protected void execute() throws Exception
          {
-            RecluseSpider bean = OldSPIBridge.getInstanceByType(getCurrentManager(),RecluseSpider.class);
+            RecluseSpider bean = getInstanceByType(RecluseSpider.class);
             assert bean != null;
             // Must invoke a method to really create the instance
             assert !bean.isNotified();
@@ -503,7 +502,7 @@
          @Override
          protected void execute() throws Exception
          {
-            SweeWaxbill bean = OldSPIBridge.getInstanceByType(getCurrentManager(), SweeWaxbill.class);
+            SweeWaxbill bean = getInstanceByType(SweeWaxbill.class);
             bean.methodThatFiresEvent();
          }
 
@@ -520,7 +519,7 @@
          @Override
          protected void execute() throws Exception
          {
-            SweeWaxbill bean = OldSPIBridge.getInstanceByType(getCurrentManager(), SweeWaxbill.class);
+            SweeWaxbill bean = getInstanceByType(SweeWaxbill.class);
             bean.methodThatRegistersObserver();
          }
 
@@ -537,7 +536,7 @@
          @Override
          protected void execute() throws Exception
          {
-            OwlFinch_Broken bean = OldSPIBridge.getInstanceByType(getCurrentManager(), OwlFinch_Broken.class);
+            OwlFinch_Broken bean = getInstanceByType(OwlFinch_Broken.class);
             bean.methodThatFiresEvent();
          }
 
@@ -554,7 +553,7 @@
          @Override
          protected void execute() throws Exception
          {
-            OwlFinch_Broken bean = OldSPIBridge.getInstanceByType(getCurrentManager(), OwlFinch_Broken.class);
+            OwlFinch_Broken bean = getInstanceByType(OwlFinch_Broken.class);
             bean.methodThatRegistersObserver();
          }
 
@@ -565,114 +564,64 @@
    @SpecAssertions( { @SpecAssertion(section = "7.6", id = "n") } )
    public void testImplicitEventBeanMatchesAPITypeOfInectionPoint() throws Exception
    {
-      new RunInDependentContext()
-      {
+      // Retrieve the implicit event bean from the manager only by
+      // its API type
+      Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyBinding());
+      assert !eventBeans.isEmpty();
+   }
 
-         @Override
-         protected void execute() throws Exception
-         {
-            // Retrieve the implicit event bean from the manager only by
-            // its API type
-            Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyBinding());
-            assert !eventBeans.isEmpty();
-         }
-
-      }.run();
+   @Test(groups = { "events" })
+   public void testImplicitEventHasAnyBinding()
+   {
+      Set<Bean<Event<AnEventType>>> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyBinding());
+      assert !eventBeans.isEmpty();
+      assert eventBeans.iterator().next().getBindings().contains(new AnyBinding());
    }
 
    @Test(groups = { "events" })
    @SpecAssertions( { @SpecAssertion(section = "7.6", id = "n") } )
    public void testImplicitEventBeanMatchesBindingAnnotationsOfInjectionPoint() throws Exception
    {
-      new RunInDependentContext()
-      {
-
-         @Override
-         protected void execute() throws Exception
-         {
-            // Retrieve the implicit event bean from the manager
-            // by its binding types (uses OrangeCheekedWaxbill)
-            Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyBinding(), new TameAnnotationLiteral(), new RoleBinding("Admin"));
-            assert !eventBeans.isEmpty();
-         }
-
-      }.run();
+      Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>(){}, new AnyBinding(), new TameAnnotationLiteral(), new RoleBinding("Admin"));
+      assert !eventBeans.isEmpty();
    }
 
    @Test(groups = { "events" })
    @SpecAssertion(section = "7.6", id = "o")
    public void testImplicitEventBeanHasStandardDeploymentType() throws Exception
    {
-      new RunInDependentContext()
-      {
-
-         @Override
-         protected void execute() throws Exception
-         {
-            // Retrieve the implicit event bean from the manager
-            // only by its API type (uses BlueFacedParrotFinch)
-            Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyBinding());
-            assert eventBeans.size() == 1;
-            Bean<?> eventBean = (Bean<?>) eventBeans.iterator().next();
-            assert eventBean.getDeploymentType().equals(Standard.class);
-         }
-
-      }.run();
+      Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyBinding());
+      assert eventBeans.size() == 1;
+      Bean<?> eventBean = (Bean<?>) eventBeans.iterator().next();
+      assert eventBean.getDeploymentType().equals(Standard.class);
    }
 
    @Test(groups = { "events" })
    @SpecAssertion(section = "7.6", id = "p")
    public void testImplicitEventBeanHasDependentScope() throws Exception
    {
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            // Retrieve the implicit event bean from the manager only
-            // by its API type (uses BlueFacedParrotFinch)
-            Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyBinding());
-            assert eventBeans.size() == 1;
-            Bean<?> eventBean = (Bean<?>) eventBeans.iterator().next();
-            assert eventBean.getScopeType().equals(Dependent.class);
-         }
-      }.run();
+      Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyBinding());
+      assert eventBeans.size() == 1;
+      Bean<?> eventBean = (Bean<?>) eventBeans.iterator().next();
+      assert eventBean.getScopeType().equals(Dependent.class);
    }
 
    @Test(groups = { "events" })
    @SpecAssertion(section = "7.6", id = "q")
    public void testImplicitEventBeanHasNoName() throws Exception
    {
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            // Retrieve the implicit event bean from the manager only
-            // by its API type (uses BlueFacedParrotFinch)
-            Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyBinding());
-            assert eventBeans.size() == 1;
-            Bean<?> eventBean = (Bean<?>) eventBeans.iterator().next();
-            assert eventBean.getName() == null;
-         }
-      }.run();
+      Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyBinding());
+      assert eventBeans.size() == 1;
+      Bean<?> eventBean = (Bean<?>) eventBeans.iterator().next();
+      assert eventBean.getName() == null;
    }
 
    @Test(groups = { "events" })
    @SpecAssertions( { @SpecAssertion(section = "7.6", id = "a"), @SpecAssertion(section = "7.6", id = "r") } )
    public void testImplicitEventBeanProvidedByContainer() throws Exception
    {
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            // Retrieve the implicit event bean from the manager only
-            // by its API type (uses BlueFacedParrotFinch)
-            Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyBinding());
-            assert eventBeans.size() == 1;
-         }
-      }.run();
+      Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyBinding());
+      assert eventBeans.size() == 1;
    }
 
    // TODO The manager related tests require intercepting all calls




More information about the weld-commits mailing list