[webbeans-commits] Webbeans SVN: r3344 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck: tests/context/dependent and 14 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Wed Jul 29 02:21:41 EDT 2009


Author: shane.bryzak at jboss.com
Date: 2009-07-29 02:21:40 -0400 (Wed, 29 Jul 2009)
New Revision: 3344

Modified:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/fires/nonbinding/NonBindingTypePassedToFireTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/enterprise/EnterpriseEventInheritenceTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DisposalMethodDefinitionTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanICTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/remove/EnterpriseBeanRemoveMethodTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/ProducerFieldDefinitionTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/ProducerFieldLifecycleTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/SimpleBeanDefinitionTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/NewSimpleBeanTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/EnterpriseBeanSpecializationIntegrationTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/byname/ResolutionByNameTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/ClientProxyTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/policy/PolicyAvailabilityTest.java
Log:
removed RunInDependentContext


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-07-29 05:07:40 UTC (rev 3343)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java	2009-07-29 06:21:40 UTC (rev 3344)
@@ -26,43 +26,6 @@
 
 public abstract class AbstractJSR299Test extends org.jboss.testharness.AbstractTest
 {
-
-   protected abstract static class RunInDependentContext
-   {
-
-      protected void setup()
-      {
-         getCurrentConfiguration().getContexts().setActive(getCurrentConfiguration().getContexts().getDependentContext());
-      }
-
-      protected void cleanup()
-      {
-         getCurrentConfiguration().getContexts().setInactive(getCurrentConfiguration().getContexts().getDependentContext());
-      }
-
-      public final void run() throws Exception
-      {
-         try
-         {
-            setup();
-            execute();
-         }
-         finally
-         {
-            cleanup();
-         }
-      }
-
-      protected JSR299Configuration getCurrentConfiguration()
-      {
-         return JSR299ConfigurationImpl.get();
-      }
-
-      protected abstract void execute() throws Exception;
-
-   }
-
-
    protected BeanManager getCurrentManager()
    {
       return getCurrentConfiguration().getManagers().getManager();

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java	2009-07-29 05:07:40 UTC (rev 3343)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java	2009-07-29 06:21:40 UTC (rev 3344)
@@ -45,19 +45,12 @@
    @SpecAssertion(section = "6.4", id = "c")
    public void testInstanceUsedForElEvaluationNotShared() throws Exception
    {
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            Set<Bean<Fox>> foxBeans = getBeans(Fox.class);
-            assert foxBeans.size() == 1;
+      Set<Bean<Fox>> foxBeans = getBeans(Fox.class);
+      assert foxBeans.size() == 1;
 
-            Fox fox1 = getCurrentConfiguration().getEl().evaluateValueExpression("#{fox}", Fox.class);
-            Fox fox2 = getCurrentConfiguration().getEl().evaluateValueExpression("#{fox}", Fox.class);
-            assert !fox1.equals(fox2);
-         }
-      }.run();
+      Fox fox1 = getCurrentConfiguration().getEl().evaluateValueExpression("#{fox}", Fox.class);
+      Fox fox2 = getCurrentConfiguration().getEl().evaluateValueExpression("#{fox}", Fox.class);
+      assert !fox1.equals(fox2);
    }
 
    @Test(groups = { "contexts", "producerMethod" })

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/fires/nonbinding/NonBindingTypePassedToFireTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/fires/nonbinding/NonBindingTypePassedToFireTest.java	2009-07-29 05:07:40 UTC (rev 3343)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/fires/nonbinding/NonBindingTypePassedToFireTest.java	2009-07-29 06:21:40 UTC (rev 3344)
@@ -14,15 +14,7 @@
    @SpecAssertion(section = "11.3.10", id = "e")
    public void testExceptionThrownIfNonBindingTypePassedToFire() throws Exception
    {
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            OwlFinch_Broken bean = getInstanceByType(OwlFinch_Broken.class);
-            bean.methodThatFiresEvent();
-         }
-
-      }.run();
+      OwlFinch_Broken bean = getInstanceByType(OwlFinch_Broken.class);
+      bean.methodThatFiresEvent();
    }
 }

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/enterprise/EnterpriseEventInheritenceTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/enterprise/EnterpriseEventInheritenceTest.java	2009-07-29 05:07:40 UTC (rev 3343)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/enterprise/EnterpriseEventInheritenceTest.java	2009-07-29 06:21:40 UTC (rev 3344)
@@ -28,45 +28,29 @@
    @SpecAssertion(section = "4.2", id = "df")
    public void testNonStaticObserverMethodNotInherited() throws Exception
    {
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            Egg egg = new Egg();
-            Set<ObserverMethod<?, Egg>> observers = getCurrentManager().resolveObserverMethods(egg);
-            assert observers.size() == 1;
+      Egg egg = new Egg();
+      Set<ObserverMethod<?, Egg>> observers = getCurrentManager().resolveObserverMethods(egg);
+      assert observers.size() == 1;
 
-            // Notify the observer so we can confirm that it
-            // is a method only on Farmer, and not LazyFarmer
-            observers.iterator().next().notify(egg);
-            assert egg.getClassesVisited().size() == 1;
-            assert egg.getClassesVisited().iterator().next().equals(Farmer.class);
-         }
-
-      }.run();
+      // Notify the observer so we can confirm that it
+      // is a method only on Farmer, and not LazyFarmer
+      observers.iterator().next().notify(egg);
+      assert egg.getClassesVisited().size() == 1;
+      assert egg.getClassesVisited().iterator().next().equals(Farmer.class);
    }
    
    @Test(groups = { "events", "inheritance" })
    @SpecAssertion(section = "4.2", id = "dl")
    public void testNonStaticObserverMethodNotIndirectlyInherited() throws Exception
    {
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            StockPrice stockPrice = new StockPrice();
-            Set<ObserverMethod<?, StockPrice>> observers = getCurrentManager().resolveObserverMethods(stockPrice);
-            assert observers.size() == 1;
+      StockPrice stockPrice = new StockPrice();
+      Set<ObserverMethod<?, StockPrice>> observers = getCurrentManager().resolveObserverMethods(stockPrice);
+      assert observers.size() == 1;
 
-            // Notify the observer so we can confirm that it
-            // is a method only on StockWatcher, and not IndirectStockWatcher
-            observers.iterator().next().notify(stockPrice);
-            assert stockPrice.getClassesVisited().size() == 1;
-            assert stockPrice.getClassesVisited().iterator().next().equals(StockWatcher.class);
-         }
-
-      }.run();
+      // Notify the observer so we can confirm that it
+      // is a method only on StockWatcher, and not IndirectStockWatcher
+      observers.iterator().next().notify(stockPrice);
+      assert stockPrice.getClassesVisited().size() == 1;
+      assert stockPrice.getClassesVisited().iterator().next().equals(StockWatcher.class);
    }
 }

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DisposalMethodDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DisposalMethodDefinitionTest.java	2009-07-29 05:07:40 UTC (rev 3343)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DisposalMethodDefinitionTest.java	2009-07-29 06:21:40 UTC (rev 3344)
@@ -35,19 +35,10 @@
    })
    public void testBindingTypesAppliedToDisposalMethodParameters() throws Exception
    {
-      new RunInDependentContext()
-      {
-
-         @Override
-         protected void execute() throws Exception
-         {
-            Bean<Tarantula> tarantula = getBeans(Tarantula.class, DEADLIEST_LITERAL).iterator().next();
-            CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(tarantula);
-            Tarantula instance = tarantula.create(creationalContext);
-            tarantula.destroy(instance, creationalContext);
-         }
-         
-      }.run();
+      Bean<Tarantula> tarantula = getBeans(Tarantula.class, DEADLIEST_LITERAL).iterator().next();
+      CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(tarantula);
+      Tarantula instance = tarantula.create(creationalContext);
+      tarantula.destroy(instance, creationalContext);
       assert SpiderProducer.isTameSpiderDestroyed();
    }
 
