[webbeans-commits] Webbeans SVN: r3205 - in tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/lookup/injectionpoint and 3 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Fri Jul 24 16:17:55 EDT 2009


Author: dallen6
Date: 2009-07-24 16:17:55 -0400 (Fri, 24 Jul 2009)
New Revision: 3205

Added:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/BasicLogger.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectableReferenceTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/Logger.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/LoggerConsumer.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/TimestampLogger.java
Modified:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/impl/OldSPIBridge.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/Cat.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/ManagerTest.java
   tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injectionpoint/beans.xml
   tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
Minor mods on injection point tests and new injectable reference tests

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/impl/OldSPIBridge.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/impl/OldSPIBridge.java	2009-07-24 19:04:31 UTC (rev 3204)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/impl/OldSPIBridge.java	2009-07-24 20:17:55 UTC (rev 3205)
@@ -41,7 +41,7 @@
       }
       else if (beans.size() > 1) 
       {
-         throw new AmbiguousResolutionException("More than one bean available");
+         throw new AmbiguousResolutionException("More than one bean available for type " + type);
       }
       return beans.iterator().next();
    }

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/BasicLogger.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/BasicLogger.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/BasicLogger.java	2009-07-24 20:17:55 UTC (rev 3205)
@@ -0,0 +1,28 @@
+package org.jboss.jsr299.tck.tests.lookup.injectionpoint;
+
+import javax.enterprise.inject.Current;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+class BasicLogger implements Logger
+{
+   @Current
+   private InjectionPoint injectionPoint;
+   
+   private static String message;
+
+   public InjectionPoint getInjectionPoint()
+   {
+      return injectionPoint;
+   }
+
+   public String getMessage()
+   {
+      return message;
+   }
+
+   public void log(String message)
+   {
+      BasicLogger.message = message;
+   }
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/BasicLogger.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/Cat.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/Cat.java	2009-07-24 19:04:31 UTC (rev 3204)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/Cat.java	2009-07-24 20:17:55 UTC (rev 3205)
@@ -1,12 +1,15 @@
 package org.jboss.jsr299.tck.tests.lookup.injectionpoint;
 
 import javax.enterprise.inject.Current;
+import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.InjectionPoint;
 
 class Cat
 {
    @Current private InjectionPoint injectionPoint;
    
+   @Current private BeanManager beanManager;
+   
    public String hello() {
       return "hello";
    }
@@ -14,4 +17,9 @@
    public InjectionPoint getInjectionPoint() {
       return injectionPoint;
    }
+
+   public BeanManager getBeanManager()
+   {
+      return beanManager;
+   }
 }

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectableReferenceTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectableReferenceTest.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectableReferenceTest.java	2009-07-24 20:17:55 UTC (rev 3205)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.jsr299.tck.tests.lookup.injectionpoint;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.literals.CurrentLiteral;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+/**
+ * InjectableReference tests for the bean manager.  These tests are
+ * only here due to the fact that InjectionPoints are always needed
+ * too.
+ * 
+ * @author David Allen
+ *
+ */
+ at Artifact
+ at BeansXml("beans.xml")
+public class InjectableReferenceTest extends AbstractJSR299Test
+{
+   @SuppressWarnings("unchecked")
+   @Test
+   @SpecAssertions({
+      @SpecAssertion(section = "11.3.2", id = "a"),
+      @SpecAssertion(section = "11.3.3", id = "a")
+   })
+   public void testGetInjectableReferenceOnBeanManager()
+   {
+      // Get an instance of the bean which has another bean injected into it
+      FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
+      BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+      InjectionPoint ip = beanWithInjectionPoint.getInjectedMetadata();
+      assert ip != null;
+      CreationalContext<BeanWithInjectionPointMetadata> creationalContext = getCurrentManager().createCreationalContext((Bean<BeanWithInjectionPointMetadata>)ip.getBean());
+      Object beanInstance = getCurrentManager().getInjectableReference(ip, creationalContext);
+      assert beanInstance instanceof BeanWithInjectionPointMetadata;
+   }
+
+   @SuppressWarnings("unchecked")
+   @Test(groups = "ri-broken")
+   @SpecAssertions({
+      @SpecAssertion(section = "11.3.2", id = "b")
+   })
+   public void testGetInjectableReferenceReturnsDelegateForDelegateInjectionPoint()
+   {
+      // Get the consumer of the logger and work back from there to get the injection point
+      LoggerConsumer loggerConsumer = getInstanceByType(LoggerConsumer.class);
+      loggerConsumer.doSomething();
+      BasicLogger delegateLogger = (BasicLogger) TimestampLogger.getLogger();
+      InjectionPoint loggerInjectionPoint = delegateLogger.getInjectionPoint();
+      CreationalContext<Logger> creationalContext = getCurrentManager().createCreationalContext((Bean<Logger>)loggerInjectionPoint.getBean());
+      Object injectedDelegateLogger = getCurrentManager().getInjectableReference(loggerInjectionPoint, creationalContext);
+      assert injectedDelegateLogger instanceof BasicLogger;
+   }
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectableReferenceTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java	2009-07-24 19:04:31 UTC (rev 3204)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java	2009-07-24 20:17:55 UTC (rev 3205)
@@ -52,272 +52,173 @@
 
    @Test(groups = { "injectionPoint" })
    @SpecAssertion(section = "5.6.9", id = "aa")
-   public void testGetBean() throws Exception
+   public void testGetBean()
    {
 
       // Get an instance of the bean which has another bean injected into it
-      new RunInDependentContext()
-      {
-         
-         @Override
-         protected void execute() throws Exception
-         {
-            FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
-            BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
-            assert beanWithInjectionPoint.getInjectedMetadata() != null;
-   
-            Set<Bean<FieldInjectionPointBean>> resolvedBeans = getBeans(FieldInjectionPointBean.class);
-            assert resolvedBeans.size() == 1;
-            assert beanWithInjectionPoint.getInjectedMetadata().getBean().equals(resolvedBeans.iterator().next());
-         }
-      }.run();
+      FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
+      BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+      assert beanWithInjectionPoint.getInjectedMetadata() != null;
+
+      Set<Bean<FieldInjectionPointBean>> resolvedBeans = getBeans(FieldInjectionPointBean.class);
+      assert resolvedBeans.size() == 1;
+      assert beanWithInjectionPoint.getInjectedMetadata().getBean().equals(resolvedBeans.iterator().next());
    }
 
    @Test(groups = { "injectionPoint" })
    @SpecAssertion(section = "5.6.9", id = "ba")
-   public void testGetType() throws Exception
+   public void testGetType()
    {
       // Get an instance of the bean which has another bean injected into it
-      new RunInDependentContext()
-      {
-         
-         @Override
-         protected void execute() throws Exception
-         {
-            FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
-            BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
-            assert beanWithInjectionPoint.getInjectedMetadata() != null;
-            assert beanWithInjectionPoint.getInjectedMetadata().getType().equals(BeanWithInjectionPointMetadata.class);
-         }
-      }.run();
+      FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
+      BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+      assert beanWithInjectionPoint.getInjectedMetadata() != null;
+      assert beanWithInjectionPoint.getInjectedMetadata().getType().equals(BeanWithInjectionPointMetadata.class);
    }
 
    @Test(groups = { "injectionPoint" })
    @SpecAssertion(section = "5.6.9", id = "bc")
-   public void testGetBindingTypes() throws Exception
+   public void testGetBindingTypes()
    {
       // Get an instance of the bean which has another bean injected into it
-      new RunInDependentContext()
-      {
-         
-         @Override
-         protected void execute() throws Exception
-         {
-            FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
-            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();
+      FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
+      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());
    }
 
    @Test(groups = { "injectionPoint" })
    @SpecAssertion(section = "5.6.9", id = "ca")
-   public void testGetMemberField() throws Exception
+   public void testGetMemberField()
    {
       // Get an instance of the bean which has another bean injected into it
-      new RunInDependentContext()
-      {
-         
-         @Override
-         protected void execute() throws Exception
-         {
-            FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
-            BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
-            assert beanWithInjectionPoint.getInjectedMetadata() != null;
-            assert Field.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getMember().getClass());
-         }
-      }.run();
+      FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
+      BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+      assert beanWithInjectionPoint.getInjectedMetadata() != null;
+      assert Field.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getMember().getClass());
    }
 
    @Test(groups = { "injectionPoint" })
    @SpecAssertion(section = "5.6.9", id = "cb")
-   public void testGetMemberMethod() throws Exception
+   public void testGetMemberMethod()
    {
       // Get an instance of the bean which has another bean injected into it
-      new RunInDependentContext()
-      {
-         
-         @Override
-         protected void execute() throws Exception
-         {
-            MethodInjectionPointBean beanWithInjectedBean = getInstanceByType(MethodInjectionPointBean.class,new CurrentLiteral());
-            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 CurrentLiteral());
-         }
-      }.run();
+      MethodInjectionPointBean beanWithInjectedBean = getInstanceByType(MethodInjectionPointBean.class,new CurrentLiteral());
+      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 CurrentLiteral());
    }
 
    @Test(groups = { "injectionPoint" })
    @SpecAssertion(section = "5.6.9", id = "cc")
