[webbeans-commits] Webbeans SVN: r2893 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck: tests/definition/binding and 6 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Thu Jun 25 17:31:33 EDT 2009


Author: dan.j.allen
Date: 2009-06-25 17:31:32 -0400 (Thu, 25 Jun 2009)
New Revision: 2893

Added:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/literals/AnyLiteral.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/AnyInjectionTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/Customer.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/Drink.java
Removed:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/literals/AnyBinding.java
Modified:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/BindingDefinitionTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/NewSimpleBeanTest.java
Log:
add test for @Any injection
ensure @Any is mutually exclusive w/ @New
change AnyBinding to AnyLiteral to be consist w/ other tck literals

Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/literals/AnyBinding.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/literals/AnyBinding.java	2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/literals/AnyBinding.java	2009-06-25 21:31:32 UTC (rev 2893)
@@ -1,9 +0,0 @@
-package org.jboss.jsr299.tck.literals;
-
-import javax.enterprise.inject.AnnotationLiteral;
-import javax.enterprise.inject.Any;
-
-public class AnyBinding extends AnnotationLiteral<Any> implements Any
-{
-
-}

Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/literals/AnyLiteral.java (from rev 2892, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/literals/AnyBinding.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/literals/AnyLiteral.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/literals/AnyLiteral.java	2009-06-25 21:31:32 UTC (rev 2893)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.literals;
+
+import javax.enterprise.inject.AnnotationLiteral;
+import javax.enterprise.inject.Any;
+
+public class AnyLiteral extends AnnotationLiteral<Any> implements Any
+{
+}

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/BindingDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/BindingDefinitionTest.java	2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/BindingDefinitionTest.java	2009-06-25 21:31:32 UTC (rev 2893)
@@ -9,8 +9,9 @@
 import org.hibernate.tck.annotations.SpecAssertion;
 import org.hibernate.tck.annotations.SpecAssertions;
 import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.jsr299.tck.literals.AnyBinding;
+import org.jboss.jsr299.tck.literals.AnyLiteral;
 import org.jboss.jsr299.tck.literals.CurrentLiteral;
+import org.jboss.jsr299.tck.literals.NewLiteral;
 import org.jboss.testharness.impl.packaging.Artifact;
 import org.testng.annotations.Test;
 
@@ -20,25 +21,36 @@
 @Artifact
 public class BindingDefinitionTest extends AbstractJSR299Test
 {
-
    @Test
-   @SpecAssertion(section = "2.3.1", id = "aaa") 
+   @SpecAssertions({
+      @SpecAssertion(section = "2.3.1", id = "a0"),
+      @SpecAssertion(section = "2.3.1", id = "aa")
+   })
    public void testDefaultBindingDeclaredInJava()
    {
       Bean<Order> order = getBeans(Order.class).iterator().next();
       assert order.getBindings().size() == 2;
       assert order.getBindings().contains(new CurrentLiteral());
-      assert order.getBindings().contains(new AnyBinding());
+      assert order.getBindings().contains(new AnyLiteral());
    }
    
    @Test
    @SpecAssertion(section = "2.3.1", id = "b")
    public void testDefaultBindingForInjectionPoint()
    {
-      Bean<Order> order = getBeans(Order.class).iterator().next();     
+      Bean<Order> order = getBeans(Order.class).iterator().next();
       InjectionPoint injectionPoint = order.getInjectionPoints().iterator().next();
       assert injectionPoint.getBean().getBindings().contains(new CurrentLiteral());
    }
+   
+   @Test
+   @SpecAssertion(section = "2.3.1", id = "a0")
+   public void testNewBindingAndAnyBindingMutualExclusive()
+   {
+      Bean<OrderProcessor> order = getBeans(OrderProcessor.class, new NewLiteral()).iterator().next();
+      assert order.getBindings().size() == 1;
+      assert order.getBindings().iterator().next().equals(new NewLiteral());
+   }
 
    @Test(groups = { "annotationDefinition", "rewrite" })
    @SpecAssertion(section = "2.3.2", id = "ba")
@@ -83,7 +95,7 @@
       Set<? extends Annotation> bindings = getBeans(BorderCollie.class, new HairyBinding(false)).iterator().next().getBindings();
       assert bindings.size() == 2;
       assert bindings.contains(new HairyBinding(false));
-      assert bindings.contains(new AnyBinding());
+      assert bindings.contains(new AnyLiteral());
    }
 
    @Test
@@ -93,7 +105,7 @@
       Set<? extends Annotation> bindings = getBeans(ShetlandPony.class).iterator().next().getBindings();
       assert bindings.size() == 2;
       assert bindings.contains(new CurrentLiteral());
-      assert bindings.contains(new AnyBinding());
+      assert bindings.contains(new AnyLiteral());
    }
 
    @Test