@@ -58,19 +49,10 @@
    })
    public void testDisposalMethodOnNonBean() throws Exception
    {
-      new RunInDependentContext()
-      {
-
-         @Override
-         protected void execute() throws Exception
-         {
-            Bean<Tarantula> tarantula = getBeans(Tarantula.class, DEADLIEST_LITERAL).iterator().next();
-            CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(tarantula);
-            Tarantula instance = getCurrentManager().getContext(tarantula.getScopeType()).get(tarantula);
-            tarantula.destroy(instance, creationalContext);
-         }
-         
-      }.run();
+      Bean<Tarantula> tarantula = getBeans(Tarantula.class, DEADLIEST_LITERAL).iterator().next();
+      CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(tarantula);
+      Tarantula instance = getCurrentManager().getContext(tarantula.getScopeType()).get(tarantula);
+      tarantula.destroy(instance, creationalContext);
       assert !DisposalNonBean.isSpiderDestroyed();
    }
 
@@ -89,19 +71,10 @@
    })
    public void testDisposalMethodParametersGetInjected() throws Exception
    {
-      new RunInDependentContext()
-      {
-
-         @Override
-         protected void execute() throws Exception
-         {
-            Bean<Tarantula> tarantula = getBeans(Tarantula.class, DEADLIEST_LITERAL).iterator().next();
-            CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(tarantula);
-            Tarantula instance = getCurrentManager().getContext(tarantula.getScopeType()).get(tarantula);
-            tarantula.destroy(instance, creationalContext);
-         }
-         
-      }.run();
+      Bean<Tarantula> tarantula = getBeans(Tarantula.class, DEADLIEST_LITERAL).iterator().next();
+      CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(tarantula);
+      Tarantula instance = getCurrentManager().getContext(tarantula.getScopeType()).get(tarantula);
+      tarantula.destroy(instance, creationalContext);
       assert SpiderProducer.isDeadliestSpiderDestroyed();
    }
 

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanICTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanICTest.java	2009-07-29 05:07:40 UTC (rev 3343)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanICTest.java	2009-07-29 06:21:40 UTC (rev 3344)
@@ -43,21 +43,12 @@
    @SpecAssertion(section = "3.10", id = "v")
    public void testNewBeanHasNoProducerMethods() throws Exception
    {
-      new RunInDependentContext()
-      {
-
-         @Override
-         protected void execute() throws Exception
-         {
-            FoxLocal fox = getInstanceByType(FoxLocal.class);
-            FoxLocal newFox = getInstanceByType(FoxLocal.class,new NewLiteral());
-            fox.setNextLitterSize(3);
-            newFox.setNextLitterSize(5);
-            Litter theOnlyLitter = getInstanceByType(Litter.class,new AnnotationLiteral<Tame>(){});
-            assert theOnlyLitter.getQuantity() == fox.getNextLitterSize();
-         }
-         
-      }.run();
+      FoxLocal fox = getInstanceByType(FoxLocal.class);
+      FoxLocal newFox = getInstanceByType(FoxLocal.class,new NewLiteral());
+      fox.setNextLitterSize(3);
+      newFox.setNextLitterSize(5);
+      Litter theOnlyLitter = getInstanceByType(Litter.class,new AnnotationLiteral<Tame>(){});
+      assert theOnlyLitter.getQuantity() == fox.getNextLitterSize();
    }
 
    @Test(groups = { "new", "ri-broken" })

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/remove/EnterpriseBeanRemoveMethodTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/remove/EnterpriseBeanRemoveMethodTest.java	2009-07-29 05:07:40 UTC (rev 3343)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/remove/EnterpriseBeanRemoveMethodTest.java	2009-07-29 06:21:40 UTC (rev 3344)
@@ -28,38 +28,22 @@
    @SpecAssertion(section = "3.2.1", id = "a")
    public void testApplicationMayCallAnyRemoveMethodOnDependentScopedSessionEnterpriseBeans() throws Exception
    {
-      new RunInDependentContext()
-      {
-
-         @Override
-         protected void execute() throws Exception
-         {
-            DependentSessionInterface sessionBean = getInstanceByType(DependentSessionInterface.class);
-            sessionBean.remove();
-            Bean<?> bean = getCurrentManager().getBeans(StateKeeper.class).iterator().next();
-            StateKeeper stateKeeper = (StateKeeper)
-               getCurrentManager().getReference(bean,StateKeeper.class, getCurrentManager().createCreationalContext(bean));
-            assert stateKeeper.isRemoveCalled();
-         }
-      }.run();
+      DependentSessionInterface sessionBean = getInstanceByType(DependentSessionInterface.class);
+      sessionBean.remove();
+      Bean<?> bean = getCurrentManager().getBeans(StateKeeper.class).iterator().next();
+      StateKeeper stateKeeper = (StateKeeper)
+         getCurrentManager().getReference(bean,StateKeeper.class, getCurrentManager().createCreationalContext(bean));
+      assert stateKeeper.isRemoveCalled();
    }
 
    @Test(groups = { "enterpriseBeans", "removeMethod", "lifecycle" })
    @SpecAssertion(section = "3.2.1", id = "da")
    public void testApplicationMayCallRemoveMethodOnDependentScopedSessionEnterpriseBeansButNoParametersArePassed() throws Exception
    {
-      new RunInDependentContext()
-      {
-
-         @Override
-         protected void execute() throws Exception
-         {
-            DependentSessionInterface sessionBean = getInstanceByType(DependentSessionInterface.class);
-            sessionBean.anotherRemoveWithParameters("required", null);
-            StateKeeper stateKeeper = getInstanceByType(StateKeeper.class);
-            assert stateKeeper.isRemoveCalled();
-         }
-      }.run();
+      DependentSessionInterface sessionBean = getInstanceByType(DependentSessionInterface.class);
+      sessionBean.anotherRemoveWithParameters("required", null);
+      StateKeeper stateKeeper = getInstanceByType(StateKeeper.class);
+      assert stateKeeper.isRemoveCalled();
    }
 
    @Test(groups = { "enterpriseBeans", "removeMethod", "lifecycle" }, expectedExceptions = UnsupportedOperationException.class)

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/ProducerFieldDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/ProducerFieldDefinitionTest.java	2009-07-29 05:07:40 UTC (rev 3343)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/ProducerFieldDefinitionTest.java	2009-07-29 06:21:40 UTC (rev 3344)
@@ -30,16 +30,10 @@
    @SpecAssertion(section = "3.4", id = "fa")
    public void testParameterizedReturnType() throws Exception
    {
-      new RunInDependentContext()
-      {
-         public void execute()
-         {
-            FunnelWeaverSpiderConsumer spiderConsumer = getInstanceByType(FunnelWeaverSpiderConsumer.class);
-            assert spiderConsumer != null;
-            assert spiderConsumer.getInjectedSpider() != null;
-            assert spiderConsumer.getInjectedSpider().equals(FunnelWeaverSpiderProducer.getSpider());
-         }
-      }.run();
+      FunnelWeaverSpiderConsumer spiderConsumer = getInstanceByType(FunnelWeaverSpiderConsumer.class);
+      assert spiderConsumer != null;
+      assert spiderConsumer.getInjectedSpider() != null;
+      assert spiderConsumer.getInjectedSpider().equals(FunnelWeaverSpiderProducer.getSpider());
    }
 
    @Test(groups = { "producerField", "deployment" })

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/ProducerFieldLifecycleTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/ProducerFieldLifecycleTest.java	2009-07-29 05:07:40 UTC (rev 3343)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/ProducerFieldLifecycleTest.java	2009-07-29 06:21:40 UTC (rev 3344)
@@ -22,15 +22,7 @@
    })
    public void testProducerFieldNotAnotherBean()
    {
-      new RunInDependentContext()
-      {
-
-         @Override
-         protected void execute() throws Exception
-         {
-            assert getInstanceByType(BrownRecluse.class) != null;
-         }
-      };
+      assert getInstanceByType(BrownRecluse.class) != null;
    }
 
    @Test(groups = { "producerField" })