-   public void testGetMemberConstructor() throws Exception
+   public void testGetMemberConstructor()
    {
       // Get an instance of the bean which has another bean injected into it
-      new RunInDependentContext()
-      {
-         
-         @Override
-         protected void execute() throws Exception
-         {
-            ConstructorInjectionPointBean beanWithInjectedBean = getInstanceByType(ConstructorInjectionPointBean.class,new CurrentLiteral());
-            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 CurrentLiteral());
-         }
-      }.run();
+      ConstructorInjectionPointBean beanWithInjectedBean = getInstanceByType(ConstructorInjectionPointBean.class,new CurrentLiteral());
+      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 CurrentLiteral());
    }
 
    @Test(groups = { "injectionPoint", "ri-broken" })
    @SpecAssertion(section = "5.6.9", id = "daa")
-   public void testGetAnnotatedField() throws Exception
+   public void testGetAnnotatedField()
    {
       // Get an instance of the bean which has another bean injected into it
-      new RunInDependentContext()
-      {
-         
-         @Override
-         protected void execute() throws Exception
-         {
-            FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
-            BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
-            assert beanWithInjectionPoint.getInjectedMetadata() != null;
-            assert beanWithInjectionPoint.getInjectedMetadata().getAnnotated() instanceof AnnotatedField;
-            assert beanWithInjectionPoint.getInjectedMetadata().getAnnotated().isAnnotationPresent(AnimalStereotype.class);
-         }
-      }.run();
+      FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
+      BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+      assert beanWithInjectionPoint.getInjectedMetadata() != null;
+      assert beanWithInjectionPoint.getInjectedMetadata().getAnnotated() instanceof AnnotatedField;
+      assert beanWithInjectionPoint.getInjectedMetadata().getAnnotated().isAnnotationPresent(AnimalStereotype.class);
    }
