[webbeans-commits] Webbeans SVN: r3316 - in tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/extensions and 7 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Tue Jul 28 12:27:31 EDT 2009


Author: dallen6
Date: 2009-07-28 12:27:30 -0400 (Tue, 28 Jul 2009)
New Revision: 3316

Added:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/BeanByTypeTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/DerivedBean.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/NonBindingType.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/NonBindingTypeLiteral.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/SimpleBean.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/Tame.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/TameLiteral.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/AmbiguousInjectableReferenceTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/AmbiguousInjectionPoint.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/AnnotatedInjectionField.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/DerivedInjectedBean.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/InjectedBean.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/SimpleBean.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/AnnotatedInjectionField.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/InjectedBean.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/SimpleBean.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/UnsatisfiedInjectableReferenceTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/UnsatisfiedInjectionPoint.java
Modified:
   tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
Added TCK tests for 11.3.2 and 11.3.4

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/BeanByTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/BeanByTypeTest.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/BeanByTypeTest.java	2009-07-28 16:27:30 UTC (rev 3316)
@@ -0,0 +1,99 @@
+/*
+ * 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.extensions.bean.bytype;
+
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.literals.CurrentLiteral;
+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;
+
+/**
+ * Tests related to obtaining beans by their type from the bean manager.
+ * 
+ * @author David Allen
+ *
+ */
+ at Artifact
+ at SpecVersion("20090625")
+public class BeanByTypeTest extends AbstractJSR299Test
+{
+   @Test
+   @SpecAssertions({
+      @SpecAssertion(section = "11.3.4", id = "aa"),
+      @SpecAssertion(section = "11.3.4", id = "b")
+   })
+   public void testGetBeans()
+   {
+      Set<Bean<?>> beans = getCurrentManager().getBeans(SimpleBean.class);
+      assert beans.size() == 1;
+      assert beans.iterator().next().getBeanClass().equals(SimpleBean.class);
+   }
+   
+   @Test
+   @SpecAssertions({
+      @SpecAssertion(section = "11.3.4", id = "c")
+   })
+   public void testNoBindingImpliesCurrent()
+   {
+      Set<Bean<?>> beans = getCurrentManager().getBeans(SimpleBean.class);
+      assert beans.size() == 1;
+      assert beans.iterator().next().getBindings().contains(new CurrentLiteral());
+   }
+
+   @Test(groups = "broken", expectedExceptions = IllegalArgumentException.class)
+   @SpecAssertions({
+      @SpecAssertion(section = "11.3.4", id = "da")
+   })
+   public void testTypeVariable()
+   {
+      //TODO Not sure how to get a type variable passed here
+      getCurrentManager().getBeans(getType(new SimpleBean()));
+   }
+
+   private <T> Type getType(T object)
+   {
+      return object.getClass();
+   }
+   
+   @Test(expectedExceptions = IllegalArgumentException.class)
+   @SpecAssertions({
+      @SpecAssertion(section = "11.3.4", id = "e")
+   })
+   public void testSameBindingTwice()
+   {
+      getCurrentManager().getBeans(SimpleBean.class, new TameLiteral(), new TameLiteral());
+   }
+
+   @Test(expectedExceptions = IllegalArgumentException.class)
+   @SpecAssertions({
+      @SpecAssertion(section = "11.3.4", id = "f")
+   })
+   public void testNonBindingType()
+   {
+      getCurrentManager().getBeans(SimpleBean.class, new NonBindingTypeLiteral());
+   }
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/BeanByTypeTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/DerivedBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/DerivedBean.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/DerivedBean.java	2009-07-28 16:27:30 UTC (rev 3316)
@@ -0,0 +1,7 @@
+package org.jboss.jsr299.tck.tests.extensions.bean.bytype;
+
+ at Tame
+class DerivedBean extends SimpleBean
+{
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/DerivedBean.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/NonBindingType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/NonBindingType.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/NonBindingType.java	2009-07-28 16:27:30 UTC (rev 3316)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.extensions.bean.bytype;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at interface NonBindingType
+{
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/NonBindingType.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/NonBindingTypeLiteral.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/NonBindingTypeLiteral.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/NonBindingTypeLiteral.java	2009-07-28 16:27:30 UTC (rev 3316)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.extensions.bean.bytype;
+
+import javax.enterprise.inject.AnnotationLiteral;
+
+public class NonBindingTypeLiteral extends AnnotationLiteral<NonBindingType> implements NonBindingType
+{
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/NonBindingTypeLiteral.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/SimpleBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/SimpleBean.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/SimpleBean.java	2009-07-28 16:27:30 UTC (rev 3316)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.extensions.bean.bytype;
+
+class SimpleBean
+{
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/SimpleBean.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/Tame.java (from rev 3314, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/Tame.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/Tame.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/Tame.java	2009-07-28 16:27:30 UTC (rev 3316)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.extensions.bean.bytype;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.BindingType;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at BindingType
+ at interface Tame
+{
+
+}

Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/TameLiteral.java (from rev 3314, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/TameAnnotationLiteral.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/TameLiteral.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/bean/bytype/TameLiteral.java	2009-07-28 16:27:30 UTC (rev 3316)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.extensions.bean.bytype;
+
+import javax.enterprise.inject.AnnotationLiteral;
+
+class TameLiteral extends AnnotationLiteral<Tame> implements Tame
+{
+
+}

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/AmbiguousInjectableReferenceTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/AmbiguousInjectableReferenceTest.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/AmbiguousInjectableReferenceTest.java	2009-07-28 16:27:30 UTC (rev 3316)
@@ -0,0 +1,54 @@
+/*
+ * 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.broken.reference.ambiguous;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.AmbiguousResolutionException;
+import javax.enterprise.inject.spi.Bean;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+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;
+
+/**
+ * Tests a custom injection point that resolves to two different bean instances
+ * which should always result in an exception.
+ * 
+ * @author David Allen
+ *
+ */
+ at Artifact
+ at SpecVersion("20090625")
+public class AmbiguousInjectableReferenceTest extends AbstractJSR299Test
+{
+   @SuppressWarnings("unchecked")
+   @Test(expectedExceptions = AmbiguousResolutionException.class)
+   @SpecAssertions({
+      @SpecAssertion(section = "11.3.2", id = "bc")
+   })
+   public void testUnsatisfiedReference()
+   {
+      Bean<SimpleBean> bean = this.getBeans(SimpleBean.class).iterator().next();
+      AmbiguousInjectionPoint injectionPoint = new AmbiguousInjectionPoint(bean);
+      CreationalContext<SimpleBean> creationalContext = getCurrentManager().createCreationalContext((Bean<SimpleBean>)injectionPoint.getBean());
+      getCurrentManager().getInjectableReference(injectionPoint, creationalContext);
+   }
+}


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

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/AmbiguousInjectionPoint.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/AmbiguousInjectionPoint.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/AmbiguousInjectionPoint.java	2009-07-28 16:27:30 UTC (rev 3316)
@@ -0,0 +1,65 @@
+package org.jboss.jsr299.tck.tests.lookup.injectionpoint.broken.reference.ambiguous;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.jsr299.tck.literals.AnyLiteral;
+import org.jboss.jsr299.tck.literals.CurrentLiteral;
+
+public class AmbiguousInjectionPoint implements InjectionPoint
+{
+   private final Bean<SimpleBean> bean;
+   private final Set<Annotation> bindings = new HashSet<Annotation>();
+
+   public AmbiguousInjectionPoint(Bean<SimpleBean> bean)
+   {
+      this.bean = bean;
+      bindings.add(new CurrentLiteral());
+      bindings.add(new AnyLiteral());
+   }
+
+   public Annotated getAnnotated()
+   {
+      return new AnnotatedInjectionField(this);
+   }
+
+   public Bean<?> getBean()
+   {
+      return bean;
+   }
+
+   public Set<Annotation> getBindings()
+   {
+      return bindings;
+   }
+
+   @SuppressWarnings("unchecked")
+   public Member getMember()
+   {
+      return ((AnnotatedField<SimpleBean>)getAnnotated()).getJavaMember();
+   }
+
+   public Type getType()
+   {
+      return InjectedBean.class;
+   }
+
+   public boolean isDelegate()
+   {
+      return false;
+   }
+
+   public boolean isTransient()
+   {
+      return false;
+   }
+
+}


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

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/AnnotatedInjectionField.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/AnnotatedInjectionField.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/AnnotatedInjectionField.java	2009-07-28 16:27:30 UTC (rev 3316)
@@ -0,0 +1,75 @@
+package org.jboss.jsr299.tck.tests.lookup.injectionpoint.broken.reference.ambiguous;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+class AnnotatedInjectionField implements AnnotatedField<InjectedBean>
+{
+
+   private final InjectionPoint injectionPoint;
+
+   public AnnotatedInjectionField(InjectionPoint injectionPoint)
+   {
+      this.injectionPoint = injectionPoint;
+   }
+
+   public Field getJavaMember()
+   {
+      try
+      {
+         return SimpleBean.class.getDeclaredField("injectedBean");
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException("Failed to get field for injectedBean", e);
+      }
+   }
+
+   public AnnotatedType<InjectedBean> getDeclaringType()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   public boolean isStatic()
+   {
+      return false;
+   }
+
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   public Set<Annotation> getAnnotations()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   public Type getBaseType()
+   {
+      // TODO Auto-generated method stub
+      return InjectedBean.class;
+   }
+
+   public Set<Type> getTypeClosure()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+   {
+      // TODO Auto-generated method stub
+      return false;
+   }
+
+}


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

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/DerivedInjectedBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/DerivedInjectedBean.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/DerivedInjectedBean.java	2009-07-28 16:27:30 UTC (rev 3316)
@@ -0,0 +1,7 @@
+package org.jboss.jsr299.tck.tests.lookup.injectionpoint.broken.reference.ambiguous;
+
+
+class DerivedInjectedBean extends InjectedBean
+{
+
+}


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

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/InjectedBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/InjectedBean.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/InjectedBean.java	2009-07-28 16:27:30 UTC (rev 3316)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.lookup.injectionpoint.broken.reference.ambiguous;
+
+class InjectedBean
+{
+}


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

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/SimpleBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/SimpleBean.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/ambiguous/SimpleBean.java	2009-07-28 16:27:30 UTC (rev 3316)
@@ -0,0 +1,17 @@
+package org.jboss.jsr299.tck.tests.lookup.injectionpoint.broken.reference.ambiguous;
+
+
+class SimpleBean
+{
+   private InjectedBean injectedBean;
+
+   public InjectedBean getInjectedBean()
+   {
+      return injectedBean;
+   }
+
+   public void setInjectedBean(InjectedBean injectedBean)
+   {
+      this.injectedBean = injectedBean;
+   }
+}


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

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/AnnotatedInjectionField.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/AnnotatedInjectionField.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/AnnotatedInjectionField.java	2009-07-28 16:27:30 UTC (rev 3316)
@@ -0,0 +1,75 @@
+package org.jboss.jsr299.tck.tests.lookup.injectionpoint.broken.reference.unresolved;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+class AnnotatedInjectionField implements AnnotatedField<InjectedBean>
+{
+
+   private final InjectionPoint injectionPoint;
+
+   public AnnotatedInjectionField(InjectionPoint injectionPoint)
+   {
+      this.injectionPoint = injectionPoint;
+   }
+
+   public Field getJavaMember()
+   {
+      try
+      {
+         return SimpleBean.class.getDeclaredField("injectedBean");
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException("Failed to get field for injectedBean", e);
+      }
+   }
+
+   public AnnotatedType<InjectedBean> getDeclaringType()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   public boolean isStatic()
+   {
+      return false;
+   }
+
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   public Set<Annotation> getAnnotations()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   public Type getBaseType()
+   {
+      // TODO Auto-generated method stub
+      return InjectedBean.class;
+   }
+
+   public Set<Type> getTypeClosure()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+   {
+      // TODO Auto-generated method stub
+      return false;
+   }
+
+}


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

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/InjectedBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/InjectedBean.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/InjectedBean.java	2009-07-28 16:27:30 UTC (rev 3316)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.lookup.injectionpoint.broken.reference.unresolved;
+
+class InjectedBean
+{
+   public InjectedBean(String name)
+   {
+      
+   }
+}


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

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/SimpleBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/SimpleBean.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/SimpleBean.java	2009-07-28 16:27:30 UTC (rev 3316)
@@ -0,0 +1,17 @@
+package org.jboss.jsr299.tck.tests.lookup.injectionpoint.broken.reference.unresolved;
+
+
+class SimpleBean
+{
+   private InjectedBean injectedBean;
+
+   public InjectedBean getInjectedBean()
+   {
+      return injectedBean;
+   }
+
+   public void setInjectedBean(InjectedBean injectedBean)
+   {
+      this.injectedBean = injectedBean;
+   }
+}


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

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/UnsatisfiedInjectableReferenceTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/UnsatisfiedInjectableReferenceTest.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/UnsatisfiedInjectableReferenceTest.java	2009-07-28 16:27:30 UTC (rev 3316)
@@ -0,0 +1,54 @@
+/*
+ * 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.broken.reference.unresolved;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.UnsatisfiedResolutionException;
+import javax.enterprise.inject.spi.Bean;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+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;
+
+/**
+ * Tests retrieving an injectable reference for a bean which cannot be
+ * resolved.
+ * 
+ * @author David Allen
+ *
+ */
+ at Artifact
+ at SpecVersion("20090625")
+public class UnsatisfiedInjectableReferenceTest extends AbstractJSR299Test
+{
+   @SuppressWarnings("unchecked")
+   @Test(expectedExceptions = UnsatisfiedResolutionException.class)
+   @SpecAssertions({
+      @SpecAssertion(section = "11.3.2", id = "bb")
+   })
+   public void testUnsatisfiedReference()
+   {
+      Bean<SimpleBean> bean = this.getBeans(SimpleBean.class).iterator().next();
+      UnsatisfiedInjectionPoint injectionPoint = new UnsatisfiedInjectionPoint(bean);
+      CreationalContext<SimpleBean> creationalContext = getCurrentManager().createCreationalContext((Bean<SimpleBean>)injectionPoint.getBean());
+      getCurrentManager().getInjectableReference(injectionPoint, creationalContext);
+   }
+}


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

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/UnsatisfiedInjectionPoint.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/UnsatisfiedInjectionPoint.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/reference/unresolved/UnsatisfiedInjectionPoint.java	2009-07-28 16:27:30 UTC (rev 3316)
@@ -0,0 +1,66 @@
+package org.jboss.jsr299.tck.tests.lookup.injectionpoint.broken.reference.unresolved;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.jsr299.tck.literals.AnyLiteral;
+import org.jboss.jsr299.tck.literals.CurrentLiteral;
+
+public class UnsatisfiedInjectionPoint implements InjectionPoint
+{
+
+   private final Bean<SimpleBean> bean;
+   private final Set<Annotation> bindings = new HashSet<Annotation>();
+   
+   public UnsatisfiedInjectionPoint(Bean<SimpleBean> beanWithInjectionPoint)
+   {
+      this.bean = beanWithInjectionPoint;
+      bindings.add(new CurrentLiteral());
+      bindings.add(new AnyLiteral());
+   }
+
+   public Annotated getAnnotated()
+   {
+      return new AnnotatedInjectionField(this);
+   }
+
+   public Bean<?> getBean()
+   {
+      return bean;
+   }
+
+   public Set<Annotation> getBindings()
+   {
+      return bindings;
+   }
+
+   @SuppressWarnings("unchecked")
+   public Member getMember()
+   {
+      return ((AnnotatedField<SimpleBean>)getAnnotated()).getJavaMember();
+   }
+
+   public Type getType()
+   {
+      return InjectedBean.class;
+   }
+
+   public boolean isDelegate()
+   {
+      return false;
+   }
+
+   public boolean isTransient()
+   {
+      return false;
+   }
+
+}


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

Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml	2009-07-28 15:56:32 UTC (rev 3315)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml	2009-07-28 16:27:30 UTC (rev 3316)
@@ -4271,6 +4271,7 @@
 
     <assertion id="c">
       <text>Implementations of |Bean| usually maintain a reference to an instance of |BeanManager|. When the |Bean| implementation performs dependency injection, it must obtain the contextual instances to inject by calling |BeanManager.getInjectableReference()|, passing an instance of  |InjectionPoint| that represents the injection point and the instance of |CreationalContext| that was passed to |Bean.create()|.</text>
+      <note>This cannot be well tested at the moment.</note>
     </assertion>
   </section>
   




More information about the weld-commits mailing list