@@ -40,16 +32,8 @@
    })
    public void testProducerStaticFieldBean()
    {
-      new RunInDependentContext()
-      {
-
-         @Override
-         protected void execute() throws Exception
-         {
-            TarantulaConsumer tarantulaConsumer = getInstanceByType(TarantulaConsumer.class);
-            assert tarantulaConsumer.getConsumedTarantula().equals(StaticTarantulaProducer.produceTarantula);
-         }
-      };
+      TarantulaConsumer tarantulaConsumer = getInstanceByType(TarantulaConsumer.class);
+      assert tarantulaConsumer.getConsumedTarantula().equals(StaticTarantulaProducer.produceTarantula);
    }
 
    @Test(groups = { "producerField" })
@@ -59,15 +43,8 @@
    })
    public void testProducerFieldBeanCreate() throws Exception
    {
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            BlackWidowConsumer spiderConsumer = getInstanceByType(BlackWidowConsumer.class);
-            assert spiderConsumer.getInjectedSpider().equals(BlackWidowProducer.blackWidow);
-         }
-      }.run();
+      BlackWidowConsumer spiderConsumer = getInstanceByType(BlackWidowConsumer.class);
+      assert spiderConsumer.getInjectedSpider().equals(BlackWidowProducer.blackWidow);
    }
 
    @Test(groups = { "producerField", "specialization" })
