Author: jharting
Date: 2009-12-16 10:57:52 -0500 (Wed, 16 Dec 2009)
New Revision: 5307
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/AlternativeStereotype.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/IntegerBean.java
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/bean/custom/beans.xml
Removed:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/Cat.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/CatBean.java
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/CustomBeanImplementationTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/House.java
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/bean/custom/javax.enterprise.inject.spi.Extension
Log:
CDITCK-57
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/AlternativeStereotype.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/AlternativeStereotype.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/AlternativeStereotype.java 2009-12-16
15:57:52 UTC (rev 5307)
@@ -0,0 +1,17 @@
+package org.jboss.jsr299.tck.tests.definition.bean.custom;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Stereotype;
+
+@Alternative
+@Stereotype
+@Target(TYPE)
+@Retention(RUNTIME)
+@interface AlternativeStereotype
+{
+}
Deleted:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/Cat.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/Cat.java 2009-12-16
14:06:05 UTC (rev 5306)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/Cat.java 2009-12-16
15:57:52 UTC (rev 5307)
@@ -1,13 +0,0 @@
-package org.jboss.jsr299.tck.tests.definition.bean.custom;
-
-class Cat
-{
-
- @SuppressWarnings("unused")
- private String name;
-
- public Cat(String name)
- {
- this.name = name;
- }
-}
Deleted:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/CatBean.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/CatBean.java 2009-12-16
14:06:05 UTC (rev 5306)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/CatBean.java 2009-12-16
15:57:52 UTC (rev 5307)
@@ -1,163 +0,0 @@
-package org.jboss.jsr299.tck.tests.definition.bean.custom;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.enterprise.context.Dependent;
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.InjectionPoint;
-
-import org.jboss.jsr299.tck.literals.DefaultLiteral;
-
-public class CatBean implements Bean<Cat>, Extension
-{
- public static final CatBean bean = new CatBean();
-
- private boolean getBindingsCalled = false;
- private boolean getInjectionPointsCalled = false;
- private boolean getNameCalled = false;
- private boolean getScopeTypeCalled = false;
- private boolean getTypesCalled = false;
- private boolean isPolicyCalled = false;
- private boolean isSerializableCalled = false;
- private boolean isNullableCalled = false;
- private boolean isGetBeanClassCalled = false;
- private boolean getStereotypesCalled = false;
-
-
- @SuppressWarnings("serial")
- public Set<Annotation> getQualifiers()
- {
- getBindingsCalled = true;
- return new HashSet<Annotation>(){{ add(new DefaultLiteral());}};
- }
-
- public Set<InjectionPoint> getInjectionPoints()
- {
- getInjectionPointsCalled = true;
- return new HashSet<InjectionPoint>();
- }
-
- public String getName()
- {
- getNameCalled = true;
- return "cat";
- }
-
- public Set<Class<? extends Annotation>> getStereotypes() {
- getStereotypesCalled = true;
- return new HashSet<Class<? extends Annotation>>();
- }
-
- public Class<? extends Annotation> getScope()
- {
- getScopeTypeCalled = true;
- return Dependent.class;
- }
-
- @SuppressWarnings("serial")
- public Set<Type> getTypes()
- {
- getTypesCalled = true;
- return new HashSet<Type>() {{ add(Cat.class); add(Object.class); }};
- }
-
- public boolean isNullable()
- {
- isNullableCalled = true;
- return false;
- }
-
- public boolean isSerializable()
- {
- isSerializableCalled = true;
- return false;
- }
-
- public Class<?> getBeanClass()
- {
- isGetBeanClassCalled = true;
- return Cat.class;
- }
-
- public boolean isAlternative()
- {
- isPolicyCalled = true;
- return false;
- }
-
- public Cat create(CreationalContext<Cat> creationalContext)
- {
- return new Cat("kitty");
- }
-
- public void destroy(Cat instance, CreationalContext<Cat> creationalContext)
- {
- creationalContext.release();
- }
-
- public boolean isGetBindingsCalled()
- {
- return getBindingsCalled;
- }
-
- public boolean isGetInjectionPointsCalled()
- {
- return getInjectionPointsCalled;
- }
-
- public boolean isGetNameCalled()
- {
- return getNameCalled;
- }
-
- public boolean isGetScopeTypeCalled()
- {
- return getScopeTypeCalled;
- }
-
- public boolean isGetTypesCalled()
- {
- return getTypesCalled;
- }
-
- public boolean isPolicyCalled()
- {
- return isPolicyCalled;
- }
-
- public boolean isSerializableCalled()
- {
- return isSerializableCalled;
- }
-
- public boolean isNullableCalled()
- {
- return isNullableCalled;
- }
-
- public static CatBean getBean()
- {
- return bean;
- }
-
- public boolean isGetBeanClassCalled()
- {
- return isGetBeanClassCalled;
- }
-
- public boolean isGetStereotypesCalled()
- {
- return getStereotypesCalled;
- }
-
- public void afterDiscovery(@Observes AfterBeanDiscovery event) {
- event.addBean(bean);
- }
-}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/CustomBeanImplementationTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/CustomBeanImplementationTest.java 2009-12-16
14:06:05 UTC (rev 5306)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/CustomBeanImplementationTest.java 2009-12-16
15:57:52 UTC (rev 5307)
@@ -42,7 +42,7 @@
})
public void testGetBeanClassCalled()
{
- assert CatBean.bean.isGetBeanClassCalled();
+ assert IntegerBean.bean.isGetBeanClassCalled();
}
@Test(groups = { "ri-broken" })
@@ -50,56 +50,55 @@
// WBRI-328
public void testGetStereotypesCalled()
{
- assert CatBean.bean.isGetStereotypesCalled();
+ assert IntegerBean.bean.isGetStereotypesCalled();
}
@Test
@SpecAssertion(section = "5.1.1", id = "k")
public void testIsPolicyCalled()
{
- assert CatBean.bean.isPolicyCalled();
+ assert IntegerBean.bean.isAlternativeCalled();
}
@Test
@SpecAssertion(section = "5.2", id = "na")
public void testGetTypesCalled()
{
- assert CatBean.bean.isGetTypesCalled();
+ assert IntegerBean.bean.isGetTypesCalled();
}
@Test
@SpecAssertion(section = "5.2", id = "nb")
public void testGetBindingsCalled()
{
- assert CatBean.bean.isGetBindingsCalled();
+ assert IntegerBean.bean.isGetQualifiersCalled();
}
@Test
@SpecAssertion(section = "5.2.1", id = "b")
public void testGetInjectionPointsCalled()
{
- assert CatBean.bean.isGetInjectionPointsCalled();
+ assert IntegerBean.bean.isGetInjectionPointsCalled();
}
- @Test(groups = { "ri-broken" })
+ @Test
@SpecAssertion(section = "5.2.4", id = "ba")
- // WBRI-328
public void testIsNullableCalled()
{
- assert CatBean.bean.isNullableCalled();
+ assert IntegerBean.bean.isNullableCalled();
}
@Test
@SpecAssertion(section = "5.3", id = "e")
public void testGetNameCalled()
{
- assert CatBean.bean.isGetNameCalled();
+ assert IntegerBean.bean.isGetNameCalled();
}
@Test
@SpecAssertion(section = "6.5.2", id = "e")
public void testGetScopeTypeCalled()
{
- assert CatBean.bean.isGetScopeTypeCalled();
+ assert IntegerBean.bean.isGetScopeCalled();
}
}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/House.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/House.java 2009-12-16
14:06:05 UTC (rev 5306)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/House.java 2009-12-16
15:57:52 UTC (rev 5307)
@@ -5,5 +5,5 @@
class House
{
@SuppressWarnings("unused")
- @Inject private Cat cat;
+ @Inject private int one;
}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/IntegerBean.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/IntegerBean.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/IntegerBean.java 2009-12-16
15:57:52 UTC (rev 5307)
@@ -0,0 +1,162 @@
+package org.jboss.jsr299.tck.tests.definition.bean.custom;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.jsr299.tck.literals.DefaultLiteral;
+
+public class IntegerBean implements Bean<Integer>, Extension
+{
+
+ public static final IntegerBean bean = new IntegerBean();
+
+ private boolean getQualifiersCalled = false;
+ private boolean getInjectionPointsCalled = false;
+ private boolean getNameCalled = false;
+ private boolean getScopeCalled = false;
+ private boolean getTypesCalled = false;
+ private boolean isAlternativeCalled = false;
+ private boolean isSerializableCalled = false;
+ private boolean isNullableCalled = false;
+ private boolean isGetBeanClassCalled = false;
+ private boolean getStereotypesCalled = false;
+
+ public Class<?> getBeanClass()
+ {
+ isGetBeanClassCalled = true;
+ return Integer.class;
+ }
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ getInjectionPointsCalled = true;
+ return Collections.emptySet();
+ }
+
+ public String getName()
+ {
+ getNameCalled = true;
+ return "one";
+ }
+
+ @SuppressWarnings("serial")
+ public Set<Annotation> getQualifiers()
+ {
+ getQualifiersCalled = true;
+ return new HashSet<Annotation>() {
+ {
+ add(new DefaultLiteral());
+ }
+ };
+ }
+
+ public Class<? extends Annotation> getScope()
+ {
+ getScopeCalled = true;
+ return Dependent.class;
+ }
+
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ getStereotypesCalled = true;
+ return Collections.emptySet();
+ }
+
+ public Set<Type> getTypes()
+ {
+ HashSet<Type> types = new HashSet<Type>();
+ types.add(Object.class);
+ types.add(Number.class);
+ types.add(Integer.class);
+
+ getTypesCalled = true;
+ return types;
+ }
+
+ public boolean isAlternative()
+ {
+ isAlternativeCalled = true;
+ return false;
+ }
+
+ public boolean isNullable()
+ {
+ isNullableCalled = true;
+ return false;
+ }
+
+ public Integer create(CreationalContext<Integer> creationalContext)
+ {
+ return new Integer(1);
+ }
+
+ public void destroy(Integer instance, CreationalContext<Integer>
creationalContext)
+ {
+ creationalContext.release();
+ }
+
+ public boolean isGetQualifiersCalled()
+ {
+ return getQualifiersCalled;
+ }
+
+ public boolean isGetInjectionPointsCalled()
+ {
+ return getInjectionPointsCalled;
+ }
+
+ public boolean isGetNameCalled()
+ {
+ return getNameCalled;
+ }
+
+ public boolean isGetScopeCalled()
+ {
+ return getScopeCalled;
+ }
+
+ public boolean isGetTypesCalled()
+ {
+ return getTypesCalled;
+ }
+
+ public boolean isAlternativeCalled()
+ {
+ return isAlternativeCalled;
+ }
+
+ public boolean isSerializableCalled()
+ {
+ return isSerializableCalled;
+ }
+
+ public boolean isNullableCalled()
+ {
+ return isNullableCalled;
+ }
+
+ public boolean isGetBeanClassCalled()
+ {
+ return isGetBeanClassCalled;
+ }
+
+ public boolean isGetStereotypesCalled()
+ {
+ return getStereotypesCalled;
+ }
+
+ public void afterDiscovery(@Observes AfterBeanDiscovery event) {
+ event.addBean(bean);
+ }
+}
Added:
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/bean/custom/beans.xml
===================================================================
---
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/bean/custom/beans.xml
(rev 0)
+++
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/bean/custom/beans.xml 2009-12-16
15:57:52 UTC (rev 5307)
@@ -0,0 +1,5 @@
+<beans>
+ <alternatives>
+
<stereotype>org.jboss.jsr299.tck.tests.definition.bean.custom.AlternativeStereotype</stereotype>
+ </alternatives>
+</beans>
Modified:
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/bean/custom/javax.enterprise.inject.spi.Extension
===================================================================
---
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/bean/custom/javax.enterprise.inject.spi.Extension 2009-12-16
14:06:05 UTC (rev 5306)
+++
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/bean/custom/javax.enterprise.inject.spi.Extension 2009-12-16
15:57:52 UTC (rev 5307)
@@ -1 +1 @@
-org.jboss.jsr299.tck.tests.definition.bean.custom.CatBean
\ No newline at end of file
+org.jboss.jsr299.tck.tests.definition.bean.custom.IntegerBean
\ No newline at end of file