-   
+
    @Test(groups = { "injectionPoint", "ri-broken" })
- 	@SpecAssertion(section = "5.6.9", id = "daa")
-   public void testGetAnnotatedParameter() throws Exception
+   @SpecAssertion(section = "5.6.9", id = "daa")
+   public void testGetAnnotatedParameter()
    {
       // Get an instance of the bean which has another bean injected into it
-      new RunInDependentContext()
-      {
-         
-         @Override
-         protected void execute() throws Exception
-         {
-            MethodInjectionPointBean beanWithInjectedBean = getInstanceByType(MethodInjectionPointBean.class,new CurrentLiteral());
-            BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
-            assert beanWithInjectionPoint.getInjectedMetadata() != null;
-            assert beanWithInjectionPoint.getInjectedMetadata().getAnnotated() instanceof AnnotatedParameter;
-            assert beanWithInjectionPoint.getInjectedMetadata().getAnnotated().isAnnotationPresent(Current.class);
-         }
-      }.run();
+      MethodInjectionPointBean beanWithInjectedBean = getInstanceByType(MethodInjectionPointBean.class,new CurrentLiteral());
+      BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+      assert beanWithInjectionPoint.getInjectedMetadata() != null;
+      assert beanWithInjectionPoint.getInjectedMetadata().getAnnotated() instanceof AnnotatedParameter;
+      assert beanWithInjectionPoint.getInjectedMetadata().getAnnotated().isAnnotationPresent(Current.class);
    }
 
    @Test(groups = { "injectionPoint" })
    @SpecAssertion(section = "5.6.9", id = "e")