@@ -77,16 +54,9 @@
    })
    public void testSpecializedBeanAlwaysUsed() throws Exception
    {
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            TarantulaConsumer spiderConsumer = getInstanceByType(TarantulaConsumer.class);
-            assert spiderConsumer.getConsumedTarantula() != null;
-            assert spiderConsumer.getConsumedTarantula() instanceof DefangedTarantula;
-         }
-      }.run();
+      TarantulaConsumer spiderConsumer = getInstanceByType(TarantulaConsumer.class);
+      assert spiderConsumer.getConsumedTarantula() != null;
+      assert spiderConsumer.getConsumedTarantula() instanceof DefangedTarantula;
    }
 
    @Test(groups = { "producerField" })
@@ -96,15 +66,8 @@
     })    
    public void testProducerFieldReturnsNullIsDependent() throws Exception
    {
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            NullSpiderConsumer consumerBean = getInstanceByType(NullSpiderConsumer.class);
-            assert consumerBean.getInjectedSpider() == null;
-         }
-      }.run();
+      NullSpiderConsumer consumerBean = getInstanceByType(NullSpiderConsumer.class);
+      assert consumerBean.getInjectedSpider() == null;
    }
 
    @Test(groups = { "producerField" }, expectedExceptions = IllegalProductException.class)  