@@ -104,7 +116,7 @@
       assert bindings.size() == 2;
       Annotation hairyLiteral = new HairyBinding(true);
       assert bindings.contains(hairyLiteral);
-      assert bindings.contains(new AnyBinding());
+      assert bindings.contains(new AnyLiteral());
    }
    
    @Test

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java	2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java	2009-06-25 21:31:32 UTC (rev 2893)
@@ -16,7 +16,7 @@
 import org.hibernate.tck.annotations.SpecAssertion;
 import org.hibernate.tck.annotations.SpecAssertions;
 import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.jsr299.tck.literals.AnyBinding;
+import org.jboss.jsr299.tck.literals.AnyLiteral;
 import org.jboss.testharness.impl.packaging.Artifact;
 import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
 import org.testng.annotations.Test;
@@ -528,23 +528,23 @@
    {
       // Retrieve the implicit event bean from the manager only by
       // its API type
-      Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyBinding());
+      Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyLiteral());
       assert !eventBeans.isEmpty();
    }
 
    @Test(groups = { "events" })
    public void testImplicitEventHasAnyBinding()
    {
-      Set<Bean<Event<AnEventType>>> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyBinding());
+      Set<Bean<Event<AnEventType>>> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyLiteral());
       assert !eventBeans.isEmpty();
-      assert eventBeans.iterator().next().getBindings().contains(new AnyBinding());
+      assert eventBeans.iterator().next().getBindings().contains(new AnyLiteral());
    }
 
    @Test(groups = { "events" })
    @SpecAssertions( { @SpecAssertion(section = "7.6", id = "n") } )
    public void testImplicitEventBeanMatchesBindingAnnotationsOfInjectionPoint() throws Exception
    {
-      Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>(){}, new AnyBinding(), new TameAnnotationLiteral(), new RoleBinding("Admin"));
+      Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>(){}, new AnyLiteral(), new TameAnnotationLiteral(), new RoleBinding("Admin"));
       assert !eventBeans.isEmpty();
    }
 
@@ -552,7 +552,7 @@
    @SpecAssertion(section = "7.6", id = "o")
    public void testImplicitEventBeanHasStandardDeploymentType() throws Exception
    {
-      Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyBinding());
+      Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyLiteral());
       assert eventBeans.size() == 1;
       Bean<?> eventBean = (Bean<?>) eventBeans.iterator().next();
       assert eventBean.getDeploymentType().equals(Standard.class);
@@ -562,7 +562,7 @@
    @SpecAssertion(section = "7.6", id = "p")
    public void testImplicitEventBeanHasDependentScope() throws Exception
    {
-      Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyBinding());
+      Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyLiteral());
       assert eventBeans.size() == 1;
       Bean<?> eventBean = (Bean<?>) eventBeans.iterator().next();
       assert eventBean.getScopeType().equals(Dependent.class);
@@ -572,7 +572,7 @@
    @SpecAssertion(section = "7.6", id = "q")
    public void testImplicitEventBeanHasNoName() throws Exception
    {
-      Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyBinding());
+      Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyLiteral());
       assert eventBeans.size() == 1;
       Bean<?> eventBean = (Bean<?>) eventBeans.iterator().next();
       assert eventBean.getName() == null;
@@ -582,7 +582,7 @@
    @SpecAssertions( { @SpecAssertion(section = "7.6", id = "a"), @SpecAssertion(section = "7.6", id = "r") } )
    public void testImplicitEventBeanProvidedByContainer() throws Exception
    {
-      Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyBinding());
+      Set<?> eventBeans = getBeans(new TypeLiteral<Event<AnEventType>>() {}, new AnyLiteral());
       assert eventBeans.size() == 1;
    }
 

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanTest.java	2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanTest.java	2009-06-25 21:31:32 UTC (rev 2893)
@@ -14,7 +14,7 @@
 import org.hibernate.tck.annotations.SpecAssertion;
 import org.hibernate.tck.annotations.SpecAssertions;
 import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.jsr299.tck.literals.AnyBinding;
+import org.jboss.jsr299.tck.literals.AnyLiteral;
 import org.jboss.jsr299.tck.literals.CurrentLiteral;
 import org.jboss.jsr299.tck.literals.NewLiteral;
 import org.jboss.testharness.impl.packaging.Artifact;
