[webbeans-commits] Webbeans SVN: r1092 - in tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests: implementation/commonAnnotations and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-19 15:50:53 -0500 (Mon, 19 Jan 2009)
New Revision: 1092
Removed:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/AbstractEjbEmbeddableTest.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/ResourceInjectionTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/enterprise/EnterpriseBeanLifecycleTest.java
Log:
Remove Embeddable stuff
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/AbstractEjbEmbeddableTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/AbstractEjbEmbeddableTest.java 2009-01-19 20:26:33 UTC (rev 1091)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/AbstractEjbEmbeddableTest.java 2009-01-19 20:50:53 UTC (rev 1092)
@@ -1,6 +0,0 @@
-package org.jboss.webbeans.tck.tests;
-
-public class AbstractEjbEmbeddableTest extends AbstractTest
-{
-
-}
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/ResourceInjectionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/ResourceInjectionTest.java 2009-01-19 20:26:33 UTC (rev 1091)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/ResourceInjectionTest.java 2009-01-19 20:50:53 UTC (rev 1092)
@@ -1,10 +1,10 @@
package org.jboss.webbeans.tck.tests.implementation.commonAnnotations;
import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.tests.AbstractEjbEmbeddableTest;
+import org.jboss.webbeans.tck.tests.AbstractTest;
import org.testng.annotations.Test;
-public class ResourceInjectionTest extends AbstractEjbEmbeddableTest
+public class ResourceInjectionTest extends AbstractTest
{
@Test(groups="stub") @SpecAssertion(section="3.10")
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/enterprise/EnterpriseBeanLifecycleTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/enterprise/EnterpriseBeanLifecycleTest.java 2009-01-19 20:26:33 UTC (rev 1091)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/enterprise/EnterpriseBeanLifecycleTest.java 2009-01-19 20:50:53 UTC (rev 1092)
@@ -7,7 +7,7 @@
import org.jboss.webbeans.tck.impl.SpecAssertion;
import org.jboss.webbeans.tck.impl.SpecVersion;
-import org.jboss.webbeans.tck.tests.AbstractEjbEmbeddableTest;
+import org.jboss.webbeans.tck.tests.AbstractTest;
import org.testng.annotations.Test;
/**
@@ -23,7 +23,7 @@
*/
@SpecVersion("20081206")
-public class EnterpriseBeanLifecycleTest extends AbstractEjbEmbeddableTest
+public class EnterpriseBeanLifecycleTest extends AbstractTest
{
/**
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1091 - in tck/trunk/impl: src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-19 15:26:33 -0500 (Mon, 19 Jan 2009)
New Revision: 1091
Added:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/BookOrderProcessor.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/CdOrderProcessor.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/NovelOrderProcessor.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/OrderProcessor.java
Removed:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/BookOrderProcessor.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/CdOrderProcessor.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/LifecycleCallbackTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/NovelOrderProcessor.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/OrderProcessor.java
Modified:
tck/trunk/impl/pom.xml
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/SimpleBeanLifecycleTest.java
Log:
refactor tests slightly
Modified: tck/trunk/impl/pom.xml
===================================================================
--- tck/trunk/impl/pom.xml 2009-01-19 18:34:54 UTC (rev 1090)
+++ tck/trunk/impl/pom.xml 2009-01-19 20:26:33 UTC (rev 1091)
@@ -63,6 +63,12 @@
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>tck-utils</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/BookOrderProcessor.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/BookOrderProcessor.java 2009-01-19 18:34:54 UTC (rev 1090)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/BookOrderProcessor.java 2009-01-19 20:26:33 UTC (rev 1091)
@@ -1,12 +0,0 @@
-package org.jboss.webbeans.tck.tests.implementation.commonAnnotations;
-
-class BookOrderProcessor extends OrderProcessor
-{
-
- @Override
- public void postConstruct() {}
-
- @Override
- public void preDestroy() {}
-
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/CdOrderProcessor.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/CdOrderProcessor.java 2009-01-19 18:34:54 UTC (rev 1090)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/CdOrderProcessor.java 2009-01-19 20:26:33 UTC (rev 1091)
@@ -1,6 +0,0 @@
-package org.jboss.webbeans.tck.tests.implementation.commonAnnotations;
-
-class CdOrderProcessor extends OrderProcessor
-{
-
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/LifecycleCallbackTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/LifecycleCallbackTest.java 2009-01-19 18:34:54 UTC (rev 1090)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/LifecycleCallbackTest.java 2009-01-19 20:26:33 UTC (rev 1091)
@@ -1,80 +0,0 @@
-package org.jboss.webbeans.tck.tests.implementation.commonAnnotations;
-
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.tests.AbstractTest;
-import org.testng.annotations.Test;
-
-public class LifecycleCallbackTest extends AbstractTest
-{
-
- @Test @SpecAssertion(section="4.2")
- public void testSubClassInheritsPostConstructOnSuperclass() throws Exception
- {
- OrderProcessor.postConstructCalled = false;
- new RunInDependentContext()
- {
- @Override
- protected void execute() throws Exception
- {
- Bean<CdOrderProcessor> bean = createSimpleBean(CdOrderProcessor.class);
- bean.create();
- }
- }.run();
- assert OrderProcessor.postConstructCalled;
- }
-
- @Test @SpecAssertion(section="4.2")
- public void testSubClassInheritsPreDestroyOnSuperclass() throws Exception
- {
- OrderProcessor.preDestroyCalled = false;
- new RunInDependentContext()
- {
- @Override
- protected void execute() throws Exception
- {
- Bean<CdOrderProcessor> bean = createSimpleBean(CdOrderProcessor.class);
- CdOrderProcessor instance = bean.create();
- bean.destroy(instance);
- }
- }.run();
- assert OrderProcessor.preDestroyCalled;
- }
-
- @Test @SpecAssertion(section="4.2")
- public void testSubClassDoesNotInheritPostConstructOnSuperclassBlockedByIntermediateClass() throws Exception
- {
-
- OrderProcessor.postConstructCalled = false;
- new RunInDependentContext()
- {
- @Override
- protected void execute() throws Exception
- {
- Bean<NovelOrderProcessor> bean = createSimpleBean(NovelOrderProcessor.class);
- bean.create();
- }
- }.run();
- assert !OrderProcessor.postConstructCalled;
- }
-
- @Test @SpecAssertion(section="4.2")
- public void testSubClassDoesNotInheritPreDestroyConstructOnSuperclassBlockedByIntermediateClass() throws Exception
- {
- OrderProcessor.preDestroyCalled = false;
- new RunInDependentContext()
- {
- @Override
- protected void execute() throws Exception
- {
- Bean<NovelOrderProcessor> bean = createSimpleBean(NovelOrderProcessor.class);
- NovelOrderProcessor instance = bean.create();
- bean.destroy(instance);
- }
- }.run();
- assert !OrderProcessor.preDestroyCalled;
-
- }
-
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/NovelOrderProcessor.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/NovelOrderProcessor.java 2009-01-19 18:34:54 UTC (rev 1090)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/NovelOrderProcessor.java 2009-01-19 20:26:33 UTC (rev 1091)
@@ -1,6 +0,0 @@
-package org.jboss.webbeans.tck.tests.implementation.commonAnnotations;
-
-class NovelOrderProcessor extends BookOrderProcessor
-{
-
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/OrderProcessor.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/OrderProcessor.java 2009-01-19 18:34:54 UTC (rev 1090)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/OrderProcessor.java 2009-01-19 20:26:33 UTC (rev 1091)
@@ -1,25 +0,0 @@
-package org.jboss.webbeans.tck.tests.implementation.commonAnnotations;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-
-class OrderProcessor
-{
-
- public static boolean postConstructCalled = false;
-
- public static boolean preDestroyCalled = true;
-
- @PostConstruct
- public void postConstruct()
- {
- postConstructCalled = true;
- }
-
- @PreDestroy
- public void preDestroy()
- {
- preDestroyCalled = true;
- }
-
-}
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/BookOrderProcessor.java (from rev 1088, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/BookOrderProcessor.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/BookOrderProcessor.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/BookOrderProcessor.java 2009-01-19 20:26:33 UTC (rev 1091)
@@ -0,0 +1,12 @@
+package org.jboss.webbeans.tck.tests.implementation.simple;
+
+class BookOrderProcessor extends OrderProcessor
+{
+
+ @Override
+ public void postConstruct() {}
+
+ @Override
+ public void preDestroy() {}
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/BookOrderProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/CdOrderProcessor.java (from rev 1088, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/CdOrderProcessor.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/CdOrderProcessor.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/CdOrderProcessor.java 2009-01-19 20:26:33 UTC (rev 1091)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.tests.implementation.simple;
+
+class CdOrderProcessor extends OrderProcessor
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/CdOrderProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/NovelOrderProcessor.java (from rev 1088, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/NovelOrderProcessor.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/NovelOrderProcessor.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/NovelOrderProcessor.java 2009-01-19 20:26:33 UTC (rev 1091)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.tests.implementation.simple;
+
+class NovelOrderProcessor extends BookOrderProcessor
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/NovelOrderProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/OrderProcessor.java (from rev 1088, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/OrderProcessor.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/OrderProcessor.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/OrderProcessor.java 2009-01-19 20:26:33 UTC (rev 1091)
@@ -0,0 +1,25 @@
+package org.jboss.webbeans.tck.tests.implementation.simple;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+class OrderProcessor
+{
+
+ public static boolean postConstructCalled = false;
+
+ public static boolean preDestroyCalled = true;
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ postConstructCalled = true;
+ }
+
+ @PreDestroy
+ public void preDestroy()
+ {
+ preDestroyCalled = true;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/OrderProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/SimpleBeanLifecycleTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/SimpleBeanLifecycleTest.java 2009-01-19 18:34:54 UTC (rev 1090)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/SimpleBeanLifecycleTest.java 2009-01-19 20:26:33 UTC (rev 1091)
@@ -92,6 +92,74 @@
assert farm.closed!=null;
}
+ @Test @SpecAssertion(section="4.2")
+ public void testSubClassInheritsPostConstructOnSuperclass() throws Exception
+ {
+ OrderProcessor.postConstructCalled = false;
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ Bean<CdOrderProcessor> bean = createSimpleBean(CdOrderProcessor.class);
+ bean.create();
+ }
+ }.run();
+ assert OrderProcessor.postConstructCalled;
+ }
+
+ @Test @SpecAssertion(section="4.2")
+ public void testSubClassInheritsPreDestroyOnSuperclass() throws Exception
+ {
+ OrderProcessor.preDestroyCalled = false;
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ Bean<CdOrderProcessor> bean = createSimpleBean(CdOrderProcessor.class);
+ CdOrderProcessor instance = bean.create();
+ bean.destroy(instance);
+ }
+ }.run();
+ assert OrderProcessor.preDestroyCalled;
+ }
+
+ @Test @SpecAssertion(section="4.2")
+ public void testSubClassDoesNotInheritPostConstructOnSuperclassBlockedByIntermediateClass() throws Exception
+ {
+
+ OrderProcessor.postConstructCalled = false;
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ Bean<NovelOrderProcessor> bean = createSimpleBean(NovelOrderProcessor.class);
+ bean.create();
+ }
+ }.run();
+ assert !OrderProcessor.postConstructCalled;
+ }
+
+ @Test @SpecAssertion(section="4.2")
+ public void testSubClassDoesNotInheritPreDestroyConstructOnSuperclassBlockedByIntermediateClass() throws Exception
+ {
+ OrderProcessor.preDestroyCalled = false;
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ Bean<NovelOrderProcessor> bean = createSimpleBean(NovelOrderProcessor.class);
+ NovelOrderProcessor instance = bean.create();
+ bean.destroy(instance);
+ }
+ }.run();
+ assert !OrderProcessor.preDestroyCalled;
+
+ }
+
@Test(groups="injection") @SpecAssertion(section="5.3")
public void testCreateInjectsFieldsDeclaredInJava()
{
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1090 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector and 4 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-19 13:34:54 -0500 (Mon, 19 Jan 2009)
New Revision: 1090
Added:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/Egg.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/Farmer.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/LazyFarmer.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/Chicken.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/Egg.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/InfertileChicken.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/Chicken.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/DisposalMethodDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/Egg.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/InfertileChicken.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/EventTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodDefinitionTest.java
Log:
Inheritance for producer fields, producer methods, observer methods
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-01-19 18:04:13 UTC (rev 1089)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-01-19 18:34:54 UTC (rev 1090)
@@ -240,7 +240,7 @@
{
beans.add(bean);
getManager().getResolver().addInjectionPoints(bean.getAnnotatedInjectionPoints());
- for (AnnotatedMethod<?> producerMethod : annotatedClass.getAnnotatedMethods(Produces.class))
+ for (AnnotatedMethod<?> producerMethod : annotatedClass.getDeclaredAnnotatedMethods(Produces.class))
{
ProducerMethodBean<?> producerMethodBean = ProducerMethodBean.of(producerMethod, bean, getManager());
beans.add(producerMethodBean);
@@ -248,7 +248,7 @@
registerEvents(producerMethodBean.getAnnotatedInjectionPoints(), beans);
log.info("Web Bean: " + producerMethodBean);
}
- for (AnnotatedField<?> producerField : annotatedClass.getAnnotatedFields(Produces.class))
+ for (AnnotatedField<?> producerField : annotatedClass.getDeclaredAnnotatedFields(Produces.class))
{
ProducerFieldBean<?> producerFieldBean = ProducerFieldBean.of(producerField, bean, getManager());
beans.add(producerFieldBean);
@@ -269,7 +269,7 @@
log.info("Web Bean: " + instanceBean);
}
}
- for (AnnotatedMethod<?> observerMethod : annotatedClass.getMethodsWithAnnotatedParameters(Observes.class))
+ for (AnnotatedMethod<?> observerMethod : annotatedClass.getDeclaredMethodsWithAnnotatedParameters(Observes.class))
{
ObserverImpl<?> observer = ObserverImpl.of(observerMethod, bean, getManager());
if (observerMethod.getAnnotatedParameters(Observes.class).size() == 1)
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java 2009-01-19 18:04:13 UTC (rev 1089)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java 2009-01-19 18:34:54 UTC (rev 1090)
@@ -39,13 +39,24 @@
public Set<AnnotatedField<?>> getFields();
/**
- * Gets all annotations which are annotated with the given annotation type
+ * Gets all fields which are annotated with the given annotation type on this
+ * class and all super classes
*
* @param annotationType The annotation to match
* @return A set of abstracted fields with the given annotation. Returns an
* empty set if there are no matches
*/
public Set<AnnotatedField<?>> getAnnotatedFields(Class<? extends Annotation> annotationType);
+
+ /**
+ * Gets all fields which are annotated with the given annotation type on this
+ * class only.
+ *
+ * @param annotationType The annotation to match
+ * @return A set of abstracted fields with the given annotation. Returns an
+ * empty set if there are no matches
+ */
+ public Set<AnnotatedField<?>> getDeclaredAnnotatedFields(Class<? extends Annotation> annotationType);
/**
* Gets all fields which are meta-annotated with metaAnnotationType
@@ -91,6 +102,15 @@
public Set<AnnotatedMethod<?>> getAnnotatedMethods(Class<? extends Annotation> annotationType);
/**
+ * Gets all methods annotated with annotationType
+ *
+ * @param annotationType The annotation to match
+ * @return A set of abstracted methods with the given annotation. Returns an
+ * empty set if there are no matches
+ */
+ public Set<AnnotatedMethod<?>> getDeclaredAnnotatedMethods(Class<? extends Annotation> annotationType);
+
+ /**
* Find the annotated method for a given methodDescriptor
*
* @param methodDescriptor
@@ -106,6 +126,15 @@
* empty set if there are no matches
*/
public Set<AnnotatedMethod<?>> getMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType);
+
+ /**
+ * Gets all with parameters annotated with annotationType
+ *
+ * @param annotationType The annotation to match
+ * @return A set of abstracted methods with the given annotation. Returns an
+ * empty set if there are no matches
+ */
+ public Set<AnnotatedMethod<?>> getDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType);
/**
* Gets the superclass.
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2009-01-19 18:04:13 UTC (rev 1089)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2009-01-19 18:34:54 UTC (rev 1090)
@@ -224,6 +224,13 @@
// The map from annotation type to abstracted field with meta-annotation
private final AnnotatedFieldMap metaAnnotatedFields;
+// The set of abstracted fields
+ private final Set<AnnotatedField<?>> declaredFields;
+ // The map from annotation type to abstracted field with annotation
+ private final AnnotatedFieldMap declaredAnnotatedFields;
+ // The map from annotation type to abstracted field with meta-annotation
+ private final AnnotatedFieldMap declaredMetaAnnotatedFields;
+
// The set of abstracted methods
private final Set<AnnotatedMethod<?>> methods;
// The map from annotation type to abstracted method with annotation
@@ -231,6 +238,13 @@
// The map from annotation type to method with a parameter with annotation
private final AnnotatedMethodMap methodsByAnnotatedParameters;
+// The set of abstracted methods
+ private final Set<AnnotatedMethod<?>> declaredMethods;
+ // The map from annotation type to abstracted method with annotation
+ private final AnnotatedMethodMap declaredAnnotatedMethods;
+ // The map from annotation type to method with a parameter with annotation
+ private final AnnotatedMethodMap declaredMethodsByAnnotatedParameters;
+
// The set of abstracted constructors
private final Set<AnnotatedConstructor<T>> constructors;
// The map from annotation type to abstracted constructor with annotation
@@ -276,6 +290,9 @@
this.fields = new HashSet<AnnotatedField<?>>();
this.annotatedFields = new AnnotatedFieldMap();
this.metaAnnotatedFields = new AnnotatedFieldMap();
+ this.declaredFields = new HashSet<AnnotatedField<?>>();
+ this.declaredAnnotatedFields = new AnnotatedFieldMap();
+ this.declaredMetaAnnotatedFields = new AnnotatedFieldMap();
for (Class<?> c = clazz; c != Object.class && c != null; c = c.getSuperclass())
{
for (Field field : c.getDeclaredFields())
@@ -286,12 +303,24 @@
}
AnnotatedField<?> annotatedField = new AnnotatedFieldImpl<Object>(field, this);
this.fields.add(annotatedField);
+ if (c == clazz)
+ {
+ this.declaredFields.add(annotatedField);
+ }
for (Annotation annotation : annotatedField.getAnnotations())
{
this.annotatedFields.put(annotation.annotationType(), annotatedField);
+ if (c == clazz)
+ {
+ this.declaredAnnotatedFields.put(annotation.annotationType(), annotatedField);
+ }
for (Annotation metaAnnotation : annotation.annotationType().getAnnotations())
{
this.metaAnnotatedFields.put(metaAnnotation.annotationType(), annotatedField);
+ if (c == clazz)
+ {
+ this.declaredMetaAnnotatedFields.put(metaAnnotation.annotationType(), annotatedField);
+ }
}
}
@@ -326,6 +355,9 @@
this.methods = new HashSet<AnnotatedMethod<?>>();
this.annotatedMethods = new AnnotatedMethodMap();
this.methodsByAnnotatedParameters = new AnnotatedMethodMap();
+ this.declaredMethods = new HashSet<AnnotatedMethod<?>>();
+ this.declaredAnnotatedMethods = new AnnotatedMethodMap();
+ this.declaredMethodsByAnnotatedParameters = new AnnotatedMethodMap();
for (Class<?> c = clazz; c != Object.class && c != null; c = c.getSuperclass())
{
for (Method method : c.getDeclaredMethods())
@@ -337,19 +369,27 @@
AnnotatedMethod<?> annotatedMethod = new AnnotatedMethodImpl<Object>(method, this);
this.methods.add(annotatedMethod);
+ if (c == clazz)
+ {
+ this.declaredMethods.add(annotatedMethod);
+ }
for (Annotation annotation : annotatedMethod.getAnnotations())
{
- if (!annotatedMethods.containsKey(annotation.annotationType()))
+ annotatedMethods.put(annotation.annotationType(), annotatedMethod);
+ if (c == clazz)
{
- annotatedMethods.put(annotation.annotationType(), new HashSet<AnnotatedMethod<?>>());
+ this.declaredAnnotatedMethods.put(annotation.annotationType(), annotatedMethod);
}
- annotatedMethods.get(annotation.annotationType()).add(annotatedMethod);
}
for (Class<? extends Annotation> annotationType : AnnotatedMethod.MAPPED_PARAMETER_ANNOTATIONS)
{
if (annotatedMethod.getAnnotatedParameters(annotationType).size() > 0)
{
methodsByAnnotatedParameters.put(annotationType, annotatedMethod);
+ if (c == clazz)
+ {
+ this.declaredMethodsByAnnotatedParameters.put(annotationType, annotatedMethod);
+ }
}
}
}
@@ -388,6 +428,16 @@
return Collections.unmodifiableSet(fields);
}
+ public Set<AnnotatedField<?>> getDeclaredFields()
+ {
+ return Collections.unmodifiableSet(declaredFields);
+ }
+
+ public Set<AnnotatedField<?>> getDeclaredAnnotatedFields(Class<? extends Annotation> annotationType)
+ {
+ return Collections.unmodifiableSet(declaredAnnotatedFields.get(annotationType));
+ }
+
/**
* Gets the abstracted constructors of the class
*
@@ -472,6 +522,11 @@
return Collections.unmodifiableSet(annotatedMethods.get(annotationType));
}
+ public Set<AnnotatedMethod<?>> getDeclaredAnnotatedMethods(Class<? extends Annotation> annotationType)
+ {
+ return Collections.unmodifiableSet(declaredAnnotatedMethods.get(annotationType));
+ }
+
/**
* Gets constructors with given annotation type
*
@@ -505,9 +560,14 @@
public Set<AnnotatedMethod<?>> getMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
{
- return methodsByAnnotatedParameters.get(annotationType);
+ return Collections.unmodifiableSet(methodsByAnnotatedParameters.get(annotationType));
}
+ public Set<AnnotatedMethod<?>> getDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
+ {
+ return Collections.unmodifiableSet(declaredMethodsByAnnotatedParameters.get(annotationType));
+ }
+
public AnnotatedMethod<?> getMethod(Method methodDescriptor)
{
// TODO Cache?
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/Egg.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/Egg.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/Egg.java 2009-01-19 18:34:54 UTC (rev 1090)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.tests.event;
+
+class Egg
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/Egg.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/EventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/EventTest.java 2009-01-19 18:04:13 UTC (rev 1089)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/EventTest.java 2009-01-19 18:34:54 UTC (rev 1090)
@@ -970,5 +970,12 @@
{
assert false;
}
+
+ @Test @SpecAssertion(section="4.2")
+ public void testNonStaticProducerMethodNotInherited()
+ {
+ deployBeans(LazyFarmer.class);
+ assert manager.resolveObservers(new Egg()).isEmpty();
+ }
}
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/Farmer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/Farmer.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/Farmer.java 2009-01-19 18:34:54 UTC (rev 1090)
@@ -0,0 +1,13 @@
+package org.jboss.webbeans.tck.tests.event;
+
+import javax.webbeans.Observes;
+
+public class Farmer
+{
+
+ public void observeEggLaying(@Observes Egg egg)
+ {
+
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/Farmer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/LazyFarmer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/LazyFarmer.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/LazyFarmer.java 2009-01-19 18:34:54 UTC (rev 1090)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.tests.event;
+
+public class LazyFarmer extends Farmer
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/LazyFarmer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/Chicken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/Chicken.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/Chicken.java 2009-01-19 18:34:54 UTC (rev 1090)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.tck.tests.implementation.producer.field;
+
+import javax.webbeans.Produces;
+
+class Chicken
+{
+
+ @Produces
+ private Egg egg = new Egg();
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/Chicken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/Egg.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/Egg.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/Egg.java 2009-01-19 18:34:54 UTC (rev 1090)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.tests.implementation.producer.field;
+
+class Egg
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/Egg.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/InfertileChicken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/InfertileChicken.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/InfertileChicken.java 2009-01-19 18:34:54 UTC (rev 1090)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.tests.implementation.producer.field;
+
+class InfertileChicken extends Chicken
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/InfertileChicken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldDefinitionTest.java 2009-01-19 18:04:13 UTC (rev 1089)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldDefinitionTest.java 2009-01-19 18:34:54 UTC (rev 1090)
@@ -269,4 +269,11 @@
assert wolfSpiderModel.getScopeType().equals(RequestScoped.class);
}
+
+ @Test @SpecAssertion(section="4.2")
+ public void testNonStaticProducerFieldNotInherited()
+ {
+ deployBeans(InfertileChicken.class);
+ assert manager.resolveByType(Egg.class).size() == 0;
+ }
}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/Chicken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/Chicken.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/Chicken.java 2009-01-19 18:34:54 UTC (rev 1090)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.tck.tests.implementation.producer.method;
+
+import javax.webbeans.Produces;
+
+class Chicken
+{
+
+ @Produces
+ public Egg produceEgg()
+ {
+ return new Egg();
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/Chicken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/DisposalMethodDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/DisposalMethodDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/DisposalMethodDefinitionTest.java 2009-01-19 18:34:54 UTC (rev 1090)
@@ -0,0 +1,15 @@
+package org.jboss.webbeans.tck.tests.implementation.producer.method;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.testng.annotations.Test;
+
+public class DisposalMethodDefinitionTest
+{
+
+ @Test(groups="stub") @SpecAssertion(section="4.2")
+ public void testNonStaticDisposalMethodNotInherited()
+ {
+
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/DisposalMethodDefinitionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/Egg.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/Egg.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/Egg.java 2009-01-19 18:34:54 UTC (rev 1090)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.tests.implementation.producer.method;
+
+class Egg
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/Egg.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/InfertileChicken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/InfertileChicken.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/InfertileChicken.java 2009-01-19 18:34:54 UTC (rev 1090)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.tests.implementation.producer.method;
+
+class InfertileChicken extends Chicken
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/InfertileChicken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodDefinitionTest.java 2009-01-19 18:04:13 UTC (rev 1089)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodDefinitionTest.java 2009-01-19 18:34:54 UTC (rev 1090)
@@ -292,4 +292,12 @@
Method method = SpiderProducer_Broken.class.getMethod("produceInteger");
createProducerMethodBean(method, bean);
}
+
+ @Test @SpecAssertion(section="4.2")
+ public void testNonStaticProducerMethodNotInherited()
+ {
+ deployBeans(InfertileChicken.class);
+ assert manager.resolveByType(Egg.class).size() == 0;
+ }
+
}
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1089 - in tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests: definition/bean and 14 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-19 13:04:13 -0500 (Mon, 19 Jan 2009)
New Revision: 1089
Added:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/BeanDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/binding/BindingDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/DeploymentTypeDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/name/NameDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/StereotypeDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/type/ApiTypeDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/EventTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/decorator/
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/decorator/DecoratorDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/interceptor/
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/interceptor/InterceptorDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/jms/JmsDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldLifecycleTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodLifecycleTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/SimpleBeanDefinitionTest.java
Removed:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/CommonWebBeanTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/binding/BindingTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/common/
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/DeploymentTypeTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/name/NameTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/StereotypesTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/type/TypeTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/EventBusTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/jms/JmsModelTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldBeanLifecycleTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldBeanModelTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodBeanLifecycleTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodBeanModelTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/SimpleBeanModelTest.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/Animal.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/AnimalStereotype.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/AnotherDeploymentType.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/DeadlyAnimal.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/DeadlySpider.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/DependentFinalTuna.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/FishStereotype.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/RedSnapper.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/Spider.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/SpiderProducer.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/Tarantula.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/WolfSpider.java
Log:
Better names, stubs for intercetpor and decorator inheritance tests
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean (from rev 1082, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/common)
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/Animal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/common/Animal.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/Animal.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.tck.tests.definition.common;
+package org.jboss.webbeans.tck.tests.definition.bean;
interface Animal
{
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/AnimalStereotype.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/common/AnimalStereotype.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/AnimalStereotype.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.tck.tests.definition.common;
+package org.jboss.webbeans.tck.tests.definition.bean;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/AnotherDeploymentType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/common/AnotherDeploymentType.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/AnotherDeploymentType.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.tck.tests.definition.common;
+package org.jboss.webbeans.tck.tests.definition.bean;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/BeanDefinitionTest.java (from rev 1082, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/common/CommonWebBeanTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/BeanDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/BeanDefinitionTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -0,0 +1,95 @@
+package org.jboss.webbeans.tck.tests.definition.bean;
+
+import java.lang.reflect.Method;
+
+import javax.webbeans.Production;
+import javax.webbeans.RequestScoped;
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.impl.SpecVersion;
+import org.jboss.webbeans.tck.tests.AbstractTest;
+import org.testng.annotations.Test;
+
+/**
+ * This test class should be used for common assertions about Web Beans
+ *
+ * @author Pete Muir
+ *
+ */
+@SpecVersion("20081206")
+public class BeanDefinitionTest extends AbstractTest
+{
+
+ // TODO This should actually somehow test the reverse - that the container
+ // throws a definition exception if any of these occur
+
+ @Test
+ @SpecAssertion(section = "2")
+ public void testApiTypesNonEmpty()
+ {
+ Bean<?> model = createSimpleBean(RedSnapper.class);
+ assert model.getTypes().size() > 0;
+ }
+
+ @Test
+ @SpecAssertion(section = "2")
+ public void testBindingTypesNonEmpty()
+ {
+ Bean<?> model = createSimpleBean(RedSnapper.class);
+ assert model.getBindings().size() > 0;
+ }
+
+ @Test
+ @SpecAssertion(section = "2")
+ public void testHasScopeType()
+ {
+ Bean<?> model = createSimpleBean(RedSnapper.class);
+ assert model.getScopeType().equals(RequestScoped.class);
+ }
+
+ @Test
+ @SpecAssertion(section = "2")
+ public void testHasDeploymentType()
+ {
+ Bean<?> model = createSimpleBean(RedSnapper.class);
+ assert model.getDeploymentType().equals(Production.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test(groups = "producerMethod")
+ @SpecAssertion(section = "5.2")
+ public void testIsNullable() throws Exception
+ {
+ Bean<SpiderProducer> spiderProducerBean = createSimpleBean(SpiderProducer.class);
+ manager.addBean(spiderProducerBean);
+ Method method = SpiderProducer.class.getMethod("getWolfSpiderSize");
+ Bean<Integer> bean = createProducerMethodBean(method, spiderProducerBean);
+ assert !bean.isNullable();
+ method = SpiderProducer.class.getMethod("makeASpider");
+ Bean<Spider> spiderBean = createProducerMethodBean(method, spiderProducerBean);
+ assert spiderBean.isNullable();
+ }
+
+ @Test
+ @SpecAssertion(section = { "3.2.2", "2.2" })
+ public void testApiTypes()
+ {
+ Bean<Tarantula> bean = createSimpleBean(Tarantula.class);
+ assert bean.getTypes().size() == 6;
+ assert bean.getTypes().contains(Tarantula.class);
+ assert bean.getTypes().contains(Spider.class);
+ assert bean.getTypes().contains(Animal.class);
+ assert bean.getTypes().contains(Object.class);
+ assert bean.getTypes().contains(DeadlySpider.class);
+ assert bean.getTypes().contains(DeadlyAnimal.class);
+ }
+
+ @Test
+ @SpecAssertion(section = "2.2")
+ public void testFinalApiType()
+ {
+ createSimpleBean(DependentFinalTuna.class);
+ }
+
+}
\ No newline at end of file
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/CommonWebBeanTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/common/CommonWebBeanTest.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/CommonWebBeanTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,95 +0,0 @@
-package org.jboss.webbeans.tck.tests.definition.common;
-
-import java.lang.reflect.Method;
-
-import javax.webbeans.Production;
-import javax.webbeans.RequestScoped;
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.impl.SpecVersion;
-import org.jboss.webbeans.tck.tests.AbstractTest;
-import org.testng.annotations.Test;
-
-/**
- * This test class should be used for common assertions about Web Beans
- *
- * @author Pete Muir
- *
- */
-@SpecVersion("20081206")
-public class CommonWebBeanTest extends AbstractTest
-{
-
- // TODO This should actually somehow test the reverse - that the container
- // throws a definition exception if any of these occur
-
- @Test
- @SpecAssertion(section = "2")
- public void testApiTypesNonEmpty()
- {
- Bean<?> model = createSimpleBean(RedSnapper.class);
- assert model.getTypes().size() > 0;
- }
-
- @Test
- @SpecAssertion(section = "2")
- public void testBindingTypesNonEmpty()
- {
- Bean<?> model = createSimpleBean(RedSnapper.class);
- assert model.getBindings().size() > 0;
- }
-
- @Test
- @SpecAssertion(section = "2")
- public void testHasScopeType()
- {
- Bean<?> model = createSimpleBean(RedSnapper.class);
- assert model.getScopeType().equals(RequestScoped.class);
- }
-
- @Test
- @SpecAssertion(section = "2")
- public void testHasDeploymentType()
- {
- Bean<?> model = createSimpleBean(RedSnapper.class);
- assert model.getDeploymentType().equals(Production.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test(groups = "producerMethod")
- @SpecAssertion(section = "5.2")
- public void testIsNullable() throws Exception
- {
- Bean<SpiderProducer> spiderProducerBean = createSimpleBean(SpiderProducer.class);
- manager.addBean(spiderProducerBean);
- Method method = SpiderProducer.class.getMethod("getWolfSpiderSize");
- Bean<Integer> bean = createProducerMethodBean(method, spiderProducerBean);
- assert !bean.isNullable();
- method = SpiderProducer.class.getMethod("makeASpider");
- Bean<Spider> spiderBean = createProducerMethodBean(method, spiderProducerBean);
- assert spiderBean.isNullable();
- }
-
- @Test
- @SpecAssertion(section = { "3.2.2", "2.2" })
- public void testApiTypes()
- {
- Bean<Tarantula> bean = createSimpleBean(Tarantula.class);
- assert bean.getTypes().size() == 6;
- assert bean.getTypes().contains(Tarantula.class);
- assert bean.getTypes().contains(Spider.class);
- assert bean.getTypes().contains(Animal.class);
- assert bean.getTypes().contains(Object.class);
- assert bean.getTypes().contains(DeadlySpider.class);
- assert bean.getTypes().contains(DeadlyAnimal.class);
- }
-
- @Test
- @SpecAssertion(section = "2.2")
- public void testFinalApiType()
- {
- createSimpleBean(DependentFinalTuna.class);
- }
-
-}
\ No newline at end of file
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/DeadlyAnimal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/common/DeadlyAnimal.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/DeadlyAnimal.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.tck.tests.definition.common;
+package org.jboss.webbeans.tck.tests.definition.bean;
interface DeadlyAnimal
{
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/DeadlySpider.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/common/DeadlySpider.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/DeadlySpider.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.tck.tests.definition.common;
+package org.jboss.webbeans.tck.tests.definition.bean;
interface DeadlySpider extends DeadlyAnimal
{
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/DependentFinalTuna.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/common/DependentFinalTuna.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/DependentFinalTuna.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.tck.tests.definition.common;
+package org.jboss.webbeans.tck.tests.definition.bean;
@AnotherDeploymentType
final class DependentFinalTuna
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/FishStereotype.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/common/FishStereotype.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/FishStereotype.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.tck.tests.definition.common;
+package org.jboss.webbeans.tck.tests.definition.bean;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/RedSnapper.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/common/RedSnapper.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/RedSnapper.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.tck.tests.definition.common;
+package org.jboss.webbeans.tck.tests.definition.bean;
import javax.webbeans.RequestScoped;
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/Spider.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/common/Spider.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/Spider.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.tck.tests.definition.common;
+package org.jboss.webbeans.tck.tests.definition.bean;
class Spider implements Animal
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/SpiderProducer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/common/SpiderProducer.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/SpiderProducer.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.tck.tests.definition.common;
+package org.jboss.webbeans.tck.tests.definition.bean;
import javax.webbeans.Produces;
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/Tarantula.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/common/Tarantula.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/Tarantula.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.tck.tests.definition.common;
+package org.jboss.webbeans.tck.tests.definition.bean;
class Tarantula extends Spider implements DeadlySpider
{
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/WolfSpider.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/common/WolfSpider.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/bean/WolfSpider.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.tck.tests.definition.common;
+package org.jboss.webbeans.tck.tests.definition.bean;
class WolfSpider implements Animal
{
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/binding/BindingDefinitionTest.java (from rev 1082, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/binding/BindingTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/binding/BindingDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/binding/BindingDefinitionTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -0,0 +1,198 @@
+package org.jboss.webbeans.tck.tests.definition.binding;
+
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Set;
+
+import javax.webbeans.Current;
+import javax.webbeans.Production;
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.impl.SpecVersion;
+import org.jboss.webbeans.tck.impl.literals.CurrentBinding;
+import org.jboss.webbeans.tck.impl.util.Reflections;
+import org.jboss.webbeans.tck.tests.AbstractTest;
+import org.testng.annotations.Test;
+
+@SpecVersion("20081206")
+public class BindingDefinitionTest extends AbstractTest
+{
+
+ @Override
+ protected List<Class<? extends Annotation>> getEnabledDeploymentTypes()
+ {
+ List<Class<? extends Annotation>> deploymentTypes = super.getStandardDeploymentTypes();
+ deploymentTypes.add(AnotherDeploymentType.class);
+ return deploymentTypes;
+ }
+
+ @Test @SpecAssertion(section={"2.3.3", "2.3.1"})
+ public void testDefaultBindingDeclaredInJava()
+ {
+ Bean<Order> order = createSimpleBean(Order.class);
+ assert order.getBindings().size() == 1;
+ order.getBindings().iterator().next().annotationType().equals(Production.class);
+ }
+
+ @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.3.2")
+ public void testBindingHasCorrectTarget()
+ {
+ assert false;
+ }
+
+ @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.3.2")
+ public void testBindingHasCorrectRetention()
+ {
+ assert false;
+ }
+
+ @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.3.2")
+ public void testBindingDeclaresBindingAnnotation()
+ {
+ assert false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test @SpecAssertion(section="2.3.3")
+ public void testBindingsDeclaredInJava()
+ {
+ Bean<Cat> cat = createSimpleBean(Cat.class);
+ assert cat.getBindings().size() == 1;
+ assert Reflections.annotationSetMatches(cat.getBindings(), Synchronous.class);
+ }
+
+ @Test @SpecAssertion(section="2.3.3")
+ public void testMultipleBindings()
+ {
+ Bean<?> model = createSimpleBean(Cod.class);
+ assert model.getBindings().size() == 2;
+ }
+
+ @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.3.4")
+ public void testBindingsDeclaredInXml()
+ {
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
+ //AnnotatedClass annotatedItem = new SimpleAnnotatedClass(Antelope.class, annotations);
+
+ //SimpleBean<Antelope> antelope = createSimpleBean(Antelope.class, annotatedItem, manager);
+ // assert Reflections.annotationSetMatches(antelope.getBindingTypes(), Asynchronous.class);
+ assert false;
+ }
+
+ @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.3.4")
+ public void testXmlBindingOverridesAndIgnoresJava()
+ {
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
+ //AnnotatedClass<Cat> annotatedItem = new SimpleAnnotatedClass<Cat>(Cat.class, annotations);
+
+ //SimpleBean<Cat> cat = createSimpleBean(Cat.class, annotatedItem, manager);
+ //assert cat.getBindingTypes().size() == 1;
+ //assert cat.getBindingTypes().contains(new AnnotationLiteral<Asynchronous>() {});
+ assert false;
+ }
+
+ @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.3.4")
+ public void testNoBindingsDeclaredInXml()
+ {
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //AnnotatedClass<Cat> annotatedItem = new SimpleAnnotatedClass<Cat>(Cat.class, annotations);
+
+ //SimpleBean<Cat> cat = createSimpleBean(Cat.class, annotatedItem, manager);
+ //assert cat.getBindingTypes().size() == 1;
+ //assert cat.getBindingTypes().contains(new AnnotationLiteral<Synchronous>() {});
+ assert false;
+ }
+
+ @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section={"2.3.4", "2.3.1"})
+ public void testDefaultBindingDeclaredInXml()
+ {
+ Bean<?> model = createSimpleBean(Tuna.class);
+ assert model.getBindings().size() == 1;
+ assert model.getBindings().contains(new CurrentBinding());
+ assert false;
+ }
+
+ @Test(groups={"injection", "producerMethod"}) @SpecAssertion(section="2.3.5")
+ public void testFieldInjectedFromProducerMethod() throws Exception
+ {
+ Bean<SpiderProducer> spiderProducer = createSimpleBean(SpiderProducer.class);
+ manager.addBean(spiderProducer);
+ Method method = SpiderProducer.class.getMethod("produceTameTarantula");
+ manager.addBean(createProducerMethodBean(method, spiderProducer));
+ Barn barn = createSimpleBean(Barn.class).create();
+ assert barn.petSpider != null;
+ assert barn.petSpider instanceof DefangedTarantula;
+ }
+
+ @Test(groups={"stub", "injection", "webbeansxml"}) @SpecAssertion(section="2.3.5")
+ public void testFieldWithBindingInXml()
+ {
+ assert false;
+ }
+
+ @Test(groups={"stub", "injection", "webbeansxml"}) @SpecAssertion(section="2.3.5")
+ public void testFieldWithBindingInXmlIgnoresAnnotations()
+ {
+ assert false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test(groups={"injection", "producerMethod"})
+ public void testMethodWithBindingAnnotationsOnParametersAreInjected() throws Exception
+ {
+ Bean<SpiderProducer> spiderProducer = createSimpleBean(SpiderProducer.class);
+ manager.addBean(spiderProducer);
+ Method method = SpiderProducer.class.getMethod("produceTameTarantula");
+ manager.addBean(createProducerMethodBean(method, spiderProducer));
+ method = SpiderProducer.class.getMethod("produceSpiderFromInjection", Tarantula.class);
+ Bean<Spider> spiderBean = createProducerMethodBean(method, spiderProducer);
+ Spider spider = spiderBean.create();
+ assert spider != null;
+ assert spider instanceof DefangedTarantula;
+ }
+
+ @Test(groups={"stub", "injection", "webbeansxml"}) @SpecAssertion(section="2.3.6")
+ public void testMethodWithBindingAnnotationsOnParametersDeclaredInXml()
+ {
+ assert false;
+ }
+
+ @Test(groups={"stub", "injection", "webbeansxml"}) @SpecAssertion(section="2.3.6")
+ public void testMethodWithBindingAnnotationsOnParametersDeclaredInXmlIgnoresAnnotations()
+ {
+ assert false;
+ }
+
+ @Test @SpecAssertion(section="4.1")
+ public void testBindingDeclaredInheritedIsInherited() throws Exception
+ {
+ Set<? extends Annotation> bindings = createSimpleBean(BorderCollie.class).getBindings();
+ assert bindings.size() == 1;
+ assert bindings.iterator().next().annotationType().equals(Hairy.class);
+ }
+
+ @Test @SpecAssertion(section="4.1")
+ public void testBindingNotDeclaredInheritedIsNotInherited()
+ {
+ Set<? extends Annotation> bindings = createSimpleBean(ShetlandPony.class).getBindings();
+ assert bindings.size() == 1;
+ assert bindings.iterator().next().annotationType().equals(Current.class);
+ }
+
+ @Test @SpecAssertion(section="4.1")
+ public void testBindingDeclaredInheritedIsBlockedByIntermediateClass()
+ {
+ Set<? extends Annotation> bindings = createSimpleBean(ClippedBorderCollie.class).getBindings();
+ assert bindings.size() == 1;
+ Annotation binding = bindings.iterator().next();
+ assert binding.annotationType().equals(Hairy.class);
+ Hairy hairy = (Hairy) binding;
+ assert hairy.clipped();
+ }
+
+}
\ No newline at end of file
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/binding/BindingTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/binding/BindingTest.java 2009-01-19 17:43:16 UTC (rev 1088)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/binding/BindingTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,198 +0,0 @@
-package org.jboss.webbeans.tck.tests.definition.binding;
-
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.List;
-import java.util.Set;
-
-import javax.webbeans.Current;
-import javax.webbeans.Production;
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.impl.SpecVersion;
-import org.jboss.webbeans.tck.impl.literals.CurrentBinding;
-import org.jboss.webbeans.tck.impl.util.Reflections;
-import org.jboss.webbeans.tck.tests.AbstractTest;
-import org.testng.annotations.Test;
-
-@SpecVersion("20081206")
-public class BindingTest extends AbstractTest
-{
-
- @Override
- protected List<Class<? extends Annotation>> getEnabledDeploymentTypes()
- {
- List<Class<? extends Annotation>> deploymentTypes = super.getStandardDeploymentTypes();
- deploymentTypes.add(AnotherDeploymentType.class);
- return deploymentTypes;
- }
-
- @Test @SpecAssertion(section={"2.3.3", "2.3.1"})
- public void testDefaultBindingDeclaredInJava()
- {
- Bean<Order> order = createSimpleBean(Order.class);
- assert order.getBindings().size() == 1;
- order.getBindings().iterator().next().annotationType().equals(Production.class);
- }
-
- @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.3.2")
- public void testBindingHasCorrectTarget()
- {
- assert false;
- }
-
- @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.3.2")
- public void testBindingHasCorrectRetention()
- {
- assert false;
- }
-
- @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.3.2")
- public void testBindingDeclaresBindingAnnotation()
- {
- assert false;
- }
-
- @SuppressWarnings("unchecked")
- @Test @SpecAssertion(section="2.3.3")
- public void testBindingsDeclaredInJava()
- {
- Bean<Cat> cat = createSimpleBean(Cat.class);
- assert cat.getBindings().size() == 1;
- assert Reflections.annotationSetMatches(cat.getBindings(), Synchronous.class);
- }
-
- @Test @SpecAssertion(section="2.3.3")
- public void testMultipleBindings()
- {
- Bean<?> model = createSimpleBean(Cod.class);
- assert model.getBindings().size() == 2;
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.3.4")
- public void testBindingsDeclaredInXml()
- {
- //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- //annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
- //AnnotatedClass annotatedItem = new SimpleAnnotatedClass(Antelope.class, annotations);
-
- //SimpleBean<Antelope> antelope = createSimpleBean(Antelope.class, annotatedItem, manager);
- // assert Reflections.annotationSetMatches(antelope.getBindingTypes(), Asynchronous.class);
- assert false;
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.3.4")
- public void testXmlBindingOverridesAndIgnoresJava()
- {
- //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- //annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
- //AnnotatedClass<Cat> annotatedItem = new SimpleAnnotatedClass<Cat>(Cat.class, annotations);
-
- //SimpleBean<Cat> cat = createSimpleBean(Cat.class, annotatedItem, manager);
- //assert cat.getBindingTypes().size() == 1;
- //assert cat.getBindingTypes().contains(new AnnotationLiteral<Asynchronous>() {});
- assert false;
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.3.4")
- public void testNoBindingsDeclaredInXml()
- {
- //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- //AnnotatedClass<Cat> annotatedItem = new SimpleAnnotatedClass<Cat>(Cat.class, annotations);
-
- //SimpleBean<Cat> cat = createSimpleBean(Cat.class, annotatedItem, manager);
- //assert cat.getBindingTypes().size() == 1;
- //assert cat.getBindingTypes().contains(new AnnotationLiteral<Synchronous>() {});
- assert false;
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section={"2.3.4", "2.3.1"})
- public void testDefaultBindingDeclaredInXml()
- {
- Bean<?> model = createSimpleBean(Tuna.class);
- assert model.getBindings().size() == 1;
- assert model.getBindings().contains(new CurrentBinding());
- assert false;
- }
-
- @Test(groups={"injection", "producerMethod"}) @SpecAssertion(section="2.3.5")
- public void testFieldInjectedFromProducerMethod() throws Exception
- {
- Bean<SpiderProducer> spiderProducer = createSimpleBean(SpiderProducer.class);
- manager.addBean(spiderProducer);
- Method method = SpiderProducer.class.getMethod("produceTameTarantula");
- manager.addBean(createProducerMethodBean(method, spiderProducer));
- Barn barn = createSimpleBean(Barn.class).create();
- assert barn.petSpider != null;
- assert barn.petSpider instanceof DefangedTarantula;
- }
-
- @Test(groups={"stub", "injection", "webbeansxml"}) @SpecAssertion(section="2.3.5")
- public void testFieldWithBindingInXml()
- {
- assert false;
- }
-
- @Test(groups={"stub", "injection", "webbeansxml"}) @SpecAssertion(section="2.3.5")
- public void testFieldWithBindingInXmlIgnoresAnnotations()
- {
- assert false;
- }
-
- @SuppressWarnings("unchecked")
- @Test(groups={"injection", "producerMethod"})
- public void testMethodWithBindingAnnotationsOnParametersAreInjected() throws Exception
- {
- Bean<SpiderProducer> spiderProducer = createSimpleBean(SpiderProducer.class);
- manager.addBean(spiderProducer);
- Method method = SpiderProducer.class.getMethod("produceTameTarantula");
- manager.addBean(createProducerMethodBean(method, spiderProducer));
- method = SpiderProducer.class.getMethod("produceSpiderFromInjection", Tarantula.class);
- Bean<Spider> spiderBean = createProducerMethodBean(method, spiderProducer);
- Spider spider = spiderBean.create();
- assert spider != null;
- assert spider instanceof DefangedTarantula;
- }
-
- @Test(groups={"stub", "injection", "webbeansxml"}) @SpecAssertion(section="2.3.6")
- public void testMethodWithBindingAnnotationsOnParametersDeclaredInXml()
- {
- assert false;
- }
-
- @Test(groups={"stub", "injection", "webbeansxml"}) @SpecAssertion(section="2.3.6")
- public void testMethodWithBindingAnnotationsOnParametersDeclaredInXmlIgnoresAnnotations()
- {
- assert false;
- }
-
- @Test @SpecAssertion(section="4.1")
- public void testBindingDeclaredInheritedIsInherited() throws Exception
- {
- Set<? extends Annotation> bindings = createSimpleBean(BorderCollie.class).getBindings();
- assert bindings.size() == 1;
- assert bindings.iterator().next().annotationType().equals(Hairy.class);
- }
-
- @Test @SpecAssertion(section="4.1")
- public void testBindingNotDeclaredInheritedIsNotInherited()
- {
- Set<? extends Annotation> bindings = createSimpleBean(ShetlandPony.class).getBindings();
- assert bindings.size() == 1;
- assert bindings.iterator().next().annotationType().equals(Current.class);
- }
-
- @Test @SpecAssertion(section="4.1")
- public void testBindingDeclaredInheritedIsBlockedByIntermediateClass()
- {
- Set<? extends Annotation> bindings = createSimpleBean(ClippedBorderCollie.class).getBindings();
- assert bindings.size() == 1;
- Annotation binding = bindings.iterator().next();
- assert binding.annotationType().equals(Hairy.class);
- Hairy hairy = (Hairy) binding;
- assert hairy.clipped();
- }
-
-}
\ No newline at end of file
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/DeploymentTypeDefinitionTest.java (from rev 1086, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/DeploymentTypeTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/DeploymentTypeDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/DeploymentTypeDefinitionTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -0,0 +1,187 @@
+package org.jboss.webbeans.tck.tests.definition.deployment;
+
+import static org.jboss.webbeans.tck.impl.WebBeansTCKImpl.configuration;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.webbeans.DefinitionException;
+import javax.webbeans.DeploymentException;
+import javax.webbeans.Production;
+import javax.webbeans.Standard;
+import javax.webbeans.UnsatisfiedDependencyException;
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.impl.SpecVersion;
+import org.jboss.webbeans.tck.tests.AbstractTest;
+import org.testng.annotations.Test;
+
+@SpecVersion("20081206")
+public class DeploymentTypeDefinitionTest extends AbstractTest
+{
+
+ @Override
+ protected List<Class<? extends Annotation>> getEnabledDeploymentTypes()
+ {
+ List<Class<? extends Annotation>> deploymentTypes = super.getStandardDeploymentTypes();
+ deploymentTypes.add(AnotherDeploymentType.class);
+ deploymentTypes.add(HornedAnimalDeploymentType.class);
+ deploymentTypes.add(NotInheritedDeploymentType.class);
+ return deploymentTypes;
+ }
+
+ @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.5.1")
+ public void testNonBuiltInComponentUsesStandard()
+ {
+ createSimpleBean(Gazelle_Broken.class);
+ }
+
+ @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.5.2")
+ public void testDeploymentTypeHasCorrectTarget()
+ {
+ assert false;
+ }
+
+ @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.5.2")
+ public void testDeploymentTypeHasCorrectRetention()
+ {
+ assert false;
+ }
+
+ @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.5.2")
+ public void testDeploymentTypeDeclaresScopeTypeAnnotation()
+ {
+ assert false;
+ }
+
+ @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.5.3")
+ public void testTooManyDeploymentTypes()
+ {
+ createSimpleBean(BeanWithTooManyDeploymentTypes_Broken.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test @SpecAssertion(section="2.5.3")
+ public void testDeploymentTypeInhertitedFromDeclaringBean() throws Exception
+ {
+ Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer.class.getMethod("produceBlackWidow");
+ Bean<BlackWidow> blackWidowSpiderModel = createProducerMethodBean(method, bean);
+ assert blackWidowSpiderModel.getDeploymentType().equals(AnotherDeploymentType.class);
+ }
+
+ @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.5.4")
+ public void testXmlDeploymentTypeOverridesJava()
+ {
+ //Map<Class<? extends Annotation>, Annotation> xmlDefinedDeploymentTypeAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //xmlDefinedDeploymentTypeAnnotations.put(AnotherDeploymentType.class, new AnotherDeploymentTypeAnnotationLiteral());
+ //AnnotatedClass<BeanWithTooManyDeploymentTypes> xmlDefinedDeploymentTypeAnnotatedItem = new SimpleAnnotatedClass<BeanWithTooManyDeploymentTypes>(BeanWithTooManyDeploymentTypes.class, xmlDefinedDeploymentTypeAnnotations);
+
+ //SimpleBean<BeanWithTooManyDeploymentTypes> model = createSimpleBean(BeanWithTooManyDeploymentTypes.class, xmlDefinedDeploymentTypeAnnotatedItem, manager);
+ //assert model.getDeploymentType().equals(AnotherDeploymentType.class);
+ assert false;
+ }
+
+
+
+ @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.5.4")
+ public void testXmlRespectsJavaDeploymentType()
+ {
+ //AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, new HashMap<Class<? extends Annotation>, Annotation>());
+ //SimpleBean<Tuna> tuna = createSimpleBean(Tuna.class, annotatedItem, manager);
+ //assert tuna.getDeploymentType().equals(AnotherDeploymentType.class);
+ assert false;
+ }
+
+ @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.5.5")
+ public void testXmlDefaultDeploymentType()
+ {
+ //AnnotatedClass<Antelope> antelopeAnnotatedItem = new SimpleAnnotatedClass<Antelope>(Antelope.class, new HashMap<Class<? extends Annotation>, Annotation>());
+ //SimpleBean<Antelope> antelope = createSimpleBean(Antelope.class, antelopeAnnotatedItem, manager);
+ // assert antelope.getDeploymentType().equals(Production.class);
+ assert false;
+ }
+
+ @Test @SpecAssertion(section="2.5.5")
+ public void testHighestPrecedenceDeploymentTypeFromStereotype()
+ {
+ Bean<?> bean = createSimpleBean(Rhinoceros.class);
+ assert bean.getDeploymentType().equals(HornedAnimalDeploymentType.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test(groups="beanLifecycle", expectedExceptions=UnsatisfiedDependencyException.class) @SpecAssertion(section="2.5.6")
+ public void testBeanWithDisabledDeploymentTypeNotInstantiated()
+ {
+ configuration().getManagers().setEnabledDeploymentTypes(
+ Arrays.asList(Standard.class, AnotherDeploymentType.class,
+ HornedAnimalDeploymentType.class));
+
+ Bean<RedSnapper> bean = createSimpleBean(RedSnapper.class);
+ manager.addBean(bean);
+ manager.getInstanceByType(RedSnapper.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test @SpecAssertion(section={"2.5.6", "2.5.7"})
+ public void testCustomDeploymentTypes()
+ {
+ configuration().getManagers().setEnabledDeploymentTypes(
+ Arrays.asList(Standard.class, AnotherDeploymentType.class,
+ HornedAnimalDeploymentType.class));
+ assert configuration().getManagers().getEnabledDeploymentTypes().size() == 3;
+ assert configuration().getManagers().getEnabledDeploymentTypes().get(0).equals(Standard.class);
+ assert configuration().getManagers().getEnabledDeploymentTypes().get(1).equals(AnotherDeploymentType.class);
+ assert configuration().getManagers().getEnabledDeploymentTypes().get(2).equals(HornedAnimalDeploymentType.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test(expectedExceptions=DeploymentException.class) @SpecAssertion(section="2.5.6")
+ public void testStandardMustBeDeclared()
+ {
+ configuration().getManagers().setEnabledDeploymentTypes(
+ Arrays.asList(AnotherDeploymentType.class, HornedAnimalDeploymentType.class));
+ }
+
+ @Test(groups={"stub", "webbeansxml"}, expectedExceptions=DeploymentException.class) @SpecAssertion(section="2.5.6")
+ public void testMultipleDeployElementsCannotBeDefined()
+ {
+
+ }
+
+ @Test @SpecAssertion(section={"2.5.5", "2.7.2", "4.1"})
+ public void testWebBeanDeploymentTypeOverridesStereotype()
+ {
+ Bean<Reindeer> bean = createSimpleBean(Reindeer.class);
+ assert bean.getDeploymentType().equals(Production.class);
+ }
+
+ @Test @SpecAssertion(section="4.1")
+ public void testDeploymentTypeDeclaredInheritedIsInherited() throws Exception
+ {
+ assert createSimpleBean(BorderCollie.class).getDeploymentType().equals(AnotherDeploymentType.class);
+ }
+
+ @Test @SpecAssertion(section="4.1")
+ public void testDeploymentTypeNotDeclaredInheritedIsNotInherited()
+ {
+ assert createSimpleBean(ShetlandPony.class).getDeploymentType().equals(Production.class);
+ }
+
+ @Test @SpecAssertion(section="4.1")
+ public void testDeploymentTypeDeclaredInheritedIsBlockedByIntermediateDeploymentTypeNotMarkedInherited()
+ {
+ assert createSimpleBean(GoldenRetriever.class).getDeploymentType().equals(Production.class);
+ }
+
+ @Test @SpecAssertion(section="4.1")
+ public void testDeploymentTypeDeclaredInheritedIsBlockedByIntermediateDeploymentTypeMarkedInherited()
+ {
+ assert createSimpleBean(GoldenLabrador.class).getDeploymentType().equals(InheritedDeploymentType.class);
+ }
+
+}
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/DeploymentTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/DeploymentTypeTest.java 2009-01-19 17:43:16 UTC (rev 1088)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/DeploymentTypeTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,187 +0,0 @@
-package org.jboss.webbeans.tck.tests.definition.deployment;
-
-import static org.jboss.webbeans.tck.impl.WebBeansTCKImpl.configuration;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.webbeans.DefinitionException;
-import javax.webbeans.DeploymentException;
-import javax.webbeans.Production;
-import javax.webbeans.Standard;
-import javax.webbeans.UnsatisfiedDependencyException;
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.impl.SpecVersion;
-import org.jboss.webbeans.tck.tests.AbstractTest;
-import org.testng.annotations.Test;
-
-@SpecVersion("20081206")
-public class DeploymentTypeTest extends AbstractTest
-{
-
- @Override
- protected List<Class<? extends Annotation>> getEnabledDeploymentTypes()
- {
- List<Class<? extends Annotation>> deploymentTypes = super.getStandardDeploymentTypes();
- deploymentTypes.add(AnotherDeploymentType.class);
- deploymentTypes.add(HornedAnimalDeploymentType.class);
- deploymentTypes.add(NotInheritedDeploymentType.class);
- return deploymentTypes;
- }
-
- @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.5.1")
- public void testNonBuiltInComponentUsesStandard()
- {
- createSimpleBean(Gazelle_Broken.class);
- }
-
- @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.5.2")
- public void testDeploymentTypeHasCorrectTarget()
- {
- assert false;
- }
-
- @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.5.2")
- public void testDeploymentTypeHasCorrectRetention()
- {
- assert false;
- }
-
- @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.5.2")
- public void testDeploymentTypeDeclaresScopeTypeAnnotation()
- {
- assert false;
- }
-
- @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.5.3")
- public void testTooManyDeploymentTypes()
- {
- createSimpleBean(BeanWithTooManyDeploymentTypes_Broken.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test @SpecAssertion(section="2.5.3")
- public void testDeploymentTypeInhertitedFromDeclaringBean() throws Exception
- {
- Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
- manager.addBean(bean);
- Method method = SpiderProducer.class.getMethod("produceBlackWidow");
- Bean<BlackWidow> blackWidowSpiderModel = createProducerMethodBean(method, bean);
- assert blackWidowSpiderModel.getDeploymentType().equals(AnotherDeploymentType.class);
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.5.4")
- public void testXmlDeploymentTypeOverridesJava()
- {
- //Map<Class<? extends Annotation>, Annotation> xmlDefinedDeploymentTypeAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
- //xmlDefinedDeploymentTypeAnnotations.put(AnotherDeploymentType.class, new AnotherDeploymentTypeAnnotationLiteral());
- //AnnotatedClass<BeanWithTooManyDeploymentTypes> xmlDefinedDeploymentTypeAnnotatedItem = new SimpleAnnotatedClass<BeanWithTooManyDeploymentTypes>(BeanWithTooManyDeploymentTypes.class, xmlDefinedDeploymentTypeAnnotations);
-
- //SimpleBean<BeanWithTooManyDeploymentTypes> model = createSimpleBean(BeanWithTooManyDeploymentTypes.class, xmlDefinedDeploymentTypeAnnotatedItem, manager);
- //assert model.getDeploymentType().equals(AnotherDeploymentType.class);
- assert false;
- }
-
-
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.5.4")
- public void testXmlRespectsJavaDeploymentType()
- {
- //AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, new HashMap<Class<? extends Annotation>, Annotation>());
- //SimpleBean<Tuna> tuna = createSimpleBean(Tuna.class, annotatedItem, manager);
- //assert tuna.getDeploymentType().equals(AnotherDeploymentType.class);
- assert false;
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.5.5")
- public void testXmlDefaultDeploymentType()
- {
- //AnnotatedClass<Antelope> antelopeAnnotatedItem = new SimpleAnnotatedClass<Antelope>(Antelope.class, new HashMap<Class<? extends Annotation>, Annotation>());
- //SimpleBean<Antelope> antelope = createSimpleBean(Antelope.class, antelopeAnnotatedItem, manager);
- // assert antelope.getDeploymentType().equals(Production.class);
- assert false;
- }
-
- @Test @SpecAssertion(section="2.5.5")
- public void testHighestPrecedenceDeploymentTypeFromStereotype()
- {
- Bean<?> bean = createSimpleBean(Rhinoceros.class);
- assert bean.getDeploymentType().equals(HornedAnimalDeploymentType.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test(groups="beanLifecycle", expectedExceptions=UnsatisfiedDependencyException.class) @SpecAssertion(section="2.5.6")
- public void testBeanWithDisabledDeploymentTypeNotInstantiated()
- {
- configuration().getManagers().setEnabledDeploymentTypes(
- Arrays.asList(Standard.class, AnotherDeploymentType.class,
- HornedAnimalDeploymentType.class));
-
- Bean<RedSnapper> bean = createSimpleBean(RedSnapper.class);
- manager.addBean(bean);
- manager.getInstanceByType(RedSnapper.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test @SpecAssertion(section={"2.5.6", "2.5.7"})
- public void testCustomDeploymentTypes()
- {
- configuration().getManagers().setEnabledDeploymentTypes(
- Arrays.asList(Standard.class, AnotherDeploymentType.class,
- HornedAnimalDeploymentType.class));
- assert configuration().getManagers().getEnabledDeploymentTypes().size() == 3;
- assert configuration().getManagers().getEnabledDeploymentTypes().get(0).equals(Standard.class);
- assert configuration().getManagers().getEnabledDeploymentTypes().get(1).equals(AnotherDeploymentType.class);
- assert configuration().getManagers().getEnabledDeploymentTypes().get(2).equals(HornedAnimalDeploymentType.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test(expectedExceptions=DeploymentException.class) @SpecAssertion(section="2.5.6")
- public void testStandardMustBeDeclared()
- {
- configuration().getManagers().setEnabledDeploymentTypes(
- Arrays.asList(AnotherDeploymentType.class, HornedAnimalDeploymentType.class));
- }
-
- @Test(groups={"stub", "webbeansxml"}, expectedExceptions=DeploymentException.class) @SpecAssertion(section="2.5.6")
- public void testMultipleDeployElementsCannotBeDefined()
- {
-
- }
-
- @Test @SpecAssertion(section={"2.5.5", "2.7.2", "4.1"})
- public void testWebBeanDeploymentTypeOverridesStereotype()
- {
- Bean<Reindeer> bean = createSimpleBean(Reindeer.class);
- assert bean.getDeploymentType().equals(Production.class);
- }
-
- @Test @SpecAssertion(section="4.1")
- public void testDeploymentTypeDeclaredInheritedIsInherited() throws Exception
- {
- assert createSimpleBean(BorderCollie.class).getDeploymentType().equals(AnotherDeploymentType.class);
- }
-
- @Test @SpecAssertion(section="4.1")
- public void testDeploymentTypeNotDeclaredInheritedIsNotInherited()
- {
- assert createSimpleBean(ShetlandPony.class).getDeploymentType().equals(Production.class);
- }
-
- @Test @SpecAssertion(section="4.1")
- public void testDeploymentTypeDeclaredInheritedIsBlockedByIntermediateDeploymentTypeNotMarkedInherited()
- {
- assert createSimpleBean(GoldenRetriever.class).getDeploymentType().equals(Production.class);
- }
-
- @Test @SpecAssertion(section="4.1")
- public void testDeploymentTypeDeclaredInheritedIsBlockedByIntermediateDeploymentTypeMarkedInherited()
- {
- assert createSimpleBean(GoldenLabrador.class).getDeploymentType().equals(InheritedDeploymentType.class);
- }
-
-}
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/name/NameDefinitionTest.java (from rev 1082, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/name/NameTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/name/NameDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/name/NameDefinitionTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -0,0 +1,144 @@
+package org.jboss.webbeans.tck.tests.definition.name;
+
+import java.lang.annotation.Annotation;
+import java.util.List;
+
+import javax.webbeans.DefinitionException;
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.impl.SpecVersion;
+import org.jboss.webbeans.tck.tests.AbstractTest;
+import org.testng.annotations.Test;
+
+@SpecVersion("20081206")
+public class NameDefinitionTest extends AbstractTest
+{
+
+ @Override
+ protected List<Class<? extends Annotation>> getEnabledDeploymentTypes()
+ {
+ List<Class<? extends Annotation>> deploymentTypes = super.getStandardDeploymentTypes();
+ deploymentTypes.add(AnotherDeploymentType.class);
+ return deploymentTypes;
+ }
+
+ @Test(groups="stub", expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.6")
+ public void testInvalidElIdentifierUsedAsWebBeanName()
+ {
+ assert false;
+ }
+
+ @Test @SpecAssertion(section="2.6.1")
+ public void testNonDefaultNamed()
+ {
+ Bean<Moose> moose = createSimpleBean(Moose.class);
+ assert moose.getName().equals("aMoose");
+ }
+
+ @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.6.2")
+ public void testNonDefaultXmlNamed()
+ {
+ /*Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(Named.class, new NamedAnnotationLiteral(){
+
+ public String value()
+ {
+ return "aTrout";
+ }
+
+ });
+ AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);*/
+ //SimpleBean<SeaBass> trout = createSimpleBean(SeaBass.class, annotatedItem, manager);
+
+ //assert trout.getName().equals("aTrout");
+ assert false;
+ }
+
+ @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.6.2")
+ public void testXmlNamedOverridesJavaNamed()
+ {
+ /*Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(Named.class, new NamedAnnotationLiteral(){
+
+ public String value()
+ {
+ return "aTrout";
+ }
+
+ });
+ AnnotatedClass<Cod> annotatedItem = new SimpleAnnotatedClass<Cod>(Cod.class, annotations);*/
+ //SimpleBean<Cod> cod = createSimpleBean(Cod.class, annotatedItem, manager);
+
+ //assert cod.getName().equals("aTrout");
+ assert false;
+ }
+
+ @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section={"2.6.2", "2.6.3"})
+ public void testJavaNamedUsedWhenNoXmlSpecified()
+ {
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //AnnotatedClass<Cod> annotatedItem = new SimpleAnnotatedClass<Cod>(Cod.class, annotations);
+ //SimpleBean<Cod> cod = createSimpleBean(Cod.class, annotatedItem, manager);
+
+ //assert cod.getName().equals("whitefish");
+ assert false;
+ }
+
+ @Test @SpecAssertion(section={"2.6.3", "3.2.7"})
+ public void testDefaultNamed()
+ {
+ Bean<Haddock> haddock = createSimpleBean(Haddock.class);
+ assert haddock.getName() != null;
+ assert haddock.getName().equals("haddock");
+ }
+
+ @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.6.3")
+ public void testDefaultXmlNamed()
+ {
+ /*Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(Named.class, new NamedAnnotationLiteral() {
+
+ public String value()
+ {
+ return "";
+ }
+
+ });
+ AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);*/
+ //SimpleBean<SeaBass> trout = createSimpleBean(SeaBass.class, annotatedItem, manager);
+
+ //assert trout.getName() != null;
+ //assert trout.getName().equals("seaBass");
+ assert false;
+ }
+
+ @Test @SpecAssertion(section={"2.6.3", "2.7"})
+ public void testSterotypeDefaultsName()
+ {
+ Bean<RedSnapper> model = createSimpleBean(RedSnapper.class);
+ assert model.getName().equals("redSnapper");
+ }
+
+ @Test @SpecAssertion(section="2.6.4")
+ public void testNotNamedInJava()
+ {
+ Bean<SeaBass> model = createSimpleBean(SeaBass.class);
+ assert model.getName() == null;
+ }
+
+ @Test @SpecAssertion(section="2.6.4")
+ public void testNotNamedInXml()
+ {
+ Bean<SeaBass> model = createSimpleBean(SeaBass.class);
+ assert model.getName() == null;
+ }
+
+ @Test @SpecAssertion(section="2.6.4")
+ public void testNotNamedInStereotype()
+ {
+ Bean<Minnow> model = createSimpleBean(Minnow.class);
+ assert model.getName() == null;
+ }
+
+}
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/name/NameTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/name/NameTest.java 2009-01-19 17:43:16 UTC (rev 1088)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/name/NameTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,144 +0,0 @@
-package org.jboss.webbeans.tck.tests.definition.name;
-
-import java.lang.annotation.Annotation;
-import java.util.List;
-
-import javax.webbeans.DefinitionException;
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.impl.SpecVersion;
-import org.jboss.webbeans.tck.tests.AbstractTest;
-import org.testng.annotations.Test;
-
-@SpecVersion("20081206")
-public class NameTest extends AbstractTest
-{
-
- @Override
- protected List<Class<? extends Annotation>> getEnabledDeploymentTypes()
- {
- List<Class<? extends Annotation>> deploymentTypes = super.getStandardDeploymentTypes();
- deploymentTypes.add(AnotherDeploymentType.class);
- return deploymentTypes;
- }
-
- @Test(groups="stub", expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.6")
- public void testInvalidElIdentifierUsedAsWebBeanName()
- {
- assert false;
- }
-
- @Test @SpecAssertion(section="2.6.1")
- public void testNonDefaultNamed()
- {
- Bean<Moose> moose = createSimpleBean(Moose.class);
- assert moose.getName().equals("aMoose");
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.6.2")
- public void testNonDefaultXmlNamed()
- {
- /*Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(Named.class, new NamedAnnotationLiteral(){
-
- public String value()
- {
- return "aTrout";
- }
-
- });
- AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);*/
- //SimpleBean<SeaBass> trout = createSimpleBean(SeaBass.class, annotatedItem, manager);
-
- //assert trout.getName().equals("aTrout");
- assert false;
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.6.2")
- public void testXmlNamedOverridesJavaNamed()
- {
- /*Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(Named.class, new NamedAnnotationLiteral(){
-
- public String value()
- {
- return "aTrout";
- }
-
- });
- AnnotatedClass<Cod> annotatedItem = new SimpleAnnotatedClass<Cod>(Cod.class, annotations);*/
- //SimpleBean<Cod> cod = createSimpleBean(Cod.class, annotatedItem, manager);
-
- //assert cod.getName().equals("aTrout");
- assert false;
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section={"2.6.2", "2.6.3"})
- public void testJavaNamedUsedWhenNoXmlSpecified()
- {
- //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- //AnnotatedClass<Cod> annotatedItem = new SimpleAnnotatedClass<Cod>(Cod.class, annotations);
- //SimpleBean<Cod> cod = createSimpleBean(Cod.class, annotatedItem, manager);
-
- //assert cod.getName().equals("whitefish");
- assert false;
- }
-
- @Test @SpecAssertion(section={"2.6.3", "3.2.7"})
- public void testDefaultNamed()
- {
- Bean<Haddock> haddock = createSimpleBean(Haddock.class);
- assert haddock.getName() != null;
- assert haddock.getName().equals("haddock");
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.6.3")
- public void testDefaultXmlNamed()
- {
- /*Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(Named.class, new NamedAnnotationLiteral() {
-
- public String value()
- {
- return "";
- }
-
- });
- AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);*/
- //SimpleBean<SeaBass> trout = createSimpleBean(SeaBass.class, annotatedItem, manager);
-
- //assert trout.getName() != null;
- //assert trout.getName().equals("seaBass");
- assert false;
- }
-
- @Test @SpecAssertion(section={"2.6.3", "2.7"})
- public void testSterotypeDefaultsName()
- {
- Bean<RedSnapper> model = createSimpleBean(RedSnapper.class);
- assert model.getName().equals("redSnapper");
- }
-
- @Test @SpecAssertion(section="2.6.4")
- public void testNotNamedInJava()
- {
- Bean<SeaBass> model = createSimpleBean(SeaBass.class);
- assert model.getName() == null;
- }
-
- @Test @SpecAssertion(section="2.6.4")
- public void testNotNamedInXml()
- {
- Bean<SeaBass> model = createSimpleBean(SeaBass.class);
- assert model.getName() == null;
- }
-
- @Test @SpecAssertion(section="2.6.4")
- public void testNotNamedInStereotype()
- {
- Bean<Minnow> model = createSimpleBean(Minnow.class);
- assert model.getName() == null;
- }
-
-}
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeDefinitionTest.java (from rev 1086, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeDefinitionTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -0,0 +1,165 @@
+package org.jboss.webbeans.tck.tests.definition.scope;
+
+import javax.webbeans.ApplicationScoped;
+import javax.webbeans.DefinitionException;
+import javax.webbeans.Dependent;
+import javax.webbeans.RequestScoped;
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.impl.SpecVersion;
+import org.jboss.webbeans.tck.tests.AbstractTest;
+import org.testng.annotations.Test;
+
+@SpecVersion("20081206")
+public class ScopeDefinitionTest extends AbstractTest
+{
+
+ @Test @SpecAssertion(section="2.4")
+ public void testScopeTypesAreExtensible()
+ {
+ Bean<Mullet> mullet = createSimpleBean(Mullet.class);
+ assert mullet.getScopeType().equals(AnotherScopeType.class);
+ }
+
+ @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.4.2")
+ public void testScopeTypeHasCorrectTarget()
+ {
+ assert false;
+ }
+
+ @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.4.2")
+ public void testScopeTypeHasCorrectRetention()
+ {
+ assert false;
+ }
+
+ @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.4.2")
+ public void testScopeTypeDeclaresScopeTypeAnnotation()
+ {
+ assert false;
+ }
+
+ @Test @SpecAssertion(section="2.4.3")
+ public void testScopeDeclaredInJava()
+ {
+ Bean<SeaBass> trout = createSimpleBean(SeaBass.class);
+ assert trout.getScopeType().equals(RequestScoped.class);
+ }
+
+ @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.4.3")
+ public void testTooManyScopesSpecifiedInJava()
+ {
+ createSimpleBean(BeanWithTooManyScopeTypes.class);
+ }
+
+ @Test(expectedExceptions=DefinitionException.class, groups={"stub", "webbeansxml"})
+ public void testTooManyScopesSpecifiedInXml()
+ {
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //annotations.put(RequestScoped.class, new RequestScopedAnnotationLiteral());
+ //annotations.put(ConversationScoped.class, new ConversationScopedAnnotationLiteral());
+ //AnnotatedClass<Antelope> antelopeAnnotatedItem = new SimpleAnnotatedClass<Antelope>(Antelope.class, annotations);
+ //createSimpleBean(null, antelopeAnnotatedItem, manager);
+ }
+
+ @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.4.4")
+ public void testScopeDeclaredInXml()
+ {
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //annotations.put(RequestScoped.class, new RequestScopedAnnotationLiteral());
+ //AnnotatedClass<Order> annotatedItem = new SimpleAnnotatedClass<Order>(Order.class, annotations);
+
+ //SimpleBean<Order> order = createSimpleBean(Order.class, annotatedItem, manager);
+ //assert order.getScopeType().equals(RequestScoped.class);
+ assert false;
+ }
+
+ @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.4.4")
+ public void testScopeMissingInXml()
+ {
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
+
+ //SimpleBean<SeaBass> trout =createSimpleBean(SeaBass.class, annotatedItem, manager);
+ //assert trout.getScopeType().equals(RequestScoped.class);
+ assert false;
+ }
+
+ @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.4.4")
+ public void testScopeDeclaredInXmlOverridesJava()
+ {
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //annotations.put(ConversationScoped.class, new ConversationScopedAnnotationLiteral());
+ //AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
+ //SimpleBean<SeaBass> trout = createSimpleBean(SeaBass.class, annotatedItem, manager);
+ //assert trout.getScopeType().equals(ConversationScoped.class);
+ assert false;
+ }
+
+ @Test @SpecAssertion(section="2.4.5")
+ public void testDefaultScope()
+ {
+ Bean<Order> order = createSimpleBean(Order.class);
+ assert order.getScopeType().equals(Dependent.class);
+ }
+
+ @Test @SpecAssertion(section={"2.4.5", "2.7.2"})
+ public void testScopeSpecifiedAndStereotyped()
+ {
+ Bean<Minnow> minnow = createSimpleBean(Minnow.class);
+ assert minnow.getScopeType().equals(RequestScoped.class);
+ }
+
+ @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.4.5")
+ public void testMutipleIncompatibleScopeStereotypes()
+ {
+ createSimpleBean(Scallop_Broken.class);
+ }
+
+ @Test @SpecAssertion(section="2.4.5")
+ public void testMutipleIncompatibleScopeStereotypesWithScopeSpecified()
+ {
+ Bean<Pollock> pollock = createSimpleBean(Pollock.class);
+ assert pollock.getScopeType().equals(Dependent.class);
+ }
+
+ @Test @SpecAssertion(section="2.4.5")
+ public void testMutipleCompatibleScopeStereotypes()
+ {
+ Bean<Grayling> grayling = createSimpleBean(Grayling.class);
+ assert grayling.getScopeType().equals(ApplicationScoped.class);
+ }
+
+ @Test @SpecAssertion(section={"2.7.2", "4.1"})
+ public void testWebBeanScopeTypeOverridesStereotype()
+ {
+ Bean<RedSnapper> bean = createSimpleBean(RedSnapper.class);
+ assert bean.getScopeType().equals(RequestScoped.class);
+ }
+
+ @Test @SpecAssertion(section="4.1")
+ public void testScopeTypeDeclaredInheritedIsInherited() throws Exception
+ {
+ assert createSimpleBean(BorderCollie.class).getScopeType().equals(RequestScoped.class);
+ }
+
+ @Test @SpecAssertion(section="4.1")
+ public void testScopeTypeNotDeclaredInheritedIsNotInherited()
+ {
+ assert createSimpleBean(ShetlandPony.class).getScopeType().equals(Dependent.class);
+ }
+
+ @Test @SpecAssertion(section="4.1")
+ public void testScopeTypeDeclaredInheritedIsBlockedByIntermediateScopeTypeMarkedInherited()
+ {
+ assert createSimpleBean(GoldenRetriever.class).getScopeType().equals(ApplicationScoped.class);
+ }
+
+ @Test @SpecAssertion(section="4.1")
+ public void testScopeTypeDeclaredInheritedIsBlockedByIntermediateScopeTypeNotMarkedInherited()
+ {
+ assert createSimpleBean(GoldenLabrador.class).getScopeType().equals(Dependent.class);
+ }
+
+}
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeDefinitionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java 2009-01-19 17:43:16 UTC (rev 1088)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,165 +0,0 @@
-package org.jboss.webbeans.tck.tests.definition.scope;
-
-import javax.webbeans.ApplicationScoped;
-import javax.webbeans.DefinitionException;
-import javax.webbeans.Dependent;
-import javax.webbeans.RequestScoped;
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.impl.SpecVersion;
-import org.jboss.webbeans.tck.tests.AbstractTest;
-import org.testng.annotations.Test;
-
-@SpecVersion("20081206")
-public class ScopeTypeTest extends AbstractTest
-{
-
- @Test @SpecAssertion(section="2.4")
- public void testScopeTypesAreExtensible()
- {
- Bean<Mullet> mullet = createSimpleBean(Mullet.class);
- assert mullet.getScopeType().equals(AnotherScopeType.class);
- }
-
- @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.4.2")
- public void testScopeTypeHasCorrectTarget()
- {
- assert false;
- }
-
- @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.4.2")
- public void testScopeTypeHasCorrectRetention()
- {
- assert false;
- }
-
- @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.4.2")
- public void testScopeTypeDeclaresScopeTypeAnnotation()
- {
- assert false;
- }
-
- @Test @SpecAssertion(section="2.4.3")
- public void testScopeDeclaredInJava()
- {
- Bean<SeaBass> trout = createSimpleBean(SeaBass.class);
- assert trout.getScopeType().equals(RequestScoped.class);
- }
-
- @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.4.3")
- public void testTooManyScopesSpecifiedInJava()
- {
- createSimpleBean(BeanWithTooManyScopeTypes.class);
- }
-
- @Test(expectedExceptions=DefinitionException.class, groups={"stub", "webbeansxml"})
- public void testTooManyScopesSpecifiedInXml()
- {
- //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- //annotations.put(RequestScoped.class, new RequestScopedAnnotationLiteral());
- //annotations.put(ConversationScoped.class, new ConversationScopedAnnotationLiteral());
- //AnnotatedClass<Antelope> antelopeAnnotatedItem = new SimpleAnnotatedClass<Antelope>(Antelope.class, annotations);
- //createSimpleBean(null, antelopeAnnotatedItem, manager);
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.4.4")
- public void testScopeDeclaredInXml()
- {
- //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- //annotations.put(RequestScoped.class, new RequestScopedAnnotationLiteral());
- //AnnotatedClass<Order> annotatedItem = new SimpleAnnotatedClass<Order>(Order.class, annotations);
-
- //SimpleBean<Order> order = createSimpleBean(Order.class, annotatedItem, manager);
- //assert order.getScopeType().equals(RequestScoped.class);
- assert false;
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.4.4")
- public void testScopeMissingInXml()
- {
- //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- //AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
-
- //SimpleBean<SeaBass> trout =createSimpleBean(SeaBass.class, annotatedItem, manager);
- //assert trout.getScopeType().equals(RequestScoped.class);
- assert false;
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.4.4")
- public void testScopeDeclaredInXmlOverridesJava()
- {
- //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- //annotations.put(ConversationScoped.class, new ConversationScopedAnnotationLiteral());
- //AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
- //SimpleBean<SeaBass> trout = createSimpleBean(SeaBass.class, annotatedItem, manager);
- //assert trout.getScopeType().equals(ConversationScoped.class);
- assert false;
- }
-
- @Test @SpecAssertion(section="2.4.5")
- public void testDefaultScope()
- {
- Bean<Order> order = createSimpleBean(Order.class);
- assert order.getScopeType().equals(Dependent.class);
- }
-
- @Test @SpecAssertion(section={"2.4.5", "2.7.2"})
- public void testScopeSpecifiedAndStereotyped()
- {
- Bean<Minnow> minnow = createSimpleBean(Minnow.class);
- assert minnow.getScopeType().equals(RequestScoped.class);
- }
-
- @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.4.5")
- public void testMutipleIncompatibleScopeStereotypes()
- {
- createSimpleBean(Scallop_Broken.class);
- }
-
- @Test @SpecAssertion(section="2.4.5")
- public void testMutipleIncompatibleScopeStereotypesWithScopeSpecified()
- {
- Bean<Pollock> pollock = createSimpleBean(Pollock.class);
- assert pollock.getScopeType().equals(Dependent.class);
- }
-
- @Test @SpecAssertion(section="2.4.5")
- public void testMutipleCompatibleScopeStereotypes()
- {
- Bean<Grayling> grayling = createSimpleBean(Grayling.class);
- assert grayling.getScopeType().equals(ApplicationScoped.class);
- }
-
- @Test @SpecAssertion(section={"2.7.2", "4.1"})
- public void testWebBeanScopeTypeOverridesStereotype()
- {
- Bean<RedSnapper> bean = createSimpleBean(RedSnapper.class);
- assert bean.getScopeType().equals(RequestScoped.class);
- }
-
- @Test @SpecAssertion(section="4.1")
- public void testScopeTypeDeclaredInheritedIsInherited() throws Exception
- {
- assert createSimpleBean(BorderCollie.class).getScopeType().equals(RequestScoped.class);
- }
-
- @Test @SpecAssertion(section="4.1")
- public void testScopeTypeNotDeclaredInheritedIsNotInherited()
- {
- assert createSimpleBean(ShetlandPony.class).getScopeType().equals(Dependent.class);
- }
-
- @Test @SpecAssertion(section="4.1")
- public void testScopeTypeDeclaredInheritedIsBlockedByIntermediateScopeTypeMarkedInherited()
- {
- assert createSimpleBean(GoldenRetriever.class).getScopeType().equals(ApplicationScoped.class);
- }
-
- @Test @SpecAssertion(section="4.1")
- public void testScopeTypeDeclaredInheritedIsBlockedByIntermediateScopeTypeNotMarkedInherited()
- {
- assert createSimpleBean(GoldenLabrador.class).getScopeType().equals(Dependent.class);
- }
-
-}
\ No newline at end of file
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/StereotypeDefinitionTest.java (from rev 1084, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/StereotypesTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/StereotypeDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/StereotypeDefinitionTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -0,0 +1,237 @@
+package org.jboss.webbeans.tck.tests.definition.stereotype;
+
+import java.lang.annotation.Annotation;
+import java.util.List;
+
+import javax.webbeans.ApplicationScoped;
+import javax.webbeans.DefinitionException;
+import javax.webbeans.Dependent;
+import javax.webbeans.Production;
+import javax.webbeans.RequestScoped;
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.impl.SpecVersion;
+import org.jboss.webbeans.tck.tests.AbstractTest;
+import org.testng.annotations.Test;
+
+@SpecVersion("20081206")
+public class StereotypeDefinitionTest extends AbstractTest
+{
+
+ @Override
+ protected List<Class<? extends Annotation>> getEnabledDeploymentTypes()
+ {
+ List<Class<? extends Annotation>> deploymentTypes = super.getStandardDeploymentTypes();
+ deploymentTypes.add(AnotherDeploymentType.class);
+ deploymentTypes.add(HornedAnimalDeploymentType.class);
+ return deploymentTypes;
+ }
+
+ @Test(groups = { "stub", "annotationDefinition" }, expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = "2.7.1")
+ public void testHasCorrectTarget()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "annotationDefinition" }, expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = "2.7.1")
+ public void testHasCorrectRetention()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "annotationDefinition" }, expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = "2.7.1")
+ public void testHasStereotypeAnnotation()
+ {
+ assert false;
+ }
+
+ @Test
+ @SpecAssertion(section = "2.7.1.1")
+ public void testStereotypeWithScopeType()
+ {
+ Bean<Moose> moose = createSimpleBean(Moose.class);
+ assert moose.getScopeType().equals(RequestScoped.class);
+ }
+
+ @Test
+ @SpecAssertion(section = "2.7.1.1")
+ public void testStereotypeWithoutScopeType()
+ {
+ Bean<Reindeer> reindeer = createSimpleBean(Reindeer.class);
+ assert reindeer.getScopeType().equals(Dependent.class);
+ }
+
+ @Test(groups = "stub")
+ @SpecAssertion(section = "2.7.1.2")
+ public void testStereotypeWithoutInterceptors()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "interceptors" })
+ @SpecAssertion(section = "2.7.1.2")
+ public void testStereotypeWithInterceptors()
+ {
+ assert false;
+ }
+
+ @Test(expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = "2.7.1.1")
+ public void testStereotypeWithTooManyScopeTypes()
+ {
+ deployBeans(Elk_Broken.class);
+ }
+
+ @Test(expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = "2.7.1.1")
+ public void testStereotypeWithTooManyDeploymentTypes()
+ {
+ deployBeans(Gazelle_Broken.class);
+ }
+
+ @Test(expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = "2.7.1.3")
+ public void testStereotypeWithNonEmptyNamed()
+ {
+ deployBeans(FallowDeer_Broken.class);
+ }
+
+ @Test(expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = "2.7.1")
+ public void testStereotypeWithBindingTypes()
+ {
+ deployBeans(RoeDeer_Broken.class);
+ }
+
+ @Test
+ @SpecAssertion(section = { "2.7.2", "2.7.4" })
+ public void testMultipleStereotypes()
+ {
+ Bean<HighlandCow> highlandCow = createSimpleBean(HighlandCow.class);
+ assert highlandCow.getName() == null;
+ assert highlandCow.getBindings().iterator().next().annotationType().equals(Tame.class);
+ assert highlandCow.getScopeType().equals(RequestScoped.class);
+ assert highlandCow.getDeploymentType().equals(HornedAnimalDeploymentType.class);
+ }
+
+ @Test
+ @SpecAssertion(section = { "2.7.2", "2.7.4" })
+ public void testMultipleStereotypesMergesScopes()
+ {
+ Bean<Springbok> springbok = createSimpleBean(Springbok.class);
+ assert springbok.getScopeType().equals(ApplicationScoped.class);
+ }
+
+ @Test(expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = { "2.7.2", "2.7.4" })
+ public void testMultipleStereotypesMergesRequiredTypes()
+ {
+ deployBeans(Antelope_Broken.class);
+ }
+
+ @Test(expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = { "2.7.2", "2.7.4" })
+ public void testMultipleStereotypesWithMultipleDeploymentTypes()
+ {
+ deployBeans(Goat_Broken.class);
+ }
+
+ @Test(expectedExceptions = DefinitionException.class, groups = "stub")
+ @SpecAssertion(section = { "2.7.2", "2.7.4" })
+ public void testMultipleStereotypesWithMultipleScopeTypes()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "webbeansxml" })
+ @SpecAssertion(section = "2.7.3")
+ public void testStereotypeDeclaredInXmlIgnoresJavaStereotypes()
+ {
+ // Map<Class<? extends Annotation>, Annotation> cooXmlAnnotations = new
+ // HashMap<Class<? extends Annotation>, Annotation>();
+ // cooXmlAnnotations.put(HornedMammalStereotype.class, new
+ // HornedMamalStereotypeAnnotationLiteral());
+ // AnnotatedClass<HighlandCow> cooXmlAnnotatedItem = new
+ // SimpleAnnotatedClass<HighlandCow>(HighlandCow.class,
+ // cooXmlAnnotations);
+
+ /*
+ * SimpleBean<HighlandCow> coo = createSimpleBean(HighlandCow.class,
+ * cooXmlAnnotatedItem); assert
+ * coo.getDeploymentType().equals(HornedAnimalDeploymentType.class);
+ * assert coo.getScopeType().equals(RequestScoped.class); assert
+ * coo.getMergedStereotypes().getRequiredTypes().size() == 1; assert
+ * coo.getMergedStereotypes().getRequiredTypes().contains(Animal.class);
+ * assert coo.getMergedStereotypes().getSupportedScopes().size() == 0;
+ */
+ assert false;
+ }
+
+ @Test(groups = { "stub", "webbeansxml" })
+ @SpecAssertion(section = "2.7.3")
+ public void testStereotypeDeclaredInXmlIgnoresJavaBindingTypes()
+ {
+ // Map<Class<? extends Annotation>, Annotation> cooXmlAnnotations = new
+ // HashMap<Class<? extends Annotation>, Annotation>();
+ // cooXmlAnnotations.put(HornedMammalStereotype.class, new
+ // HornedMamalStereotypeAnnotationLiteral());
+ // cooXmlAnnotations.put(Synchronous.class, new
+ // SynchronousAnnotationLiteral());
+ // AnnotatedClass<HighlandCow> cooXmlAnnotatedItem = new
+ // SimpleAnnotatedClass<HighlandCow>(HighlandCow.class,
+ // cooXmlAnnotations);
+
+ /*
+ * SimpleBean<HighlandCow> coo = createSimpleBean(HighlandCow.class,
+ * cooXmlAnnotatedItem); assert coo.getBindingTypes().size() == 1; assert
+ * coo.getBindingTypes().contains(new SynchronousAnnotationLiteral());
+ */
+ assert false;
+
+ }
+
+ @Test
+ @SpecAssertion(section = { "2.7.1.4", "2.7.4" })
+ public void testRequiredTypeIsImplemented()
+ {
+ assert createSimpleBean(HighlandCow.class).getTypes().contains(Animal.class);
+ }
+
+ @Test(expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = { "2.7.1.4", "2.7.4" })
+ public void testRequiredTypeIsNotImplemented()
+ {
+ deployBeans(Chair_Broken.class);
+ }
+
+ @Test
+ @SpecAssertion(section = { "2.7.1.4", "2.7.4" })
+ public void testScopeIsSupported()
+ {
+ assert createSimpleBean(Goldfish.class).getScopeType().equals(RequestScoped.class);
+ }
+
+ @Test(expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = { "2.7.1.4", "2.7.4" })
+ public void testScopeIsNotSupported()
+ {
+ createSimpleBean(Carp_Broken.class);
+ }
+
+ @Test @SpecAssertion(section="4.1")
+ public void testStereotypeDeclaredInheritedIsInherited() throws Exception
+ {
+ assert createSimpleBean(BorderCollie.class).getScopeType().equals(RequestScoped.class);
+ }
+
+ @Test @SpecAssertion(section="4.1")
+ public void testStereotypeNotDeclaredInheritedIsNotInherited()
+ {
+ assert createSimpleBean(ShetlandPony.class).getDeploymentType().equals(Production.class);
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/StereotypeDefinitionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/StereotypesTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/StereotypesTest.java 2009-01-19 17:43:16 UTC (rev 1088)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/StereotypesTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,237 +0,0 @@
-package org.jboss.webbeans.tck.tests.definition.stereotype;
-
-import java.lang.annotation.Annotation;
-import java.util.List;
-
-import javax.webbeans.ApplicationScoped;
-import javax.webbeans.DefinitionException;
-import javax.webbeans.Dependent;
-import javax.webbeans.Production;
-import javax.webbeans.RequestScoped;
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.impl.SpecVersion;
-import org.jboss.webbeans.tck.tests.AbstractTest;
-import org.testng.annotations.Test;
-
-@SpecVersion("20081206")
-public class StereotypesTest extends AbstractTest
-{
-
- @Override
- protected List<Class<? extends Annotation>> getEnabledDeploymentTypes()
- {
- List<Class<? extends Annotation>> deploymentTypes = super.getStandardDeploymentTypes();
- deploymentTypes.add(AnotherDeploymentType.class);
- deploymentTypes.add(HornedAnimalDeploymentType.class);
- return deploymentTypes;
- }
-
- @Test(groups = { "stub", "annotationDefinition" }, expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = "2.7.1")
- public void testHasCorrectTarget()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "annotationDefinition" }, expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = "2.7.1")
- public void testHasCorrectRetention()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "annotationDefinition" }, expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = "2.7.1")
- public void testHasStereotypeAnnotation()
- {
- assert false;
- }
-
- @Test
- @SpecAssertion(section = "2.7.1.1")
- public void testStereotypeWithScopeType()
- {
- Bean<Moose> moose = createSimpleBean(Moose.class);
- assert moose.getScopeType().equals(RequestScoped.class);
- }
-
- @Test
- @SpecAssertion(section = "2.7.1.1")
- public void testStereotypeWithoutScopeType()
- {
- Bean<Reindeer> reindeer = createSimpleBean(Reindeer.class);
- assert reindeer.getScopeType().equals(Dependent.class);
- }
-
- @Test(groups = "stub")
- @SpecAssertion(section = "2.7.1.2")
- public void testStereotypeWithoutInterceptors()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "interceptors" })
- @SpecAssertion(section = "2.7.1.2")
- public void testStereotypeWithInterceptors()
- {
- assert false;
- }
-
- @Test(expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = "2.7.1.1")
- public void testStereotypeWithTooManyScopeTypes()
- {
- deployBeans(Elk_Broken.class);
- }
-
- @Test(expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = "2.7.1.1")
- public void testStereotypeWithTooManyDeploymentTypes()
- {
- deployBeans(Gazelle_Broken.class);
- }
-
- @Test(expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = "2.7.1.3")
- public void testStereotypeWithNonEmptyNamed()
- {
- deployBeans(FallowDeer_Broken.class);
- }
-
- @Test(expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = "2.7.1")
- public void testStereotypeWithBindingTypes()
- {
- deployBeans(RoeDeer_Broken.class);
- }
-
- @Test
- @SpecAssertion(section = { "2.7.2", "2.7.4" })
- public void testMultipleStereotypes()
- {
- Bean<HighlandCow> highlandCow = createSimpleBean(HighlandCow.class);
- assert highlandCow.getName() == null;
- assert highlandCow.getBindings().iterator().next().annotationType().equals(Tame.class);
- assert highlandCow.getScopeType().equals(RequestScoped.class);
- assert highlandCow.getDeploymentType().equals(HornedAnimalDeploymentType.class);
- }
-
- @Test
- @SpecAssertion(section = { "2.7.2", "2.7.4" })
- public void testMultipleStereotypesMergesScopes()
- {
- Bean<Springbok> springbok = createSimpleBean(Springbok.class);
- assert springbok.getScopeType().equals(ApplicationScoped.class);
- }
-
- @Test(expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = { "2.7.2", "2.7.4" })
- public void testMultipleStereotypesMergesRequiredTypes()
- {
- deployBeans(Antelope_Broken.class);
- }
-
- @Test(expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = { "2.7.2", "2.7.4" })
- public void testMultipleStereotypesWithMultipleDeploymentTypes()
- {
- deployBeans(Goat_Broken.class);
- }
-
- @Test(expectedExceptions = DefinitionException.class, groups = "stub")
- @SpecAssertion(section = { "2.7.2", "2.7.4" })
- public void testMultipleStereotypesWithMultipleScopeTypes()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "webbeansxml" })
- @SpecAssertion(section = "2.7.3")
- public void testStereotypeDeclaredInXmlIgnoresJavaStereotypes()
- {
- // Map<Class<? extends Annotation>, Annotation> cooXmlAnnotations = new
- // HashMap<Class<? extends Annotation>, Annotation>();
- // cooXmlAnnotations.put(HornedMammalStereotype.class, new
- // HornedMamalStereotypeAnnotationLiteral());
- // AnnotatedClass<HighlandCow> cooXmlAnnotatedItem = new
- // SimpleAnnotatedClass<HighlandCow>(HighlandCow.class,
- // cooXmlAnnotations);
-
- /*
- * SimpleBean<HighlandCow> coo = createSimpleBean(HighlandCow.class,
- * cooXmlAnnotatedItem); assert
- * coo.getDeploymentType().equals(HornedAnimalDeploymentType.class);
- * assert coo.getScopeType().equals(RequestScoped.class); assert
- * coo.getMergedStereotypes().getRequiredTypes().size() == 1; assert
- * coo.getMergedStereotypes().getRequiredTypes().contains(Animal.class);
- * assert coo.getMergedStereotypes().getSupportedScopes().size() == 0;
- */
- assert false;
- }
-
- @Test(groups = { "stub", "webbeansxml" })
- @SpecAssertion(section = "2.7.3")
- public void testStereotypeDeclaredInXmlIgnoresJavaBindingTypes()
- {
- // Map<Class<? extends Annotation>, Annotation> cooXmlAnnotations = new
- // HashMap<Class<? extends Annotation>, Annotation>();
- // cooXmlAnnotations.put(HornedMammalStereotype.class, new
- // HornedMamalStereotypeAnnotationLiteral());
- // cooXmlAnnotations.put(Synchronous.class, new
- // SynchronousAnnotationLiteral());
- // AnnotatedClass<HighlandCow> cooXmlAnnotatedItem = new
- // SimpleAnnotatedClass<HighlandCow>(HighlandCow.class,
- // cooXmlAnnotations);
-
- /*
- * SimpleBean<HighlandCow> coo = createSimpleBean(HighlandCow.class,
- * cooXmlAnnotatedItem); assert coo.getBindingTypes().size() == 1; assert
- * coo.getBindingTypes().contains(new SynchronousAnnotationLiteral());
- */
- assert false;
-
- }
-
- @Test
- @SpecAssertion(section = { "2.7.1.4", "2.7.4" })
- public void testRequiredTypeIsImplemented()
- {
- assert createSimpleBean(HighlandCow.class).getTypes().contains(Animal.class);
- }
-
- @Test(expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = { "2.7.1.4", "2.7.4" })
- public void testRequiredTypeIsNotImplemented()
- {
- deployBeans(Chair_Broken.class);
- }
-
- @Test
- @SpecAssertion(section = { "2.7.1.4", "2.7.4" })
- public void testScopeIsSupported()
- {
- assert createSimpleBean(Goldfish.class).getScopeType().equals(RequestScoped.class);
- }
-
- @Test(expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = { "2.7.1.4", "2.7.4" })
- public void testScopeIsNotSupported()
- {
- createSimpleBean(Carp_Broken.class);
- }
-
- @Test @SpecAssertion(section="4.1")
- public void testStereotypeDeclaredInheritedIsInherited() throws Exception
- {
- assert createSimpleBean(BorderCollie.class).getScopeType().equals(RequestScoped.class);
- }
-
- @Test @SpecAssertion(section="4.1")
- public void testStereotypeNotDeclaredInheritedIsNotInherited()
- {
- assert createSimpleBean(ShetlandPony.class).getDeploymentType().equals(Production.class);
- }
-
-}
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/type/ApiTypeDefinitionTest.java (from rev 1082, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/type/TypeTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/type/ApiTypeDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/type/ApiTypeDefinitionTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -0,0 +1,21 @@
+package org.jboss.webbeans.tck.tests.definition.type;
+
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.tests.AbstractTest;
+import org.testng.annotations.Test;
+
+public class ApiTypeDefinitionTest extends AbstractTest
+{
+
+ @Test @SpecAssertion(section="2.6.3")
+ public void testDefaultNamed()
+ {
+ Bean<Haddock> haddock = createSimpleBean(Haddock.class);
+ assert haddock.getName() != null;
+ assert haddock.getName().equals("haddock");
+ }
+
+}
+
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/type/TypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/type/TypeTest.java 2009-01-19 17:43:16 UTC (rev 1088)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/type/TypeTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,21 +0,0 @@
-package org.jboss.webbeans.tck.tests.definition.type;
-
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.tests.AbstractTest;
-import org.testng.annotations.Test;
-
-public class TypeTest extends AbstractTest
-{
-
- @Test @SpecAssertion(section="2.6.3")
- public void testDefaultNamed()
- {
- Bean<Haddock> haddock = createSimpleBean(Haddock.class);
- assert haddock.getName() != null;
- assert haddock.getName().equals("haddock");
- }
-
-}
-
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/EventBusTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/EventBusTest.java 2009-01-19 17:43:16 UTC (rev 1088)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/EventBusTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,974 +0,0 @@
-package org.jboss.webbeans.tck.tests.event;
-
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.Set;
-
-import javax.webbeans.DefinitionException;
-import javax.webbeans.Dependent;
-import javax.webbeans.DuplicateBindingTypeException;
-import javax.webbeans.Event;
-import javax.webbeans.Observer;
-import javax.webbeans.ObserverException;
-import javax.webbeans.Standard;
-import javax.webbeans.TypeLiteral;
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.impl.SpecVersion;
-import org.jboss.webbeans.tck.tests.AbstractTest;
-import org.testng.annotations.Test;
-
-/**
- * Event bus tests
- *
- * @author Nicklas Karlsson
- * @author David Allen
- *
- */
-@SpecVersion("20081206")
-public class EventBusTest extends AbstractTest
-{
- public static class AnEventType
- {
- }
-
- public static class ATemplatedEventType<T>
- {
- }
-
- public static class AnObserver implements Observer<AnEventType>
- {
- public boolean wasNotified = false;
-
- public void notify(AnEventType event)
- {
- wasNotified = true;
- }
- }
-
- public static class AListObserver implements Observer<ArrayList<String>>
- {
- public boolean wasNotified = false;
-
- public void notify(ArrayList<String> event)
- {
- wasNotified = true;
- }
- }
-
- public static class AnObserverWithException implements Observer<AnEventType>
- {
- public boolean wasNotified = false;
- public RuntimeException theException = new RuntimeException("RE1");
-
- public void notify(AnEventType event)
- {
- wasNotified = true;
- throw theException;
- }
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.1")
- public void testEventTypeIncludesAllSuperclassesAndInterfacesOfEventObject()
- {
- assert false;
- }
-
- @Test(groups = { "events" })
- @SpecAssertion(section = "8.2")
- public void testManagerFireEvent()
- {
- // First a simple event with no bindings is fired
- AnEventType anEvent = new AnEventType();
- manager.fireEvent(anEvent);
-
- // Next an event with some event bindings is fired
- manager.fireEvent(anEvent, new RoleBinding("Admin"));
- }
-
- /**
- * If the type of the event object passed to fireEvent() contains type
- * variables or wildcards, an IllegalArgumentException is thrown
- */
- @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
- @SpecAssertion(section = { "8.1", "8.2" })
- public void testManagerFireEventWithEventTypeParametersFails()
- {
- ATemplatedEventType<String> anEvent = new ATemplatedEventType<String>();
- manager.fireEvent(anEvent);
- }
-
- /**
- * If the type of the event object passed to fireEvent() contains type
- * variables or wildcards, an IllegalArgumentException is thrown
- */
- @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
- @SpecAssertion(section = { "8.1", "8.2" })
- public void testManagerFireEventWithEventTypeWildcardsFails()
- {
- // Although the above test is really the same as with a wildcard, we will
- // test
- // it anyhow since the specification calls it out separately.
- ATemplatedEventType<?> anEventOnAnyType = new ATemplatedEventType<String>();
- manager.fireEvent(anEventOnAnyType);
- }
-
- @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
- @SpecAssertion(section = { "8.1", "8.2" })
- public void testManagerFireEventWithNonBindingAnnotationsFails()
- {
- // The specs are not exactly clear on what is supposed to happen here,
- // but borrowing from Section 8.3, we'll expect the same behavior here
- // for a consistent API.
- // TODO Verify that fireEvent should fail on non-binding annotations
- AnEventType anEvent = new AnEventType();
- manager.fireEvent(anEvent, new AnimalStereotypeAnnotationLiteral());
- }
-
- @Test(groups = { "events" })
- @SpecAssertion(section = "8.3")
- public void testManagerAddObserver()
- {
- Observer<AnEventType> observer = new AnObserver();
-
- // First test with the Class<T> of the event type
- manager.addObserver(observer, AnEventType.class);
- Set<Observer<AnEventType>> resolvedObservers = manager.resolveObservers(new AnEventType());
- assert !resolvedObservers.isEmpty();
- assert resolvedObservers.size() == 1;
- assert resolvedObservers.iterator().next() == observer;
-
- // Now test with the TypeLiteral<T> of the event type
- observer = new AnObserver();
- manager.addObserver(observer, new TypeLiteral<AnEventType>()
- {
- });
- resolvedObservers = manager.resolveObservers(new AnEventType());
- assert !resolvedObservers.isEmpty();
- assert resolvedObservers.size() == 2;
- boolean foundObserver = false;
- for (Observer<AnEventType> obs : resolvedObservers)
- {
- if (obs == observer)
- {
- foundObserver = true;
- break;
- }
- }
- assert foundObserver;
-
- // Try adding an observer with some binding types
- observer = new AnObserver();
- Annotation[] bindingTypes = new Annotation[] { new RoleBinding("Admin"), new RoleBinding("Manager") };
- manager.addObserver(observer, AnEventType.class, bindingTypes);
- resolvedObservers = manager.resolveObservers(new AnEventType(), bindingTypes);
- assert !resolvedObservers.isEmpty();
- assert resolvedObservers.size() == 3;
- foundObserver = false;
- for (Observer<AnEventType> obs : resolvedObservers)
- {
- if (obs == observer)
- {
- foundObserver = true;
- break;
- }
- }
- assert foundObserver;
- }
-
- @Test(groups = { "events" })
- @SpecAssertion(section = "8.3")
- public void testManagerRemoveObserver()
- {
- Observer<AnEventType> observer = new AnObserver();
-
- // First test with the Class<T> of the event type
- manager.addObserver(observer, AnEventType.class);
- manager.removeObserver(observer, AnEventType.class);
- Set<Observer<AnEventType>> resolvedObservers = manager.resolveObservers(new AnEventType());
- assert resolvedObservers.isEmpty();
-
- // Now test with the TypeLiteral<T> of the event type
- observer = new AnObserver();
- manager.addObserver(observer, new TypeLiteral<AnEventType>()
- {
- });
- manager.removeObserver(observer, new TypeLiteral<AnEventType>()
- {
- });
- resolvedObservers = manager.resolveObservers(new AnEventType());
- assert resolvedObservers.isEmpty();
-
- // Also test with binding types
- Annotation[] bindings = new Annotation[] { new RoleBinding("Admin") };
- manager.addObserver(observer, AnEventType.class, bindings);
- manager.removeObserver(observer, AnEventType.class);
- resolvedObservers = manager.resolveObservers(new AnEventType(), bindings);
- assert !resolvedObservers.isEmpty();
- manager.removeObserver(observer, AnEventType.class, new RoleBinding("Admin"));
- resolvedObservers = manager.resolveObservers(new AnEventType(), bindings);
- assert resolvedObservers.isEmpty();
- }
-
- @Test(groups = { "events" }, expectedExceptions = { DuplicateBindingTypeException.class })
- @SpecAssertion(section = "8.3")
- public void testMultipleInstancesOfSameBindingTypeWhenAddingObserverFails()
- {
- Observer<AnEventType> observer = new AnObserver();
- manager.addObserver(observer, AnEventType.class, new RoleBinding("Admin"), new TameAnnotationLiteral(), new TameAnnotationLiteral());
- }
-
- @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
- @SpecAssertion(section = "8.3")
- public void testNonBindingTypePassedToAddObserverFails()
- {
- Observer<AnEventType> observer = new AnObserver();
- manager.addObserver(observer, AnEventType.class, new AnimalStereotypeAnnotationLiteral());
- }
-
- @Test(groups = { "events" }, expectedExceptions = { DuplicateBindingTypeException.class })
- @SpecAssertion(section = "8.3")
- public void testMultipleInstancesOfSameBindingTypeWhenRemovingObserverFails()
- {
- Observer<AnEventType> observer = new AnObserver();
- manager.addObserver(observer, AnEventType.class);
- manager.removeObserver(observer, AnEventType.class, new RoleBinding("Admin"), new TameAnnotationLiteral(), new TameAnnotationLiteral());
- }
-
- @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
- @SpecAssertion(section = "8.3")
- public void testNonBindingTypePassedToRemoveObserverFails()
- {
- Observer<AnEventType> observer = new AnObserver();
- manager.addObserver(observer, AnEventType.class);
- manager.removeObserver(observer, AnEventType.class, new AnimalStereotypeAnnotationLiteral());
- }
-
- @Test(groups = { "events" })
- @SpecAssertion(section = { "8.1", "8.4" })
- public void testConsumerNotifiedWhenEventTypeAndAllBindingsMatch()
- {
- AnObserver observer1 = new AnObserver();
- AnObserver observer2 = new AnObserver();
- manager.addObserver(observer1, AnEventType.class);
- manager.addObserver(observer2, AnEventType.class);
-
- // Fire an event that will be delivered to the two above observers
- AnEventType anEvent = new AnEventType();
- manager.fireEvent(anEvent);
-
- assert observer1.wasNotified;
- assert observer2.wasNotified;
- }
-
- @Test(groups = { "events" })
- @SpecAssertion(section = "8.4")
- public void testObserverThrowsExceptionAbortsNotifications()
- {
- AnObserver observer = new AnObserver();
- AnObserverWithException anotherObserver = new AnObserverWithException();
- manager.addObserver(anotherObserver, AnEventType.class);
- manager.addObserver(observer, AnEventType.class);
-
- // Fire an event that will be delivered to the two above observers
- AnEventType anEvent = new AnEventType();
- boolean fireFailed = false;
- try
- {
- manager.fireEvent(anEvent);
- }
- catch (Exception e)
- {
- if (anotherObserver.theException.equals(e))
- fireFailed = true;
- }
- assert fireFailed;
-
- assert anotherObserver.wasNotified;
- // TODO This cannot properly test for event processing abort
- // assert !observer.wasNotified;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.4")
- public void testObserverCalledBeforeTransactionCompleteMaySetRollbackOnly()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.4")
- public void testObserverManipulatingJTATransactionsDirectlyFails()
- {
- assert false;
- }
-
- @Test(groups = { "events" })
- @SpecAssertion(section = "8.5")
- public void testObserverMethodOnEnterpriseBeanIsBusinessMethodOrStatic()
- {
- deployBeans(Pomeranian.class);
- Set<Bean<Object>> beans = manager.resolveByType(Object.class);
- assert beans.size() >= 2;
- Set<Observer<String>> observers = manager.resolveObservers("An event");
- assert observers.size() == 2;
- }
-
- @Test(groups = { "events" })
- @SpecAssertion(section = "8.5")
- public void testObserverMethodOnEnterpriseBeanNotBusinessMethodOrStaticFails()
- {
- deployBeans(TibetanTerrier.class);
- Set<Bean<Object>> beans = manager.resolveByType(Object.class);
- assert beans.size() >= 2;
- Set<Observer<String>> observers = manager.resolveObservers("An event");
- assert observers.size() == 1;
- }
-
- @Test(groups = { "events" })
- @SpecAssertion(section = "8.5")
- public void testMultipleObserverMethodsOK()
- {
- // Somewhat of a cheat, but this other test already does have 2 observer
- // methods
- // for the same event type and event bindings.
- testObserverMethodOnEnterpriseBeanIsBusinessMethodOrStatic();
- }
-
- @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
- @SpecAssertion(section = { "8.5.1", "8.5.2" })
- public void testObserverMethodMustHaveOnlyOneEventParameter()
- {
- deployBeans(YorkshireTerrier.class);
-
- Set<Bean<Object>> beans = manager.resolveByType(Object.class);
- assert beans != null;
- }
-
- @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
- @SpecAssertion(section = "8.5.1")
- public void testObserverMethodCannotObserveParameterizedEvents()
- {
- deployBeans(BostonTerrier.class);
- Set<Bean<Object>> beans = manager.resolveByType(Object.class);
- assert beans != null;
- }
-
- @Test(groups = { "events" })
- @SpecAssertion(section = "8.5.1")
- public void testObserverMethodWithoutBindingTypesObservesEventsWithoutBindingTypes()
- {
- // This observer has no binding types specified
- deployBeans(Pomeranian.class);
- Set<Bean<Object>> beans = manager.resolveByType(Object.class);
- assert beans.size() >= 2;
-
- // Resolve registered observers with an event containing no binding types
- Set<Observer<String>> resolvedObservers = manager.resolveObservers("A new event");
- assert !resolvedObservers.isEmpty();
- assert resolvedObservers.size() == 2;
- }
-
- @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
- @SpecAssertion(section = "8.5.2")
- public void testObserverMethodAnnotatedProducesFails()
- {
- deployBeans(BorderTerrier.class);
- Set<Bean<Object>> beans = manager.resolveByType(Object.class);
- assert beans != null;
- }
-
- @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
- @SpecAssertion(section = "8.5.2")
- public void testObserverMethodAnnotatedInitializerFails()
- {
- deployBeans(AustralianTerrier.class);
- Set<Bean<Object>> beans = manager.resolveByType(Object.class);
- assert beans != null;
- }
-
- @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
- @SpecAssertion(section = "8.5.2")
- public void testObserverMethodAnnotatedDestructorFails()
- {
- deployBeans(CairnsTerrier.class);
- Set<Bean<Object>> beans = manager.resolveByType(Object.class);
- assert beans != null;
- }
-
- @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
- @SpecAssertion(section = "8.5.2")
- public void testObserverMethodWithDisposesParamFails()
- {
- deployBeans(FoxTerrier.class);
- Set<Bean<Object>> beans = manager.resolveByType(Object.class);
- assert beans != null;
- }
-
- @Test(groups = { "events" })
- @SpecAssertion(section = "8.5.2")
- public void testObserverMethodMayHaveMultipleBindingTypes()
- {
- deployBeans(BullTerrier.class);
- Set<Bean<Object>> beans = manager.resolveByType(Object.class);
- assert beans != null;
- // If we can resolve the observer with the two binding types,
- // then it worked
- Set<Observer<String>> resolvedObservers = manager.resolveObservers("An event object", new RoleBinding("Admin"), new TameAnnotationLiteral());
- assert !resolvedObservers.isEmpty();
- assert resolvedObservers.size() == 1;
-
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.5.3")
- public void testXMLDefinedObserverMethodIgnoresBindingAnnotations()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.5.3")
- public void testXMLDefinedObserverNotFindingImplementationMethodFails()
- {
- assert false;
- }
-
- @Test(groups = { "events" })
- @SpecAssertion(section = "8.5.4")
- public void testObserverMethodReceivesInjectionsOnNonObservesParameters()
- {
- deployBeans(BananaSpider.class);
- Set<Bean<Object>> beans = manager.resolveByType(Object.class);
- assert beans != null;
- }
-
- /**
- * Tests that a conditional observer is not notified of events until after it
- * is created by some other separate action.
- */
- @Test(groups = { "events" })
- @SpecAssertion(section = "8.5.5")
- public void testConditionalObserver()
- {
- deployBeans(RecluseSpider.class);
-
- manager.fireEvent("New string event");
- // Should not be notified since bean is not instantiated yet
- assert !RecluseSpider.isNotified();
-
- // Now instantiate the bean and fire another event
- try
- {
- activateDependentContext();
- RecluseSpider bean = manager.getInstanceByType(RecluseSpider.class);
- assert bean != null;
-
- manager.fireEvent("Another event");
- assert RecluseSpider.isNotified();
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.1")
- public void testTransactionalObserverCanOnlyObserveSinglePhase()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.5.6")
- public void testTransactionalObserverNotifiedImmediatelyWhenNoTransactionInProgress()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.5.6")
- public void testAfterTransactionCompletionObserver()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.5.6")
- public void testAfterTransactionSuccessObserver()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.5.6")
- public void testAfterTransactionFailureObserver()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.5.6")
- public void testBeforeTransactionCompletionObserver()
- {
- assert false;
- }
-
- @Test(groups = { "broken", "events" })
- @SpecAssertion(section = "8.5.7")
- public void testObserverMethodRegistration()
- {
- // For now, this test is checking the registration of methods
- // TODO Check the called test to make sure it is still valid here
- testObserverMethodOnEnterpriseBeanIsBusinessMethodOrStatic();
- }
-
- /**
- *
- */
- @Test(groups = { "broken", "events" })
- @SpecAssertion(section = "8.5.7")
- public void testEnterpriseBeanObserverMethodCalledWithCallerContext()
- {
- deployBeans(Pomeranian.class);
- Set<Bean<Object>> beans = manager.resolveByType(Object.class);
- assert beans.size() >= 1;
- String event = "A new event";
- Set<Observer<String>> observers = manager.resolveObservers(event);
- assert observers.size() == 2;
-
- manager.fireEvent(event);
- assert Thread.currentThread().equals(Pomeranian.notificationThread);
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.5.7")
- public void testTransactionalObserverThrownExceptionIsCaughtAndLogged()
- {
- assert false;
- }
-
- @Test(groups = { "events" }, expectedExceptions = { TeaCupPomeranian.OversizedException.class })
- @SpecAssertion(section = "8.5.7")
- public void testNonTransactionalObserverThrownNonCheckedExceptionIsRethrown()
- {
- deployBeans(TeaCupPomeranian.class);
- Set<Bean<Object>> beans = manager.resolveByType(Object.class);
- assert !beans.isEmpty();
- manager.fireEvent("Another event");
- }
-
- @Test(groups = { "events" }, expectedExceptions = { ObserverException.class })
- @SpecAssertion(section = "8.5.7")
- public void testNonTransactionalObserverThrownCheckedExceptionIsWrappedAndRethrown()
- {
- deployBeans(TeaCupPomeranian.class);
- Set<Bean<Object>> beans = manager.resolveByType(Object.class);
- assert !beans.isEmpty();
- manager.fireEvent(new Integer(1));
- }
-
- @Test(groups = { "events" }, expectedExceptions = { DuplicateBindingTypeException.class })
- @SpecAssertion(section = "8.6")
- public void testDuplicateBindingsToFireFails()
- {
- deployBeans(SweeWaxbill_Broken.class);
- try
- {
- activateDependentContext();
- SweeWaxbill_Broken bean = manager.getInstanceByType(SweeWaxbill_Broken.class);
- bean.methodThatFiresEvent();
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "events" }, expectedExceptions = { DuplicateBindingTypeException.class })
- @SpecAssertion(section = "8.6")
- public void testDuplicateBindingsToObservesFails()
- {
- deployBeans(SweeWaxbill_Broken.class);
- try
- {
- activateDependentContext();
- SweeWaxbill_Broken bean = manager.getInstanceByType(SweeWaxbill_Broken.class);
- bean.methodThatRegistersObserver();
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
- @SpecAssertion(section = "8.6")
- public void testNonBindingTypePassedToFireFails()
- {
- deployBeans(OwlFinch_Broken.class);
- try
- {
- activateDependentContext();
- OwlFinch_Broken bean = manager.getInstanceByType(OwlFinch_Broken.class);
- bean.methodThatFiresEvent();
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
- @SpecAssertion(section = "8.6")
- public void testNonBindingTypePassedToObservesFails()
- {
- deployBeans(OwlFinch_Broken.class);
- try
- {
- activateDependentContext();
- OwlFinch_Broken bean = manager.getInstanceByType(OwlFinch_Broken.class);
- bean.methodThatRegistersObserver();
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "events" })
- @SpecAssertion(section = "8.6")
- public void testFiresAnnotationOnEventTypes()
- {
- deployBeans(BlueFacedParrotFinch.class);
- try
- {
- activateDependentContext();
- BlueFacedParrotFinch bean = manager.getInstanceByType(BlueFacedParrotFinch.class);
- bean.methodThatRegistersObserver();
-
- Set<Observer<String>> observers = manager.resolveObservers("String type event");
- assert observers.size() == 1;
- }
- finally
- {
- deactivateDependentContext();
- }
- deployBeans(StarFinch.class, FinchKeeper.class, BirdCage.class);
- try
- {
- activateDependentContext();
- StarFinch starFinch = manager.getInstanceByType(StarFinch.class);
- FinchKeeper birdKeeper = manager.getInstanceByType(FinchKeeper.class);
- BirdCage birdCage = manager.getInstanceByType(BirdCage.class);
- assert starFinch != null;
- assert birdCage != null;
- assert birdCage.getSomeMess() != null;
- assert birdKeeper.isNewMessDetected();
- }
- finally
- {
- deactivateDependentContext();
- }
- deployBeans(OrangeCheekedWaxbill.class, FinchKeeper.class);
- try
- {
- activateDependentContext();
- OrangeCheekedWaxbill bird = manager.getInstanceByType(OrangeCheekedWaxbill.class);
- FinchKeeper birdKeeper = manager.getInstanceByType(FinchKeeper.class);
- assert bird != null;
- assert bird.getSomeMess() != null;
- assert birdKeeper.isNewMessDetected();
- }
- finally
- {
- deactivateDependentContext();
- }
- deployBeans(AuroraFinch.class, FinchKeeper.class);
- try
- {
- activateDependentContext();
- AuroraFinch bird = manager.getInstanceByType(AuroraFinch.class);
- FinchKeeper birdKeeper = manager.getInstanceByType(FinchKeeper.class);
- assert bird != null;
- assert birdKeeper.isNewMessDetected();
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
- @SpecAssertion(section = "8.6")
- public void testFiresAnnotationOnNonEventTypeInjectionPointFails()
- {
- deployBeans(CommonWaxbill_Broken.class);
- try
- {
- activateDependentContext();
- CommonWaxbill_Broken bean = manager.getInstanceByType(CommonWaxbill_Broken.class);
- assert bean != null;
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
- @SpecAssertion(section = "8.6")
- public void testFiresAnnotationOnInjectionPointWithoutTypeParameterFails()
- {
- deployBeans(BlackRumpedWaxbill_Broken.class);
- try
- {
- activateDependentContext();
- BlackRumpedWaxbill_Broken bean = manager.getInstanceByType(BlackRumpedWaxbill_Broken.class);
- assert bean != null;
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
- @SpecAssertion(section = "8.6")
- public void testFiresAnnotationOnInjectionPointWithWildcardedTypeParameterFails()
- {
- deployBeans(GoldbreastWaxbill_Broken.class);
- try
- {
- activateDependentContext();
- GoldbreastWaxbill_Broken bean = manager.getInstanceByType(GoldbreastWaxbill_Broken.class);
- assert bean != null;
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
- @SpecAssertion(section = "8.6")
- public void testFiresAnnotationOnInjectionPointWithTypeVariabledTypeParameterFails()
- {
- deployBeans(JavaSparrow_Broken.class);
- try
- {
- activateDependentContext();
- JavaSparrow_Broken bean = manager.getInstanceByType(JavaSparrow_Broken.class);
- assert bean != null;
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "events" })
- @SpecAssertion(section = "8.6")
- public void testImplicitEventBeanMatchesAPITypeOfInectionPoint()
- {
- deployBeans(BlueFacedParrotFinch.class);
- try
- {
- activateDependentContext();
- BlueFacedParrotFinch bean = manager.getInstanceByType(BlueFacedParrotFinch.class);
- assert bean != null;
- // Retrieve the implicit event bean from the manager only by its API
- // type
- Set<?> eventBeans = manager.resolveByType(Event.class, new FiresBinding());
- assert !eventBeans.isEmpty();
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "events" })
- @SpecAssertion(section = "8.6")
- public void testImplicitEventBeanMatchesBindingAnnotationsOfInjectionPoint()
- {
- deployBeans(OrangeCheekedWaxbill.class);
- try
- {
- activateDependentContext();
- OrangeCheekedWaxbill bean = manager.getInstanceByType(OrangeCheekedWaxbill.class);
- assert bean != null;
- // Retrieve the implicit event bean from the manager by its binding
- // types
- Set<?> eventBeans = manager.resolveByType(Event.class, new FiresBinding(), new TameAnnotationLiteral());
- assert !eventBeans.isEmpty();
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "events" })
- @SpecAssertion(section = "8.6")
- public void testImplicitEventBeanHasStandardDeploymentType()
- {
- deployBeans(BlueFacedParrotFinch.class);
- try
- {
- activateDependentContext();
- BlueFacedParrotFinch bean = manager.getInstanceByType(BlueFacedParrotFinch.class);
- assert bean != null;
- // Retrieve the implicit event bean from the manager only by its API
- // type
- Set<?> eventBeans = manager.resolveByType(Event.class, new FiresBinding());
- assert eventBeans.size() == 1;
- Bean<?> eventBean = (Bean<?>) eventBeans.iterator().next();
- assert eventBean.getDeploymentType().equals(Standard.class);
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "events" })
- @SpecAssertion(section = "8.6")
- public void testImplicitEventBeanHasDependentScope()
- {
- deployBeans(BlueFacedParrotFinch.class);
- try
- {
- activateDependentContext();
- BlueFacedParrotFinch bean = manager.getInstanceByType(BlueFacedParrotFinch.class);
- assert bean != null;
- // Retrieve the implicit event bean from the manager only by its API
- // type
- Set<?> eventBeans = manager.resolveByType(Event.class, new FiresBinding());
- assert eventBeans.size() == 1;
- Bean<?> eventBean = (Bean<?>) eventBeans.iterator().next();
- assert eventBean.getScopeType().equals(Dependent.class);
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.6")
- public void testFireMethodCallsManagerFireWithEventObject()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.6")
- public void testFireMethodCallsManagerFireWithBindingAnnotationsExceptObservable()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.6")
- public void testFireMethodCallsManagerFireWithAllBindingAnnotationInstances()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.6")
- public void testObserveMethodCallsManagerAddObserverWithObserverObject()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.6")
- public void testObserveMethodCallsManagerAddObserverWithAllBindingAnnotationsExceptObservable()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.6")
- public void testObserveMethodCallsManagerAddObserverWithAllBindingAnnotationInstance()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.7")
- public void testEventObjectContainsTypeVariablesWhenResolvingFails()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.7")
- public void testEventObjectContainsWildcardsWhenResolvingFails()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.7")
- public void testDuplicateBindingTypesWhenResolvingFails()
- {
- assert false;
- }
-
- @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
- @SpecAssertion(section = "8.7")
- public void testNonBindingTypeAnnotationWhenResolvingFails()
- {
- AnObserver observer = new AnObserver();
- manager.addObserver(observer, new TypeLiteral<AnEventType>()
- {
- });
- Set<Observer<AnEventType>> resolvedObservers = manager.resolveObservers(new AnEventType(), new AnimalStereotypeAnnotationLiteral());
- assert !resolvedObservers.isEmpty();
- }
-
- @Test(groups = { "events" })
- @SpecAssertion(section = "8.7")
- public void testResolvingChecksEventType()
- {
- Observer<AnEventType> observer = new AnObserver();
- manager.addObserver(observer, AnEventType.class);
- Set<Observer<AnEventType>> resolvedObservers = manager.resolveObservers(new AnEventType());
- assert !resolvedObservers.isEmpty();
- Set<?> emptyObserverSet = manager.resolveObservers("A string event");
- assert emptyObserverSet.isEmpty();
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.7")
- public void testResolvingChecksTypeParameters()
- {
- AListObserver observer = new AListObserver();
- manager.addObserver(observer, new TypeLiteral<ArrayList<String>>()
- {
- });
- Set<Observer<ArrayList<String>>> resolvedObservers = manager.resolveObservers(new ArrayList<String>(), new AnimalStereotypeAnnotationLiteral());
- assert !resolvedObservers.isEmpty();
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.7")
- public void testResolvingChecksBindingTypes()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.7")
- public void testResolvingChecksBindingTypeMembers()
- {
- assert false;
- }
-
-}
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/EventTest.java (from rev 1082, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/EventBusTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/EventTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/EventTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -0,0 +1,974 @@
+package org.jboss.webbeans.tck.tests.event;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Set;
+
+import javax.webbeans.DefinitionException;
+import javax.webbeans.Dependent;
+import javax.webbeans.DuplicateBindingTypeException;
+import javax.webbeans.Event;
+import javax.webbeans.Observer;
+import javax.webbeans.ObserverException;
+import javax.webbeans.Standard;
+import javax.webbeans.TypeLiteral;
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.impl.SpecVersion;
+import org.jboss.webbeans.tck.tests.AbstractTest;
+import org.testng.annotations.Test;
+
+/**
+ * Event bus tests
+ *
+ * @author Nicklas Karlsson
+ * @author David Allen
+ *
+ */
+@SpecVersion("20081206")
+public class EventTest extends AbstractTest
+{
+ public static class AnEventType
+ {
+ }
+
+ public static class ATemplatedEventType<T>
+ {
+ }
+
+ public static class AnObserver implements Observer<AnEventType>
+ {
+ public boolean wasNotified = false;
+
+ public void notify(AnEventType event)
+ {
+ wasNotified = true;
+ }
+ }
+
+ public static class AListObserver implements Observer<ArrayList<String>>
+ {
+ public boolean wasNotified = false;
+
+ public void notify(ArrayList<String> event)
+ {
+ wasNotified = true;
+ }
+ }
+
+ public static class AnObserverWithException implements Observer<AnEventType>
+ {
+ public boolean wasNotified = false;
+ public RuntimeException theException = new RuntimeException("RE1");
+
+ public void notify(AnEventType event)
+ {
+ wasNotified = true;
+ throw theException;
+ }
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.1")
+ public void testEventTypeIncludesAllSuperclassesAndInterfacesOfEventObject()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "8.2")
+ public void testManagerFireEvent()
+ {
+ // First a simple event with no bindings is fired
+ AnEventType anEvent = new AnEventType();
+ manager.fireEvent(anEvent);
+
+ // Next an event with some event bindings is fired
+ manager.fireEvent(anEvent, new RoleBinding("Admin"));
+ }
+
+ /**
+ * If the type of the event object passed to fireEvent() contains type
+ * variables or wildcards, an IllegalArgumentException is thrown
+ */
+ @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
+ @SpecAssertion(section = { "8.1", "8.2" })
+ public void testManagerFireEventWithEventTypeParametersFails()
+ {
+ ATemplatedEventType<String> anEvent = new ATemplatedEventType<String>();
+ manager.fireEvent(anEvent);
+ }
+
+ /**
+ * If the type of the event object passed to fireEvent() contains type
+ * variables or wildcards, an IllegalArgumentException is thrown
+ */
+ @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
+ @SpecAssertion(section = { "8.1", "8.2" })
+ public void testManagerFireEventWithEventTypeWildcardsFails()
+ {
+ // Although the above test is really the same as with a wildcard, we will
+ // test
+ // it anyhow since the specification calls it out separately.
+ ATemplatedEventType<?> anEventOnAnyType = new ATemplatedEventType<String>();
+ manager.fireEvent(anEventOnAnyType);
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
+ @SpecAssertion(section = { "8.1", "8.2" })
+ public void testManagerFireEventWithNonBindingAnnotationsFails()
+ {
+ // The specs are not exactly clear on what is supposed to happen here,
+ // but borrowing from Section 8.3, we'll expect the same behavior here
+ // for a consistent API.
+ // TODO Verify that fireEvent should fail on non-binding annotations
+ AnEventType anEvent = new AnEventType();
+ manager.fireEvent(anEvent, new AnimalStereotypeAnnotationLiteral());
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "8.3")
+ public void testManagerAddObserver()
+ {
+ Observer<AnEventType> observer = new AnObserver();
+
+ // First test with the Class<T> of the event type
+ manager.addObserver(observer, AnEventType.class);
+ Set<Observer<AnEventType>> resolvedObservers = manager.resolveObservers(new AnEventType());
+ assert !resolvedObservers.isEmpty();
+ assert resolvedObservers.size() == 1;
+ assert resolvedObservers.iterator().next() == observer;
+
+ // Now test with the TypeLiteral<T> of the event type
+ observer = new AnObserver();
+ manager.addObserver(observer, new TypeLiteral<AnEventType>()
+ {
+ });
+ resolvedObservers = manager.resolveObservers(new AnEventType());
+ assert !resolvedObservers.isEmpty();
+ assert resolvedObservers.size() == 2;
+ boolean foundObserver = false;
+ for (Observer<AnEventType> obs : resolvedObservers)
+ {
+ if (obs == observer)
+ {
+ foundObserver = true;
+ break;
+ }
+ }
+ assert foundObserver;
+
+ // Try adding an observer with some binding types
+ observer = new AnObserver();
+ Annotation[] bindingTypes = new Annotation[] { new RoleBinding("Admin"), new RoleBinding("Manager") };
+ manager.addObserver(observer, AnEventType.class, bindingTypes);
+ resolvedObservers = manager.resolveObservers(new AnEventType(), bindingTypes);
+ assert !resolvedObservers.isEmpty();
+ assert resolvedObservers.size() == 3;
+ foundObserver = false;
+ for (Observer<AnEventType> obs : resolvedObservers)
+ {
+ if (obs == observer)
+ {
+ foundObserver = true;
+ break;
+ }
+ }
+ assert foundObserver;
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "8.3")
+ public void testManagerRemoveObserver()
+ {
+ Observer<AnEventType> observer = new AnObserver();
+
+ // First test with the Class<T> of the event type
+ manager.addObserver(observer, AnEventType.class);
+ manager.removeObserver(observer, AnEventType.class);
+ Set<Observer<AnEventType>> resolvedObservers = manager.resolveObservers(new AnEventType());
+ assert resolvedObservers.isEmpty();
+
+ // Now test with the TypeLiteral<T> of the event type
+ observer = new AnObserver();
+ manager.addObserver(observer, new TypeLiteral<AnEventType>()
+ {
+ });
+ manager.removeObserver(observer, new TypeLiteral<AnEventType>()
+ {
+ });
+ resolvedObservers = manager.resolveObservers(new AnEventType());
+ assert resolvedObservers.isEmpty();
+
+ // Also test with binding types
+ Annotation[] bindings = new Annotation[] { new RoleBinding("Admin") };
+ manager.addObserver(observer, AnEventType.class, bindings);
+ manager.removeObserver(observer, AnEventType.class);
+ resolvedObservers = manager.resolveObservers(new AnEventType(), bindings);
+ assert !resolvedObservers.isEmpty();
+ manager.removeObserver(observer, AnEventType.class, new RoleBinding("Admin"));
+ resolvedObservers = manager.resolveObservers(new AnEventType(), bindings);
+ assert resolvedObservers.isEmpty();
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { DuplicateBindingTypeException.class })
+ @SpecAssertion(section = "8.3")
+ public void testMultipleInstancesOfSameBindingTypeWhenAddingObserverFails()
+ {
+ Observer<AnEventType> observer = new AnObserver();
+ manager.addObserver(observer, AnEventType.class, new RoleBinding("Admin"), new TameAnnotationLiteral(), new TameAnnotationLiteral());
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
+ @SpecAssertion(section = "8.3")
+ public void testNonBindingTypePassedToAddObserverFails()
+ {
+ Observer<AnEventType> observer = new AnObserver();
+ manager.addObserver(observer, AnEventType.class, new AnimalStereotypeAnnotationLiteral());
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { DuplicateBindingTypeException.class })
+ @SpecAssertion(section = "8.3")
+ public void testMultipleInstancesOfSameBindingTypeWhenRemovingObserverFails()
+ {
+ Observer<AnEventType> observer = new AnObserver();
+ manager.addObserver(observer, AnEventType.class);
+ manager.removeObserver(observer, AnEventType.class, new RoleBinding("Admin"), new TameAnnotationLiteral(), new TameAnnotationLiteral());
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
+ @SpecAssertion(section = "8.3")
+ public void testNonBindingTypePassedToRemoveObserverFails()
+ {
+ Observer<AnEventType> observer = new AnObserver();
+ manager.addObserver(observer, AnEventType.class);
+ manager.removeObserver(observer, AnEventType.class, new AnimalStereotypeAnnotationLiteral());
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = { "8.1", "8.4" })
+ public void testConsumerNotifiedWhenEventTypeAndAllBindingsMatch()
+ {
+ AnObserver observer1 = new AnObserver();
+ AnObserver observer2 = new AnObserver();
+ manager.addObserver(observer1, AnEventType.class);
+ manager.addObserver(observer2, AnEventType.class);
+
+ // Fire an event that will be delivered to the two above observers
+ AnEventType anEvent = new AnEventType();
+ manager.fireEvent(anEvent);
+
+ assert observer1.wasNotified;
+ assert observer2.wasNotified;
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "8.4")
+ public void testObserverThrowsExceptionAbortsNotifications()
+ {
+ AnObserver observer = new AnObserver();
+ AnObserverWithException anotherObserver = new AnObserverWithException();
+ manager.addObserver(anotherObserver, AnEventType.class);
+ manager.addObserver(observer, AnEventType.class);
+
+ // Fire an event that will be delivered to the two above observers
+ AnEventType anEvent = new AnEventType();
+ boolean fireFailed = false;
+ try
+ {
+ manager.fireEvent(anEvent);
+ }
+ catch (Exception e)
+ {
+ if (anotherObserver.theException.equals(e))
+ fireFailed = true;
+ }
+ assert fireFailed;
+
+ assert anotherObserver.wasNotified;
+ // TODO This cannot properly test for event processing abort
+ // assert !observer.wasNotified;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.4")
+ public void testObserverCalledBeforeTransactionCompleteMaySetRollbackOnly()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.4")
+ public void testObserverManipulatingJTATransactionsDirectlyFails()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "8.5")
+ public void testObserverMethodOnEnterpriseBeanIsBusinessMethodOrStatic()
+ {
+ deployBeans(Pomeranian.class);
+ Set<Bean<Object>> beans = manager.resolveByType(Object.class);
+ assert beans.size() >= 2;
+ Set<Observer<String>> observers = manager.resolveObservers("An event");
+ assert observers.size() == 2;
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "8.5")
+ public void testObserverMethodOnEnterpriseBeanNotBusinessMethodOrStaticFails()
+ {
+ deployBeans(TibetanTerrier.class);
+ Set<Bean<Object>> beans = manager.resolveByType(Object.class);
+ assert beans.size() >= 2;
+ Set<Observer<String>> observers = manager.resolveObservers("An event");
+ assert observers.size() == 1;
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "8.5")
+ public void testMultipleObserverMethodsOK()
+ {
+ // Somewhat of a cheat, but this other test already does have 2 observer
+ // methods
+ // for the same event type and event bindings.
+ testObserverMethodOnEnterpriseBeanIsBusinessMethodOrStatic();
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
+ @SpecAssertion(section = { "8.5.1", "8.5.2" })
+ public void testObserverMethodMustHaveOnlyOneEventParameter()
+ {
+ deployBeans(YorkshireTerrier.class);
+
+ Set<Bean<Object>> beans = manager.resolveByType(Object.class);
+ assert beans != null;
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
+ @SpecAssertion(section = "8.5.1")
+ public void testObserverMethodCannotObserveParameterizedEvents()
+ {
+ deployBeans(BostonTerrier.class);
+ Set<Bean<Object>> beans = manager.resolveByType(Object.class);
+ assert beans != null;
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "8.5.1")
+ public void testObserverMethodWithoutBindingTypesObservesEventsWithoutBindingTypes()
+ {
+ // This observer has no binding types specified
+ deployBeans(Pomeranian.class);
+ Set<Bean<Object>> beans = manager.resolveByType(Object.class);
+ assert beans.size() >= 2;
+
+ // Resolve registered observers with an event containing no binding types
+ Set<Observer<String>> resolvedObservers = manager.resolveObservers("A new event");
+ assert !resolvedObservers.isEmpty();
+ assert resolvedObservers.size() == 2;
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
+ @SpecAssertion(section = "8.5.2")
+ public void testObserverMethodAnnotatedProducesFails()
+ {
+ deployBeans(BorderTerrier.class);
+ Set<Bean<Object>> beans = manager.resolveByType(Object.class);
+ assert beans != null;
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
+ @SpecAssertion(section = "8.5.2")
+ public void testObserverMethodAnnotatedInitializerFails()
+ {
+ deployBeans(AustralianTerrier.class);
+ Set<Bean<Object>> beans = manager.resolveByType(Object.class);
+ assert beans != null;
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
+ @SpecAssertion(section = "8.5.2")
+ public void testObserverMethodAnnotatedDestructorFails()
+ {
+ deployBeans(CairnsTerrier.class);
+ Set<Bean<Object>> beans = manager.resolveByType(Object.class);
+ assert beans != null;
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
+ @SpecAssertion(section = "8.5.2")
+ public void testObserverMethodWithDisposesParamFails()
+ {
+ deployBeans(FoxTerrier.class);
+ Set<Bean<Object>> beans = manager.resolveByType(Object.class);
+ assert beans != null;
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "8.5.2")
+ public void testObserverMethodMayHaveMultipleBindingTypes()
+ {
+ deployBeans(BullTerrier.class);
+ Set<Bean<Object>> beans = manager.resolveByType(Object.class);
+ assert beans != null;
+ // If we can resolve the observer with the two binding types,
+ // then it worked
+ Set<Observer<String>> resolvedObservers = manager.resolveObservers("An event object", new RoleBinding("Admin"), new TameAnnotationLiteral());
+ assert !resolvedObservers.isEmpty();
+ assert resolvedObservers.size() == 1;
+
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.5.3")
+ public void testXMLDefinedObserverMethodIgnoresBindingAnnotations()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.5.3")
+ public void testXMLDefinedObserverNotFindingImplementationMethodFails()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "8.5.4")
+ public void testObserverMethodReceivesInjectionsOnNonObservesParameters()
+ {
+ deployBeans(BananaSpider.class);
+ Set<Bean<Object>> beans = manager.resolveByType(Object.class);
+ assert beans != null;
+ }
+
+ /**
+ * Tests that a conditional observer is not notified of events until after it
+ * is created by some other separate action.
+ */
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "8.5.5")
+ public void testConditionalObserver()
+ {
+ deployBeans(RecluseSpider.class);
+
+ manager.fireEvent("New string event");
+ // Should not be notified since bean is not instantiated yet
+ assert !RecluseSpider.isNotified();
+
+ // Now instantiate the bean and fire another event
+ try
+ {
+ activateDependentContext();
+ RecluseSpider bean = manager.getInstanceByType(RecluseSpider.class);
+ assert bean != null;
+
+ manager.fireEvent("Another event");
+ assert RecluseSpider.isNotified();
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.1")
+ public void testTransactionalObserverCanOnlyObserveSinglePhase()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.5.6")
+ public void testTransactionalObserverNotifiedImmediatelyWhenNoTransactionInProgress()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.5.6")
+ public void testAfterTransactionCompletionObserver()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.5.6")
+ public void testAfterTransactionSuccessObserver()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.5.6")
+ public void testAfterTransactionFailureObserver()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.5.6")
+ public void testBeforeTransactionCompletionObserver()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "broken", "events" })
+ @SpecAssertion(section = "8.5.7")
+ public void testObserverMethodRegistration()
+ {
+ // For now, this test is checking the registration of methods
+ // TODO Check the called test to make sure it is still valid here
+ testObserverMethodOnEnterpriseBeanIsBusinessMethodOrStatic();
+ }
+
+ /**
+ *
+ */
+ @Test(groups = { "broken", "events" })
+ @SpecAssertion(section = "8.5.7")
+ public void testEnterpriseBeanObserverMethodCalledWithCallerContext()
+ {
+ deployBeans(Pomeranian.class);
+ Set<Bean<Object>> beans = manager.resolveByType(Object.class);
+ assert beans.size() >= 1;
+ String event = "A new event";
+ Set<Observer<String>> observers = manager.resolveObservers(event);
+ assert observers.size() == 2;
+
+ manager.fireEvent(event);
+ assert Thread.currentThread().equals(Pomeranian.notificationThread);
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.5.7")
+ public void testTransactionalObserverThrownExceptionIsCaughtAndLogged()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { TeaCupPomeranian.OversizedException.class })
+ @SpecAssertion(section = "8.5.7")
+ public void testNonTransactionalObserverThrownNonCheckedExceptionIsRethrown()
+ {
+ deployBeans(TeaCupPomeranian.class);
+ Set<Bean<Object>> beans = manager.resolveByType(Object.class);
+ assert !beans.isEmpty();
+ manager.fireEvent("Another event");
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { ObserverException.class })
+ @SpecAssertion(section = "8.5.7")
+ public void testNonTransactionalObserverThrownCheckedExceptionIsWrappedAndRethrown()
+ {
+ deployBeans(TeaCupPomeranian.class);
+ Set<Bean<Object>> beans = manager.resolveByType(Object.class);
+ assert !beans.isEmpty();
+ manager.fireEvent(new Integer(1));
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { DuplicateBindingTypeException.class })
+ @SpecAssertion(section = "8.6")
+ public void testDuplicateBindingsToFireFails()
+ {
+ deployBeans(SweeWaxbill_Broken.class);
+ try
+ {
+ activateDependentContext();
+ SweeWaxbill_Broken bean = manager.getInstanceByType(SweeWaxbill_Broken.class);
+ bean.methodThatFiresEvent();
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { DuplicateBindingTypeException.class })
+ @SpecAssertion(section = "8.6")
+ public void testDuplicateBindingsToObservesFails()
+ {
+ deployBeans(SweeWaxbill_Broken.class);
+ try
+ {
+ activateDependentContext();
+ SweeWaxbill_Broken bean = manager.getInstanceByType(SweeWaxbill_Broken.class);
+ bean.methodThatRegistersObserver();
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
+ @SpecAssertion(section = "8.6")
+ public void testNonBindingTypePassedToFireFails()
+ {
+ deployBeans(OwlFinch_Broken.class);
+ try
+ {
+ activateDependentContext();
+ OwlFinch_Broken bean = manager.getInstanceByType(OwlFinch_Broken.class);
+ bean.methodThatFiresEvent();
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
+ @SpecAssertion(section = "8.6")
+ public void testNonBindingTypePassedToObservesFails()
+ {
+ deployBeans(OwlFinch_Broken.class);
+ try
+ {
+ activateDependentContext();
+ OwlFinch_Broken bean = manager.getInstanceByType(OwlFinch_Broken.class);
+ bean.methodThatRegistersObserver();
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "8.6")
+ public void testFiresAnnotationOnEventTypes()
+ {
+ deployBeans(BlueFacedParrotFinch.class);
+ try
+ {
+ activateDependentContext();
+ BlueFacedParrotFinch bean = manager.getInstanceByType(BlueFacedParrotFinch.class);
+ bean.methodThatRegistersObserver();
+
+ Set<Observer<String>> observers = manager.resolveObservers("String type event");
+ assert observers.size() == 1;
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ deployBeans(StarFinch.class, FinchKeeper.class, BirdCage.class);
+ try
+ {
+ activateDependentContext();
+ StarFinch starFinch = manager.getInstanceByType(StarFinch.class);
+ FinchKeeper birdKeeper = manager.getInstanceByType(FinchKeeper.class);
+ BirdCage birdCage = manager.getInstanceByType(BirdCage.class);
+ assert starFinch != null;
+ assert birdCage != null;
+ assert birdCage.getSomeMess() != null;
+ assert birdKeeper.isNewMessDetected();
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ deployBeans(OrangeCheekedWaxbill.class, FinchKeeper.class);
+ try
+ {
+ activateDependentContext();
+ OrangeCheekedWaxbill bird = manager.getInstanceByType(OrangeCheekedWaxbill.class);
+ FinchKeeper birdKeeper = manager.getInstanceByType(FinchKeeper.class);
+ assert bird != null;
+ assert bird.getSomeMess() != null;
+ assert birdKeeper.isNewMessDetected();
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ deployBeans(AuroraFinch.class, FinchKeeper.class);
+ try
+ {
+ activateDependentContext();
+ AuroraFinch bird = manager.getInstanceByType(AuroraFinch.class);
+ FinchKeeper birdKeeper = manager.getInstanceByType(FinchKeeper.class);
+ assert bird != null;
+ assert birdKeeper.isNewMessDetected();
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
+ @SpecAssertion(section = "8.6")
+ public void testFiresAnnotationOnNonEventTypeInjectionPointFails()
+ {
+ deployBeans(CommonWaxbill_Broken.class);
+ try
+ {
+ activateDependentContext();
+ CommonWaxbill_Broken bean = manager.getInstanceByType(CommonWaxbill_Broken.class);
+ assert bean != null;
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
+ @SpecAssertion(section = "8.6")
+ public void testFiresAnnotationOnInjectionPointWithoutTypeParameterFails()
+ {
+ deployBeans(BlackRumpedWaxbill_Broken.class);
+ try
+ {
+ activateDependentContext();
+ BlackRumpedWaxbill_Broken bean = manager.getInstanceByType(BlackRumpedWaxbill_Broken.class);
+ assert bean != null;
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
+ @SpecAssertion(section = "8.6")
+ public void testFiresAnnotationOnInjectionPointWithWildcardedTypeParameterFails()
+ {
+ deployBeans(GoldbreastWaxbill_Broken.class);
+ try
+ {
+ activateDependentContext();
+ GoldbreastWaxbill_Broken bean = manager.getInstanceByType(GoldbreastWaxbill_Broken.class);
+ assert bean != null;
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
+ @SpecAssertion(section = "8.6")
+ public void testFiresAnnotationOnInjectionPointWithTypeVariabledTypeParameterFails()
+ {
+ deployBeans(JavaSparrow_Broken.class);
+ try
+ {
+ activateDependentContext();
+ JavaSparrow_Broken bean = manager.getInstanceByType(JavaSparrow_Broken.class);
+ assert bean != null;
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "8.6")
+ public void testImplicitEventBeanMatchesAPITypeOfInectionPoint()
+ {
+ deployBeans(BlueFacedParrotFinch.class);
+ try
+ {
+ activateDependentContext();
+ BlueFacedParrotFinch bean = manager.getInstanceByType(BlueFacedParrotFinch.class);
+ assert bean != null;
+ // Retrieve the implicit event bean from the manager only by its API
+ // type
+ Set<?> eventBeans = manager.resolveByType(Event.class, new FiresBinding());
+ assert !eventBeans.isEmpty();
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "8.6")
+ public void testImplicitEventBeanMatchesBindingAnnotationsOfInjectionPoint()
+ {
+ deployBeans(OrangeCheekedWaxbill.class);
+ try
+ {
+ activateDependentContext();
+ OrangeCheekedWaxbill bean = manager.getInstanceByType(OrangeCheekedWaxbill.class);
+ assert bean != null;
+ // Retrieve the implicit event bean from the manager by its binding
+ // types
+ Set<?> eventBeans = manager.resolveByType(Event.class, new FiresBinding(), new TameAnnotationLiteral());
+ assert !eventBeans.isEmpty();
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "8.6")
+ public void testImplicitEventBeanHasStandardDeploymentType()
+ {
+ deployBeans(BlueFacedParrotFinch.class);
+ try
+ {
+ activateDependentContext();
+ BlueFacedParrotFinch bean = manager.getInstanceByType(BlueFacedParrotFinch.class);
+ assert bean != null;
+ // Retrieve the implicit event bean from the manager only by its API
+ // type
+ Set<?> eventBeans = manager.resolveByType(Event.class, new FiresBinding());
+ assert eventBeans.size() == 1;
+ Bean<?> eventBean = (Bean<?>) eventBeans.iterator().next();
+ assert eventBean.getDeploymentType().equals(Standard.class);
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "8.6")
+ public void testImplicitEventBeanHasDependentScope()
+ {
+ deployBeans(BlueFacedParrotFinch.class);
+ try
+ {
+ activateDependentContext();
+ BlueFacedParrotFinch bean = manager.getInstanceByType(BlueFacedParrotFinch.class);
+ assert bean != null;
+ // Retrieve the implicit event bean from the manager only by its API
+ // type
+ Set<?> eventBeans = manager.resolveByType(Event.class, new FiresBinding());
+ assert eventBeans.size() == 1;
+ Bean<?> eventBean = (Bean<?>) eventBeans.iterator().next();
+ assert eventBean.getScopeType().equals(Dependent.class);
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.6")
+ public void testFireMethodCallsManagerFireWithEventObject()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.6")
+ public void testFireMethodCallsManagerFireWithBindingAnnotationsExceptObservable()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.6")
+ public void testFireMethodCallsManagerFireWithAllBindingAnnotationInstances()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.6")
+ public void testObserveMethodCallsManagerAddObserverWithObserverObject()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.6")
+ public void testObserveMethodCallsManagerAddObserverWithAllBindingAnnotationsExceptObservable()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.6")
+ public void testObserveMethodCallsManagerAddObserverWithAllBindingAnnotationInstance()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.7")
+ public void testEventObjectContainsTypeVariablesWhenResolvingFails()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.7")
+ public void testEventObjectContainsWildcardsWhenResolvingFails()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.7")
+ public void testDuplicateBindingTypesWhenResolvingFails()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
+ @SpecAssertion(section = "8.7")
+ public void testNonBindingTypeAnnotationWhenResolvingFails()
+ {
+ AnObserver observer = new AnObserver();
+ manager.addObserver(observer, new TypeLiteral<AnEventType>()
+ {
+ });
+ Set<Observer<AnEventType>> resolvedObservers = manager.resolveObservers(new AnEventType(), new AnimalStereotypeAnnotationLiteral());
+ assert !resolvedObservers.isEmpty();
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "8.7")
+ public void testResolvingChecksEventType()
+ {
+ Observer<AnEventType> observer = new AnObserver();
+ manager.addObserver(observer, AnEventType.class);
+ Set<Observer<AnEventType>> resolvedObservers = manager.resolveObservers(new AnEventType());
+ assert !resolvedObservers.isEmpty();
+ Set<?> emptyObserverSet = manager.resolveObservers("A string event");
+ assert emptyObserverSet.isEmpty();
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.7")
+ public void testResolvingChecksTypeParameters()
+ {
+ AListObserver observer = new AListObserver();
+ manager.addObserver(observer, new TypeLiteral<ArrayList<String>>()
+ {
+ });
+ Set<Observer<ArrayList<String>>> resolvedObservers = manager.resolveObservers(new ArrayList<String>(), new AnimalStereotypeAnnotationLiteral());
+ assert !resolvedObservers.isEmpty();
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.7")
+ public void testResolvingChecksBindingTypes()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.7")
+ public void testResolvingChecksBindingTypeMembers()
+ {
+ assert false;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/event/EventTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/decorator/DecoratorDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/decorator/DecoratorDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/decorator/DecoratorDefinitionTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -0,0 +1,21 @@
+package org.jboss.webbeans.tck.tests.implementation.decorator;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.testng.annotations.Test;
+
+public class DecoratorDefinitionTest
+{
+
+ @Test(groups="stub") @SpecAssertion(section="4.2")
+ public void testDecoratorBindingInherited()
+ {
+ assert false;
+ }
+
+ @Test(groups="stub") @SpecAssertion(section="4.2")
+ public void testDecoratorBindingBlockedByIntermediateClass()
+ {
+ assert false;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/decorator/DecoratorDefinitionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/interceptor/InterceptorDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/interceptor/InterceptorDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/interceptor/InterceptorDefinitionTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -0,0 +1,21 @@
+package org.jboss.webbeans.tck.tests.implementation.interceptor;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.testng.annotations.Test;
+
+public class InterceptorDefinitionTest
+{
+
+ @Test(groups="stub") @SpecAssertion(section="4.2")
+ public void testNonStaticWithInterceptorBindingInherited()
+ {
+ assert false;
+ }
+
+ @Test(groups="stub") @SpecAssertion(section="4.2")
+ public void testNonStaticWithInterceptorBindingBlockedByIntermediateClass()
+ {
+ assert false;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/interceptor/InterceptorDefinitionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/jms/JmsDefinitionTest.java (from rev 1082, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/jms/JmsModelTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/jms/JmsDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/jms/JmsDefinitionTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -0,0 +1,18 @@
+package org.jboss.webbeans.tck.tests.implementation.jms;
+
+import javax.webbeans.DefinitionException;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.tests.AbstractTest;
+import org.testng.annotations.Test;
+
+public class JmsDefinitionTest extends AbstractTest
+{
+
+ @Test(expectedExceptions=DefinitionException.class, groups={"stub", "jms"}) @SpecAssertion(section="2.6")
+ public void testJmsEndpointHasName()
+ {
+ assert false;
+ }
+
+}
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/jms/JmsModelTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/jms/JmsModelTest.java 2009-01-19 17:43:16 UTC (rev 1088)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/jms/JmsModelTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,18 +0,0 @@
-package org.jboss.webbeans.tck.tests.implementation.jms;
-
-import javax.webbeans.DefinitionException;
-
-import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.tests.AbstractTest;
-import org.testng.annotations.Test;
-
-public class JmsModelTest extends AbstractTest
-{
-
- @Test(expectedExceptions=DefinitionException.class, groups={"stub", "jms"}) @SpecAssertion(section="2.6")
- public void testJmsEndpointHasName()
- {
- assert false;
- }
-
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldBeanLifecycleTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldBeanLifecycleTest.java 2009-01-19 17:43:16 UTC (rev 1088)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldBeanLifecycleTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,58 +0,0 @@
-package org.jboss.webbeans.tck.tests.implementation.producer.field;
-
-import java.lang.reflect.Field;
-
-import javax.webbeans.IllegalProductException;
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.impl.SpecVersion;
-import org.jboss.webbeans.tck.tests.AbstractTest;
-import org.testng.annotations.Test;
-
-@SpecVersion("20081206")
-public class ProducerFieldBeanLifecycleTest extends AbstractTest
-{
-
- @SuppressWarnings("unchecked")
- @Test(groups={"producerField", "broken"}) @SpecAssertion(section="5.6")
- public void testProducerFieldBeanCreate() throws Exception
- {
- Bean<OtherSpiderProducer> spiderProducer = createSimpleBean(OtherSpiderProducer.class);
- manager.addBean(spiderProducer);
- Field method = OtherSpiderProducer.class.getField("produceTarantula");
- Bean<Tarantula> tarantulaBean = createProducerFieldBean(method, spiderProducer);
- Tarantula tarantula = tarantulaBean.create();
- assert tarantula != null;
- }
-
- @Test(groups={"stub", "specialization"}) @SpecAssertion(section="3.3.3")
- public void testSpecializedBeanAlwaysUsed()
- {
- // TODO Placeholder
- assert false;
- }
-
-
- @SuppressWarnings("unchecked")
- @Test(groups={"producerField", "broken"}) @SpecAssertion(section={"3.5", "5.6", "8.3"})
- public void testProducerFieldReturnsNullIsDependent() throws Exception
- {
- Bean<OtherSpiderProducer> spiderProducer = createSimpleBean(OtherSpiderProducer.class);
- manager.addBean(spiderProducer);
- Field method = OtherSpiderProducer.class.getField("getNullSpider");
- Bean<Spider> spiderBean = createProducerFieldBean(method, spiderProducer);
- Spider spider = spiderBean.create();
- assert spider == null;
- }
-
- @Test(groups="producerField", expectedExceptions=IllegalProductException.class) @SpecAssertion(section={"3.5", "5.6"})
- public void testProducerFieldReturnsNullIsNotDependent() throws Exception
- {
- Bean<OtherSpiderProducer_Broken> spiderProducer = createSimpleBean(OtherSpiderProducer_Broken.class);
- manager.addBean(spiderProducer);
- Field method = OtherSpiderProducer_Broken.class.getField("getRequestScopedSpider");
- createProducerFieldBean(method, spiderProducer).create();
- }
-
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldBeanModelTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldBeanModelTest.java 2009-01-19 17:43:16 UTC (rev 1088)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldBeanModelTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,272 +0,0 @@
-package org.jboss.webbeans.tck.tests.implementation.producer.field;
-
-import java.lang.reflect.Field;
-
-import javax.webbeans.Current;
-import javax.webbeans.DefinitionException;
-import javax.webbeans.Production;
-import javax.webbeans.RequestScoped;
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.impl.SpecVersion;
-import org.jboss.webbeans.tck.tests.AbstractTest;
-import org.testng.annotations.Test;
-
-@SpecVersion("20081206")
-public class ProducerFieldBeanModelTest extends AbstractTest
-{
-
- @SuppressWarnings("unchecked")
- @Test(groups="producerField") @SpecAssertion(section="2.5.3")
- public void testProducerFieldInheritsDeploymentTypeOfDeclaringWebBean() throws Exception
- {
- Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
- manager.addBean(bean);
- Field field = OtherSpiderProducer.class.getField("produceTameTarantula");
- Bean<Tarantula> tarantulaModel = createProducerFieldBean(field, bean);
- tarantulaModel.getDeploymentType().equals(AnotherDeploymentType.class);
- }
-
- /*@Test(groups="producerField", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.5")
- public void testStaticField() throws Exception
- {
- SimpleBean<BeanWithStaticProducerField> bean = createSimpleBean(BeanWithStaticProducerField.class);
- manager.addBean(bean);
- Field field = BeanWithStaticProducerField.class.getField("getString");
- createProducerFieldBean(String.class, field, bean);
- }*/
-
- @Test(groups={"stub", "producerField", "enterpriseBeans", "stub"}, expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.5")
- public void testProducerFieldIsNotBusinessField() throws Exception
- {
- assert false;
- }
-
- @Test(groups="producerField") @SpecAssertion(section="3.5")
- public void testParameterizedReturnType() throws Exception
- {
- Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
- manager.addBean(bean);
- Field field = OtherSpiderProducer.class.getField("getFunnelWeaverSpider");
- createProducerFieldBean(field, bean);
- }
-
- @Test(groups="producerField", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.5")
- public void testParameterizedReturnTypeWithWildcard() throws Exception
- {
- Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
- manager.addBean(bean);
- Field field = OtherSpiderProducer.class.getField("getAnotherFunnelWeaver");
- createProducerFieldBean(field, bean);
- }
-
- @Test(groups={"stub", "producerField", "deployment"}) @SpecAssertion(section="3.5")
- public void testBeanDeclaresMultipleProducerFields()
- {
- assert false;
- }
-
- @SuppressWarnings("unchecked")
- @Test(groups="producerField") @SpecAssertion(section={"3.5", "2.3.1"})
- public void testDefaultBindingType() throws Exception
- {
- Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
- manager.addBean(bean);
- Field field = OtherSpiderProducer.class.getField("produceTarantula");
- Bean<Tarantula> tarantulaModel = createProducerFieldBean(field, bean);
- assert tarantulaModel.getBindings().size() == 1;
- assert tarantulaModel.getBindings().iterator().next().annotationType().equals(Current.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test(groups="producerField") @SpecAssertion(section="3.5.1")
- public void testApiTypeForClassReturn() throws Exception
- {
- Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
- manager.addBean(bean);
- Field field = OtherSpiderProducer.class.getField("produceTarantula");
- Bean<Tarantula> tarantulaModel = createProducerFieldBean(field, bean);
- assert tarantulaModel.getTypes().size() == 6;
- assert tarantulaModel.getTypes().contains(Tarantula.class);
- assert tarantulaModel.getTypes().contains(DeadlySpider.class);
- assert tarantulaModel.getTypes().contains(Spider.class);
- assert tarantulaModel.getTypes().contains(Animal.class);
- assert tarantulaModel.getTypes().contains(DeadlyAnimal.class);
- assert tarantulaModel.getTypes().contains(Object.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test(groups="producerField") @SpecAssertion(section="3.5.1")
- public void testApiTypeForInterfaceReturn() throws Exception
- {
- Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
- manager.addBean(bean);
- Field field = OtherSpiderProducer.class.getField("makeASpider");
- Bean<Animal> animalModel = createProducerFieldBean(field, bean);
- assert animalModel.getTypes().size() == 2;
- assert animalModel.getTypes().contains(Animal.class);
- assert animalModel.getTypes().contains(Object.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test(groups="producerField") @SpecAssertion(section="3.5.1")
- public void testApiTypeForPrimitiveReturn() throws Exception
- {
- Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
- manager.addBean(bean);
- Field field = OtherSpiderProducer.class.getField("getWolfSpiderSize");
- Bean<Integer> intModel = createProducerFieldBean(field, bean);
- assert intModel.getTypes().size() == 2;
- assert intModel.getTypes().contains(int.class);
- assert intModel.getTypes().contains(Object.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test(groups="producerField") @SpecAssertion(section={"3.5.1", "2.2"})
- public void testApiTypeForArrayTypeReturn() throws Exception
- {
- Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
- manager.addBean(bean);
- Field field = OtherSpiderProducer.class.getField("getSpiders");
- Bean<Spider[]> spidersModel = createProducerFieldBean(field, bean);
- assert spidersModel.getTypes().size() == 2;
- assert spidersModel.getTypes().contains(Spider[].class);
- assert spidersModel.getTypes().contains(Object.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test(groups="producerField") @SpecAssertion(section="3.5.2")
- public void testBindingType() throws Exception
- {
- Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
- manager.addBean(bean);
- Field field = OtherSpiderProducer.class.getField("produceTameTarantula");
- Bean<Tarantula> tarantulaModel = createProducerFieldBean(field, bean);
- assert tarantulaModel.getBindings().size() == 1;
- assert tarantulaModel.getBindings().iterator().next().annotationType().equals(Tame.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test(groups="producerField") @SpecAssertion(section="3.5.2")
- public void testScopeType() throws Exception
- {
- Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
- manager.addBean(bean);
- Field field = OtherSpiderProducer.class.getField("produceDaddyLongLegs");
- Bean<DaddyLongLegs> daddyLongLegsModel = createProducerFieldBean(field, bean);
- assert daddyLongLegsModel.getScopeType().equals(RequestScoped.class);
-
- // TODO Inherit scope from returned web bean?
- }
-
- @SuppressWarnings("unchecked")
- @Test(groups="producerField") @SpecAssertion(section="3.5.2")
- public void testDeploymentType() throws Exception
- {
- Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
- manager.addBean(bean);
- Field field = OtherSpiderProducer.class.getField("getLadybirdSpider");
- Bean<LadybirdSpider> ladybirdSpiderModel = createProducerFieldBean(field, bean);
- assert ladybirdSpiderModel.getDeploymentType().equals(Production.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test(groups="producerField") @SpecAssertion(section="3.5.2")
- public void testNamedField() throws Exception
- {
- Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
- manager.addBean(bean);
- Field field = OtherSpiderProducer.class.getField("produceBlackWidow");
- Bean<BlackWidow> blackWidowSpiderModel = createProducerFieldBean(field, bean);
- assert blackWidowSpiderModel.getName().equals("blackWidow");
- }
-
- @SuppressWarnings("unchecked")
- @Test(groups="producerField") @SpecAssertion(section="3.5.2")
- public void testDefaultNamedField() throws Exception
- {
- Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
- manager.addBean(bean);
- Field field = OtherSpiderProducer.class.getField("produceDaddyLongLegs");
- Bean<DaddyLongLegs> daddyLongLegsSpiderModel = createProducerFieldBean(field, bean);
- assert daddyLongLegsSpiderModel.getName().equals("produceDaddyLongLegs");
- }
-
- @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
- public void testDisposalFieldNonStatic()
- {
- // TODO Placeholder
- assert false;
- }
-
- @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
- public void testDisposalFieldFieldDeclaredOnWebBeanImplementationClass()
- {
- // TODO Placeholder
- assert false;
- }
-
- @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
- public void testDisposalFieldBindingAnnotations()
- {
- // TODO Placeholder
- assert false;
- }
-
- @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
- public void testDisposalFieldDefaultBindingAnnotations()
- {
- // TODO Placeholder
- assert false;
- }
-
- @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
- public void testDisposalFieldDoesNotResolveToProducerField()
- {
- // TODO Placeholder
- assert false;
- }
-
- @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
- public void testDisposalFieldDeclaredOnEnabledBean()
- {
- // TODO Placeholder
- // TODO Move this
-
- assert false;
- }
-
- @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
- public void testBeanCanDeclareMultipleDisposalFields()
- {
- // TODO move this
- // TODO Placeholder
- assert false;
- }
-
- @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
- public void testProducerFieldHasNoMoreThanOneDisposalField()
- {
- // TODO move this
- // TODO Placeholder
- assert false;
- }
-
- @SuppressWarnings("unchecked")
- @Test(groups="producerField") @SpecAssertion(section={"2.7.2", "3.5.2", "2.2"})
- public void testStereotype() throws Exception
- {
- Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
- manager.addBean(bean);
- Field field = OtherSpiderProducer.class.getField("produceWolfSpider");
- Bean<WolfSpider> wolfSpiderModel = createProducerFieldBean(field, bean);
-
-
- // TODO reimplement stereotype tests
- //assert wolfSpiderModel.getMergedStereotypes().getRequiredTypes().size() == 1;
- //assert wolfSpiderModel.getMergedStereotypes().getRequiredTypes().contains(Animal.class);
-
- assert wolfSpiderModel.getScopeType().equals(RequestScoped.class);
- }
-}
\ No newline at end of file
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldDefinitionTest.java (from rev 1082, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldBeanModelTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldDefinitionTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -0,0 +1,272 @@
+package org.jboss.webbeans.tck.tests.implementation.producer.field;
+
+import java.lang.reflect.Field;
+
+import javax.webbeans.Current;
+import javax.webbeans.DefinitionException;
+import javax.webbeans.Production;
+import javax.webbeans.RequestScoped;
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.impl.SpecVersion;
+import org.jboss.webbeans.tck.tests.AbstractTest;
+import org.testng.annotations.Test;
+
+@SpecVersion("20081206")
+public class ProducerFieldDefinitionTest extends AbstractTest
+{
+
+ @SuppressWarnings("unchecked")
+ @Test(groups="producerField") @SpecAssertion(section="2.5.3")
+ public void testProducerFieldInheritsDeploymentTypeOfDeclaringWebBean() throws Exception
+ {
+ Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
+ manager.addBean(bean);
+ Field field = OtherSpiderProducer.class.getField("produceTameTarantula");
+ Bean<Tarantula> tarantulaModel = createProducerFieldBean(field, bean);
+ tarantulaModel.getDeploymentType().equals(AnotherDeploymentType.class);
+ }
+
+ /*@Test(groups="producerField", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.5")
+ public void testStaticField() throws Exception
+ {
+ SimpleBean<BeanWithStaticProducerField> bean = createSimpleBean(BeanWithStaticProducerField.class);
+ manager.addBean(bean);
+ Field field = BeanWithStaticProducerField.class.getField("getString");
+ createProducerFieldBean(String.class, field, bean);
+ }*/
+
+ @Test(groups={"stub", "producerField", "enterpriseBeans", "stub"}, expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.5")
+ public void testProducerFieldIsNotBusinessField() throws Exception
+ {
+ assert false;
+ }
+
+ @Test(groups="producerField") @SpecAssertion(section="3.5")
+ public void testParameterizedReturnType() throws Exception
+ {
+ Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
+ manager.addBean(bean);
+ Field field = OtherSpiderProducer.class.getField("getFunnelWeaverSpider");
+ createProducerFieldBean(field, bean);
+ }
+
+ @Test(groups="producerField", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.5")
+ public void testParameterizedReturnTypeWithWildcard() throws Exception
+ {
+ Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
+ manager.addBean(bean);
+ Field field = OtherSpiderProducer.class.getField("getAnotherFunnelWeaver");
+ createProducerFieldBean(field, bean);
+ }
+
+ @Test(groups={"stub", "producerField", "deployment"}) @SpecAssertion(section="3.5")
+ public void testBeanDeclaresMultipleProducerFields()
+ {
+ assert false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test(groups="producerField") @SpecAssertion(section={"3.5", "2.3.1"})
+ public void testDefaultBindingType() throws Exception
+ {
+ Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
+ manager.addBean(bean);
+ Field field = OtherSpiderProducer.class.getField("produceTarantula");
+ Bean<Tarantula> tarantulaModel = createProducerFieldBean(field, bean);
+ assert tarantulaModel.getBindings().size() == 1;
+ assert tarantulaModel.getBindings().iterator().next().annotationType().equals(Current.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test(groups="producerField") @SpecAssertion(section="3.5.1")
+ public void testApiTypeForClassReturn() throws Exception
+ {
+ Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
+ manager.addBean(bean);
+ Field field = OtherSpiderProducer.class.getField("produceTarantula");
+ Bean<Tarantula> tarantulaModel = createProducerFieldBean(field, bean);
+ assert tarantulaModel.getTypes().size() == 6;
+ assert tarantulaModel.getTypes().contains(Tarantula.class);
+ assert tarantulaModel.getTypes().contains(DeadlySpider.class);
+ assert tarantulaModel.getTypes().contains(Spider.class);
+ assert tarantulaModel.getTypes().contains(Animal.class);
+ assert tarantulaModel.getTypes().contains(DeadlyAnimal.class);
+ assert tarantulaModel.getTypes().contains(Object.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test(groups="producerField") @SpecAssertion(section="3.5.1")
+ public void testApiTypeForInterfaceReturn() throws Exception
+ {
+ Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
+ manager.addBean(bean);
+ Field field = OtherSpiderProducer.class.getField("makeASpider");
+ Bean<Animal> animalModel = createProducerFieldBean(field, bean);
+ assert animalModel.getTypes().size() == 2;
+ assert animalModel.getTypes().contains(Animal.class);
+ assert animalModel.getTypes().contains(Object.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test(groups="producerField") @SpecAssertion(section="3.5.1")
+ public void testApiTypeForPrimitiveReturn() throws Exception
+ {
+ Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
+ manager.addBean(bean);
+ Field field = OtherSpiderProducer.class.getField("getWolfSpiderSize");
+ Bean<Integer> intModel = createProducerFieldBean(field, bean);
+ assert intModel.getTypes().size() == 2;
+ assert intModel.getTypes().contains(int.class);
+ assert intModel.getTypes().contains(Object.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test(groups="producerField") @SpecAssertion(section={"3.5.1", "2.2"})
+ public void testApiTypeForArrayTypeReturn() throws Exception
+ {
+ Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
+ manager.addBean(bean);
+ Field field = OtherSpiderProducer.class.getField("getSpiders");
+ Bean<Spider[]> spidersModel = createProducerFieldBean(field, bean);
+ assert spidersModel.getTypes().size() == 2;
+ assert spidersModel.getTypes().contains(Spider[].class);
+ assert spidersModel.getTypes().contains(Object.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test(groups="producerField") @SpecAssertion(section="3.5.2")
+ public void testBindingType() throws Exception
+ {
+ Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
+ manager.addBean(bean);
+ Field field = OtherSpiderProducer.class.getField("produceTameTarantula");
+ Bean<Tarantula> tarantulaModel = createProducerFieldBean(field, bean);
+ assert tarantulaModel.getBindings().size() == 1;
+ assert tarantulaModel.getBindings().iterator().next().annotationType().equals(Tame.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test(groups="producerField") @SpecAssertion(section="3.5.2")
+ public void testScopeType() throws Exception
+ {
+ Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
+ manager.addBean(bean);
+ Field field = OtherSpiderProducer.class.getField("produceDaddyLongLegs");
+ Bean<DaddyLongLegs> daddyLongLegsModel = createProducerFieldBean(field, bean);
+ assert daddyLongLegsModel.getScopeType().equals(RequestScoped.class);
+
+ // TODO Inherit scope from returned web bean?
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test(groups="producerField") @SpecAssertion(section="3.5.2")
+ public void testDeploymentType() throws Exception
+ {
+ Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
+ manager.addBean(bean);
+ Field field = OtherSpiderProducer.class.getField("getLadybirdSpider");
+ Bean<LadybirdSpider> ladybirdSpiderModel = createProducerFieldBean(field, bean);
+ assert ladybirdSpiderModel.getDeploymentType().equals(Production.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test(groups="producerField") @SpecAssertion(section="3.5.2")
+ public void testNamedField() throws Exception
+ {
+ Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
+ manager.addBean(bean);
+ Field field = OtherSpiderProducer.class.getField("produceBlackWidow");
+ Bean<BlackWidow> blackWidowSpiderModel = createProducerFieldBean(field, bean);
+ assert blackWidowSpiderModel.getName().equals("blackWidow");
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test(groups="producerField") @SpecAssertion(section="3.5.2")
+ public void testDefaultNamedField() throws Exception
+ {
+ Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
+ manager.addBean(bean);
+ Field field = OtherSpiderProducer.class.getField("produceDaddyLongLegs");
+ Bean<DaddyLongLegs> daddyLongLegsSpiderModel = createProducerFieldBean(field, bean);
+ assert daddyLongLegsSpiderModel.getName().equals("produceDaddyLongLegs");
+ }
+
+ @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
+ public void testDisposalFieldNonStatic()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+ @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
+ public void testDisposalFieldFieldDeclaredOnWebBeanImplementationClass()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+ @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
+ public void testDisposalFieldBindingAnnotations()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+ @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
+ public void testDisposalFieldDefaultBindingAnnotations()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+ @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
+ public void testDisposalFieldDoesNotResolveToProducerField()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+ @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
+ public void testDisposalFieldDeclaredOnEnabledBean()
+ {
+ // TODO Placeholder
+ // TODO Move this
+
+ assert false;
+ }
+
+ @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
+ public void testBeanCanDeclareMultipleDisposalFields()
+ {
+ // TODO move this
+ // TODO Placeholder
+ assert false;
+ }
+
+ @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
+ public void testProducerFieldHasNoMoreThanOneDisposalField()
+ {
+ // TODO move this
+ // TODO Placeholder
+ assert false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test(groups="producerField") @SpecAssertion(section={"2.7.2", "3.5.2", "2.2"})
+ public void testStereotype() throws Exception
+ {
+ Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
+ manager.addBean(bean);
+ Field field = OtherSpiderProducer.class.getField("produceWolfSpider");
+ Bean<WolfSpider> wolfSpiderModel = createProducerFieldBean(field, bean);
+
+
+ // TODO reimplement stereotype tests
+ //assert wolfSpiderModel.getMergedStereotypes().getRequiredTypes().size() == 1;
+ //assert wolfSpiderModel.getMergedStereotypes().getRequiredTypes().contains(Animal.class);
+
+ assert wolfSpiderModel.getScopeType().equals(RequestScoped.class);
+ }
+}
\ No newline at end of file
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldLifecycleTest.java (from rev 1082, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldBeanLifecycleTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldLifecycleTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/field/ProducerFieldLifecycleTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -0,0 +1,58 @@
+package org.jboss.webbeans.tck.tests.implementation.producer.field;
+
+import java.lang.reflect.Field;
+
+import javax.webbeans.IllegalProductException;
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.impl.SpecVersion;
+import org.jboss.webbeans.tck.tests.AbstractTest;
+import org.testng.annotations.Test;
+
+@SpecVersion("20081206")
+public class ProducerFieldLifecycleTest extends AbstractTest
+{
+
+ @SuppressWarnings("unchecked")
+ @Test(groups={"producerField", "broken"}) @SpecAssertion(section="5.6")
+ public void testProducerFieldBeanCreate() throws Exception
+ {
+ Bean<OtherSpiderProducer> spiderProducer = createSimpleBean(OtherSpiderProducer.class);
+ manager.addBean(spiderProducer);
+ Field method = OtherSpiderProducer.class.getField("produceTarantula");
+ Bean<Tarantula> tarantulaBean = createProducerFieldBean(method, spiderProducer);
+ Tarantula tarantula = tarantulaBean.create();
+ assert tarantula != null;
+ }
+
+ @Test(groups={"stub", "specialization"}) @SpecAssertion(section="3.3.3")
+ public void testSpecializedBeanAlwaysUsed()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+
+ @SuppressWarnings("unchecked")
+ @Test(groups={"producerField", "broken"}) @SpecAssertion(section={"3.5", "5.6", "8.3"})
+ public void testProducerFieldReturnsNullIsDependent() throws Exception
+ {
+ Bean<OtherSpiderProducer> spiderProducer = createSimpleBean(OtherSpiderProducer.class);
+ manager.addBean(spiderProducer);
+ Field method = OtherSpiderProducer.class.getField("getNullSpider");
+ Bean<Spider> spiderBean = createProducerFieldBean(method, spiderProducer);
+ Spider spider = spiderBean.create();
+ assert spider == null;
+ }
+
+ @Test(groups="producerField", expectedExceptions=IllegalProductException.class) @SpecAssertion(section={"3.5", "5.6"})
+ public void testProducerFieldReturnsNullIsNotDependent() throws Exception
+ {
+ Bean<OtherSpiderProducer_Broken> spiderProducer = createSimpleBean(OtherSpiderProducer_Broken.class);
+ manager.addBean(spiderProducer);
+ Field method = OtherSpiderProducer_Broken.class.getField("getRequestScopedSpider");
+ createProducerFieldBean(method, spiderProducer).create();
+ }
+
+}
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodBeanLifecycleTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodBeanLifecycleTest.java 2009-01-19 17:43:16 UTC (rev 1088)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodBeanLifecycleTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,70 +0,0 @@
-package org.jboss.webbeans.tck.tests.implementation.producer.method;
-
-import java.lang.reflect.Method;
-
-import javax.webbeans.IllegalProductException;
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.impl.SpecVersion;
-import org.jboss.webbeans.tck.tests.AbstractTest;
-import org.testng.annotations.Test;
-
-@SpecVersion("20081206")
-public class ProducerMethodBeanLifecycleTest extends AbstractTest
-{
-
- @Test(groups={"producerMethod", "broken"}) @SpecAssertion(section="5.6")
- public void testProducerMethodBeanCreate() throws Exception
- {
- Bean<SpiderProducer> spiderProducer = createSimpleBean(SpiderProducer.class);
- manager.addBean(spiderProducer);
- Method method = SpiderProducer.class.getMethod("produceTarantula");
- Bean<Tarantula> tarantulaBean = createProducerMethodBean(method, spiderProducer);
- Tarantula tarantula = tarantulaBean.create();
- assert tarantula != null;
- }
-
- @Test(groups={"stub", "specialization"}) @SpecAssertion(section="3.3.3")
- public void testSpecializedBeanAlwaysUsed()
- {
- // TODO Placeholder
- assert false;
- }
-
- @Test(groups={"stub", "disposalMethod", "beanLifecycle"}) @SpecAssertion(section="3.3.4")
- public void testDisposalMethodCalled()
- {
- // TODO Placeholder
- assert false;
- }
-
- @Test(groups={"stub", "disposalMethod", "beanLifecycle"}) @SpecAssertion(section="3.3.4")
- public void testDisposalMethodHasParametersInjected()
- {
- // TODO Placeholder
- assert false;
- }
-
-
- @Test(groups={"producerMethod", "broken"}) @SpecAssertion(section={"3.4", "5.6", "8.3"})
- public void testProducerMethodReturnsNullIsDependent() throws Exception
- {
- Bean<SpiderProducer> spiderProducer = createSimpleBean(SpiderProducer.class);
- manager.addBean(spiderProducer);
- Method method = SpiderProducer.class.getMethod("getNullSpider");
- Bean<Spider> spiderBean = createProducerMethodBean(method, spiderProducer);
- Spider spider = spiderBean.create();
- assert spider == null;
- }
-
- @Test(groups="producerMethod", expectedExceptions=IllegalProductException.class) @SpecAssertion(section={"3.4", "5.6"})
- public void testProducerMethodReturnsNullIsNotDependent() throws Exception
- {
- Bean<SpiderProducer_Broken> spiderProducer = createSimpleBean(SpiderProducer_Broken.class);
- manager.addBean(spiderProducer);
- Method method = SpiderProducer_Broken.class.getMethod("getRequestScopedSpider");
- createProducerMethodBean(method, spiderProducer).create();
- }
-
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodBeanModelTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodBeanModelTest.java 2009-01-19 17:43:16 UTC (rev 1088)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodBeanModelTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,295 +0,0 @@
-package org.jboss.webbeans.tck.tests.implementation.producer.method;
-
-import java.lang.reflect.Method;
-
-import javax.webbeans.Current;
-import javax.webbeans.DefinitionException;
-import javax.webbeans.Production;
-import javax.webbeans.RequestScoped;
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.impl.SpecVersion;
-import org.jboss.webbeans.tck.tests.AbstractTest;
-import org.testng.annotations.Test;
-
-@SpecVersion("20081206")
-public class ProducerMethodBeanModelTest extends AbstractTest
-{
-
- @Test(groups="producerMethod") @SpecAssertion(section="2.5.3")
- public void testProducerMethodInheritsDeploymentTypeOfDeclaringWebBean() throws Exception
- {
- Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
- manager.addBean(bean);
- Method method = SpiderProducer.class.getMethod("produceTameTarantula");
- Bean<Tarantula> tarantulaModel = createProducerMethodBean(method, bean);
- tarantulaModel.getDeploymentType().equals(AnotherDeploymentType.class);
- }
-
- @Test(groups="producerMethod") @SpecAssertion(section="3.4")
- public void testStaticMethod() throws Exception
- {
- Bean<BeanWithStaticProducerMethod> bean = createSimpleBean(BeanWithStaticProducerMethod.class);
- manager.addBean(bean);
- Method method = BeanWithStaticProducerMethod.class.getMethod("getString");
- createProducerMethodBean(method, bean);
- }
-
- @Test(groups={"stub", "producerMethod", "enterpriseBeans", "stub"}, expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
- public void testProducerMethodIsNotBusinessMethod() throws Exception
- {
- assert false;
- }
-
- @Test(groups="producerMethod") @SpecAssertion(section="3.4")
- public void testParameterizedReturnType() throws Exception
- {
- Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
- manager.addBean(bean);
- Method method = SpiderProducer.class.getMethod("getFunnelWeaverSpider");
- createProducerMethodBean(method, bean);
- }
-
- @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
- public void testParameterizedReturnTypeWithWildcard() throws Exception
- {
- Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
- manager.addBean(bean);
- Method method = SpiderProducer.class.getMethod("getAnotherFunnelWeaver");
- createProducerMethodBean(method, bean);
- }
-
- @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
- public void testParameterizedReturnTypeWithTypeParameter() throws Exception
- {
- Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
- manager.addBean(bean);
- Method method = SpiderProducer.class.getMethod("getFunnelWeaver");
- createProducerMethodBean(method, bean);
- }
-
- @Test(groups="producerMethod") @SpecAssertion(section={"3.4", "2.3.1"})
- public void testDefaultBindingType() throws Exception
- {
- Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
- manager.addBean(bean);
- Method method = SpiderProducer.class.getMethod("produceTarantula");
- Bean<Tarantula> tarantulaModel = createProducerMethodBean(method, bean);
- assert tarantulaModel.getBindings().size() == 1;
- assert tarantulaModel.getBindings().iterator().next().annotationType().equals(Current.class);
- }
-
- @Test(groups="producerMethod") @SpecAssertion(section="3.4.1")
- public void testApiTypeForClassReturn() throws Exception
- {
- Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
- manager.addBean(bean);
- Method method = SpiderProducer.class.getMethod("produceTarantula");
- Bean<Tarantula> tarantulaModel = createProducerMethodBean(method, bean);
- assert tarantulaModel.getTypes().size() == 6;
- assert tarantulaModel.getTypes().contains(Tarantula.class);
- assert tarantulaModel.getTypes().contains(DeadlySpider.class);
- assert tarantulaModel.getTypes().contains(Spider.class);
- assert tarantulaModel.getTypes().contains(Animal.class);
- assert tarantulaModel.getTypes().contains(DeadlyAnimal.class);
- assert tarantulaModel.getTypes().contains(Object.class);
- }
-
- @Test(groups="producerMethod") @SpecAssertion(section="3.4.1")
- public void testApiTypeForInterfaceReturn() throws Exception
- {
- Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
- manager.addBean(bean);
- Method method = SpiderProducer.class.getMethod("makeASpider");
- Bean<Animal> animalModel = createProducerMethodBean(method, bean);
- assert animalModel.getTypes().size() == 2;
- assert animalModel.getTypes().contains(Animal.class);
- assert animalModel.getTypes().contains(Object.class);
- }
-
- @Test(groups="producerMethod") @SpecAssertion(section="3.4.1")
- public void testApiTypeForPrimitiveReturn() throws Exception
- {
- Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
- manager.addBean(bean);
- Method method = SpiderProducer.class.getMethod("getWolfSpiderSize");
- Bean<Integer> intModel = createProducerMethodBean(method, bean);
- assert intModel.getTypes().size() == 2;
- assert intModel.getTypes().contains(int.class);
- assert intModel.getTypes().contains(Object.class);
- }
-
- @Test(groups="producerMethod") @SpecAssertion(section={"3.4.1", "2.2"})
- public void testApiTypeForArrayTypeReturn() throws Exception
- {
- Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
- manager.addBean(bean);
- Method method = SpiderProducer.class.getMethod("getSpiders");
- Bean<Spider[]> spidersModel = createProducerMethodBean(method, bean);
- assert spidersModel.getTypes().size() == 2;
- assert spidersModel.getTypes().contains(Spider[].class);
- assert spidersModel.getTypes().contains(Object.class);
- }
-
- @Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
- public void testBindingType() throws Exception
- {
- Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
- manager.addBean(bean);
- Method method = SpiderProducer.class.getMethod("produceTameTarantula");
- Bean<Tarantula> tarantulaModel = createProducerMethodBean(method, bean);
- assert tarantulaModel.getBindings().size() == 1;
- assert tarantulaModel.getBindings().iterator().next().annotationType().equals(Tame.class);
- }
-
- @Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
- public void testScopeType() throws Exception
- {
- Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
- manager.addBean(bean);
- Method method = SpiderProducer.class.getMethod("produceDaddyLongLegs");
- Bean<DaddyLongLegs> daddyLongLegsModel = createProducerMethodBean(method, bean);
- assert daddyLongLegsModel.getScopeType().equals(RequestScoped.class);
-
- // TODO Inherit scope from returned web bean?
- }
-
- @Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
- public void testDeploymentType() throws Exception
- {
- Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
- manager.addBean(bean);
- Method method = SpiderProducer.class.getMethod("getLadybirdSpider");
- Bean<LadybirdSpider> ladybirdSpiderModel = createProducerMethodBean(method, bean);
- assert ladybirdSpiderModel.getDeploymentType().equals(Production.class);
- }
-
- @Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
- public void testNamedMethod() throws Exception
- {
- Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
- manager.addBean(bean);
- Method method = SpiderProducer.class.getMethod("produceBlackWidow");
- Bean<BlackWidow> blackWidowSpiderModel = createProducerMethodBean(method, bean);
- assert blackWidowSpiderModel.getName().equals("blackWidow");
- }
-
- @Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
- public void testDefaultNamedMethod() throws Exception
- {
- Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
- manager.addBean(bean);
- Method method = SpiderProducer.class.getMethod("produceDaddyLongLegs");
- Bean<DaddyLongLegs> daddyLongLegsSpiderModel = createProducerMethodBean(method, bean);
- assert daddyLongLegsSpiderModel.getName().equals("produceDaddyLongLegs");
- }
-
- @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
- public void testProducerMethodAnnotatedDestructor() throws Exception
- {
- Bean<SpiderProducer_Broken> bean = createSimpleBean(SpiderProducer_Broken.class);
- manager.addBean(bean);
- Method method = SpiderProducer_Broken.class.getMethod("destroy");
- createProducerMethodBean(method, bean);
- }
-
- @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
- public void testProducerMethodWithParameterAnnotatedDisposes() throws Exception
- {
- Bean<SpiderProducer_Broken> bean = createSimpleBean(SpiderProducer_Broken.class);
- manager.addBean(bean);
- Method method = SpiderProducer_Broken.class.getMethod("dispose", String.class);
- createProducerMethodBean(method, bean);
- }
-
- @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
- public void testProducerMethodWithParameterAnnotatedObserves() throws Exception
- {
- Bean<SpiderProducer_Broken> bean = createSimpleBean(SpiderProducer_Broken.class);
- manager.addBean(bean);
- Method method = SpiderProducer_Broken.class.getMethod("observe", String.class);
- createProducerMethodBean(method, bean);
- }
-
- @Test(groups={"stub", "disposalMethod"}) @SpecAssertion(section="3.3.4")
- public void testDisposalMethodNonStatic()
- {
- // TODO Placeholder
- assert false;
- }
-
- @Test(groups={"stub", "disposalMethod"}) @SpecAssertion(section="3.3.4")
- public void testDisposalMethodMethodDeclaredOnWebBeanImplementationClass()
- {
- // TODO Placeholder
- assert false;
- }
-
- @Test(groups={"stub", "disposalMethod"}) @SpecAssertion(section="3.3.4")
- public void testDisposalMethodBindingAnnotations()
- {
- // TODO Placeholder
- assert false;
- }
-
- @Test(groups={"stub", "disposalMethod"}) @SpecAssertion(section="3.3.4")
- public void testDisposalMethodDefaultBindingAnnotations()
- {
- // TODO Placeholder
- assert false;
- }
-
- @Test(groups={"stub", "disposalMethod"}) @SpecAssertion(section="3.3.4")
- public void testDisposalMethodDoesNotResolveToProducerMethod()
- {
- // TODO Placeholder
- assert false;
- }
-
- @Test(groups={"stub", "disposalMethod"}) @SpecAssertion(section="3.3.5")
- public void testDisposalMethodDeclaredOnEnabledBean()
- {
- // TODO Placeholder
- // TODO Move this
-
- assert false;
- }
-
- @Test(groups={"stub", "disposalMethod"}) @SpecAssertion(section="3.3.5")
- public void testBeanCanDeclareMultipleDisposalMethods()
- {
- // TODO move this
- // TODO Placeholder
- assert false;
- }
-
- @Test(groups={"stub", "disposalMethod"}) @SpecAssertion(section="3.3.5")
- public void testProducerMethodHasNoMoreThanOneDisposalMethod()
- {
- // TODO move this
- // TODO Placeholder
- assert false;
- }
-
- @Test(groups="producerMethod") @SpecAssertion(section={"2.7.2", "3.4.2", "2.2"})
- public void testStereotypeSpecifiesScope() throws Exception
- {
- Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
- manager.addBean(bean);
- Method method = SpiderProducer.class.getMethod("produceWolfSpider");
- Bean<WolfSpider> wolfSpider = createProducerMethodBean(method, bean);
- //assert wolfSpiderModel.getMergedStereotypes().getRequiredTypes().size() == 1;
- //assert wolfSpiderModel.getMergedStereotypes().getRequiredTypes().contains(Animal.class);
- assert wolfSpider.getScopeType().equals(RequestScoped.class);
- }
-
- @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section={"2.7.2", "3.4.2", "2.2"})
- public void testStereotypeEnforcesTypes() throws Exception
- {
- Bean<SpiderProducer_Broken> bean = createSimpleBean(SpiderProducer_Broken.class);
- manager.addBean(bean);
- Method method = SpiderProducer_Broken.class.getMethod("produceInteger");
- createProducerMethodBean(method, bean);
- }
-}
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodDefinitionTest.java (from rev 1082, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodBeanModelTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodDefinitionTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -0,0 +1,295 @@
+package org.jboss.webbeans.tck.tests.implementation.producer.method;
+
+import java.lang.reflect.Method;
+
+import javax.webbeans.Current;
+import javax.webbeans.DefinitionException;
+import javax.webbeans.Production;
+import javax.webbeans.RequestScoped;
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.impl.SpecVersion;
+import org.jboss.webbeans.tck.tests.AbstractTest;
+import org.testng.annotations.Test;
+
+@SpecVersion("20081206")
+public class ProducerMethodDefinitionTest extends AbstractTest
+{
+
+ @Test(groups="producerMethod") @SpecAssertion(section="2.5.3")
+ public void testProducerMethodInheritsDeploymentTypeOfDeclaringWebBean() throws Exception
+ {
+ Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer.class.getMethod("produceTameTarantula");
+ Bean<Tarantula> tarantulaModel = createProducerMethodBean(method, bean);
+ tarantulaModel.getDeploymentType().equals(AnotherDeploymentType.class);
+ }
+
+ @Test(groups="producerMethod") @SpecAssertion(section="3.4")
+ public void testStaticMethod() throws Exception
+ {
+ Bean<BeanWithStaticProducerMethod> bean = createSimpleBean(BeanWithStaticProducerMethod.class);
+ manager.addBean(bean);
+ Method method = BeanWithStaticProducerMethod.class.getMethod("getString");
+ createProducerMethodBean(method, bean);
+ }
+
+ @Test(groups={"stub", "producerMethod", "enterpriseBeans", "stub"}, expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
+ public void testProducerMethodIsNotBusinessMethod() throws Exception
+ {
+ assert false;
+ }
+
+ @Test(groups="producerMethod") @SpecAssertion(section="3.4")
+ public void testParameterizedReturnType() throws Exception
+ {
+ Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer.class.getMethod("getFunnelWeaverSpider");
+ createProducerMethodBean(method, bean);
+ }
+
+ @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
+ public void testParameterizedReturnTypeWithWildcard() throws Exception
+ {
+ Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer.class.getMethod("getAnotherFunnelWeaver");
+ createProducerMethodBean(method, bean);
+ }
+
+ @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
+ public void testParameterizedReturnTypeWithTypeParameter() throws Exception
+ {
+ Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer.class.getMethod("getFunnelWeaver");
+ createProducerMethodBean(method, bean);
+ }
+
+ @Test(groups="producerMethod") @SpecAssertion(section={"3.4", "2.3.1"})
+ public void testDefaultBindingType() throws Exception
+ {
+ Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer.class.getMethod("produceTarantula");
+ Bean<Tarantula> tarantulaModel = createProducerMethodBean(method, bean);
+ assert tarantulaModel.getBindings().size() == 1;
+ assert tarantulaModel.getBindings().iterator().next().annotationType().equals(Current.class);
+ }
+
+ @Test(groups="producerMethod") @SpecAssertion(section="3.4.1")
+ public void testApiTypeForClassReturn() throws Exception
+ {
+ Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer.class.getMethod("produceTarantula");
+ Bean<Tarantula> tarantulaModel = createProducerMethodBean(method, bean);
+ assert tarantulaModel.getTypes().size() == 6;
+ assert tarantulaModel.getTypes().contains(Tarantula.class);
+ assert tarantulaModel.getTypes().contains(DeadlySpider.class);
+ assert tarantulaModel.getTypes().contains(Spider.class);
+ assert tarantulaModel.getTypes().contains(Animal.class);
+ assert tarantulaModel.getTypes().contains(DeadlyAnimal.class);
+ assert tarantulaModel.getTypes().contains(Object.class);
+ }
+
+ @Test(groups="producerMethod") @SpecAssertion(section="3.4.1")
+ public void testApiTypeForInterfaceReturn() throws Exception
+ {
+ Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer.class.getMethod("makeASpider");
+ Bean<Animal> animalModel = createProducerMethodBean(method, bean);
+ assert animalModel.getTypes().size() == 2;
+ assert animalModel.getTypes().contains(Animal.class);
+ assert animalModel.getTypes().contains(Object.class);
+ }
+
+ @Test(groups="producerMethod") @SpecAssertion(section="3.4.1")
+ public void testApiTypeForPrimitiveReturn() throws Exception
+ {
+ Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer.class.getMethod("getWolfSpiderSize");
+ Bean<Integer> intModel = createProducerMethodBean(method, bean);
+ assert intModel.getTypes().size() == 2;
+ assert intModel.getTypes().contains(int.class);
+ assert intModel.getTypes().contains(Object.class);
+ }
+
+ @Test(groups="producerMethod") @SpecAssertion(section={"3.4.1", "2.2"})
+ public void testApiTypeForArrayTypeReturn() throws Exception
+ {
+ Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer.class.getMethod("getSpiders");
+ Bean<Spider[]> spidersModel = createProducerMethodBean(method, bean);
+ assert spidersModel.getTypes().size() == 2;
+ assert spidersModel.getTypes().contains(Spider[].class);
+ assert spidersModel.getTypes().contains(Object.class);
+ }
+
+ @Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
+ public void testBindingType() throws Exception
+ {
+ Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer.class.getMethod("produceTameTarantula");
+ Bean<Tarantula> tarantulaModel = createProducerMethodBean(method, bean);
+ assert tarantulaModel.getBindings().size() == 1;
+ assert tarantulaModel.getBindings().iterator().next().annotationType().equals(Tame.class);
+ }
+
+ @Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
+ public void testScopeType() throws Exception
+ {
+ Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer.class.getMethod("produceDaddyLongLegs");
+ Bean<DaddyLongLegs> daddyLongLegsModel = createProducerMethodBean(method, bean);
+ assert daddyLongLegsModel.getScopeType().equals(RequestScoped.class);
+
+ // TODO Inherit scope from returned web bean?
+ }
+
+ @Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
+ public void testDeploymentType() throws Exception
+ {
+ Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer.class.getMethod("getLadybirdSpider");
+ Bean<LadybirdSpider> ladybirdSpiderModel = createProducerMethodBean(method, bean);
+ assert ladybirdSpiderModel.getDeploymentType().equals(Production.class);
+ }
+
+ @Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
+ public void testNamedMethod() throws Exception
+ {
+ Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer.class.getMethod("produceBlackWidow");
+ Bean<BlackWidow> blackWidowSpiderModel = createProducerMethodBean(method, bean);
+ assert blackWidowSpiderModel.getName().equals("blackWidow");
+ }
+
+ @Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
+ public void testDefaultNamedMethod() throws Exception
+ {
+ Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer.class.getMethod("produceDaddyLongLegs");
+ Bean<DaddyLongLegs> daddyLongLegsSpiderModel = createProducerMethodBean(method, bean);
+ assert daddyLongLegsSpiderModel.getName().equals("produceDaddyLongLegs");
+ }
+
+ @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
+ public void testProducerMethodAnnotatedDestructor() throws Exception
+ {
+ Bean<SpiderProducer_Broken> bean = createSimpleBean(SpiderProducer_Broken.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer_Broken.class.getMethod("destroy");
+ createProducerMethodBean(method, bean);
+ }
+
+ @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
+ public void testProducerMethodWithParameterAnnotatedDisposes() throws Exception
+ {
+ Bean<SpiderProducer_Broken> bean = createSimpleBean(SpiderProducer_Broken.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer_Broken.class.getMethod("dispose", String.class);
+ createProducerMethodBean(method, bean);
+ }
+
+ @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
+ public void testProducerMethodWithParameterAnnotatedObserves() throws Exception
+ {
+ Bean<SpiderProducer_Broken> bean = createSimpleBean(SpiderProducer_Broken.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer_Broken.class.getMethod("observe", String.class);
+ createProducerMethodBean(method, bean);
+ }
+
+ @Test(groups={"stub", "disposalMethod"}) @SpecAssertion(section="3.3.4")
+ public void testDisposalMethodNonStatic()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+ @Test(groups={"stub", "disposalMethod"}) @SpecAssertion(section="3.3.4")
+ public void testDisposalMethodMethodDeclaredOnWebBeanImplementationClass()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+ @Test(groups={"stub", "disposalMethod"}) @SpecAssertion(section="3.3.4")
+ public void testDisposalMethodBindingAnnotations()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+ @Test(groups={"stub", "disposalMethod"}) @SpecAssertion(section="3.3.4")
+ public void testDisposalMethodDefaultBindingAnnotations()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+ @Test(groups={"stub", "disposalMethod"}) @SpecAssertion(section="3.3.4")
+ public void testDisposalMethodDoesNotResolveToProducerMethod()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+ @Test(groups={"stub", "disposalMethod"}) @SpecAssertion(section="3.3.5")
+ public void testDisposalMethodDeclaredOnEnabledBean()
+ {
+ // TODO Placeholder
+ // TODO Move this
+
+ assert false;
+ }
+
+ @Test(groups={"stub", "disposalMethod"}) @SpecAssertion(section="3.3.5")
+ public void testBeanCanDeclareMultipleDisposalMethods()
+ {
+ // TODO move this
+ // TODO Placeholder
+ assert false;
+ }
+
+ @Test(groups={"stub", "disposalMethod"}) @SpecAssertion(section="3.3.5")
+ public void testProducerMethodHasNoMoreThanOneDisposalMethod()
+ {
+ // TODO move this
+ // TODO Placeholder
+ assert false;
+ }
+
+ @Test(groups="producerMethod") @SpecAssertion(section={"2.7.2", "3.4.2", "2.2"})
+ public void testStereotypeSpecifiesScope() throws Exception
+ {
+ Bean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer.class.getMethod("produceWolfSpider");
+ Bean<WolfSpider> wolfSpider = createProducerMethodBean(method, bean);
+ //assert wolfSpiderModel.getMergedStereotypes().getRequiredTypes().size() == 1;
+ //assert wolfSpiderModel.getMergedStereotypes().getRequiredTypes().contains(Animal.class);
+ assert wolfSpider.getScopeType().equals(RequestScoped.class);
+ }
+
+ @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section={"2.7.2", "3.4.2", "2.2"})
+ public void testStereotypeEnforcesTypes() throws Exception
+ {
+ Bean<SpiderProducer_Broken> bean = createSimpleBean(SpiderProducer_Broken.class);
+ manager.addBean(bean);
+ Method method = SpiderProducer_Broken.class.getMethod("produceInteger");
+ createProducerMethodBean(method, bean);
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodDefinitionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodLifecycleTest.java (from rev 1082, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodBeanLifecycleTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodLifecycleTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/producer/method/ProducerMethodLifecycleTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -0,0 +1,70 @@
+package org.jboss.webbeans.tck.tests.implementation.producer.method;
+
+import java.lang.reflect.Method;
+
+import javax.webbeans.IllegalProductException;
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.impl.SpecVersion;
+import org.jboss.webbeans.tck.tests.AbstractTest;
+import org.testng.annotations.Test;
+
+@SpecVersion("20081206")
+public class ProducerMethodLifecycleTest extends AbstractTest
+{
+
+ @Test(groups={"producerMethod", "broken"}) @SpecAssertion(section="5.6")
+ public void testProducerMethodBeanCreate() throws Exception
+ {
+ Bean<SpiderProducer> spiderProducer = createSimpleBean(SpiderProducer.class);
+ manager.addBean(spiderProducer);
+ Method method = SpiderProducer.class.getMethod("produceTarantula");
+ Bean<Tarantula> tarantulaBean = createProducerMethodBean(method, spiderProducer);
+ Tarantula tarantula = tarantulaBean.create();
+ assert tarantula != null;
+ }
+
+ @Test(groups={"stub", "specialization"}) @SpecAssertion(section="3.3.3")
+ public void testSpecializedBeanAlwaysUsed()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+ @Test(groups={"stub", "disposalMethod", "beanLifecycle"}) @SpecAssertion(section="3.3.4")
+ public void testDisposalMethodCalled()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+ @Test(groups={"stub", "disposalMethod", "beanLifecycle"}) @SpecAssertion(section="3.3.4")
+ public void testDisposalMethodHasParametersInjected()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+
+ @Test(groups={"producerMethod", "broken"}) @SpecAssertion(section={"3.4", "5.6", "8.3"})
+ public void testProducerMethodReturnsNullIsDependent() throws Exception
+ {
+ Bean<SpiderProducer> spiderProducer = createSimpleBean(SpiderProducer.class);
+ manager.addBean(spiderProducer);
+ Method method = SpiderProducer.class.getMethod("getNullSpider");
+ Bean<Spider> spiderBean = createProducerMethodBean(method, spiderProducer);
+ Spider spider = spiderBean.create();
+ assert spider == null;
+ }
+
+ @Test(groups="producerMethod", expectedExceptions=IllegalProductException.class) @SpecAssertion(section={"3.4", "5.6"})
+ public void testProducerMethodReturnsNullIsNotDependent() throws Exception
+ {
+ Bean<SpiderProducer_Broken> spiderProducer = createSimpleBean(SpiderProducer_Broken.class);
+ manager.addBean(spiderProducer);
+ Method method = SpiderProducer_Broken.class.getMethod("getRequestScopedSpider");
+ createProducerMethodBean(method, spiderProducer).create();
+ }
+
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/SimpleBeanDefinitionTest.java (from rev 1082, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/SimpleBeanModelTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/SimpleBeanDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/SimpleBeanDefinitionTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -0,0 +1,304 @@
+package org.jboss.webbeans.tck.tests.implementation.simple;
+
+import java.lang.annotation.Annotation;
+import java.util.List;
+
+import javax.webbeans.AnnotationLiteral;
+import javax.webbeans.DefinitionException;
+import javax.webbeans.NonexistentConstructorException;
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.impl.SpecVersion;
+import org.jboss.webbeans.tck.tests.AbstractTest;
+import org.jboss.webbeans.tck.tests.implementation.simple.OuterBean_Broken.InnerBean_Broken;
+import org.jboss.webbeans.tck.tests.implementation.simple.OuterBean_Broken.StaticInnerBean_Broken;
+import org.testng.annotations.Test;
+
+@SpecVersion("20081206")
+public class SimpleBeanDefinitionTest extends AbstractTest
+{
+
+ @Override
+ protected List<Class<? extends Annotation>> getEnabledDeploymentTypes()
+ {
+ List<Class<? extends Annotation>> deploymentTypes = super.getStandardDeploymentTypes();
+ deploymentTypes.add(AnotherDeploymentType.class);
+ return deploymentTypes;
+ }
+
+ //*** BEAN CLASS CHECKS ****//
+
+ @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2")
+ public void testAbstractClassDeclaredInJavaIsNotAllowed()
+ {
+ createSimpleBean(Cow_Broken.class);
+ }
+
+ @Test(groups="innerClass") @SpecAssertion(section="3.2")
+ public void testStaticInnerClassDeclaredInJavaAllowed()
+ {
+ createSimpleBean(StaticInnerBean_Broken.class);
+ }
+
+ @Test(expectedExceptions=DefinitionException.class, groups="innerClass") @SpecAssertion(section="3.2")
+ public void testNonStaticInnerClassDeclaredInJavaNotAllowed()
+ {
+ createSimpleBean(InnerBean_Broken.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2")
+ public void testParameterizedClassDeclaredInJavaIsNotAllowed()
+ {
+ createSimpleBean(ParameterizedBean_Broken.class);
+ }
+
+ @Test(expectedExceptions=DefinitionException.class, groups={"stub", "interceptors", "decorators"}) @SpecAssertion(section="3.2")
+ public void testClassCannotBeInterceptorAndDecorator()
+ {
+
+ }
+
+ @Test(groups="stub")
+ public void testEntitiesNotDiscoveredAsSimpleBeans()
+ {
+ assert false;
+ }
+
+ @Test
+ public void testClassesImplementingServletInterfacesNotDiscoveredAsSimpleBeans()
+ {
+ deployBeans(MockFilter.class, MockHttpSessionListener.class, MockServlet.class, MockServletContextListener.class, MockServletRequestListener.class);
+ assert manager.resolveByType(MockFilter.class).size() == 0;
+ assert manager.resolveByType(MockHttpSessionListener.class).size() == 0;
+ assert manager.resolveByType(MockServlet.class).size() == 0;
+ assert manager.resolveByType(MockServletContextListener.class).size() == 0;
+ assert manager.resolveByType(MockServletRequestListener.class).size() == 0;
+ }
+
+ @Test
+ public void testClassesImplementingEnterpriseBeanInterfaceNotDiscoveredAsSimpleBean()
+ {
+ deployBeans(MockEnterpriseBean.class);
+ assert manager.resolveByType(MockEnterpriseBean.class).size() == 0;
+ }
+
+ @Test
+ public void testClassExtendingUiComponentNotDiscoveredAsSimpleBean()
+ {
+ deployBeans(MockUIComponent.class);
+ assert manager.resolveByType(MockUIComponent.class).size() == 0;
+ }
+
+ @Test(groups="stub")
+ public void testEjbsNotDiscoveredAsSimpleBean()
+ {
+
+ }
+
+ @Test(groups={"stub", "producerMethod", "webbeansxml"}) @SpecAssertion(section="3.2.4")
+ public void testBeanDeclaredInXmlIgnoresProducerMethodDeclaredInJava()
+ {
+ assert false;
+ }
+
+ @Test(groups={"stub", "disposalMethod", "webbeansxml"}) @SpecAssertion(section="3.2.4")
+ public void testBeanDeclaredInXmlIgnoresDisposalMethodDeclaredInJava()
+ {
+ assert false;
+ }
+
+ @Test(groups={"stub", "observerMethod", "webbeansxml"}) @SpecAssertion(section="3.2.4")
+ public void testBeanDeclaredInXmlIgnoresObserverMethodDeclaredInJava()
+ {
+ assert false;
+ }
+
+ @Test(expectedExceptions=DefinitionException.class, groups={"stub", "webbeansxml"}) @SpecAssertion(section="3.2.4")
+ public void testAbstractClassDeclaredInXmlIsNotAllowed()
+ {
+
+ }
+
+ @Test(groups={"stub", "innerClass", "webbeansxml"}) @SpecAssertion(section="3.2.4")
+ public void testStaticInnerClassDeclaredInXmlAllowed()
+ {
+ assert false;
+ }
+
+ @Test(expectedExceptions=DefinitionException.class, groups={"stub", "innerClass", "webbeansxml"}) @SpecAssertion(section="3.2.4")
+ public void testNonStaticInnerClassDeclaredInXmlNotAllowed()
+ {
+ assert false;
+ }
+
+ @Test(expectedExceptions=DefinitionException.class, groups={"stub", "webbeansxml"}) @SpecAssertion(section="3.2.4")
+ public void testParameterizedClassDeclaredInXmlIsNotAllowed()
+ {
+ assert false;
+ }
+
+ @Test(expectedExceptions=DefinitionException.class, groups={"stub", "interceptors"}) @SpecAssertion(section="3.2.4")
+ public void testClassHasInterceptorInJavaMustHaveInterceptorInXml()
+ {
+ assert false;
+ }
+
+ @Test(expectedExceptions=DefinitionException.class, groups={"stub", "interceptors"}) @SpecAssertion(section="3.2.4")
+ public void testClassHasDecoratorInJavaMustHaveDecoratorInXml()
+ {
+ assert false;
+ }
+
+ @Test @SpecAssertion(section="3.2.5.1")
+ public void testInitializerAnnotatedConstructor() throws Exception
+ {
+ deployBeans(Sheep.class);
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ manager.getInstanceByType(Sheep.class);
+ assert Sheep.constructedCorrectly;
+
+ }
+ }.run();
+
+ }
+
+ @Test @SpecAssertion(section="3.2.5.1")
+ public void testImplicitConstructorUsed()
+ {
+ Bean<Order> order = createSimpleBean(Order.class);
+ // TODO Test this properly!
+ }
+
+ @Test @SpecAssertion(section="3.2.5.1")
+ public void testEmptyConstructorUsed()
+ {
+ createSimpleBean(Donkey.class).create();
+ assert Donkey.constructedCorrectly;
+ }
+
+ @Test @SpecAssertion(section="3.2.5.1")
+ public void testInitializerAnnotatedConstructorUsedOverEmptyConstuctor() throws Exception
+ {
+ deployBeans(Turkey.class);
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ manager.getInstanceByType(Turkey.class);
+ assert Turkey.constructedCorrectly;
+ }
+ }.run();
+ }
+
+ @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2.5.1")
+ public void testTooManyInitializerAnnotatedConstructor()
+ {
+ createSimpleBean(Goose_Broken.class);
+ }
+
+ @Test(expectedExceptions=DefinitionException.class, groups={"stub", "disposalMethod"}) @SpecAssertion(section="3.2.5.1")
+ public void testConstructorHasDisposesParameter()
+ {
+ assert false;
+ }
+
+ @Test(expectedExceptions=DefinitionException.class, groups={"stub", "observerMethod"}) @SpecAssertion(section="3.2.5.1")
+ public void testConstructorHasObservesParameter()
+ {
+ assert false;
+ }
+
+ @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="3.2.5.2")
+ public void testImplicitConstructorDeclaredInXmlUsed()
+ {
+ assert false;
+ }
+
+ @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="3.2.5.2")
+ public void testEmptyConstructorDeclaredInXmlUsed()
+ {
+ assert false;
+ }
+
+ @Test(expectedExceptions=NonexistentConstructorException.class, groups={"stub", "webbeansxml"}) @SpecAssertion(section="3.2.5.2")
+ public void testConstructorDeclaredInXmlDoesNotExist()
+ {
+ assert false;
+ }
+
+ @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="3.2.5.2")
+ public void testConstructorDeclaredInXmlIgnoresBindingTypesDeclaredInJava()
+ {
+ assert false;
+ }
+
+ @Test @SpecAssertion(section="3.2.5.3")
+ public void testBindingTypeAnnotatedConstructor() throws Exception
+ {
+ deployBeans(Duck.class);
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ manager.getInstanceByType(Duck.class);
+ assert Duck.constructedCorrectly;
+ }
+ }.run();
+ }
+
+ @Test(groups="specializationInherit") @SpecAssertion(section="3.2.6")
+ public void testSpecializedClassInheritsBindingTypes()
+ {
+ Bean<Tractor> bean = createSimpleBean(Tractor.class);
+ assert bean.getBindings().size()==2;
+ assert bean.getBindings().contains( new AnnotationLiteral<Motorized>() {} );
+ assert bean.getBindings().contains( new AnnotationLiteral<HeavyDuty>() {} );
+ }
+
+ @Test(groups="specializationInherit") @SpecAssertion(section="3.2.6")
+ public void testSpecializedClassInheritsName()
+ {
+ Bean<Tractor> bean = createSimpleBean(Tractor.class);
+ assert bean.getName()!=null;
+ assert bean.getName().equals("plough");
+ }
+
+ @Test(groups={"stub", "specialization"}) @SpecAssertion(section="3.2.6")
+ public void testLessSpecializedClassNotInstantiated()
+ {
+ assert false;
+ }
+
+ @Test(groups={"stub", "specialization"},expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2.6")
+ public void testSpecializedClassMustExtendAnotherWebBean()
+ {
+ assert false;
+ }
+
+ @Test(groups={"stub", "specialization"}) @SpecAssertion(section="3.2.6")
+ public void testSpecializedClassDeclaredInXmlInheritsBindingTypes()
+ {
+ assert false;
+ }
+
+ @Test(groups={"stub", "specialization"}) @SpecAssertion(section="3.2.6")
+ public void testSpecializedClassDeclaredInXmlInheritsName()
+ {
+ assert false;
+ }
+
+ @Test(groups={"stub", "specialization"}) @SpecAssertion(section="3.2.6")
+ public void testLessSpecializedClassDeclaredInXmlNotInstantiated()
+ {
+ assert false;
+ }
+
+}
Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/SimpleBeanModelTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/SimpleBeanModelTest.java 2009-01-19 17:43:16 UTC (rev 1088)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/simple/SimpleBeanModelTest.java 2009-01-19 18:04:13 UTC (rev 1089)
@@ -1,304 +0,0 @@
-package org.jboss.webbeans.tck.tests.implementation.simple;
-
-import java.lang.annotation.Annotation;
-import java.util.List;
-
-import javax.webbeans.AnnotationLiteral;
-import javax.webbeans.DefinitionException;
-import javax.webbeans.NonexistentConstructorException;
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.impl.SpecVersion;
-import org.jboss.webbeans.tck.tests.AbstractTest;
-import org.jboss.webbeans.tck.tests.implementation.simple.OuterBean_Broken.InnerBean_Broken;
-import org.jboss.webbeans.tck.tests.implementation.simple.OuterBean_Broken.StaticInnerBean_Broken;
-import org.testng.annotations.Test;
-
-@SpecVersion("20081206")
-public class SimpleBeanModelTest extends AbstractTest
-{
-
- @Override
- protected List<Class<? extends Annotation>> getEnabledDeploymentTypes()
- {
- List<Class<? extends Annotation>> deploymentTypes = super.getStandardDeploymentTypes();
- deploymentTypes.add(AnotherDeploymentType.class);
- return deploymentTypes;
- }
-
- //*** BEAN CLASS CHECKS ****//
-
- @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2")
- public void testAbstractClassDeclaredInJavaIsNotAllowed()
- {
- createSimpleBean(Cow_Broken.class);
- }
-
- @Test(groups="innerClass") @SpecAssertion(section="3.2")
- public void testStaticInnerClassDeclaredInJavaAllowed()
- {
- createSimpleBean(StaticInnerBean_Broken.class);
- }
-
- @Test(expectedExceptions=DefinitionException.class, groups="innerClass") @SpecAssertion(section="3.2")
- public void testNonStaticInnerClassDeclaredInJavaNotAllowed()
- {
- createSimpleBean(InnerBean_Broken.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2")
- public void testParameterizedClassDeclaredInJavaIsNotAllowed()
- {
- createSimpleBean(ParameterizedBean_Broken.class);
- }
-
- @Test(expectedExceptions=DefinitionException.class, groups={"stub", "interceptors", "decorators"}) @SpecAssertion(section="3.2")
- public void testClassCannotBeInterceptorAndDecorator()
- {
-
- }
-
- @Test(groups="stub")
- public void testEntitiesNotDiscoveredAsSimpleBeans()
- {
- assert false;
- }
-
- @Test
- public void testClassesImplementingServletInterfacesNotDiscoveredAsSimpleBeans()
- {
- deployBeans(MockFilter.class, MockHttpSessionListener.class, MockServlet.class, MockServletContextListener.class, MockServletRequestListener.class);
- assert manager.resolveByType(MockFilter.class).size() == 0;
- assert manager.resolveByType(MockHttpSessionListener.class).size() == 0;
- assert manager.resolveByType(MockServlet.class).size() == 0;
- assert manager.resolveByType(MockServletContextListener.class).size() == 0;
- assert manager.resolveByType(MockServletRequestListener.class).size() == 0;
- }
-
- @Test
- public void testClassesImplementingEnterpriseBeanInterfaceNotDiscoveredAsSimpleBean()
- {
- deployBeans(MockEnterpriseBean.class);
- assert manager.resolveByType(MockEnterpriseBean.class).size() == 0;
- }
-
- @Test
- public void testClassExtendingUiComponentNotDiscoveredAsSimpleBean()
- {
- deployBeans(MockUIComponent.class);
- assert manager.resolveByType(MockUIComponent.class).size() == 0;
- }
-
- @Test(groups="stub")
- public void testEjbsNotDiscoveredAsSimpleBean()
- {
-
- }
-
- @Test(groups={"stub", "producerMethod", "webbeansxml"}) @SpecAssertion(section="3.2.4")
- public void testBeanDeclaredInXmlIgnoresProducerMethodDeclaredInJava()
- {
- assert false;
- }
-
- @Test(groups={"stub", "disposalMethod", "webbeansxml"}) @SpecAssertion(section="3.2.4")
- public void testBeanDeclaredInXmlIgnoresDisposalMethodDeclaredInJava()
- {
- assert false;
- }
-
- @Test(groups={"stub", "observerMethod", "webbeansxml"}) @SpecAssertion(section="3.2.4")
- public void testBeanDeclaredInXmlIgnoresObserverMethodDeclaredInJava()
- {
- assert false;
- }
-
- @Test(expectedExceptions=DefinitionException.class, groups={"stub", "webbeansxml"}) @SpecAssertion(section="3.2.4")
- public void testAbstractClassDeclaredInXmlIsNotAllowed()
- {
-
- }
-
- @Test(groups={"stub", "innerClass", "webbeansxml"}) @SpecAssertion(section="3.2.4")
- public void testStaticInnerClassDeclaredInXmlAllowed()
- {
- assert false;
- }
-
- @Test(expectedExceptions=DefinitionException.class, groups={"stub", "innerClass", "webbeansxml"}) @SpecAssertion(section="3.2.4")
- public void testNonStaticInnerClassDeclaredInXmlNotAllowed()
- {
- assert false;
- }
-
- @Test(expectedExceptions=DefinitionException.class, groups={"stub", "webbeansxml"}) @SpecAssertion(section="3.2.4")
- public void testParameterizedClassDeclaredInXmlIsNotAllowed()
- {
- assert false;
- }
-
- @Test(expectedExceptions=DefinitionException.class, groups={"stub", "interceptors"}) @SpecAssertion(section="3.2.4")
- public void testClassHasInterceptorInJavaMustHaveInterceptorInXml()
- {
- assert false;
- }
-
- @Test(expectedExceptions=DefinitionException.class, groups={"stub", "interceptors"}) @SpecAssertion(section="3.2.4")
- public void testClassHasDecoratorInJavaMustHaveDecoratorInXml()
- {
- assert false;
- }
-
- @Test @SpecAssertion(section="3.2.5.1")
- public void testInitializerAnnotatedConstructor() throws Exception
- {
- deployBeans(Sheep.class);
- new RunInDependentContext()
- {
- @Override
- protected void execute() throws Exception
- {
- manager.getInstanceByType(Sheep.class);
- assert Sheep.constructedCorrectly;
-
- }
- }.run();
-
- }
-
- @Test @SpecAssertion(section="3.2.5.1")
- public void testImplicitConstructorUsed()
- {
- Bean<Order> order = createSimpleBean(Order.class);
- // TODO Test this properly!
- }
-
- @Test @SpecAssertion(section="3.2.5.1")
- public void testEmptyConstructorUsed()
- {
- createSimpleBean(Donkey.class).create();
- assert Donkey.constructedCorrectly;
- }
-
- @Test @SpecAssertion(section="3.2.5.1")
- public void testInitializerAnnotatedConstructorUsedOverEmptyConstuctor() throws Exception
- {
- deployBeans(Turkey.class);
- new RunInDependentContext()
- {
- @Override
- protected void execute() throws Exception
- {
- manager.getInstanceByType(Turkey.class);
- assert Turkey.constructedCorrectly;
- }
- }.run();
- }
-
- @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2.5.1")
- public void testTooManyInitializerAnnotatedConstructor()
- {
- createSimpleBean(Goose_Broken.class);
- }
-
- @Test(expectedExceptions=DefinitionException.class, groups={"stub", "disposalMethod"}) @SpecAssertion(section="3.2.5.1")
- public void testConstructorHasDisposesParameter()
- {
- assert false;
- }
-
- @Test(expectedExceptions=DefinitionException.class, groups={"stub", "observerMethod"}) @SpecAssertion(section="3.2.5.1")
- public void testConstructorHasObservesParameter()
- {
- assert false;
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="3.2.5.2")
- public void testImplicitConstructorDeclaredInXmlUsed()
- {
- assert false;
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="3.2.5.2")
- public void testEmptyConstructorDeclaredInXmlUsed()
- {
- assert false;
- }
-
- @Test(expectedExceptions=NonexistentConstructorException.class, groups={"stub", "webbeansxml"}) @SpecAssertion(section="3.2.5.2")
- public void testConstructorDeclaredInXmlDoesNotExist()
- {
- assert false;
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="3.2.5.2")
- public void testConstructorDeclaredInXmlIgnoresBindingTypesDeclaredInJava()
- {
- assert false;
- }
-
- @Test @SpecAssertion(section="3.2.5.3")
- public void testBindingTypeAnnotatedConstructor() throws Exception
- {
- deployBeans(Duck.class);
- new RunInDependentContext()
- {
- @Override
- protected void execute() throws Exception
- {
- manager.getInstanceByType(Duck.class);
- assert Duck.constructedCorrectly;
- }
- }.run();
- }
-
- @Test(groups="specializationInherit") @SpecAssertion(section="3.2.6")
- public void testSpecializedClassInheritsBindingTypes()
- {
- Bean<Tractor> bean = createSimpleBean(Tractor.class);
- assert bean.getBindings().size()==2;
- assert bean.getBindings().contains( new AnnotationLiteral<Motorized>() {} );
- assert bean.getBindings().contains( new AnnotationLiteral<HeavyDuty>() {} );
- }
-
- @Test(groups="specializationInherit") @SpecAssertion(section="3.2.6")
- public void testSpecializedClassInheritsName()
- {
- Bean<Tractor> bean = createSimpleBean(Tractor.class);
- assert bean.getName()!=null;
- assert bean.getName().equals("plough");
- }
-
- @Test(groups={"stub", "specialization"}) @SpecAssertion(section="3.2.6")
- public void testLessSpecializedClassNotInstantiated()
- {
- assert false;
- }
-
- @Test(groups={"stub", "specialization"},expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2.6")
- public void testSpecializedClassMustExtendAnotherWebBean()
- {
- assert false;
- }
-
- @Test(groups={"stub", "specialization"}) @SpecAssertion(section="3.2.6")
- public void testSpecializedClassDeclaredInXmlInheritsBindingTypes()
- {
- assert false;
- }
-
- @Test(groups={"stub", "specialization"}) @SpecAssertion(section="3.2.6")
- public void testSpecializedClassDeclaredInXmlInheritsName()
- {
- assert false;
- }
-
- @Test(groups={"stub", "specialization"}) @SpecAssertion(section="3.2.6")
- public void testLessSpecializedClassDeclaredInXmlNotInstantiated()
- {
- assert false;
- }
-
-}
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1088 - tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-19 12:43:16 -0500 (Mon, 19 Jan 2009)
New Revision: 1088
Added:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/BookOrderProcessor.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/CdOrderProcessor.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/LifecycleCallbackTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/NovelOrderProcessor.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/OrderProcessor.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
Log:
Tests for inheritance of lifecycle callbacks
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2009-01-19 17:33:39 UTC (rev 1087)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2009-01-19 17:43:16 UTC (rev 1088)
@@ -328,7 +328,7 @@
this.methodsByAnnotatedParameters = new AnnotatedMethodMap();
for (Class<?> c = clazz; c != Object.class && c != null; c = c.getSuperclass())
{
- for (Method method : clazz.getDeclaredMethods())
+ for (Method method : c.getDeclaredMethods())
{
if (!method.isAccessible())
{
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/BookOrderProcessor.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/BookOrderProcessor.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/BookOrderProcessor.java 2009-01-19 17:43:16 UTC (rev 1088)
@@ -0,0 +1,12 @@
+package org.jboss.webbeans.tck.tests.implementation.commonAnnotations;
+
+class BookOrderProcessor extends OrderProcessor
+{
+
+ @Override
+ public void postConstruct() {}
+
+ @Override
+ public void preDestroy() {}
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/BookOrderProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/CdOrderProcessor.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/CdOrderProcessor.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/CdOrderProcessor.java 2009-01-19 17:43:16 UTC (rev 1088)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.tests.implementation.commonAnnotations;
+
+class CdOrderProcessor extends OrderProcessor
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/CdOrderProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/LifecycleCallbackTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/LifecycleCallbackTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/LifecycleCallbackTest.java 2009-01-19 17:43:16 UTC (rev 1088)
@@ -0,0 +1,80 @@
+package org.jboss.webbeans.tck.tests.implementation.commonAnnotations;
+
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.tests.AbstractTest;
+import org.testng.annotations.Test;
+
+public class LifecycleCallbackTest extends AbstractTest
+{
+
+ @Test @SpecAssertion(section="4.2")
+ public void testSubClassInheritsPostConstructOnSuperclass() throws Exception
+ {
+ OrderProcessor.postConstructCalled = false;
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ Bean<CdOrderProcessor> bean = createSimpleBean(CdOrderProcessor.class);
+ bean.create();
+ }
+ }.run();
+ assert OrderProcessor.postConstructCalled;
+ }
+
+ @Test @SpecAssertion(section="4.2")
+ public void testSubClassInheritsPreDestroyOnSuperclass() throws Exception
+ {
+ OrderProcessor.preDestroyCalled = false;
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ Bean<CdOrderProcessor> bean = createSimpleBean(CdOrderProcessor.class);
+ CdOrderProcessor instance = bean.create();
+ bean.destroy(instance);
+ }
+ }.run();
+ assert OrderProcessor.preDestroyCalled;
+ }
+
+ @Test @SpecAssertion(section="4.2")
+ public void testSubClassDoesNotInheritPostConstructOnSuperclassBlockedByIntermediateClass() throws Exception
+ {
+
+ OrderProcessor.postConstructCalled = false;
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ Bean<NovelOrderProcessor> bean = createSimpleBean(NovelOrderProcessor.class);
+ bean.create();
+ }
+ }.run();
+ assert !OrderProcessor.postConstructCalled;
+ }
+
+ @Test @SpecAssertion(section="4.2")
+ public void testSubClassDoesNotInheritPreDestroyConstructOnSuperclassBlockedByIntermediateClass() throws Exception
+ {
+ OrderProcessor.preDestroyCalled = false;
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ Bean<NovelOrderProcessor> bean = createSimpleBean(NovelOrderProcessor.class);
+ NovelOrderProcessor instance = bean.create();
+ bean.destroy(instance);
+ }
+ }.run();
+ assert !OrderProcessor.preDestroyCalled;
+
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/LifecycleCallbackTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/NovelOrderProcessor.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/NovelOrderProcessor.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/NovelOrderProcessor.java 2009-01-19 17:43:16 UTC (rev 1088)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.tests.implementation.commonAnnotations;
+
+class NovelOrderProcessor extends BookOrderProcessor
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/NovelOrderProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/OrderProcessor.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/OrderProcessor.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/OrderProcessor.java 2009-01-19 17:43:16 UTC (rev 1088)
@@ -0,0 +1,25 @@
+package org.jboss.webbeans.tck.tests.implementation.commonAnnotations;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+class OrderProcessor
+{
+
+ public static boolean postConstructCalled = false;
+
+ public static boolean preDestroyCalled = true;
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ postConstructCalled = true;
+ }
+
+ @PreDestroy
+ public void preDestroy()
+ {
+ preDestroyCalled = true;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/OrderProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1087 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-19 12:33:39 -0500 (Mon, 19 Jan 2009)
New Revision: 1087
Added:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injection/DeluxeHenHouse.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injection/HenHouse.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injection/InjectionTest.java
Log:
Injection of superclasses
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-01-19 17:07:46 UTC (rev 1086)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-01-19 17:33:39 UTC (rev 1087)
@@ -34,6 +34,7 @@
import javax.webbeans.ScopeType;
import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.injection.InjectionPointProvider;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
@@ -85,6 +86,28 @@
// TODO Interceptors
initInitializerMethods();
}
+
+ /**
+ * Injects bound fields
+ *
+ * @param instance The instance to inject into
+ */
+ protected void injectBoundFields(T instance)
+ {
+ InjectionPointProvider injectionPointProvider = manager.getInjectionPointProvider();
+ for (AnnotatedField<?> injectableField : getInjectableFields())
+ {
+ injectionPointProvider.pushInjectionPoint(injectableField);
+ try
+ {
+ injectableField.inject(instance, manager);
+ }
+ finally
+ {
+ injectionPointProvider.popInjectionPoint();
+ }
+ }
+ }
/**
* Initializes the bean type
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-01-19 17:07:46 UTC (rev 1086)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-01-19 17:33:39 UTC (rev 1087)
@@ -44,7 +44,6 @@
import org.jboss.webbeans.ejb.InternalEjbDescriptor;
import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
@@ -373,27 +372,6 @@
}
/**
- * Injects bound fields
- *
- * @param instance The bean instance
- */
- protected void injectBoundFields(T instance)
- {
- for (AnnotatedField<?> field : getInjectableFields())
- {
- try
- {
- manager.getInjectionPointProvider().pushInjectionPoint(field);
- field.inject(instance, manager);
- }
- finally
- {
- manager.getInjectionPointProvider().popInjectionPoint();
- }
- }
- }
-
- /**
* Gets the specializes type of the bean
*
* @return The specialized type
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-01-19 17:07:46 UTC (rev 1086)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-01-19 17:33:39 UTC (rev 1087)
@@ -268,28 +268,6 @@
}
/**
- * Injects bound fields
- *
- * @param instance The instance to inject into
- */
- protected void injectBoundFields(T instance)
- {
- InjectionPointProvider injectionPointProvider = manager.getInjectionPointProvider();
- for (AnnotatedField<?> injectableField : getInjectableFields())
- {
- injectionPointProvider.pushInjectionPoint(injectableField);
- try
- {
- injectableField.inject(instance, manager);
- }
- finally
- {
- injectionPointProvider.popInjectionPoint();
- }
- }
- }
-
- /**
* Initializes the bean and its metadata
*/
@Override
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2009-01-19 17:07:46 UTC (rev 1086)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2009-01-19 17:33:39 UTC (rev 1087)
@@ -278,7 +278,7 @@
this.metaAnnotatedFields = new AnnotatedFieldMap();
for (Class<?> c = clazz; c != Object.class && c != null; c = c.getSuperclass())
{
- for (Field field : clazz.getDeclaredFields())
+ for (Field field : c.getDeclaredFields())
{
if (!field.isAccessible())
{
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injection/DeluxeHenHouse.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injection/DeluxeHenHouse.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injection/DeluxeHenHouse.java 2009-01-19 17:33:39 UTC (rev 1087)
@@ -0,0 +1,7 @@
+package org.jboss.webbeans.tck.tests.lookup.injection;
+
+
+public class DeluxeHenHouse extends HenHouse
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injection/DeluxeHenHouse.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injection/HenHouse.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injection/HenHouse.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injection/HenHouse.java 2009-01-19 17:33:39 UTC (rev 1087)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.tck.tests.lookup.injection;
+
+import javax.webbeans.Current;
+
+public class HenHouse
+{
+
+ @Current
+ public Fox fox;
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injection/HenHouse.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injection/InjectionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injection/InjectionTest.java 2009-01-19 17:07:46 UTC (rev 1086)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injection/InjectionTest.java 2009-01-19 17:33:39 UTC (rev 1087)
@@ -91,6 +91,23 @@
manager.addBean(tunaBean);
bean.create();
}
+
+ @Test @SpecAssertion(section="4.2")
+ public void testFieldDeclaredInSuperclassInjected() throws Exception
+ {
+ deployBeans(Fox.class, DeluxeHenHouse.class, HenHouse.class);
+
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ DeluxeHenHouse henHouse = manager.getInstanceByType(DeluxeHenHouse.class);
+ assert henHouse.fox != null;
+ assert henHouse.fox.getName().equals("gavin");
+ }
+ }.run();
+ }
@Test(groups = { "stub", "injection", "webbeansxml" })
@SpecAssertion(section = "3.7.2")
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1086 - in tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition: scope and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-19 12:07:46 -0500 (Mon, 19 Jan 2009)
New Revision: 1086
Modified:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/DeploymentTypeTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java
Log:
mark tests
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/DeploymentTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/DeploymentTypeTest.java 2009-01-19 17:00:48 UTC (rev 1085)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/DeploymentTypeTest.java 2009-01-19 17:07:46 UTC (rev 1086)
@@ -153,7 +153,7 @@
}
- @Test @SpecAssertion(section={"2.5.5", "2.7.2"})
+ @Test @SpecAssertion(section={"2.5.5", "2.7.2", "4.1"})
public void testWebBeanDeploymentTypeOverridesStereotype()
{
Bean<Reindeer> bean = createSimpleBean(Reindeer.class);
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java 2009-01-19 17:00:48 UTC (rev 1085)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java 2009-01-19 17:07:46 UTC (rev 1086)
@@ -131,7 +131,7 @@
assert grayling.getScopeType().equals(ApplicationScoped.class);
}
- @Test @SpecAssertion(section="2.7.2")
+ @Test @SpecAssertion(section={"2.7.2", "4.1"})
public void testWebBeanScopeTypeOverridesStereotype()
{
Bean<RedSnapper> bean = createSimpleBean(RedSnapper.class);
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1085 - tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-19 12:00:48 -0500 (Mon, 19 Jan 2009)
New Revision: 1085
Added:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/BorderCollie.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Dog.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/GoldenLabrador.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/GoldenRetriever.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Horse.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/InheritedDeploymentType.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Labrador.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/NotInheritedDeploymentType.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Retriever.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/ShetlandPony.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/GoldenLabrador.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/Labrador.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/NotInheritedScope.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/AnotherDeploymentType.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/DeploymentTypeTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java
Log:
Add tests and support for deployment type inheritance
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-01-19 16:08:06 UTC (rev 1084)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -28,7 +28,6 @@
import javax.webbeans.BindingType;
import javax.webbeans.DefinitionException;
import javax.webbeans.Dependent;
-import javax.webbeans.DeploymentType;
import javax.webbeans.Event;
import javax.webbeans.InjectionPoint;
import javax.webbeans.Named;
@@ -180,20 +179,10 @@
/**
* Initializes the deployment types
*/
- protected void initDeploymentType()
+ protected abstract void initDeploymentType();
+
+ protected void initDeploymentTypeFromStereotype()
{
- Set<Annotation> deploymentTypes = getAnnotatedItem().getMetaAnnotations(DeploymentType.class);
- if (deploymentTypes.size() > 1)
- {
- throw new DefinitionException("At most one deployment type may be specified (" + deploymentTypes + " are specified) on " + getAnnotatedItem().toString());
- }
- if (deploymentTypes.size() == 1)
- {
- this.deploymentType = deploymentTypes.iterator().next().annotationType();
- log.trace("Deployment type " + deploymentType + " specified by annotation");
- return;
- }
-
AnnotationMap possibleDeploymentTypes = getMergedStereotypes().getPossibleDeploymentTypes();
if (possibleDeploymentTypes.size() > 0)
{
@@ -201,10 +190,6 @@
log.trace("Deployment type " + deploymentType + " specified by stereotype");
return;
}
-
- this.deploymentType = getDefaultDeploymentType();
- log.trace("Using default @Production deployment type");
- return;
}
/**
@@ -288,7 +273,7 @@
*/
protected abstract void initScopeType();
- protected boolean initScopeFromStereotype()
+ protected boolean initScopeTypeFromStereotype()
{
Set<Annotation> possibleScopeTypes = getMergedStereotypes().getPossibleScopeTypes();
if (possibleScopeTypes.size() == 1)
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-01-19 16:08:06 UTC (rev 1084)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -24,6 +24,7 @@
import javax.webbeans.BindingType;
import javax.webbeans.DefinitionException;
import javax.webbeans.Dependent;
+import javax.webbeans.DeploymentType;
import javax.webbeans.Destructor;
import javax.webbeans.Disposes;
import javax.webbeans.Initializer;
@@ -156,33 +157,29 @@
@Override
protected void initScopeType()
{
- Set<Annotation> scopeAnnotations = getAnnotatedItem().getMetaAnnotations(ScopeType.class);
- if (scopeAnnotations.size() == 1)
+ for (AnnotatedClass<?> clazz = getAnnotatedItem(); clazz != null; clazz = clazz.getSuperclass())
{
- this.scopeType = scopeAnnotations.iterator().next().annotationType();
- log.trace("Scope " + scopeType + " specified by annotation");
- return;
- }
- else if (scopeAnnotations.size() > 1)
- {
- for (AnnotatedClass<?> clazz = getAnnotatedItem(); clazz != null; clazz = clazz.getSuperclass())
+ Set<Annotation> scopeTypes = clazz.getDeclaredMetaAnnotations(ScopeType.class);
+ scopeTypes = clazz.getDeclaredMetaAnnotations(ScopeType.class);
+ if (scopeTypes.size() == 1)
{
- scopeAnnotations = clazz.getDeclaredMetaAnnotations(ScopeType.class);
- if (scopeAnnotations.size() == 1)
+ if (getAnnotatedItem().isAnnotationPresent(scopeTypes.iterator().next().annotationType()))
{
- this.scopeType = scopeAnnotations.iterator().next().annotationType();
+ this.scopeType = scopeTypes.iterator().next().annotationType();
log.trace("Scope " + scopeType + " specified by annotation");
- return;
}
- else if (scopeAnnotations.size() > 1)
- {
- throw new DefinitionException("At most one scope may be specified");
- }
+ break;
}
-
+ else if (scopeTypes.size() > 1)
+ {
+ throw new DefinitionException("At most one scope may be specified");
+ }
}
- initScopeFromStereotype();
+ if (this.scopeType == null)
+ {
+ initScopeTypeFromStereotype();
+ }
if (this.scopeType == null)
{
@@ -190,7 +187,41 @@
log.trace("Using default @Dependent scope");
}
}
+
+ @Override
+ protected void initDeploymentType()
+ {
+ for (AnnotatedClass<?> clazz = getAnnotatedItem(); clazz != null; clazz = clazz.getSuperclass())
+ {
+ Set<Annotation> deploymentTypes = clazz.getDeclaredMetaAnnotations(DeploymentType.class);
+ if (deploymentTypes.size() == 1)
+ {
+ if (getAnnotatedItem().isAnnotationPresent(deploymentTypes.iterator().next().annotationType()))
+ {
+ this.deploymentType = deploymentTypes.iterator().next().annotationType();
+ log.trace("Deployment type " + deploymentType + " specified by annotation");
+ }
+ break;
+ }
+ else if (deploymentTypes.size() > 1)
+ {
+ throw new DefinitionException("At most one scope may be specified");
+ }
+ }
+ if (this.deploymentType == null)
+ {
+ initDeploymentTypeFromStereotype();
+ }
+
+ if (this.deploymentType == null)
+ {
+ this.deploymentType = getDefaultDeploymentType();
+ log.trace("Using default @Production deployment type");
+ return;
+ }
+ }
+
/**
* Validate that the scope type is allowed by the stereotypes on the bean and
* the bean type
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-01-19 16:08:06 UTC (rev 1084)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -25,6 +25,7 @@
import javax.webbeans.DefinitionException;
import javax.webbeans.Dependent;
+import javax.webbeans.DeploymentType;
import javax.webbeans.IllegalProductException;
import javax.webbeans.Initializer;
import javax.webbeans.Produces;
@@ -222,7 +223,7 @@
return;
}
- initScopeFromStereotype();
+ initScopeTypeFromStereotype();
if (this.scopeType == null)
{
@@ -230,7 +231,32 @@
log.trace("Using default @Dependent scope");
}
}
+
+ @Override
+ protected void initDeploymentType()
+ {
+ Set<Annotation> deploymentTypes = getAnnotatedItem().getMetaAnnotations(DeploymentType.class);
+ if (deploymentTypes.size() > 1)
+ {
+ throw new DefinitionException("At most one deployment type may be specified (" + deploymentTypes + " are specified) on " + getAnnotatedItem().toString());
+ }
+ else if (deploymentTypes.size() == 1)
+ {
+ this.deploymentType = deploymentTypes.iterator().next().annotationType();
+ log.trace("Deployment type " + deploymentType + " specified by annotation");
+ return;
+ }
+ initDeploymentTypeFromStereotype();
+
+ if (this.deploymentType == null)
+ {
+ this.deploymentType = getDefaultDeploymentType();
+ log.trace("Using default @Production deployment type");
+ return;
+ }
+ }
+
/**
* Gets the receiver of the product
*
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/AnotherDeploymentType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/AnotherDeploymentType.java 2009-01-19 16:08:06 UTC (rev 1084)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/AnotherDeploymentType.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -5,6 +5,7 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@@ -14,6 +15,7 @@
@Retention(RUNTIME)
@Documented
@DeploymentType
+@Inherited
@interface AnotherDeploymentType
{
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/BorderCollie.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/BorderCollie.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/BorderCollie.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.tests.definition.deployment;
+
+class BorderCollie extends Dog
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/BorderCollie.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/DeploymentTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/DeploymentTypeTest.java 2009-01-19 16:08:06 UTC (rev 1084)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/DeploymentTypeTest.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -27,7 +27,9 @@
protected List<Class<? extends Annotation>> getEnabledDeploymentTypes()
{
List<Class<? extends Annotation>> deploymentTypes = super.getStandardDeploymentTypes();
+ deploymentTypes.add(AnotherDeploymentType.class);
deploymentTypes.add(HornedAnimalDeploymentType.class);
+ deploymentTypes.add(NotInheritedDeploymentType.class);
return deploymentTypes;
}
@@ -157,4 +159,29 @@
Bean<Reindeer> bean = createSimpleBean(Reindeer.class);
assert bean.getDeploymentType().equals(Production.class);
}
-}
\ No newline at end of file
+
+ @Test @SpecAssertion(section="4.1")
+ public void testDeploymentTypeDeclaredInheritedIsInherited() throws Exception
+ {
+ assert createSimpleBean(BorderCollie.class).getDeploymentType().equals(AnotherDeploymentType.class);
+ }
+
+ @Test @SpecAssertion(section="4.1")
+ public void testDeploymentTypeNotDeclaredInheritedIsNotInherited()
+ {
+ assert createSimpleBean(ShetlandPony.class).getDeploymentType().equals(Production.class);
+ }
+
+ @Test @SpecAssertion(section="4.1")
+ public void testDeploymentTypeDeclaredInheritedIsBlockedByIntermediateDeploymentTypeNotMarkedInherited()
+ {
+ assert createSimpleBean(GoldenRetriever.class).getDeploymentType().equals(Production.class);
+ }
+
+ @Test @SpecAssertion(section="4.1")
+ public void testDeploymentTypeDeclaredInheritedIsBlockedByIntermediateDeploymentTypeMarkedInherited()
+ {
+ assert createSimpleBean(GoldenLabrador.class).getDeploymentType().equals(InheritedDeploymentType.class);
+ }
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Dog.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Dog.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Dog.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -0,0 +1,8 @@
+package org.jboss.webbeans.tck.tests.definition.deployment;
+
+
+@AnotherDeploymentType
+class Dog
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Dog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/GoldenLabrador.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/GoldenLabrador.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/GoldenLabrador.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.tests.definition.deployment;
+
+class GoldenLabrador extends Labrador
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/GoldenLabrador.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/GoldenRetriever.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/GoldenRetriever.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/GoldenRetriever.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.tests.definition.deployment;
+
+class GoldenRetriever extends Retriever
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/GoldenRetriever.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Horse.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Horse.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Horse.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -0,0 +1,8 @@
+package org.jboss.webbeans.tck.tests.definition.deployment;
+
+
+@NotInheritedDeploymentType
+class Horse
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Horse.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/InheritedDeploymentType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/InheritedDeploymentType.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/InheritedDeploymentType.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -0,0 +1,22 @@
+package org.jboss.webbeans.tck.tests.definition.deployment;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.DeploymentType;
+
+@Target( { TYPE, METHOD })
+@Retention(RUNTIME)
+@Documented
+@DeploymentType
+@Inherited
+@interface InheritedDeploymentType
+{
+
+}
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/InheritedDeploymentType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Labrador.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Labrador.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Labrador.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -0,0 +1,8 @@
+package org.jboss.webbeans.tck.tests.definition.deployment;
+
+
+@InheritedDeploymentType
+class Labrador extends Dog
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Labrador.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/NotInheritedDeploymentType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/NotInheritedDeploymentType.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/NotInheritedDeploymentType.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -0,0 +1,20 @@
+package org.jboss.webbeans.tck.tests.definition.deployment;
+
+import static java.lang.annotation.ElementType.METHOD;
+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.webbeans.DeploymentType;
+
+@Target( { TYPE, METHOD })
+@Retention(RUNTIME)
+@Documented
+@DeploymentType
+@interface NotInheritedDeploymentType
+{
+
+}
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/NotInheritedDeploymentType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Retriever.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Retriever.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Retriever.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -0,0 +1,7 @@
+package org.jboss.webbeans.tck.tests.definition.deployment;
+
+@NotInheritedDeploymentType
+class Retriever extends Dog
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/Retriever.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/ShetlandPony.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/ShetlandPony.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/ShetlandPony.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.tests.definition.deployment;
+
+class ShetlandPony extends Horse
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/deployment/ShetlandPony.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/GoldenLabrador.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/GoldenLabrador.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/GoldenLabrador.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.tests.definition.scope;
+
+class GoldenLabrador extends Labrador
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/GoldenLabrador.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/Labrador.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/Labrador.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/Labrador.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -0,0 +1,8 @@
+package org.jboss.webbeans.tck.tests.definition.scope;
+
+
+@NotInheritedScope
+class Labrador extends Dog
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/Labrador.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/NotInheritedScope.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/NotInheritedScope.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/NotInheritedScope.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -0,0 +1,21 @@
+package org.jboss.webbeans.tck.tests.definition.scope;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+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.webbeans.ScopeType;
+
+@Target( { TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@Documented
+@ScopeType
+@interface NotInheritedScope
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/NotInheritedScope.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java 2009-01-19 16:08:06 UTC (rev 1084)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java 2009-01-19 17:00:48 UTC (rev 1085)
@@ -151,9 +151,15 @@
}
@Test @SpecAssertion(section="4.1")
- public void testScopeTypeDeclaredInheritedIsBlockedByIntermediateClass()
+ public void testScopeTypeDeclaredInheritedIsBlockedByIntermediateScopeTypeMarkedInherited()
{
assert createSimpleBean(GoldenRetriever.class).getScopeType().equals(ApplicationScoped.class);
}
+ @Test @SpecAssertion(section="4.1")
+ public void testScopeTypeDeclaredInheritedIsBlockedByIntermediateScopeTypeNotMarkedInherited()
+ {
+ assert createSimpleBean(GoldenLabrador.class).getScopeType().equals(Dependent.class);
+ }
+
}
\ No newline at end of file
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1084 - tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-19 11:08:06 -0500 (Mon, 19 Jan 2009)
New Revision: 1084
Added:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/BorderCollie.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/Horse.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/LongHairedDog.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/ShetlandPony.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/AnimalStereotype.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/StereotypesTest.java
Log:
stereotype inheritance tests
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/AnimalStereotype.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/AnimalStereotype.java 2009-01-19 15:58:59 UTC (rev 1083)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/AnimalStereotype.java 2009-01-19 16:08:06 UTC (rev 1084)
@@ -5,6 +5,7 @@
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@@ -15,6 +16,7 @@
@Target( { TYPE, METHOD, FIELD })
@Retention(RUNTIME)
@RequestScoped
+@Inherited
@interface AnimalStereotype
{
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/BorderCollie.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/BorderCollie.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/BorderCollie.java 2009-01-19 16:08:06 UTC (rev 1084)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.tests.definition.stereotype;
+
+class BorderCollie extends LongHairedDog
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/BorderCollie.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/Horse.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/Horse.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/Horse.java 2009-01-19 16:08:06 UTC (rev 1084)
@@ -0,0 +1,7 @@
+package org.jboss.webbeans.tck.tests.definition.stereotype;
+
+@AnotherStereotype
+class Horse
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/Horse.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/LongHairedDog.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/LongHairedDog.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/LongHairedDog.java 2009-01-19 16:08:06 UTC (rev 1084)
@@ -0,0 +1,7 @@
+package org.jboss.webbeans.tck.tests.definition.stereotype;
+
+@AnimalStereotype
+class LongHairedDog implements Animal
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/LongHairedDog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/ShetlandPony.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/ShetlandPony.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/ShetlandPony.java 2009-01-19 16:08:06 UTC (rev 1084)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.tests.definition.stereotype;
+
+class ShetlandPony extends Horse
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/ShetlandPony.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/StereotypesTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/StereotypesTest.java 2009-01-19 15:58:59 UTC (rev 1083)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/stereotype/StereotypesTest.java 2009-01-19 16:08:06 UTC (rev 1084)
@@ -6,6 +6,7 @@
import javax.webbeans.ApplicationScoped;
import javax.webbeans.DefinitionException;
import javax.webbeans.Dependent;
+import javax.webbeans.Production;
import javax.webbeans.RequestScoped;
import javax.webbeans.manager.Bean;
@@ -221,4 +222,16 @@
createSimpleBean(Carp_Broken.class);
}
+ @Test @SpecAssertion(section="4.1")
+ public void testStereotypeDeclaredInheritedIsInherited() throws Exception
+ {
+ assert createSimpleBean(BorderCollie.class).getScopeType().equals(RequestScoped.class);
+ }
+
+ @Test @SpecAssertion(section="4.1")
+ public void testStereotypeNotDeclaredInheritedIsNotInherited()
+ {
+ assert createSimpleBean(ShetlandPony.class).getDeploymentType().equals(Production.class);
+ }
+
}
17 years, 2 months
[webbeans-commits] Webbeans SVN: r1083 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean and 7 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-19 10:58:59 -0500 (Mon, 19 Jan 2009)
New Revision: 1083
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/DeferredEventNotificationTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/ClassAnnotatedItemTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/ResolutionByTypeTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java
Log:
Fix scope inheritance
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-01-19 15:58:59 UTC (rev 1083)
@@ -261,7 +261,7 @@
*/
public <T> Set<Bean<T>> resolveByType(Class<T> type, Annotation... bindings)
{
- return resolveByType(new AnnotatedClassImpl<T>(type, type, bindings), bindings);
+ return resolveByType(AnnotatedClassImpl.of(type, bindings), bindings);
}
/**
@@ -276,7 +276,7 @@
*/
public <T> Set<Bean<T>> resolveByType(TypeLiteral<T> type, Annotation... bindings)
{
- return resolveByType(new AnnotatedClassImpl<T>(type.getRawType(), type.getType(), bindings), bindings);
+ return resolveByType(AnnotatedClassImpl.of(type, bindings), bindings);
}
/**
@@ -564,7 +564,7 @@
*/
public <T> T getInstanceByType(Class<T> type, Annotation... bindings)
{
- return getInstanceByType(new AnnotatedClassImpl<T>(type, type, bindings), bindings);
+ return getInstanceByType(AnnotatedClassImpl.of(type, bindings), bindings);
}
public <T> T getMostSpecializedInstance(Bean<T> bean, boolean create)
@@ -592,7 +592,7 @@
*/
public <T> T getInstanceByType(TypeLiteral<T> type, Annotation... bindings)
{
- return getInstanceByType(new AnnotatedClassImpl<T>(type.getRawType(), type.getType(), bindings), bindings);
+ return getInstanceByType(AnnotatedClassImpl.of(type, bindings), bindings);
}
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-01-19 15:58:59 UTC (rev 1083)
@@ -32,7 +32,6 @@
import javax.webbeans.Event;
import javax.webbeans.InjectionPoint;
import javax.webbeans.Named;
-import javax.webbeans.ScopeType;
import javax.webbeans.Specializes;
import javax.webbeans.Standard;
import javax.webbeans.Stereotype;
@@ -287,33 +286,25 @@
/**
* Initializes the scope type
*/
- protected void initScopeType()
+ protected abstract void initScopeType();
+
+ protected boolean initScopeFromStereotype()
{
- Set<Annotation> scopeAnnotations = getAnnotatedItem().getMetaAnnotations(ScopeType.class);
- if (scopeAnnotations.size() > 1)
- {
- throw new DefinitionException("At most one scope may be specified");
- }
- if (scopeAnnotations.size() == 1)
- {
- this.scopeType = scopeAnnotations.iterator().next().annotationType();
- log.trace("Scope " + scopeType + " specified by annotation");
- return;
- }
-
Set<Annotation> possibleScopeTypes = getMergedStereotypes().getPossibleScopeTypes();
if (possibleScopeTypes.size() == 1)
{
this.scopeType = possibleScopeTypes.iterator().next().annotationType();
log.trace("Scope " + scopeType + " specified by stereotype");
- return;
+ return true;
}
else if (possibleScopeTypes.size() > 1)
{
throw new DefinitionException("All stereotypes must specify the same scope OR a scope must be specified on the bean");
}
- this.scopeType = Dependent.class;
- log.trace("Using default @Dependent scope");
+ else
+ {
+ return false;
+ }
}
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-01-19 15:58:59 UTC (rev 1083)
@@ -23,12 +23,14 @@
import javax.webbeans.BindingType;
import javax.webbeans.DefinitionException;
+import javax.webbeans.Dependent;
import javax.webbeans.Destructor;
import javax.webbeans.Disposes;
import javax.webbeans.Initializer;
import javax.webbeans.Observes;
import javax.webbeans.Produces;
import javax.webbeans.Production;
+import javax.webbeans.ScopeType;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedClass;
@@ -150,6 +152,44 @@
}
}
}
+
+ @Override
+ protected void initScopeType()
+ {
+ Set<Annotation> scopeAnnotations = getAnnotatedItem().getMetaAnnotations(ScopeType.class);
+ if (scopeAnnotations.size() == 1)
+ {
+ this.scopeType = scopeAnnotations.iterator().next().annotationType();
+ log.trace("Scope " + scopeType + " specified by annotation");
+ return;
+ }
+ else if (scopeAnnotations.size() > 1)
+ {
+ for (AnnotatedClass<?> clazz = getAnnotatedItem(); clazz != null; clazz = clazz.getSuperclass())
+ {
+ scopeAnnotations = clazz.getDeclaredMetaAnnotations(ScopeType.class);
+ if (scopeAnnotations.size() == 1)
+ {
+ this.scopeType = scopeAnnotations.iterator().next().annotationType();
+ log.trace("Scope " + scopeType + " specified by annotation");
+ return;
+ }
+ else if (scopeAnnotations.size() > 1)
+ {
+ throw new DefinitionException("At most one scope may be specified");
+ }
+ }
+
+ }
+
+ initScopeFromStereotype();
+
+ if (this.scopeType == null)
+ {
+ this.scopeType = Dependent.class;
+ log.trace("Using default @Dependent scope");
+ }
+ }
/**
* Validate that the scope type is allowed by the stereotypes on the bean and
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-01-19 15:58:59 UTC (rev 1083)
@@ -21,17 +21,21 @@
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.HashSet;
+import java.util.Set;
import javax.webbeans.DefinitionException;
import javax.webbeans.Dependent;
import javax.webbeans.IllegalProductException;
import javax.webbeans.Initializer;
import javax.webbeans.Produces;
+import javax.webbeans.ScopeType;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.MetaDataCache;
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.injection.InjectionPointImpl;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Reflections;
@@ -47,6 +51,8 @@
{
// The declaring bean
protected AbstractClassBean<?> declaringBean;
+
+ private static final LogProvider log = Logging.getLogProvider(AbstractProducerBean.class);
/**
* Constructor
@@ -200,6 +206,30 @@
}
}
}
+
+ @Override
+ protected void initScopeType()
+ {
+ Set<Annotation> scopeAnnotations = getAnnotatedItem().getMetaAnnotations(ScopeType.class);
+ if (scopeAnnotations.size() > 1)
+ {
+ throw new DefinitionException("At most one scope may be specified");
+ }
+ if (scopeAnnotations.size() == 1)
+ {
+ this.scopeType = scopeAnnotations.iterator().next().annotationType();
+ log.trace("Scope " + scopeType + " specified by annotation");
+ return;
+ }
+
+ initScopeFromStereotype();
+
+ if (this.scopeType == null)
+ {
+ this.scopeType = Dependent.class;
+ log.trace("Using default @Dependent scope");
+ }
+ }
/**
* Gets the receiver of the product
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-01-19 15:58:59 UTC (rev 1083)
@@ -192,7 +192,7 @@
private <T> void createSimpleBean(Class<T> clazz, Set<AbstractBean<?, ?>> beans)
{
- AnnotatedClass<T> annotatedClass = new AnnotatedClassImpl<T>(clazz);
+ AnnotatedClass<T> annotatedClass = AnnotatedClassImpl.of(clazz);
createBean(SimpleBean.of(annotatedClass, manager), annotatedClass, beans);
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java 2009-01-19 15:58:59 UTC (rev 1083)
@@ -108,9 +108,9 @@
public Set<AnnotatedMethod<?>> getMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType);
/**
- * Gets the superclass
+ * Gets the superclass.
*
- * @return The abstracted superclass
+ * @return The abstracted superclass, null if there is no superclass
*/
public AnnotatedClass<?> getSuperclass();
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2009-01-19 15:58:59 UTC (rev 1083)
@@ -299,7 +299,7 @@
public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
{
- return Collections.unmodifiableSet(metaAnnotationMap.get(metaAnnotationType));
+ return Collections.unmodifiableSet(declaredMetaAnnotationMap.get(metaAnnotationType));
}
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2009-01-19 15:58:59 UTC (rev 1083)
@@ -31,6 +31,8 @@
import java.util.Map;
import java.util.Set;
+import javax.webbeans.TypeLiteral;
+
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedConstructor;
import org.jboss.webbeans.introspector.AnnotatedField;
@@ -51,7 +53,7 @@
*/
public class AnnotatedClassImpl<T> extends AbstractAnnotatedType<T> implements AnnotatedClass<T>
{
-
+
/**
* A (annotation type -> set of field abstractions with annotation/meta
* annotation) map
@@ -59,31 +61,31 @@
private static class AnnotatedFieldMap extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedField<?>>>
{
private Map<Class<? extends Annotation>, Set<AnnotatedField<?>>> delegate;
-
+
public AnnotatedFieldMap()
{
delegate = new HashMap<Class<? extends Annotation>, Set<AnnotatedField<?>>>();
}
-
+
@Override
protected Map<Class<? extends Annotation>, Set<AnnotatedField<?>>> delegate()
{
return delegate;
}
-
+
@Override
public String toString()
{
return Strings.mapToString("AnnotatedFieldMap (annotation type -> field abstraction set): ", delegate);
}
-
+
@Override
public Set<AnnotatedField<?>> get(Object key)
{
Set<AnnotatedField<?>> fields = super.get(key);
return fields != null ? fields : new HashSet<AnnotatedField<?>>();
}
-
+
public void put(Class<? extends Annotation> key, AnnotatedField<?> value)
{
Set<AnnotatedField<?>> fields = super.get(key);
@@ -94,40 +96,40 @@
}
fields.add(value);
}
-
+
}
-
+
/**
* A (annotation type -> set of method abstractions with annotation) map
*/
private class AnnotatedMethodMap extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedMethod<?>>>
{
private Map<Class<? extends Annotation>, Set<AnnotatedMethod<?>>> delegate;
-
+
public AnnotatedMethodMap()
{
delegate = new HashMap<Class<? extends Annotation>, Set<AnnotatedMethod<?>>>();
}
-
+
@Override
protected Map<Class<? extends Annotation>, Set<AnnotatedMethod<?>>> delegate()
{
return delegate;
}
-
+
@Override
public String toString()
{
return Strings.mapToString("AnnotatedMethodMap (annotation type -> method abstraction set): ", delegate);
}
-
+
@Override
public Set<AnnotatedMethod<?>> get(Object key)
{
Set<AnnotatedMethod<?>> methods = super.get(key);
return methods != null ? methods : new HashSet<AnnotatedMethod<?>>();
}
-
+
public void put(Class<? extends Annotation> key, AnnotatedMethod<?> value)
{
Set<AnnotatedMethod<?>> methods = super.get(key);
@@ -138,40 +140,40 @@
}
methods.add(value);
}
-
+
}
-
+
/**
* A (annotation type -> set of constructor abstractions with annotation) map
*/
private class AnnotatedConstructorMap extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>>
{
private Map<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>> delegate;
-
+
public AnnotatedConstructorMap()
{
delegate = new HashMap<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>>();
}
-
+
@Override
protected Map<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>> delegate()
{
return delegate;
}
-
+
@Override
public String toString()
{
return Strings.mapToString("AnnotatedConstructorMap (annotation type -> constructor abstraction set): ", delegate);
}
-
+
@Override
public Set<AnnotatedConstructor<T>> get(Object key)
{
Set<AnnotatedConstructor<T>> constructors = super.get(key);
return constructors != null ? constructors : new HashSet<AnnotatedConstructor<T>>();
}
-
+
public void add(Class<? extends Annotation> key, AnnotatedConstructor<T> value)
{
Set<AnnotatedConstructor<T>> constructors = super.get(key);
@@ -183,7 +185,7 @@
constructors.add(value);
}
}
-
+
/**
* A (class list -> set of constructor abstractions with matching parameters)
* map
@@ -191,18 +193,18 @@
private class ConstructorsByArgumentMap extends ForwardingMap<List<Class<?>>, AnnotatedConstructor<T>>
{
private Map<List<Class<?>>, AnnotatedConstructor<T>> delegate;
-
+
public ConstructorsByArgumentMap()
{
delegate = new HashMap<List<Class<?>>, AnnotatedConstructor<T>>();
}
-
+
@Override
protected Map<List<Class<?>>, AnnotatedConstructor<T>> delegate()
{
return delegate;
}
-
+
@Override
public String toString()
{
@@ -214,45 +216,53 @@
private final Class<T> clazz;
// The type arguments
private final Type[] actualTypeArguments;
-
+
// The set of abstracted fields
private final Set<AnnotatedField<?>> fields;
// The map from annotation type to abstracted field with annotation
private final AnnotatedFieldMap annotatedFields;
// The map from annotation type to abstracted field with meta-annotation
private final AnnotatedFieldMap metaAnnotatedFields;
-
+
// The set of abstracted methods
private final Set<AnnotatedMethod<?>> methods;
// The map from annotation type to abstracted method with annotation
private final AnnotatedMethodMap annotatedMethods;
// The map from annotation type to method with a parameter with annotation
private final AnnotatedMethodMap methodsByAnnotatedParameters;
-
+
// The set of abstracted constructors
private final Set<AnnotatedConstructor<T>> constructors;
// The map from annotation type to abstracted constructor with annotation
private final AnnotatedConstructorMap annotatedConstructors;
// The map from class list to abstracted constructor
private final ConstructorsByArgumentMap constructorsByArgumentMap;
-
+
// Cached string representation
private String toString;
+ public static <T> AnnotatedClass<T> of(Class<T> clazz)
+ {
+ return new AnnotatedClassImpl<T>(clazz, clazz, clazz.getAnnotations(), clazz.getDeclaredAnnotations());
+ }
+
+ // TODO Introduce a lightweight implementation for resolution
+ @Deprecated
+ public static <T> AnnotatedClassImpl<T> of(TypeLiteral<T> typeLiteral, Annotation[] annotations)
+ {
+ return new AnnotatedClassImpl<T>(typeLiteral.getRawType(), typeLiteral.getType(), annotations, annotations);
+ }
+
+ // TODO Introduce a lightweight implementation for resolution
+ @Deprecated
+ public static <T> AnnotatedClassImpl<T> of(Class<T> clazz, Annotation[] annotations)
+ {
+ return new AnnotatedClassImpl<T>(clazz, clazz, annotations, annotations);
+ }
- /**
- * Constructor
- *
- * Initializes superclass with built annotation map, sets the raw type and
- * determines the actual type arguments
- *
- * @param rawType The raw type of the class
- * @param type The type of the class
- * @param annotations The array of annotations on the class
- */
- public AnnotatedClassImpl(Class<T> rawType, Type type, Annotation[] annotations)
+ private AnnotatedClassImpl(Class<T> rawType, Type type, Annotation[] annotations, Annotation[] declaredAnnotations)
{
- super(buildAnnotationMap(annotations), rawType);
+ super(buildAnnotationMap(annotations), buildAnnotationMap(declaredAnnotations), rawType);
this.clazz = rawType;
if (type instanceof ParameterizedType)
{
@@ -262,7 +272,7 @@
{
actualTypeArguments = new Type[0];
}
-
+
this.fields = new HashSet<AnnotatedField<?>>();
this.annotatedFields = new AnnotatedFieldMap();
this.metaAnnotatedFields = new AnnotatedFieldMap();
@@ -284,10 +294,10 @@
this.metaAnnotatedFields.put(metaAnnotation.annotationType(), annotatedField);
}
}
-
+
}
}
-
+
this.constructors = new HashSet<AnnotatedConstructor<T>>();
this.constructorsByArgumentMap = new ConstructorsByArgumentMap();
this.annotatedConstructors = new AnnotatedConstructorMap();
@@ -302,7 +312,7 @@
}
this.constructors.add(annotatedConstructor);
this.constructorsByArgumentMap.put(Arrays.asList(constructor.getParameterTypes()), annotatedConstructor);
-
+
for (Annotation annotation : annotatedConstructor.getAnnotations())
{
if (!annotatedConstructors.containsKey(annotation.annotationType()))
@@ -312,7 +322,7 @@
annotatedConstructors.get(annotation.annotationType()).add(annotatedConstructor);
}
}
-
+
this.methods = new HashSet<AnnotatedMethod<?>>();
this.annotatedMethods = new AnnotatedMethodMap();
this.methodsByAnnotatedParameters = new AnnotatedMethodMap();
@@ -324,7 +334,7 @@
{
method.setAccessible(true);
}
-
+
AnnotatedMethod<?> annotatedMethod = new AnnotatedMethodImpl<Object>(method, this);
this.methods.add(annotatedMethod);
for (Annotation annotation : annotatedMethod.getAnnotations())
@@ -345,25 +355,8 @@
}
}
}
-
- public static <T> AnnotatedClass<T> of(Class<T> clazz)
- {
- return new AnnotatedClassImpl<T>(clazz);
- }
/**
- * Constructor
- *
- * Calls another constructor with the class annotations array
- *
- * @param clazz The implementing class
- */
- public AnnotatedClassImpl(Class<T> clazz)
- {
- this(clazz, clazz, clazz.getAnnotations());
- }
-
- /**
* Gets the implementing class
*
* @return The class
@@ -372,7 +365,7 @@
{
return clazz;
}
-
+
/**
* Gets the delegate (class)
*
@@ -382,7 +375,7 @@
{
return clazz;
}
-
+
/**
* Gets the abstracted fields of the class
*
@@ -394,7 +387,7 @@
{
return Collections.unmodifiableSet(fields);
}
-
+
/**
* Gets the abstracted constructors of the class
*
@@ -406,7 +399,7 @@
{
return Collections.unmodifiableSet(constructors);
}
-
+
/**
* Gets abstracted fields with requested meta-annotation type present
*
@@ -415,7 +408,8 @@
* populated for the requested meta-annotation type and the result is
* returned
*
- * @param metaAnnotationType The meta-annotation type to match
+ * @param metaAnnotationType
+ * The meta-annotation type to match
* @return The set of abstracted fields with meta-annotation present. Returns
* an empty set if no matches are found.
*/
@@ -423,13 +417,14 @@
{
return Collections.unmodifiableSet(metaAnnotatedFields.get(metaAnnotationType));
}
-
+
/**
* Gets the abstracted field annotated with a specific annotation type
*
* If the fields map is null, initialize it first
*
- * @param annotationType The annotation type to match
+ * @param annotationType
+ * The annotation type to match
* @return A set of matching abstracted fields, null if none are found.
*
*/
@@ -437,7 +432,7 @@
{
return Collections.unmodifiableSet(annotatedFields.get(annotationType));
}
-
+
/**
* Gets the type of the class
*
@@ -447,7 +442,7 @@
{
return clazz;
}
-
+
/**
* Gets the actual type arguments
*
@@ -459,13 +454,14 @@
{
return actualTypeArguments;
}
-
+
/**
* Gets the abstracted methods that have a certain annotation type present
*
* If the annotated methods map is null, initialize it first
*
- * @param annotationType The annotation type to match
+ * @param annotationType
+ * The annotation type to match
* @return A set of matching method abstractions. Returns an empty set if no
* matches are found.
*
@@ -475,11 +471,12 @@
{
return Collections.unmodifiableSet(annotatedMethods.get(annotationType));
}
-
+
/**
* Gets constructors with given annotation type
*
- * @param annotationType The annotation type to match
+ * @param annotationType
+ * The annotation type to match
* @return A set of abstracted constructors with given annotation type. If
* the constructors set is empty, initialize it first. Returns an
* empty set if there are no matches.
@@ -490,11 +487,12 @@
{
return Collections.unmodifiableSet(annotatedConstructors.get(annotationType));
}
-
+
/**
* Gets a constructor with given arguments
*
- * @param arguments The arguments to match
+ * @param arguments
+ * The arguments to match
* @return A constructor which takes given arguments. Null is returned if
* there are no matches.
*
@@ -522,7 +520,7 @@
}
return null;
}
-
+
/**
* Gets a string representation of the class
*
@@ -538,5 +536,5 @@
toString = "Annotated class " + Names.class2String(getDelegate());
return toString;
}
-
+
}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/DeferredEventNotificationTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/DeferredEventNotificationTest.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/DeferredEventNotificationTest.java 2009-01-19 15:58:59 UTC (rev 1083)
@@ -67,7 +67,7 @@
//AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, annotations);
// TODO This should test a real class
tuna = SimpleBean.of(Tuna.class, manager);
- om = new AnnotatedMethodImpl<Object>(AnObserver.class.getMethod("observe", new Class[] { Event.class }), new AnnotatedClassImpl<AnObserver>(AnObserver.class));
+ om = new AnnotatedMethodImpl<Object>(AnObserver.class.getMethod("observe", new Class[] { Event.class }), AnnotatedClassImpl.of(AnObserver.class));
AnObserver observerInstance = new AnObserver();
// TODO Fix this Observer<Event> observer = new MockObserverImpl<Event>(tuna, om, Event.class);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/ClassAnnotatedItemTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/ClassAnnotatedItemTest.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/ClassAnnotatedItemTest.java 2009-01-19 15:58:59 UTC (rev 1083)
@@ -18,7 +18,7 @@
@Test
public void testDeclaredAnnotations()
{
- AnnotatedClass<Order> annotatedElement = new AnnotatedClassImpl<Order>(Order.class);
+ AnnotatedClass<Order> annotatedElement = AnnotatedClassImpl.of(Order.class);
assert annotatedElement.getAnnotations().size() == 1;
assert annotatedElement.getAnnotation(Production.class) != null;
assert annotatedElement.getType().equals(Order.class);
@@ -27,7 +27,7 @@
@Test
public void testMetaAnnotations()
{
- AnnotatedClass<Order> annotatedElement = new AnnotatedClassImpl<Order>(Order.class);
+ AnnotatedClass<Order> annotatedElement = AnnotatedClassImpl.of(Order.class);
Set<Annotation> annotations = annotatedElement.getMetaAnnotations(DeploymentType.class);
assert annotations.size() == 1;
Iterator<Annotation> it = annotations.iterator();
@@ -38,10 +38,10 @@
@Test
public void testEmpty()
{
- AnnotatedClass<Order> annotatedElement = new AnnotatedClassImpl<Order>(Order.class);
+ AnnotatedClass<Order> annotatedElement = AnnotatedClassImpl.of(Order.class);
assert annotatedElement.getAnnotation(Stereotype.class) == null;
assert annotatedElement.getMetaAnnotations(Stereotype.class).size() == 0;
- AnnotatedClass<Antelope> classWithNoAnnotations = new AnnotatedClassImpl<Antelope>(Antelope.class);
+ AnnotatedClass<Antelope> classWithNoAnnotations = AnnotatedClassImpl.of(Antelope.class);
assert classWithNoAnnotations.getAnnotations().size() == 0;
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/ResolutionByTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/ResolutionByTypeTest.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/ResolutionByTypeTest.java 2009-01-19 15:58:59 UTC (rev 1083)
@@ -16,7 +16,7 @@
public class ResolutionByTypeTest extends AbstractTest
{
- private AnnotatedClass<FishFarm> fishFarmClass = new AnnotatedClassImpl<FishFarm>(FishFarm.class);
+ private AnnotatedClass<FishFarm> fishFarmClass = AnnotatedClassImpl.of(FishFarm.class);
@Test(groups="resolution")
public void testAnnotatedField() throws Exception
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java 2009-01-19 15:45:09 UTC (rev 1082)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java 2009-01-19 15:58:59 UTC (rev 1083)
@@ -153,7 +153,7 @@
@Test @SpecAssertion(section="4.1")
public void testScopeTypeDeclaredInheritedIsBlockedByIntermediateClass()
{
- //assert getSimpleBean(GoldenRetriever.class).getScopeType().equals(ApplicationScoped.class);
+ assert createSimpleBean(GoldenRetriever.class).getScopeType().equals(ApplicationScoped.class);
}
}
\ No newline at end of file
17 years, 2 months