@@ -114,26 +77,19 @@
    })   
    public void testProducerFieldReturnsNullIsNotDependent() throws Exception
    {
-      new RunInDependentContext()
+      NullSpiderConsumerForBrokenProducer consumer = getInstanceByType(NullSpiderConsumerForBrokenProducer.class);
+      // The injected spider is proxied since it is in the request scope.
+      // So to actually create the bean instance, we need to invoke
+      // some method on the proxy.
+      if (consumer.getInjectedSpider() == null)
       {
-         @Override
-         protected void execute() throws Exception
-         {
-            NullSpiderConsumerForBrokenProducer consumer = getInstanceByType(NullSpiderConsumerForBrokenProducer.class);
-            // The injected spider is proxied since it is in the request scope.
-            // So to actually create the bean instance, we need to invoke
-            // some method on the proxy.
-            if (consumer.getInjectedSpider() == null)
-            {
-               // No proxy in this impl, and no exception = fail
-            }
-            else
-            {
-               // Proxy is assumed, so invoke some method
-               consumer.getInjectedSpider().bite();
-            }
-         }
-      }.run();
+         // No proxy in this impl, and no exception = fail
+      }
+      else
+      {
+         // Proxy is assumed, so invoke some method
+         consumer.getInjectedSpider().bite();
+      }
    }
 
 }

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/SimpleBeanDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/SimpleBeanDefinitionTest.java	2009-07-29 05:07:40 UTC (rev 3343)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/SimpleBeanDefinitionTest.java	2009-07-29 06:21:40 UTC (rev 3344)
@@ -1,11 +1,11 @@
 package org.jboss.jsr299.tck.tests.implementation.simple.definition;
 
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecAssertions;
-import org.jboss.test.audit.annotations.SpecVersion;
 import org.jboss.jsr299.tck.AbstractJSR299Test;
 import org.jboss.jsr299.tck.tests.implementation.simple.definition.OuterClass.InnerClass_NotBeean;
 import org.jboss.jsr299.tck.tests.implementation.simple.definition.OuterClass.StaticInnerClass;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecAssertions;
+import org.jboss.test.audit.annotations.SpecVersion;
 import org.jboss.testharness.impl.packaging.Artifact;
 import org.testng.annotations.Test;
 
@@ -84,17 +84,9 @@
    @SpecAssertion(section = "3.1.4.1", id = "a")
    public void testInitializerAnnotatedConstructor() throws Exception
    {
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            Sheep.constructedCorrectly = false;
-            getInstanceByType(Sheep.class);
-            assert Sheep.constructedCorrectly;
-
-         }
-      }.run();
+      Sheep.constructedCorrectly = false;
+      getInstanceByType(Sheep.class);
+      assert Sheep.constructedCorrectly;
    }
 
    @Test