@@ -107,7 +107,7 @@
       Bean<OrderLocal> newOrderBean = getBeans(OrderLocal.class, new NewLiteral()).iterator().next();
       assert orderBean.getBindings().size() == 2;
       assert orderBean.getBindings().contains(new CurrentLiteral());
-      assert orderBean.getBindings().contains(new AnyBinding());
+      assert orderBean.getBindings().contains(new AnyLiteral());
       
       assert getBeans(OrderLocal.class, new NewLiteral()).size() == 1;
       assert newOrderBean.getBindings().size() == 1;
@@ -120,7 +120,7 @@
       assert getBeans(LionLocal.class, TAME_LITERAL).size() == 1;
       assert lionBean.getBindings().size() == 2;
       assert lionBean.getBindings().contains(TAME_LITERAL);
-      assert lionBean.getBindings().contains(new AnyBinding());
+      assert lionBean.getBindings().contains(new AnyLiteral());
       
       assert getBeans(LionLocal.class, new NewLiteral()).size() == 1;
       assert newLionBean.getBindings().size() == 1;

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java	2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java	2009-06-25 21:31:32 UTC (rev 2893)
@@ -11,7 +11,7 @@
 import org.hibernate.tck.annotations.SpecAssertion;
 import org.hibernate.tck.annotations.SpecAssertions;
 import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.jsr299.tck.literals.AnyBinding;
+import org.jboss.jsr299.tck.literals.AnyLiteral;
 import org.jboss.jsr299.tck.literals.CurrentLiteral;
 import org.jboss.testharness.impl.packaging.Artifact;
 import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
@@ -93,7 +93,7 @@
       assert getCurrentManager().getBeans(Tarantula.class).size() == 1;
       assert getCurrentManager().getBeans(Tarantula.class).iterator().next().getBindings().size() == 2;
       assert getCurrentManager().getBeans(Tarantula.class).iterator().next().getBindings().contains(new CurrentLiteral());
-      assert getCurrentManager().getBeans(Tarantula.class).iterator().next().getBindings().contains(new AnyBinding());
+      assert getCurrentManager().getBeans(Tarantula.class).iterator().next().getBindings().contains(new AnyLiteral());
    }
 
    @Test(groups = "producerMethod")

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-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/NewSimpleBeanTest.java	2009-06-25 21:31:32 UTC (rev 2893)
@@ -14,7 +14,7 @@
 
 import org.hibernate.tck.annotations.SpecAssertion;
 import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.jsr299.tck.literals.AnyBinding;
+import org.jboss.jsr299.tck.literals.AnyLiteral;
 import org.jboss.jsr299.tck.literals.CurrentLiteral;
 import org.jboss.jsr299.tck.literals.NewLiteral;
 import org.jboss.testharness.impl.packaging.Artifact;
@@ -186,7 +186,7 @@
       assert getCurrentManager().getBeans(Lion.class, TAME_LITERAL).size() == 1;
       assert getCurrentManager().getBeans(Lion.class, TAME_LITERAL).iterator().next().getBindings().size() == 2;
       assert getCurrentManager().getBeans(Lion.class, TAME_LITERAL).iterator().next().getBindings().contains(TAME_LITERAL);
-      assert getCurrentManager().getBeans(Lion.class, TAME_LITERAL).iterator().next().getBindings().contains(new AnyBinding());
+      assert getCurrentManager().getBeans(Lion.class, TAME_LITERAL).iterator().next().getBindings().contains(new AnyLiteral());
 
       assert getBeans(Lion.class, new NewLiteral()).size() == 1;
       assert getBeans(Lion.class, new NewLiteral()).iterator().next().getBindings().size() == 1;

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/AnyInjectionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/AnyInjectionTest.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/AnyInjectionTest.java	2009-06-25 21:31:32 UTC (rev 2893)
@@ -0,0 +1,15 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.any;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+ at Artifact
+public class AnyInjectionTest extends AbstractJSR299Test
+{
+   @Test(groups = "ri-broken")
+   public void testAnyInjectionIfExactlyOneBeanForType()
+   {
+      assert getInstanceByType(Customer.class).drink != null;
+   }
+}

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/Customer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/Customer.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/Customer.java	2009-06-25 21:31:32 UTC (rev 2893)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.any;
+
+import javax.enterprise.inject.Any;
+
+class Customer
+{
+   @Any Drink drink;
+}

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/Drink.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/Drink.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/Drink.java	2009-06-25 21:31:32 UTC (rev 2893)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.any;
+
+class Drink
+{
+
+}




More information about the weld-commits mailing list