-   public void testDependentScope() throws Exception
+   public void testDependentScope()
    {
-      new RunInDependentContext()
-      {
-         
-         @Override
-         protected void execute() throws Exception
-         {
-            assert getBeans(InjectionPoint.class).size() == 1;
-            assert getBeans(InjectionPoint.class).iterator().next().getScopeType().equals(Dependent.class);
-         }
-         
-      }.run();
+      assert getBeans(InjectionPoint.class).size() == 1;
+      assert getBeans(InjectionPoint.class).iterator().next().getScopeType().equals(Dependent.class);
    }
 
    @Test(groups = { "injectionPoint" })
    @SpecAssertions({
       @SpecAssertion(section = "5.6.9", id = "e")
    })
-   public void testApiTypeInjectionPoint()  throws Exception
+   public void testApiTypeInjectionPoint()
    {
       // Get an instance of the bean which has another bean injected into it
-      new RunInDependentContext()
-      {
-         
-         @Override
-         protected void execute() throws Exception
-         {
-            FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
-            BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
-            assert beanWithInjectionPoint.getInjectedMetadata() != null;
-            assert InjectionPoint.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getClass());
-         }
-      }.run();
+      FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
+      BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+      assert beanWithInjectionPoint.getInjectedMetadata() != null;
+      assert InjectionPoint.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getClass());
    }
 
    @Test(groups = { "injectionPoint" })
    @SpecAssertions({
       @SpecAssertion(section = "5.6.9", id = "e")
    })
-   public void testCurrentBinding() throws Exception
+   public void testCurrentBinding()
    {
       // Get an instance of the bean which has another bean injected into it
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
-            BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
-            assert beanWithInjectionPoint.getInjectedMetadata() != null;
-            assert beanWithInjectionPoint.getInjectedMetadata().getBindings().contains(new CurrentLiteral());
-         }
-      }.run();
+      FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
+      BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+      assert beanWithInjectionPoint.getInjectedMetadata() != null;
+      assert beanWithInjectionPoint.getInjectedMetadata().getBindings().contains(new CurrentLiteral());
    }
-   
+
    @Test(groups = { "injectionPoint" })
    @SpecAssertion(section = "5.6.9", id = "dca")
-   public void testIsTransient() throws Exception
+   public void testIsTransient()
    {
-	   new RunInDependentContext()
-	   {
-		   @Override
-		   protected void execute() throws Exception
-		   {
-			   FieldInjectionPointBean bean1 = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
-			   TransientFieldInjectionPointBean bean2 = getInstanceByType(TransientFieldInjectionPointBean.class,new CurrentLiteral());
-			   InjectionPoint ip1 = bean1.getInjectedBean().getInjectedMetadata();
-			   InjectionPoint ip2 = bean2.getInjectedBean().getInjectedMetadata();
-			   assert !ip1.isTransient();
-			   assert ip2.isTransient();
-		   }
-	   }.run();
+      FieldInjectionPointBean bean1 = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
+      TransientFieldInjectionPointBean bean2 = getInstanceByType(TransientFieldInjectionPointBean.class,new CurrentLiteral());
+      InjectionPoint ip1 = bean1.getInjectedBean().getInjectedMetadata();
+      InjectionPoint ip2 = bean2.getInjectedBean().getInjectedMetadata();
+      assert !ip1.isTransient();
+      assert ip2.isTransient();
    }