@@ -114,30 +106,14 @@
    @SpecAssertion(section = "3.1.4.1", id = "a")
    public void testInitializerAnnotatedConstructorUsedOverEmptyConstuctor() throws Exception
    {
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            getInstanceByType(Turkey.class);
-            assert Turkey.constructedCorrectly;
-         }
-      }.run();
+      getInstanceByType(Turkey.class);
+      assert Turkey.constructedCorrectly;
    }
 
    @Test
    @SpecAssertion(section = "3.1", id = "fa")
    public void testDependentScopedBeanCanHavePublicField() throws Exception
    {
-      new RunInDependentContext()
-      {
-
-         @Override
-         protected void execute() throws Exception
-         {
-            assert getInstanceByType(Tiger.class).name.equals("pete");
-         }
-
-      }.run();
+      assert getInstanceByType(Tiger.class).name.equals("pete");
    }
 }

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/NewSimpleBeanTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/NewSimpleBeanTest.java	2009-07-29 05:07:40 UTC (rev 3343)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/NewSimpleBeanTest.java	2009-07-29 06:21:40 UTC (rev 3344)
@@ -87,65 +87,37 @@
    @SpecAssertion(section = "3.10", id = "w")
    public void testNewBeanHasNoProducerFields() throws Exception
    {
-      new RunInDependentContext()
-      {
-
-         @Override
-         protected void execute() throws Exception
-         {
-            Fox fox = getInstanceByType(Fox.class);
-            Fox newFox = getInstanceByType(Fox.class,new NewLiteral());
-            newFox.setDen(new Den("NewFoxDen"));
-            Den theOnlyDen = getInstanceByType(Den.class);
-            assert theOnlyDen.getName().equals(fox.getDen().getName());
-         }
-         
-      }.run();
-      
+      Fox fox = getInstanceByType(Fox.class);
+      Fox newFox = getInstanceByType(Fox.class,new NewLiteral());
+      newFox.setDen(new Den("NewFoxDen"));
+      Den theOnlyDen = getInstanceByType(Den.class);
+      assert theOnlyDen.getName().equals(fox.getDen().getName());
    }
 
    @Test(groups = { "new" })
    @SpecAssertion(section = "3.10", id = "v")
    public void testNewBeanHasNoProducerMethods() throws Exception
    {
-      new RunInDependentContext()
-      {
-
-         @Override
-         protected void execute() throws Exception
-         {
-            Fox fox = getInstanceByType(Fox.class);
-            Fox newFox = getInstanceByType(Fox.class,new NewLiteral());
-            fox.setNextLitterSize(3);
-            newFox.setNextLitterSize(5);
-            Litter theOnlyLitter = getInstanceByType(Litter.class);
-            assert theOnlyLitter.getQuantity() == fox.getNextLitterSize();
-         }
-         
-      }.run();
+      Fox fox = getInstanceByType(Fox.class);
+      Fox newFox = getInstanceByType(Fox.class,new NewLiteral());
+      fox.setNextLitterSize(3);
+      newFox.setNextLitterSize(5);
+      Litter theOnlyLitter = getInstanceByType(Litter.class);
+      assert theOnlyLitter.getQuantity() == fox.getNextLitterSize();
    }
 
    @Test(groups = { "new" })
    @SpecAssertion(section = "3.10", id = "x")
    public void testNewBeanHasNoDisposerMethods() throws Exception
    {
-      new RunInDependentContext()
-      {
-
-         @Override
-         protected void execute() throws Exception
-         {
-            Fox fox = getInstanceByType(Fox.class);
-            Fox newFox = getInstanceByType(Fox.class,new NewLiteral());
-            Bean<Litter> litterBean = getBeans(Litter.class).iterator().next();
-            CreationalContext<Litter> creationalContext = getCurrentManager().createCreationalContext(litterBean);
-            Litter litter = getInstanceByType(Litter.class);
-            litterBean.destroy(litter, creationalContext);
-            assert fox.isLitterDisposed();
-            assert !newFox.isLitterDisposed();
-         }
-         
-      }.run();
+      Fox fox = getInstanceByType(Fox.class);
+      Fox newFox = getInstanceByType(Fox.class,new NewLiteral());
+      Bean<Litter> litterBean = getBeans(Litter.class).iterator().next();
+      CreationalContext<Litter> creationalContext = getCurrentManager().createCreationalContext(litterBean);
+      Litter litter = getInstanceByType(Litter.class);
+      litterBean.destroy(litter, creationalContext);
+      assert fox.isLitterDisposed();
+      assert !newFox.isLitterDisposed();
    }
 
    @Test

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/EnterpriseBeanSpecializationIntegrationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/EnterpriseBeanSpecializationIntegrationTest.java	2009-07-29 05:07:40 UTC (rev 3343)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/EnterpriseBeanSpecializationIntegrationTest.java	2009-07-29 06:21:40 UTC (rev 3344)
@@ -32,17 +32,8 @@
    })
    public void testSpecializedBeanNotInstantiated() throws Exception
    {
-      new RunInDependentContext()
-      {
-         
-         @Override
-         protected void execute() throws Exception
-         {
-            FarmerLocal farmer = getInstanceByType(FarmerLocal.class,LANDOWNER_LITERAL);
-            assert farmer.getClassName().equals(LazyFarmer.class.getName());
-         }
-         
-      }.run();
+      FarmerLocal farmer = getInstanceByType(FarmerLocal.class,LANDOWNER_LITERAL);
+      assert farmer.getClassName().equals(LazyFarmer.class.getName());
    }
    
    
