Author: pete.muir(a)jboss.org
Date: 2009-10-13 10:08:59 -0400 (Tue, 13 Oct 2009)
New Revision: 4004
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Bird.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Canary.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Capercaillie.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/CapercaillieLocal.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Dove.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/EnterpriseResolutionByTypeTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Parrot.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ScottishBirdLocal.java
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java
Log:
add tests for @BeanTypes
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Bird.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Bird.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Bird.java 2009-10-13
14:08:59 UTC (rev 4004)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+public interface Bird
+{
+
+}
Property changes on:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Bird.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Canary.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Canary.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Canary.java 2009-10-13
14:08:59 UTC (rev 4004)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+import javax.enterprise.inject.BeanTypes;
+
+(a)BeanTypes(Canary.class)
+public class Canary implements Bird
+{
+
+}
Property changes on:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Canary.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Capercaillie.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Capercaillie.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Capercaillie.java 2009-10-13
14:08:59 UTC (rev 4004)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+import javax.ejb.Stateless;
+import javax.enterprise.inject.BeanTypes;
+
+@Stateless
+(a)BeanTypes(CapercaillieLocal.class)
+public class Capercaillie implements CapercaillieLocal
+{
+
+}
Property changes on:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Capercaillie.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/CapercaillieLocal.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/CapercaillieLocal.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/CapercaillieLocal.java 2009-10-13
14:08:59 UTC (rev 4004)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+import javax.ejb.Local;
+
+@Local
+public interface CapercaillieLocal
+{
+
+}
Property changes on:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/CapercaillieLocal.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Dove.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Dove.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Dove.java 2009-10-13
14:08:59 UTC (rev 4004)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+public class Dove implements Bird
+{
+
+ public Dove(String name) {}
+
+}
Property changes on:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Dove.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/EnterpriseResolutionByTypeTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/EnterpriseResolutionByTypeTest.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/EnterpriseResolutionByTypeTest.java 2009-10-13
14:08:59 UTC (rev 4004)
@@ -0,0 +1,46 @@
+/*
+ * 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.typesafe.resolution;
+
+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.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.testng.annotations.Test;
+
+@Artifact
+@SpecVersion(spec="cdi", version="PFD2")
+(a)Packaging(PackagingType.EAR)
+public class EnterpriseResolutionByTypeTest extends AbstractJSR299Test
+{
+
+ @Test
+ @SpecAssertion(section = "TBD", id = "TBD")
+ public void testBeanTypesOnSessionBean()
+ {
+ assert getBeans(CapercaillieLocal.class).size() == 1;
+ assert getBeans(ScottishBirdLocal.class).isEmpty();
+ Bean<CapercaillieLocal> bean = getUniqueBean(CapercaillieLocal.class);
+ assert bean.getTypes().size() == 1;
+ assert bean.getTypes().iterator().next().equals(CapercaillieLocal.class);
+ }
+
+}
Property changes on:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/EnterpriseResolutionByTypeTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Parrot.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Parrot.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Parrot.java 2009-10-13
14:08:59 UTC (rev 4004)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+public class Parrot implements Bird
+{
+
+ public Parrot(String name) {}
+
+}
Property changes on:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Parrot.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java 2009-10-13
14:08:59 UTC (rev 4004)
@@ -0,0 +1,18 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+import javax.enterprise.inject.BeanTypes;
+import javax.enterprise.inject.Produces;
+
+public class PetShop
+{
+
+ @Produces @BeanTypes(Dove.class)
+ private Dove dove = new Dove("charlie");
+
+ @Produces @BeanTypes(Parrot.class)
+ public Parrot getParrot()
+ {
+ return new Parrot("polly");
+ }
+
+}
Property changes on:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java 2009-10-13
12:32:09 UTC (rev 4003)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java 2009-10-13
14:08:59 UTC (rev 4004)
@@ -209,4 +209,38 @@
assert getCurrentManager().getBeans("crabSpider").size() == 0;
}
+
+ @Test
+ @SpecAssertion(section = "TBD", id = "TBD")
+ public void testBeanTypesOnManagedBean()
+ {
+ assert getBeans(Canary.class).size() == 1;
+ Set<Bean<Bird>> beans = getBeans(Bird.class);
+ Bean<Canary> bean = getUniqueBean(Canary.class);
+ assert getBeans(Bird.class).isEmpty();
+ assert bean.getTypes().size() == 1;
+ assert bean.getTypes().iterator().next().equals(Canary.class);
+ }
+
+ @Test
+ @SpecAssertion(section = "TBD", id = "TBD")
+ public void testBeanTypesOnProducerMethod()
+ {
+ assert getBeans(Parrot.class).size() == 1;
+ assert getBeans(Bird.class).isEmpty();
+ Bean<Parrot> bean = getUniqueBean(Parrot.class);
+ assert bean.getTypes().size() == 1;
+ assert bean.getTypes().iterator().next().equals(Parrot.class);
+ }
+
+ @Test
+ @SpecAssertion(section = "TBD", id = "TBD")
+ public void testBeanTypesOnProducerField()
+ {
+ assert getBeans(Dove.class).size() == 1;
+ assert getBeans(Bird.class).isEmpty();
+ Bean<Dove> bean = getUniqueBean(Dove.class);
+ assert bean.getTypes().size() == 1;
+ assert bean.getTypes().iterator().next().equals(Dove.class);
+ }
}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ScottishBirdLocal.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ScottishBirdLocal.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ScottishBirdLocal.java 2009-10-13
14:08:59 UTC (rev 4004)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+import javax.ejb.Local;
+
+@Local
+public interface ScottishBirdLocal extends Bird
+{
+
+}
Property changes on:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ScottishBirdLocal.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native