-   
+
    @Test(groups = { "injectionPoint", "ri-broken" })
    @SpecAssertion(section = "5.6.9", id="dba")
-   public void testIsDelegate() throws Exception {
-      new RunInDependentContext()
-      {
-         @Override
-         protected void execute() throws Exception
-         {
-            assert !getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral()).getInjectedBean().getInjectedMetadata().isDelegate();
-            
-            Cat cat = getInstanceByType(Cat.class, new CurrentLiteral());
-            assert cat.hello().equals("hello world!");
-            assert cat.getInjectionPoint() != null;
-            assert cat.getInjectionPoint().isDelegate();
-         }
-      }.run();
+   public void testIsDelegate()
+   {
+      assert !getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral()).getInjectedBean().getInjectedMetadata().isDelegate();
+
+      Cat cat = getInstanceByType(Cat.class, new CurrentLiteral());
+      assert cat.hello().equals("hello world!");
+      assert cat.getBeanManager() != null;
+      assert cat.getInjectionPoint() != null;
+      assert cat.getInjectionPoint().isDelegate();
    }
-   
+
    @Test(groups = { "ri-broken", "resolution" })
    @SpecAssertion(section = "5.3", id = "hb")
-   public void testDecoratorNotResolved() {
+   public void testDecoratorNotResolved() 
+   {
       Cat cat = getInstanceByType(Cat.class);
       assert cat != null;
       assert cat.getClass().equals(Cat.class);

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/Logger.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/Logger.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/Logger.java	2009-07-24 20:17:55 UTC (rev 3205)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.lookup.injectionpoint;
+
+interface Logger
+{
+   public void log(String message);
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/Logger.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/LoggerConsumer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/LoggerConsumer.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/LoggerConsumer.java	2009-07-24 20:17:55 UTC (rev 3205)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.lookup.injectionpoint;
+
+import javax.enterprise.inject.Current;
+
+class LoggerConsumer
+{
+   @Current
+   private Logger logger;
+
+   public Logger getLogger()
+   {
+      return logger;
+   }
+
+   public void doSomething()
+   {
+      logger.log("Test message");
+   }
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/LoggerConsumer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/TimestampLogger.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/TimestampLogger.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/TimestampLogger.java	2009-07-24 20:17:55 UTC (rev 3205)
@@ -0,0 +1,27 @@
+package org.jboss.jsr299.tck.tests.lookup.injectionpoint;
+
+import java.util.Date;
+
+import javax.decorator.Decorates;
+import javax.decorator.Decorator;
+
+ at Decorator
+class TimestampLogger implements Logger
+{
+   @Decorates 
+   private Logger logger;
+   
+   private static Logger staticLogger;
+
+   public void log(String message)
+   {
+      staticLogger = logger;
+      logger.log(new Date().toString() + ":  " + message);
+   }
+
+   public static Logger getLogger()
+   {
+      return staticLogger;
+   }
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/TimestampLogger.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/ManagerTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/ManagerTest.java	2009-07-24 19:04:31 UTC (rev 3204)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/ManagerTest.java	2009-07-24 20:17:55 UTC (rev 3205)
@@ -1,5 +1,7 @@
 package org.jboss.jsr299.tck.tests.lookup.manager;
 
+import java.io.Serializable;
+
 import javax.enterprise.context.Dependent;
 import javax.enterprise.inject.AnnotationLiteral;
 import javax.enterprise.inject.Current;
@@ -22,30 +24,21 @@
 {
    @Test(groups={"manager", "injection", "deployment"}) 
    @SpecAssertion(section="11.3", id = "c")
-   public void testInjectingManager() throws Exception
+   public void testInjectingManager()
    {
-      new RunInDependentContext()
-      {
-         
-         @Override
-         protected void execute() throws Exception
-         {
-            FishFarmOffice fishFarmOffice = getInstanceByType(FishFarmOffice.class);
-            assert fishFarmOffice.beanManager != null;
-         }
-         
-      }.run();      
+      FishFarmOffice fishFarmOffice = getInstanceByType(FishFarmOffice.class);
+      assert fishFarmOffice.beanManager != null;
    }  
    
    @Test
-   @SpecAssertion(section = "11.3", id = "a")
+   @SpecAssertion(section = "11.3", id = "aa")
    public void testContainerProvidesManagerBean()
    {
       assert getBeans(BeanManager.class).size() > 0;
    }
    
    @Test
-   @SpecAssertion(section = "11.3", id = "a")
+   @SpecAssertion(section = "11.3", id = "ab")
    public void testManagerBeanIsDependentScoped()
    {
       Bean<BeanManager> beanManager = getBeans(BeanManager.class).iterator().next();
@@ -53,7 +46,7 @@
    }
 
    @Test
-   @SpecAssertion(section = "11.3", id = "a")
+   @SpecAssertion(section = "11.3", id = "ac")
    public void testManagerBeanHasCurrentBinding()
    {      
       Bean<BeanManager> beanManager = getBeans(BeanManager.class).iterator().next();
@@ -61,6 +54,13 @@
    }
    
    @Test
+   @SpecAssertion(section = "11.3", id = "b")
+   public void testManagerBeanIsPassivationCapable()
+   {
+      assert isSerializable(getCurrentManager().getClass());
+   }
+
+   @Test
    @SpecAssertions({
       @SpecAssertion(section = "11.3.1", id = "a"),
       @SpecAssertion(section = "11.3.1", id = "b")
@@ -70,4 +70,10 @@
       Bean<FishFarmOffice> bean = getBeans(FishFarmOffice.class).iterator().next();
       assert getCurrentManager().getReference(bean,FishFarmOffice.class, getCurrentManager().createCreationalContext(bean)) instanceof FishFarmOffice;      
    }
+   
+   private boolean isSerializable(Class<?> clazz)
+   {
+      return clazz.isPrimitive() || Serializable.class.isAssignableFrom(clazz);
+   }
+
 }

Modified: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injectionpoint/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injectionpoint/beans.xml	2009-07-24 19:04:31 UTC (rev 3204)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injectionpoint/beans.xml	2009-07-24 20:17:55 UTC (rev 3205)
@@ -1,5 +1,6 @@
 <beans> 
    <decorators>
+      <class>org.jboss.jsr299.tck.tests.lookup.injectionpoint.TimestampLogger</class>
       <class>org.jboss.jsr299.tck.tests.lookup.injectionpoint.CatDecorator</class>
    </decorators>
 </beans>

Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml	2009-07-24 19:04:31 UTC (rev 3204)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml	2009-07-24 20:17:55 UTC (rev 3205)
@@ -4087,10 +4087,18 @@
   </section>
 
   <section id="11.3" title="The BeanManager object">
-    <assertion id="a">
-      <text>The container provides a built-in bean with bean type |BeanManager|, scope |@Dependent| and binding |@Current|.</text>
+    <assertion id="aa">
+      <text>The container provides a built-in bean with bean type |BeanManager|~, scope |@Dependent| and binding |@Current|~.</text>
     </assertion>
 
+    <assertion id="ab">
+      <text>The container provides a built-in bean with ~bean type |BeanManager|,~ scope |@Dependent|~ and binding |@Current|~.</text>
+    </assertion>
+
+    <assertion id="ac">
+      <text>The container provides a built-in bean with ~bean type |BeanManager|, scope |@Dependent| and~ binding |@Current|.</text>
+    </assertion>
+
     <assertion id="b">
       <text>The built-in implementation must be a passivation capable dependency, as defined in Section 6.6.2, "Passivation capable dependencies".</text>
     </assertion>




More information about the weld-commits mailing list