@@ -50,16 +41,7 @@
    @SpecAssertion(section="4.3.2", id = "a")
    public void testProducerMethodOnSpecializedBeanCalledOnSpecializingBean() throws Exception
    {
-      new RunInDependentContext()
-      {
-         
-         @Override
-         protected void execute() throws Exception
-         {
-            assert getBeans(Waste.class).size() == 1;
-            assert getInstanceByType(Waste.class).getFrom().equals(Office.class.getName());
-         }
-         
-      }.run();
+      assert getBeans(Waste.class).size() == 1;
+      assert getInstanceByType(Waste.class).getFrom().equals(Office.class.getName());
    }
 }

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/byname/ResolutionByNameTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/byname/ResolutionByNameTest.java	2009-07-29 05:07:40 UTC (rev 3343)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/byname/ResolutionByNameTest.java	2009-07-29 06:21:40 UTC (rev 3344)
@@ -34,19 +34,11 @@
    // WBRI-306
    public void testAmbiguousELNamesResolved() throws Exception
    {
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            // Cod, Plaice and AlaskaPlaice are named "whitefish" - Cod is a not-enabled policy, AlaskaPlaice specializes Plaice
-            assert getCurrentManager().getBeans("whitefish").size() == 1;
-            assert getCurrentManager().getBeans("whitefish").iterator().next().getTypes().contains(AlaskaPlaice.class);
-            // Both Salmon and Sole are named "fish" - Sole is an enabled policy
-            assert getCurrentManager().getBeans("fish").size() == 1;
-            assert getCurrentManager().getBeans("fish").iterator().next().getTypes().contains(Sole.class);
-         }
-         
-      }.run();
+      // Cod, Plaice and AlaskaPlaice are named "whitefish" - Cod is a not-enabled policy, AlaskaPlaice specializes Plaice
+      assert getCurrentManager().getBeans("whitefish").size() == 1;
+      assert getCurrentManager().getBeans("whitefish").iterator().next().getTypes().contains(AlaskaPlaice.class);
+      // Both Salmon and Sole are named "fish" - Sole is an enabled policy
+      assert getCurrentManager().getBeans("fish").size() == 1;
+      assert getCurrentManager().getBeans("fish").iterator().next().getTypes().contains(Sole.class);
    }
 }

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/ClientProxyTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/ClientProxyTest.java	2009-07-29 05:07:40 UTC (rev 3343)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/ClientProxyTest.java	2009-07-29 06:21:40 UTC (rev 3344)
@@ -63,27 +63,21 @@
    }
    @Test
    @SpecAssertion(section="5.5.2", id="ab")
-   public void testInactiveScope() throws Exception {
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            assert getCurrentConfiguration().getContexts().getRequestContext().isActive();
-            setContextInactive(getCurrentConfiguration().getContexts().getRequestContext());
-            assert !getCurrentConfiguration().getContexts().getRequestContext().isActive();
-            try {
-               getInstanceByType(TunedTuna.class).getState();
-               assert false;
-            } catch (ContextNotActiveException cnae) {
-            } catch (IllegalStateException ise) {
-            } catch (Throwable t) {
-               assert false;
-            }
-            
-            // TODO need to set request scope active again, some other tests will fail otherwise
-            setContextActive(getCurrentConfiguration().getContexts().getRequestContext());
-         }
-      }.run();
+   public void testInactiveScope() throws Exception 
+   {
+      assert getCurrentConfiguration().getContexts().getRequestContext().isActive();
+      setContextInactive(getCurrentConfiguration().getContexts().getRequestContext());
+      assert !getCurrentConfiguration().getContexts().getRequestContext().isActive();
+      try {
+         getInstanceByType(TunedTuna.class).getState();
+         assert false;
+      } catch (ContextNotActiveException cnae) {
+      } catch (IllegalStateException ise) {
+      } catch (Throwable t) {
+         assert false;
+      }
+      
+      // TODO need to set request scope active again, some other tests will fail otherwise
+      setContextActive(getCurrentConfiguration().getContexts().getRequestContext());
    }
 }

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java	2009-07-29 05:07:40 UTC (rev 3343)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java	2009-07-29 06:21:40 UTC (rev 3344)
@@ -26,32 +26,18 @@
    @SpecAssertion(section="4.2", id = "aa")
    public void testFieldDeclaredInSuperclassInjected() throws Exception
    {      
-      new RunInDependentContext()
-      {
-        @Override
-         protected void execute() throws Exception
-         {
-           DeluxeHenHouse henHouse = getInstanceByType(DeluxeHenHouse.class);
-           assert henHouse.fox != null;
-           assert henHouse.fox.getName().equals("gavin");
-         }
-      }.run();
+     DeluxeHenHouse henHouse = getInstanceByType(DeluxeHenHouse.class);
+     assert henHouse.fox != null;
+     assert henHouse.fox.getName().equals("gavin");
    }
    
    @Test 
    @SpecAssertion(section="4.2", id = "ac")
    public void testFieldDeclaredInIndirectSuperclassInjected() throws Exception
    {
-      new RunInDependentContext()
-      {
-        @Override
-         protected void execute() throws Exception
-         {
-           MegaPoorHenHouse henHouse = getInstanceByType(MegaPoorHenHouse.class);
-           assert henHouse.fox != null;
-           assert henHouse.fox.getName().equals("gavin");
-         }
-      }.run();
+      MegaPoorHenHouse henHouse = getInstanceByType(MegaPoorHenHouse.class);
+      assert henHouse.fox != null;
+      assert henHouse.fox.getName().equals("gavin");
    }
 
    @Test(groups = {"injection", "underInvestigation"})

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/policy/PolicyAvailabilityTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/policy/PolicyAvailabilityTest.java	2009-07-29 05:07:40 UTC (rev 3343)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/policy/PolicyAvailabilityTest.java	2009-07-29 06:21:40 UTC (rev 3344)
@@ -45,40 +45,26 @@
       // WBRI-306
    public void testPolicyAvailability() throws Exception
    {
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            Set<Bean<Animal>> animals =  getBeans(Animal.class);
-            Set<Type> types = new HashSet<Type>();
-            for (Bean<Animal> animal : animals) {
-               types.addAll(animal.getTypes());
-            }
-            assert types.contains(Chicken.class);
-            assert types.contains(Cat.class);
-            assert !types.contains(Horse.class);
-            assert !types.contains(Dog.class);
-            
-            assert getCurrentManager().getBeans("cat").size() == 1;
-            assert getCurrentManager().getBeans("dog").size() == 0;
-         }
-      }.run();
+      Set<Bean<Animal>> animals =  getBeans(Animal.class);
+      Set<Type> types = new HashSet<Type>();
+      for (Bean<Animal> animal : animals) {
+         types.addAll(animal.getTypes());
+      }
+      assert types.contains(Chicken.class);
+      assert types.contains(Cat.class);
+      assert !types.contains(Horse.class);
+      assert !types.contains(Dog.class);
+      
+      assert getCurrentManager().getBeans("cat").size() == 1;
+      assert getCurrentManager().getBeans("dog").size() == 0;
    }
 
    @Test(groups = {"policy"})
    @SpecAssertion(section = "5.2", id = "g")
    public void testAnyEnabledPolicyStereotypeMakesPolicyEnabled() throws Exception
    {
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            assert getBeans(Bird.class).size() == 1;
-            assert getCurrentManager().getBeans("bird").size() == 1;
-         }
-      }.run();
+      assert getBeans(Bird.class).size() == 1;
+      assert getCurrentManager().getBeans("bird").size() == 1;
    }
    
    @Test(groups = {"policy", "ri-broken"})
@@ -86,14 +72,7 @@
    // WBRI-306
    public void testProducerPolicies() throws Exception
    {
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            assert getBeans(Sheep.class, new AnnotationLiteral<Wild>(){}).size() == 2;
-            assert getBeans(Sheep.class, new AnnotationLiteral<Tame>(){}).size() == 0;
-         }
-      }.run();
+      assert getBeans(Sheep.class, new AnnotationLiteral<Wild>(){}).size() == 2;
+      assert getBeans(Sheep.class, new AnnotationLiteral<Tame>(){}).size() == 0;
    }
 }




More information about the weld-commits mailing list