[webbeans-commits] Webbeans SVN: r2905 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer: register and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-06-26 15:58:30 -0400 (Fri, 26 Jun 2009)
New Revision: 2905
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/ObserverTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/Role.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/RoleBinding.java
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/ConsumerNotifiedForEventTest.java
Log:
repackage and rename observer test
update assertion numbers
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/ObserverTest.java (from rev 2904, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/ConsumerNotifiedForEventTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/ObserverTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/ObserverTest.java 2009-06-26 19:58:30 UTC (rev 2905)
@@ -0,0 +1,70 @@
+package org.jboss.jsr299.tck.tests.event.observer;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.event.Observer;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+/**
+ * Spec version: 20090519
+ */
+@Artifact
+public class ObserverTest extends AbstractJSR299Test
+{
+ public static class AnEventType
+ {
+ }
+
+ public static class AnObserver implements Observer<AnEventType>
+ {
+ public boolean wasNotified = false;
+
+ public boolean notify(AnEventType event)
+ {
+ wasNotified = true;
+ return false;
+ }
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertions( {
+ @SpecAssertion(section = "10.2", id = "h"),
+ @SpecAssertion(section = "11.2.7", id = "b"),
+ @SpecAssertion(section = "10.6", id = "a")
+ })
+ public void testObserverNotifiedWhenEventTypeAndAllBindingsMatch()
+ {
+ Annotation roleBinding = new RoleBinding("Admin");
+ AnObserver observer1 = new AnObserver();
+ AnObserver observer2 = new AnObserver();
+ getCurrentManager().addObserver(observer1);
+ getCurrentManager().addObserver(observer2, roleBinding);
+
+ // Fire an event that will be delivered to the two above observers
+ AnEventType anEvent = new AnEventType();
+ getCurrentManager().fireEvent(anEvent, roleBinding);
+
+ assert observer1.wasNotified;
+ assert observer2.wasNotified;
+ observer1.wasNotified = false;
+ observer2.wasNotified = false;
+
+ // Fire an event that will be delivered to only one
+ getCurrentManager().fireEvent(anEvent);
+ assert observer1.wasNotified;
+ assert !observer2.wasNotified;
+ observer1.wasNotified = false;
+ observer2.wasNotified = false;
+
+ // Also make sure the binding value is considered
+ getCurrentManager().fireEvent(anEvent, new RoleBinding("user"));
+ assert observer1.wasNotified;
+ assert !observer2.wasNotified;
+ }
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/Role.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/Role.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/Role.java 2009-06-26 19:58:30 UTC (rev 2905)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.tests.event.observer;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+
+import javax.enterprise.inject.BindingType;
+
+@BindingType
+@Retention(RUNTIME)
+@interface Role
+{
+ String value();
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/RoleBinding.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/RoleBinding.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/RoleBinding.java 2009-06-26 19:58:30 UTC (rev 2905)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.event.observer;
+
+import javax.enterprise.inject.AnnotationLiteral;
+
+class RoleBinding extends AnnotationLiteral<Role> implements Role
+{
+ private String value = null;
+
+ public RoleBinding(String value)
+ {
+ this.value = value;
+ }
+
+ public String value()
+ {
+ return value;
+ }
+
+}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/ConsumerNotifiedForEventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/ConsumerNotifiedForEventTest.java 2009-06-26 19:48:37 UTC (rev 2904)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/ConsumerNotifiedForEventTest.java 2009-06-26 19:58:30 UTC (rev 2905)
@@ -1,68 +0,0 @@
-package org.jboss.jsr299.tck.tests.event.observer.register;
-
-import java.lang.annotation.Annotation;
-
-import javax.enterprise.event.Observer;
-
-import org.hibernate.tck.annotations.SpecAssertion;
-import org.hibernate.tck.annotations.SpecAssertions;
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.testng.annotations.Test;
-
-@Artifact
-public class ConsumerNotifiedForEventTest extends AbstractJSR299Test
-{
- public static class AnEventType
- {
- }
-
- public static class AnObserver implements Observer<AnEventType>
- {
- public boolean wasNotified = false;
-
- public boolean notify(AnEventType event)
- {
- wasNotified = true;
- return false;
- }
- }
-
- @Test(groups = { "events" })
- @SpecAssertions( {
- @SpecAssertion(section = "7.1", id = "h"),
- @SpecAssertion(section = "7.3", id = "d"),
- @SpecAssertion(section = "7.4", id = "b")
- })
- public void testConsumerNotifiedWhenEventTypeAndAllBindingsMatch()
- {
- Annotation roleBinding = new RoleBinding("Admin");
- AnObserver observer1 = new AnObserver();
- AnObserver observer2 = new AnObserver();
- getCurrentManager().addObserver(observer1);
- getCurrentManager().addObserver(observer2, roleBinding);
-
- // Fire an event that will be delivered to the two above observers
- AnEventType anEvent = new AnEventType();
- getCurrentManager().fireEvent(anEvent, roleBinding);
-
- assert observer1.wasNotified;
- assert observer2.wasNotified;
- observer1.wasNotified = false;
- observer2.wasNotified = false;
-
- // Fire an event that will be delivered to only one
- getCurrentManager().fireEvent(anEvent);
- assert observer1.wasNotified;
- assert !observer2.wasNotified;
- observer1.wasNotified = false;
- observer2.wasNotified = false;
-
- // Also make sure the binding value is considered
- getCurrentManager().fireEvent(anEvent, new RoleBinding("user"));
- assert observer1.wasNotified;
- assert !observer2.wasNotified;
- }
-
-
-}
15 years, 6 months
[webbeans-commits] Webbeans SVN: r2904 - in tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/event/broken and 13 other directories.
by webbeans-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-06-26 15:48:37 -0400 (Fri, 26 Jun 2009)
New Revision: 2904
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/AwardEvent.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Awards.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Course.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/CourseFullEvent.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Honors.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/HonorsLiteral.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/ImplicitEventTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Registration.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Student.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/StudentRegisteredEvent.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/ObserverExceptionAbortsProcessingTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/checkedException/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/AnimalStereotype.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/AnimalStereotypeAnnotationLiteral.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/ConsumerNotifiedForEventTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/DuplicateBindingsToAddObserverTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/DuplicateBindingsToRemoveObserverTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/ManagerAddObserverTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/ManagerRemoveObserverTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/NonBindingTypesToAddObserverTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/Role.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/RoleBinding.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/Tame.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/TameAnnotationLiteral.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/runtimeException/
tck/trunk/impl/src/main/resources/observer/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/event/observer/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer10/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer11/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/AnimalStereotype.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/AnimalStereotypeAnnotationLiteral.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/ConsumerNotifiedForEventTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/DuplicateBindingsToAddObserverTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/DuplicateBindingsToRemoveObserverTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/ManagerAddObserverTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/NonBindingTypesToAddObserverTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/ObserverExceptionAbortsTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/Role.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/RoleBinding.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/Tame.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/TameAnnotationLiteral.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer2/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/registerUsingEvent/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/event/registerUsingEvent/
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/event1/CommonWaxbill_Broken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/checkedException/CheckedExceptionWrappedTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/checkedException/Tame.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/checkedException/TeaCupPomeranian.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/AnotherEnabledDeploymentType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/AuroraFinch.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/BirdCage.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/BlueFacedParrotFinch.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/FinchKeeper.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/OneEyed.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/OneEyedLiteral.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/OrangeCheekedWaxbill.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/RegisterObserversUsingImplicitEventTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/StarFinch.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/Tame.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/runtimeException/ObserverExceptionRethrownTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/runtimeException/Tame.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/runtimeException/TameAnnotationLiteral.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/runtimeException/TeaCupPomeranian.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/beans.xml
Log:
implement some additional event tests
reorganize
attempt to recover from a nasty merge conflict
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/event1/CommonWaxbill_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/event1/CommonWaxbill_Broken.java 2009-06-26 17:12:22 UTC (rev 2903)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/event1/CommonWaxbill_Broken.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -6,6 +6,5 @@
class CommonWaxbill_Broken
{
- @Any
- protected ArrayList<String> simpleEvent;
+ @Any protected ArrayList<String> simpleEvent;
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/AwardEvent.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/AwardEvent.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/AwardEvent.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,16 @@
+package org.jboss.jsr299.tck.tests.event.implicit;
+
+class AwardEvent
+{
+ private Student student;
+
+ public AwardEvent(Student student)
+ {
+ this.student = student;
+ }
+
+ public Student getStudent()
+ {
+ return student;
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Awards.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Awards.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Awards.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.tests.event.implicit;
+
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
+
+class Awards
+{
+ private @Any @Honors Event<AwardEvent> honorsAwardEvent;
+
+ public void grantHonorsStatus(Student student)
+ {
+ honorsAwardEvent.fire(new AwardEvent(student));
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Course.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Course.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Course.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.event.implicit;
+
+class Course
+{
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/CourseFullEvent.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/CourseFullEvent.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/CourseFullEvent.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,16 @@
+package org.jboss.jsr299.tck.tests.event.implicit;
+
+class CourseFullEvent
+{
+ private Course course;
+
+ public CourseFullEvent(Course course)
+ {
+ this.course = course;
+ }
+
+ public Course getCourse()
+ {
+ return course;
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Honors.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Honors.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Honors.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.event.implicit;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@interface Honors
+{
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/HonorsLiteral.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/HonorsLiteral.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/HonorsLiteral.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,7 @@
+package org.jboss.jsr299.tck.tests.event.implicit;
+
+import javax.enterprise.inject.AnnotationLiteral;
+
+public class HonorsLiteral extends AnnotationLiteral<Honors>
+{
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/ImplicitEventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/ImplicitEventTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/ImplicitEventTest.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,67 @@
+package org.jboss.jsr299.tck.tests.event.implicit;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.TypeLiteral;
+import javax.enterprise.inject.deployment.Standard;
+import javax.enterprise.inject.spi.Bean;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.literals.AnyLiteral;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+/**
+ * Test that there is an implicit event bean for every legal event type
+ *
+ * Spec version: 20090519
+ *
+ * @author Dan Allen
+ */
+@Artifact
+public class ImplicitEventTest extends AbstractJSR299Test
+{
+ // FIXME ri-broken: remove @Any from the Registration @Initializer and verify the tests pass
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "10.4.2", id = "a"),
+ @SpecAssertion(section = "10.4.2", id = "b"),
+ @SpecAssertion(section = "10.1", id = "i")
+ })
+ public void testImplicitEventExistsForEachEventType()
+ {
+ assert getBeans(new TypeLiteral<Event<StudentRegisteredEvent>>() {}, new AnyLiteral()).size() == 1;
+ assert getBeans(new TypeLiteral<Event<CourseFullEvent>>() {}, new AnyLiteral()).size() == 1;
+ assert getBeans(new TypeLiteral<Event<AwardEvent>>() {}, new AnyLiteral()).size() == 1;
+ assert getBeans(new TypeLiteral<Event<AwardEvent>>() {}, new AnyLiteral(), new HonorsLiteral()).size() == 1;
+ }
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "10.4.2", id = "c"),
+ @SpecAssertion(section = "10.4.2", id = "d"),
+ @SpecAssertion(section = "10.4.2", id = "e"),
+ @SpecAssertion(section = "10.4.2", id = "g")
+ })
+ public void testImplicitEventHasCorrectAttributes()
+ {
+ Bean<Event<StudentRegisteredEvent>> event = getBeans(new TypeLiteral<Event<StudentRegisteredEvent>>() {}, new AnyLiteral()).iterator().next();
+ assert event != null;
+ assert event.getDeploymentType().equals(Standard.class);
+ assert event.getScopeType().equals(Dependent.class);
+ assert event.getName() == null;
+ assert event.getBindings().size() == 1;
+ assert event.getBindings().iterator().next().equals(new AnyLiteral());
+ assert event.isSerializable();
+ }
+
+ @Test
+ @SpecAssertion(section = "10.4.2", id = "f")
+ public void testImplicitEventImplementationProvidedByContainer()
+ {
+ assert getInstanceByType(Registration.class).getCourseFullEvent() != null;
+
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Registration.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Registration.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Registration.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,33 @@
+package org.jboss.jsr299.tck.tests.event.implicit;
+
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Initializer;
+
+class Registration
+{
+ private @Any Event<StudentRegisteredEvent> studentRegisteredEvent;
+
+ private Event<CourseFullEvent> courseFullEvent;
+
+ // FIXME @Any should not be required here
+ public @Initializer Registration(@Any Event<CourseFullEvent> courseFullEvent)
+ {
+ this.courseFullEvent = courseFullEvent;
+ }
+
+ public void registerUser(Student student)
+ {
+ studentRegisteredEvent.fire(new StudentRegisteredEvent(student));
+ }
+
+ public void registerForCourse(Course course, Student user)
+ {
+ courseFullEvent.fire(new CourseFullEvent(course));
+ }
+
+ Event<CourseFullEvent> getCourseFullEvent()
+ {
+ return courseFullEvent;
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Student.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Student.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/Student.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.event.implicit;
+
+class Student
+{
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/StudentRegisteredEvent.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/StudentRegisteredEvent.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/StudentRegisteredEvent.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,16 @@
+package org.jboss.jsr299.tck.tests.event.implicit;
+
+class StudentRegisteredEvent
+{
+ private Student student;
+
+ public StudentRegisteredEvent(Student student)
+ {
+ this.student = student;
+ }
+
+ public Student getStudent()
+ {
+ return student;
+ }
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing (from rev 2892, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1)
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/AnimalStereotype.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/AnimalStereotype.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/AnimalStereotype.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,21 +0,0 @@
-package org.jboss.jsr299.tck.tests.event.register.observer1;
-
-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.Retention;
-import java.lang.annotation.Target;
-
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.Stereotype;
-
-@Stereotype()
-@Target( { TYPE, METHOD, FIELD })
-@Retention(RUNTIME)
-@RequestScoped
-@interface AnimalStereotype
-{
-
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/AnimalStereotypeAnnotationLiteral.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/AnimalStereotypeAnnotationLiteral.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/AnimalStereotypeAnnotationLiteral.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,8 +0,0 @@
-package org.jboss.jsr299.tck.tests.event.register.observer1;
-
-import javax.enterprise.inject.AnnotationLiteral;
-
-class AnimalStereotypeAnnotationLiteral extends AnnotationLiteral<AnimalStereotype> implements AnimalStereotype
-{
-
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/ConsumerNotifiedForEventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/ConsumerNotifiedForEventTest.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/ConsumerNotifiedForEventTest.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,68 +0,0 @@
-package org.jboss.jsr299.tck.tests.event.register.observer1;
-
-import java.lang.annotation.Annotation;
-
-import javax.event.Observer;
-
-import org.hibernate.tck.annotations.SpecAssertion;
-import org.hibernate.tck.annotations.SpecAssertions;
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.testng.annotations.Test;
-
-@Artifact
-public class ConsumerNotifiedForEventTest extends AbstractJSR299Test
-{
- public static class AnEventType
- {
- }
-
- public static class AnObserver implements Observer<AnEventType>
- {
- public boolean wasNotified = false;
-
- public boolean notify(AnEventType event)
- {
- wasNotified = true;
- return false;
- }
- }
-
- @Test(groups = { "events" })
- @SpecAssertions( {
- @SpecAssertion(section = "7.1", id = "h"),
- @SpecAssertion(section = "7.3", id = "d"),
- @SpecAssertion(section = "7.4", id = "b")
- })
- public void testConsumerNotifiedWhenEventTypeAndAllBindingsMatch()
- {
- Annotation roleBinding = new RoleBinding("Admin");
- AnObserver observer1 = new AnObserver();
- AnObserver observer2 = new AnObserver();
- getCurrentManager().addObserver(observer1);
- getCurrentManager().addObserver(observer2, roleBinding);
-
- // Fire an event that will be delivered to the two above observers
- AnEventType anEvent = new AnEventType();
- getCurrentManager().fireEvent(anEvent, roleBinding);
-
- assert observer1.wasNotified;
- assert observer2.wasNotified;
- observer1.wasNotified = false;
- observer2.wasNotified = false;
-
- // Fire an event that will be delivered to only one
- getCurrentManager().fireEvent(anEvent);
- assert observer1.wasNotified;
- assert !observer2.wasNotified;
- observer1.wasNotified = false;
- observer2.wasNotified = false;
-
- // Also make sure the binding value is considered
- getCurrentManager().fireEvent(anEvent, new RoleBinding("user"));
- assert observer1.wasNotified;
- assert !observer2.wasNotified;
- }
-
-
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/DuplicateBindingsToAddObserverTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/DuplicateBindingsToAddObserverTest.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/DuplicateBindingsToAddObserverTest.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,35 +0,0 @@
-package org.jboss.jsr299.tck.tests.event.register.observer1;
-
-import javax.event.Observer;
-
-import org.hibernate.tck.annotations.SpecAssertion;
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.testng.annotations.Test;
-
-@Artifact
-public class DuplicateBindingsToAddObserverTest extends AbstractJSR299Test
-{
- public static class AnEventType
- {
- }
-
- public static class AnObserver implements Observer<AnEventType>
- {
- public boolean wasNotified = false;
-
- public boolean notify(AnEventType event)
- {
- wasNotified = true;
- return false;
- }
- }
-
- @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
- @SpecAssertion(section = "7.3", id = "j")
- public void testMultipleInstancesOfSameBindingTypeWhenAddingObserverFails()
- {
- Observer<AnEventType> observer = new AnObserver();
- getCurrentManager().addObserver(observer, new RoleBinding("Admin"), new TameAnnotationLiteral(), new TameAnnotationLiteral());
- }
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/DuplicateBindingsToRemoveObserverTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/DuplicateBindingsToRemoveObserverTest.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/DuplicateBindingsToRemoveObserverTest.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,36 +0,0 @@
-package org.jboss.jsr299.tck.tests.event.register.observer1;
-
-import javax.event.Observer;
-
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.testharness.impl.packaging.Artifact;
-
-@Artifact
-public class DuplicateBindingsToRemoveObserverTest extends AbstractJSR299Test
-{
- public static class AnEventType
- {
- }
-
- public static class AnObserver implements Observer<AnEventType>
- {
- public boolean wasNotified = false;
-
- public boolean notify(AnEventType event)
- {
- wasNotified = true;
- return false;
- }
- }
-/*
- * no longer valid under new spi
- *
- @Test(groups = { "events" }, expectedExceptions = { DuplicateBindingTypeException.class })
- @SpecAssertion(section = "7.3", id = "k")
- public void testMultipleInstancesOfSameBindingTypeWhenRemovingObserverFails()
- {
- Observer<AnEventType> observer = new AnObserver();
- getCurrentManager().removeObserver(observer);
- }
- */
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/ManagerAddObserverTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/ManagerAddObserverTest.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/ManagerAddObserverTest.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,100 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.jsr299.tck.tests.event.register.observer1;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-import javax.event.Observer;
-
-import org.hibernate.tck.annotations.SpecAssertion;
-import org.hibernate.tck.annotations.SpecAssertions;
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.testng.annotations.Test;
-
-/**
- * Tests for the manager.addObserver() method.
- *
- * @author David Allen
- *
- */
-@Artifact
-public class ManagerAddObserverTest extends AbstractJSR299Test
-{
- public static class AnEventType
- {
- }
-
- public static class AnObserver implements Observer<AnEventType>
- {
- public boolean wasNotified = false;
-
- public boolean notify(AnEventType event)
- {
- wasNotified = true;
- return false;
- }
- }
-
- @Test(groups = { "events" })
- @SpecAssertions( { @SpecAssertion(section = "7.3", id = "b"), @SpecAssertion(section = "7.3", id = "c") })
- public void testManagerAddObserver()
- {
- Observer<AnEventType> observer1 = new AnObserver();
-
- // First test with the Class<T> of the event type
- getCurrentManager().addObserver(observer1);
- Set<Observer<AnEventType>> resolvedObservers = getCurrentManager().resolveObservers(new AnEventType());
- assert resolvedObservers.size() == 1;
- assert resolvedObservers.iterator().next() == observer1;
-
- // Now test with the TypeLiteral<T> of the event type
- Observer<AnEventType> observer2 = new AnObserver();
- getCurrentManager().addObserver(observer2);
- resolvedObservers = getCurrentManager().resolveObservers(new AnEventType());
- assert resolvedObservers.size() == 2;
- boolean foundObserver = false;
- for (Observer<AnEventType> obs : resolvedObservers)
- {
- if (obs == observer2)
- {
- foundObserver = true;
- break;
- }
- }
- assert foundObserver;
-
- // Try adding an observer with some binding types
- Observer<AnEventType> observer3 = new AnObserver();
- Annotation[] bindingTypes = new Annotation[] { new RoleBinding("Admin"), new RoleBinding("Manager") };
- getCurrentManager().addObserver(observer3, bindingTypes);
- resolvedObservers = getCurrentManager().resolveObservers(new AnEventType(), bindingTypes);
- assert resolvedObservers.size() == 3;
- foundObserver = false;
- for (Observer<AnEventType> obs : resolvedObservers)
- {
- if (obs == observer3)
- {
- foundObserver = true;
- break;
- }
- }
- assert foundObserver;
- }
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/NonBindingTypesToAddObserverTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/NonBindingTypesToAddObserverTest.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/NonBindingTypesToAddObserverTest.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,36 +0,0 @@
-package org.jboss.jsr299.tck.tests.event.register.observer1;
-
-import javax.event.Observer;
-
-import org.hibernate.tck.annotations.SpecAssertion;
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.testng.annotations.Test;
-
-@Artifact
-public class NonBindingTypesToAddObserverTest extends AbstractJSR299Test
-{
- public static class AnEventType
- {
- }
-
- public static class AnObserver implements Observer<AnEventType>
- {
- public boolean wasNotified = false;
-
- public boolean notify(AnEventType event)
- {
- wasNotified = true;
- return false;
- }
- }
-
- @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
- @SpecAssertion(section = "7.3", id = "l")
- public void testNonBindingTypePassedToAddObserverFails()
- {
- Observer<AnEventType> observer = new AnObserver();
- getCurrentManager().addObserver(observer, new AnimalStereotypeAnnotationLiteral());
- }
-
-}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/ObserverExceptionAbortsProcessingTest.java (from rev 2892, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/ObserverExceptionAbortsTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/ObserverExceptionAbortsProcessingTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/ObserverExceptionAbortsProcessingTest.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,65 @@
+package org.jboss.jsr299.tck.tests.event.observer.abortProcessing;
+
+import javax.enterprise.event.Observer;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+/**
+ * Spec version: 20090519
+ */
+@Artifact
+public class ObserverExceptionAbortsProcessingTest extends AbstractJSR299Test
+{
+ public static class AnEventType
+ {
+ }
+
+ public static class AnObserverWithException implements Observer<AnEventType>
+ {
+ public boolean wasNotified = false;
+ public RuntimeException theException = new RuntimeException("RE1");
+
+ public boolean notify(AnEventType event)
+ {
+ wasNotified = true;
+ throw theException;
+ }
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "10.6", id = "c")
+ public void testObserverThrowsExceptionAbortsNotifications()
+ {
+ AnObserverWithException observer = new AnObserverWithException();
+ AnObserverWithException anotherObserver = new AnObserverWithException();
+ getCurrentManager().addObserver(anotherObserver);
+ getCurrentManager().addObserver(observer);
+
+ // Fire an event that will be delivered to the two above observers
+ AnEventType anEvent = new AnEventType();
+ boolean fireFailed = false;
+ try
+ {
+ getCurrentManager().fireEvent(anEvent);
+ }
+ catch (Exception e)
+ {
+ if (e.equals(observer.theException))
+ {
+ fireFailed = true;
+ assert observer.wasNotified;
+ assert !anotherObserver.wasNotified;
+ }
+ else if (e.equals(anotherObserver.theException))
+ {
+ fireFailed = true;
+ assert !observer.wasNotified;
+ assert anotherObserver.wasNotified;
+ }
+ }
+ assert fireFailed;
+ }
+}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/ObserverExceptionAbortsTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/ObserverExceptionAbortsTest.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/ObserverExceptionAbortsTest.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,66 +0,0 @@
-package org.jboss.jsr299.tck.tests.event.register.observer1;
-
-import javax.event.Observer;
-
-import org.hibernate.tck.annotations.SpecAssertion;
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.testng.annotations.Test;
-
-@Artifact
-public class ObserverExceptionAbortsTest extends AbstractJSR299Test
-{
- public static class AnEventType
- {
- }
-
- public static class AnObserver implements Observer<AnEventType>
- {
- public boolean wasNotified = false;
-
- public boolean notify(AnEventType event)
- {
- wasNotified = true;
- return false;
- }
- }
-
- public static class AnObserverWithException implements Observer<AnEventType>
- {
- public boolean wasNotified = false;
- public RuntimeException theException = new RuntimeException("RE1");
-
- public boolean notify(AnEventType event)
- {
- wasNotified = true;
- throw theException;
- }
- }
-
- @Test(groups = { "events" })
- @SpecAssertion(section = "7.4", id = "c")
- public void testObserverThrowsExceptionAbortsNotifications()
- {
- AnObserverWithException observer = new AnObserverWithException();
- AnObserverWithException anotherObserver = new AnObserverWithException();
- getCurrentManager().addObserver(anotherObserver);
- getCurrentManager().addObserver(observer);
-
- // Fire an event that will be delivered to the two above observers
- AnEventType anEvent = new AnEventType();
- boolean fireFailed = false;
- try
- {
- getCurrentManager().fireEvent(anEvent);
- }
- catch (Exception e)
- {
- if (e.equals(observer.theException) || e.equals(anotherObserver.theException))
- fireFailed = true;
- }
- assert fireFailed;
- // Only one of the observers can be notified if processing
- // is aborted
- assert observer.wasNotified ^ anotherObserver.wasNotified;
- }
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/Role.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/Role.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/Role.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,14 +0,0 @@
-package org.jboss.jsr299.tck.tests.event.register.observer1;
-
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-
-import javax.enterprise.inject.BindingType;
-
-@BindingType
-@Retention(RUNTIME)
-@interface Role
-{
- String value();
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/RoleBinding.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/RoleBinding.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/RoleBinding.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,20 +0,0 @@
-package org.jboss.jsr299.tck.tests.event.register.observer1;
-
-import javax.enterprise.inject.AnnotationLiteral;
-
-
-class RoleBinding extends AnnotationLiteral<Role> implements Role
-{
- private String value = null;
-
- public RoleBinding(String value)
- {
- this.value = value;
- }
-
- public String value()
- {
- return value;
- }
-
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/Tame.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/Tame.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/Tame.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,22 +0,0 @@
-package org.jboss.jsr299.tck.tests.event.register.observer1;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.enterprise.inject.BindingType;
-
-@Target( { TYPE, METHOD, PARAMETER, FIELD })
-@Retention(RUNTIME)
-@Documented
-@BindingType
-@interface Tame
-{
-
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/TameAnnotationLiteral.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/TameAnnotationLiteral.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/abortProcessing/TameAnnotationLiteral.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,8 +0,0 @@
-package org.jboss.jsr299.tck.tests.event.register.observer1;
-
-import javax.enterprise.inject.AnnotationLiteral;
-
-class TameAnnotationLiteral extends AnnotationLiteral<Tame> implements Tame
-{
-
-}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/checkedException (from rev 2892, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer11)
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/checkedException/CheckedExceptionWrappedTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer11/CheckedExceptionWrappedTest.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/checkedException/CheckedExceptionWrappedTest.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -9,16 +9,15 @@
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
+ * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package org.jboss.jsr299.tck.tests.event.observer.checkedException;
-package org.jboss.jsr299.tck.tests.event.broken.observer11;
+import javax.enterprise.event.ObserverException;
-import javax.event.ObserverException;
-
import org.hibernate.tck.annotations.SpecAssertion;
import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.testharness.impl.packaging.Artifact;
@@ -28,17 +27,17 @@
* Tests that a checked exception thrown from a non-transactional
* observer is wrapped and thrown.
*
+ * Spec version: 20090519
+ *
* @author David Allen
- *
*/
@Artifact
public class CheckedExceptionWrappedTest extends AbstractJSR299Test
{
@Test(groups = { "events" }, expectedExceptions = { ObserverException.class })
- @SpecAssertion(section = "7.5.8", id = "r")
+ @SpecAssertion(section = "10.6.1", id = "r")
public void testNonTransactionalObserverThrowsCheckedExceptionIsWrappedAndRethrown()
{
getCurrentManager().fireEvent(new Integer(1));
- assert false;
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/checkedException/Tame.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer11/Tame.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/checkedException/Tame.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.event.broken.observer11;
+package org.jboss.jsr299.tck.tests.event.observer.checkedException;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/checkedException/TeaCupPomeranian.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer11/TeaCupPomeranian.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/checkedException/TeaCupPomeranian.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,16 +1,12 @@
-package org.jboss.jsr299.tck.tests.event.broken.observer11;
+package org.jboss.jsr299.tck.tests.event.observer.checkedException;
-import javax.enterprise.inject.Named;
-import javax.event.Observes;
+import javax.enterprise.event.Observes;
-@Tame
-@Named("Teddy")
-class TeaCupPomeranian
+@Tame class TeaCupPomeranian
{
public static class OversizedException extends RuntimeException
{
private static final long serialVersionUID = 1L;
-
}
public static class TooSmallException extends Exception
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/AnimalStereotype.java (from rev 2892, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/AnimalStereotype.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/AnimalStereotype.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/AnimalStereotype.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.event.observer.register;
+
+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.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.stereotype.Stereotype;
+
+@Stereotype
+@Target( { TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@RequestScoped
+@interface AnimalStereotype
+{
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/AnimalStereotypeAnnotationLiteral.java (from rev 2892, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/AnimalStereotypeAnnotationLiteral.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/AnimalStereotypeAnnotationLiteral.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/AnimalStereotypeAnnotationLiteral.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,7 @@
+package org.jboss.jsr299.tck.tests.event.observer.register;
+
+import javax.enterprise.inject.AnnotationLiteral;
+
+class AnimalStereotypeAnnotationLiteral extends AnnotationLiteral<AnimalStereotype> implements AnimalStereotype
+{
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/ConsumerNotifiedForEventTest.java (from rev 2892, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/ConsumerNotifiedForEventTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/ConsumerNotifiedForEventTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/ConsumerNotifiedForEventTest.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,68 @@
+package org.jboss.jsr299.tck.tests.event.observer.register;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.event.Observer;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+@Artifact
+public class ConsumerNotifiedForEventTest extends AbstractJSR299Test
+{
+ public static class AnEventType
+ {
+ }
+
+ public static class AnObserver implements Observer<AnEventType>
+ {
+ public boolean wasNotified = false;
+
+ public boolean notify(AnEventType event)
+ {
+ wasNotified = true;
+ return false;
+ }
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertions( {
+ @SpecAssertion(section = "7.1", id = "h"),
+ @SpecAssertion(section = "7.3", id = "d"),
+ @SpecAssertion(section = "7.4", id = "b")
+ })
+ public void testConsumerNotifiedWhenEventTypeAndAllBindingsMatch()
+ {
+ Annotation roleBinding = new RoleBinding("Admin");
+ AnObserver observer1 = new AnObserver();
+ AnObserver observer2 = new AnObserver();
+ getCurrentManager().addObserver(observer1);
+ getCurrentManager().addObserver(observer2, roleBinding);
+
+ // Fire an event that will be delivered to the two above observers
+ AnEventType anEvent = new AnEventType();
+ getCurrentManager().fireEvent(anEvent, roleBinding);
+
+ assert observer1.wasNotified;
+ assert observer2.wasNotified;
+ observer1.wasNotified = false;
+ observer2.wasNotified = false;
+
+ // Fire an event that will be delivered to only one
+ getCurrentManager().fireEvent(anEvent);
+ assert observer1.wasNotified;
+ assert !observer2.wasNotified;
+ observer1.wasNotified = false;
+ observer2.wasNotified = false;
+
+ // Also make sure the binding value is considered
+ getCurrentManager().fireEvent(anEvent, new RoleBinding("user"));
+ assert observer1.wasNotified;
+ assert !observer2.wasNotified;
+ }
+
+
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/DuplicateBindingsToAddObserverTest.java (from rev 2892, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/DuplicateBindingsToAddObserverTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/DuplicateBindingsToAddObserverTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/DuplicateBindingsToAddObserverTest.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,35 @@
+package org.jboss.jsr299.tck.tests.event.observer.register;
+
+import javax.enterprise.event.Observer;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+@Artifact
+public class DuplicateBindingsToAddObserverTest extends AbstractJSR299Test
+{
+ public static class AnEventType
+ {
+ }
+
+ public static class AnObserver implements Observer<AnEventType>
+ {
+ public boolean wasNotified = false;
+
+ public boolean notify(AnEventType event)
+ {
+ wasNotified = true;
+ return false;
+ }
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
+ @SpecAssertion(section = "7.3", id = "j")
+ public void testMultipleInstancesOfSameBindingTypeWhenAddingObserverFails()
+ {
+ Observer<AnEventType> observer = new AnObserver();
+ getCurrentManager().addObserver(observer, new RoleBinding("Admin"), new TameAnnotationLiteral(), new TameAnnotationLiteral());
+ }
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/DuplicateBindingsToRemoveObserverTest.java (from rev 2892, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/DuplicateBindingsToRemoveObserverTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/DuplicateBindingsToRemoveObserverTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/DuplicateBindingsToRemoveObserverTest.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,36 @@
+package org.jboss.jsr299.tck.tests.event.observer.register;
+
+import javax.enterprise.event.Observer;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+
+@Artifact
+public class DuplicateBindingsToRemoveObserverTest extends AbstractJSR299Test
+{
+ public static class AnEventType
+ {
+ }
+
+ public static class AnObserver implements Observer<AnEventType>
+ {
+ public boolean wasNotified = false;
+
+ public boolean notify(AnEventType event)
+ {
+ wasNotified = true;
+ return false;
+ }
+ }
+/*
+ * no longer valid under new spi
+ *
+ @Test(groups = { "events" }, expectedExceptions = { DuplicateBindingTypeException.class })
+ @SpecAssertion(section = "7.3", id = "k")
+ public void testMultipleInstancesOfSameBindingTypeWhenRemovingObserverFails()
+ {
+ Observer<AnEventType> observer = new AnObserver();
+ getCurrentManager().removeObserver(observer);
+ }
+ */
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/ManagerAddObserverTest.java (from rev 2892, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/ManagerAddObserverTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/ManagerAddObserverTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/ManagerAddObserverTest.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.jsr299.tck.tests.event.observer.register;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javax.enterprise.event.Observer;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+/**
+ * Tests for the manager.addObserver() method.
+ *
+ * @author David Allen
+ *
+ */
+@Artifact
+public class ManagerAddObserverTest extends AbstractJSR299Test
+{
+ public static class AnEventType
+ {
+ }
+
+ public static class AnObserver implements Observer<AnEventType>
+ {
+ public boolean wasNotified = false;
+
+ public boolean notify(AnEventType event)
+ {
+ wasNotified = true;
+ return false;
+ }
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertions( { @SpecAssertion(section = "7.3", id = "b"), @SpecAssertion(section = "7.3", id = "c") })
+ public void testManagerAddObserver()
+ {
+ Observer<AnEventType> observer1 = new AnObserver();
+
+ // First test with the Class<T> of the event type
+ getCurrentManager().addObserver(observer1);
+ Set<Observer<AnEventType>> resolvedObservers = getCurrentManager().resolveObservers(new AnEventType());
+ assert resolvedObservers.size() == 1;
+ assert resolvedObservers.iterator().next() == observer1;
+
+ // Now test with the TypeLiteral<T> of the event type
+ Observer<AnEventType> observer2 = new AnObserver();
+ getCurrentManager().addObserver(observer2);
+ resolvedObservers = getCurrentManager().resolveObservers(new AnEventType());
+ assert resolvedObservers.size() == 2;
+ boolean foundObserver = false;
+ for (Observer<AnEventType> obs : resolvedObservers)
+ {
+ if (obs == observer2)
+ {
+ foundObserver = true;
+ break;
+ }
+ }
+ assert foundObserver;
+
+ // Try adding an observer with some binding types
+ Observer<AnEventType> observer3 = new AnObserver();
+ Annotation[] bindingTypes = new Annotation[] { new RoleBinding("Admin"), new RoleBinding("Manager") };
+ getCurrentManager().addObserver(observer3, bindingTypes);
+ resolvedObservers = getCurrentManager().resolveObservers(new AnEventType(), bindingTypes);
+ assert resolvedObservers.size() == 3;
+ foundObserver = false;
+ for (Observer<AnEventType> obs : resolvedObservers)
+ {
+ if (obs == observer3)
+ {
+ foundObserver = true;
+ break;
+ }
+ }
+ assert foundObserver;
+ }
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/ManagerRemoveObserverTest.java (from rev 2903, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer2/ManagerRemoveObserverTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/ManagerRemoveObserverTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/ManagerRemoveObserverTest.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.jsr299.tck.tests.event.observer.register;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javax.enterprise.event.Observer;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+/**
+ * Tests the manager.removeObserver() method.
+ *
+ * @author David Allen
+ *
+ */
+@Artifact
+public class ManagerRemoveObserverTest extends AbstractJSR299Test
+{
+ public static class AnEventType
+ {
+ }
+
+ public static class AnObserver implements Observer<AnEventType>
+ {
+ public boolean wasNotified = false;
+
+ public boolean notify(AnEventType event)
+ {
+ wasNotified = true;
+ return false;
+ }
+ }
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "7.3", id = "e")
+ public void testManagerRemoveObserver()
+ {
+ Observer<AnEventType> observer = new AnObserver();
+
+ // First test with the Class<T> of the event type
+ getCurrentManager().addObserver(observer);
+ getCurrentManager().removeObserver(observer);
+ Set<Observer<AnEventType>> resolvedObservers = getCurrentManager().resolveObservers(new AnEventType());
+ assert resolvedObservers.isEmpty();
+
+ // Also test with binding types
+ Annotation[] bindings = new Annotation[] { new RoleBinding("Admin") };
+ getCurrentManager().addObserver(observer, bindings);
+ getCurrentManager().removeObserver(observer);
+ resolvedObservers = getCurrentManager().resolveObservers(new AnEventType(), bindings);
+ assert resolvedObservers.isEmpty();
+ }
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/NonBindingTypesToAddObserverTest.java (from rev 2892, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/NonBindingTypesToAddObserverTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/NonBindingTypesToAddObserverTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/NonBindingTypesToAddObserverTest.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,36 @@
+package org.jboss.jsr299.tck.tests.event.observer.register;
+
+import javax.enterprise.event.Observer;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+@Artifact
+public class NonBindingTypesToAddObserverTest extends AbstractJSR299Test
+{
+ public static class AnEventType
+ {
+ }
+
+ public static class AnObserver implements Observer<AnEventType>
+ {
+ public boolean wasNotified = false;
+
+ public boolean notify(AnEventType event)
+ {
+ wasNotified = true;
+ return false;
+ }
+ }
+
+ @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
+ @SpecAssertion(section = "7.3", id = "l")
+ public void testNonBindingTypePassedToAddObserverFails()
+ {
+ Observer<AnEventType> observer = new AnObserver();
+ getCurrentManager().addObserver(observer, new AnimalStereotypeAnnotationLiteral());
+ }
+
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/Role.java (from rev 2892, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/Role.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/Role.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/Role.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.tests.event.observer.register;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+
+import javax.enterprise.inject.BindingType;
+
+@BindingType
+@Retention(RUNTIME)
+@interface Role
+{
+ String value();
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/RoleBinding.java (from rev 2892, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/RoleBinding.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/RoleBinding.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/RoleBinding.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.event.observer.register;
+
+import javax.enterprise.inject.AnnotationLiteral;
+
+class RoleBinding extends AnnotationLiteral<Role> implements Role
+{
+ private String value = null;
+
+ public RoleBinding(String value)
+ {
+ this.value = value;
+ }
+
+ public String value()
+ {
+ return value;
+ }
+
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/Tame.java (from rev 2892, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/Tame.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/Tame.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/Tame.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.event.observer.register;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@interface Tame
+{
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/TameAnnotationLiteral.java (from rev 2892, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/TameAnnotationLiteral.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/TameAnnotationLiteral.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/register/TameAnnotationLiteral.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -0,0 +1,7 @@
+package org.jboss.jsr299.tck.tests.event.observer.register;
+
+import javax.enterprise.inject.AnnotationLiteral;
+
+class TameAnnotationLiteral extends AnnotationLiteral<Tame> implements Tame
+{
+}
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent (from rev 2892, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/registerUsingEvent)
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/AnotherEnabledDeploymentType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/registerUsingEvent/AnotherEnabledDeploymentType.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/AnotherEnabledDeploymentType.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.event.registerUsingEvent;
+package org.jboss.jsr299.tck.tests.event.observer.registerUsingEvent;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/AuroraFinch.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/registerUsingEvent/AuroraFinch.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/AuroraFinch.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,10 +1,10 @@
-package org.jboss.jsr299.tck.tests.event.registerUsingEvent;
+package org.jboss.jsr299.tck.tests.event.observer.registerUsingEvent;
+import javax.enterprise.event.Event;
import javax.enterprise.inject.Any;
import javax.enterprise.inject.Initializer;
-import javax.event.Event;
-import org.jboss.jsr299.tck.tests.event.registerUsingEvent.StarFinch.Mess;
+import org.jboss.jsr299.tck.tests.event.observer.registerUsingEvent.StarFinch.Mess;
class AuroraFinch
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/BirdCage.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/registerUsingEvent/BirdCage.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/BirdCage.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,9 +1,9 @@
-package org.jboss.jsr299.tck.tests.event.registerUsingEvent;
+package org.jboss.jsr299.tck.tests.event.observer.registerUsingEvent;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Current;
-import org.jboss.jsr299.tck.tests.event.registerUsingEvent.StarFinch.Mess;
+import org.jboss.jsr299.tck.tests.event.observer.registerUsingEvent.StarFinch.Mess;
@RequestScoped
class BirdCage
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/BlueFacedParrotFinch.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/registerUsingEvent/BlueFacedParrotFinch.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/BlueFacedParrotFinch.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,8 +1,8 @@
-package org.jboss.jsr299.tck.tests.event.registerUsingEvent;
+package org.jboss.jsr299.tck.tests.event.observer.registerUsingEvent;
+import javax.enterprise.event.Event;
+import javax.enterprise.event.Observer;
import javax.enterprise.inject.Any;
-import javax.event.Event;
-import javax.event.Observer;
class BlueFacedParrotFinch
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/FinchKeeper.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/registerUsingEvent/FinchKeeper.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/FinchKeeper.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,9 +1,9 @@
-package org.jboss.jsr299.tck.tests.event.registerUsingEvent;
+package org.jboss.jsr299.tck.tests.event.observer.registerUsingEvent;
import javax.enterprise.context.RequestScoped;
-import javax.event.Observes;
+import javax.enterprise.event.Observes;
-import org.jboss.jsr299.tck.tests.event.registerUsingEvent.StarFinch.Mess;
+import org.jboss.jsr299.tck.tests.event.observer.registerUsingEvent.StarFinch.Mess;
@RequestScoped
class FinchKeeper
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/OneEyed.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/registerUsingEvent/OneEyed.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/OneEyed.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.event.registerUsingEvent;
+package org.jboss.jsr299.tck.tests.event.observer.registerUsingEvent;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/OneEyedLiteral.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/registerUsingEvent/OneEyedLiteral.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/OneEyedLiteral.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.event.registerUsingEvent;
+package org.jboss.jsr299.tck.tests.event.observer.registerUsingEvent;
import javax.enterprise.inject.AnnotationLiteral;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/OrangeCheekedWaxbill.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/registerUsingEvent/OrangeCheekedWaxbill.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/OrangeCheekedWaxbill.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,10 +1,10 @@
-package org.jboss.jsr299.tck.tests.event.registerUsingEvent;
+package org.jboss.jsr299.tck.tests.event.observer.registerUsingEvent;
+import javax.enterprise.event.Event;
import javax.enterprise.inject.Any;
import javax.enterprise.inject.Initializer;
-import javax.event.Event;
-import org.jboss.jsr299.tck.tests.event.registerUsingEvent.StarFinch.Mess;
+import org.jboss.jsr299.tck.tests.event.observer.registerUsingEvent.StarFinch.Mess;
class OrangeCheekedWaxbill
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/RegisterObserversUsingImplicitEventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/registerUsingEvent/RegisterObserversUsingImplicitEventTest.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/RegisterObserversUsingImplicitEventTest.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.jsr299.tck.tests.event.registerUsingEvent;
+package org.jboss.jsr299.tck.tests.event.observer.registerUsingEvent;
import java.util.Set;
-import javax.event.Observer;
+import javax.enterprise.event.Observer;
import org.hibernate.tck.annotations.SpecAssertion;
import org.hibernate.tck.annotations.SpecAssertions;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/StarFinch.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/registerUsingEvent/StarFinch.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/StarFinch.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,8 +1,8 @@
-package org.jboss.jsr299.tck.tests.event.registerUsingEvent;
+package org.jboss.jsr299.tck.tests.event.observer.registerUsingEvent;
+import javax.enterprise.event.Event;
import javax.enterprise.inject.Any;
import javax.enterprise.inject.Produces;
-import javax.event.Event;
public class StarFinch
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/Tame.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/registerUsingEvent/Tame.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/Tame.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.event.registerUsingEvent;
+package org.jboss.jsr299.tck.tests.event.observer.registerUsingEvent;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/runtimeException (from rev 2892, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer10)
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/runtimeException/ObserverExceptionRethrownTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer10/ObserverExceptionRethrownTest.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/runtimeException/ObserverExceptionRethrownTest.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -9,13 +9,13 @@
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
+ * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.jsr299.tck.tests.event.broken.observer10;
+package org.jboss.jsr299.tck.tests.event.observer.runtimeException;
import org.hibernate.tck.annotations.SpecAssertion;
import org.jboss.jsr299.tck.AbstractJSR299Test;
@@ -26,18 +26,18 @@
* Tests that an unchecked exception thrown from a non-transactional
* observer is rethrown.
*
+ * Spec version: 20090519
+ *
* @author David Allen
- *
*/
@Artifact
public class ObserverExceptionRethrownTest extends AbstractJSR299Test
{
@Test(groups = { "events" }, expectedExceptions = { TeaCupPomeranian.OversizedException.class })
- @SpecAssertion(section = "7.5.8", id = "q")
+ @SpecAssertion(section = "10.6.1", id = "q")
public void testNonTransactionalObserverThrowsNonCheckedExceptionIsRethrown()
{
- getCurrentManager().fireEvent("Another event");
+ getCurrentManager().fireEvent("string event");
}
-
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/runtimeException/Tame.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer10/Tame.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/runtimeException/Tame.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.event.broken.observer10;
+package org.jboss.jsr299.tck.tests.event.observer.runtimeException;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/runtimeException/TameAnnotationLiteral.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer10/TameAnnotationLiteral.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/runtimeException/TameAnnotationLiteral.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.event.broken.observer10;
+package org.jboss.jsr299.tck.tests.event.observer.runtimeException;
import javax.enterprise.inject.AnnotationLiteral;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/runtimeException/TeaCupPomeranian.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer10/TeaCupPomeranian.java 2009-06-25 20:27:55 UTC (rev 2892)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/runtimeException/TeaCupPomeranian.java 2009-06-26 19:48:37 UTC (rev 2904)
@@ -1,16 +1,12 @@
-package org.jboss.jsr299.tck.tests.event.broken.observer10;
+package org.jboss.jsr299.tck.tests.event.observer.runtimeException;
-import javax.enterprise.inject.Named;
-import javax.event.Observes;
+import javax.enterprise.event.Observes;
-@Tame
-@Named("Teddy")
-class TeaCupPomeranian
+@Tame class TeaCupPomeranian
{
public static class OversizedException extends RuntimeException
{
private static final long serialVersionUID = 1L;
-
}
public static class TooSmallException extends Exception
Copied: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent (from rev 2903, tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/event/registerUsingEvent)
Modified: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/event/registerUsingEvent/beans.xml 2009-06-26 17:12:22 UTC (rev 2903)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/event/observer/registerUsingEvent/beans.xml 2009-06-26 19:48:37 UTC (rev 2904)
@@ -2,6 +2,6 @@
<deploy>
<type>javax.enterprise.inject.deployment.Standard</type>
<type>javax.enterprise.inject.deployment.Production</type>
- <type>org.jboss.jsr299.tck.tests.event.registerUsingEvent.AnotherEnabledDeploymentType</type>
+ <type>org.jboss.jsr299.tck.tests.event.observer.registerUsingEvent.AnotherEnabledDeploymentType</type>
</deploy>
</beans>
15 years, 6 months
[webbeans-commits] Webbeans SVN: r2903 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/bean and 10 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-06-26 13:12:22 -0400 (Fri, 26 Jun 2009)
New Revision: 2903
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/AnnotationModel.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/BindingTypeModel.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MergedStereotypes.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MetaDataCache.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/ScopeModel.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java
Removed:
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/AnnotationModel.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/BindingTypeModel.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MergedStereotypes.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MetaDataCache.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/ScopeModel.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/StereotypeModel.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/FacadeImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventObserver.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBType.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/resources/ClassTransformer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/context/PassivatingContextTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/StereotypesTest.java
Log:
rename package
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -86,7 +86,7 @@
import org.jboss.webbeans.log.Log;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.manager.api.WebBeansManager;
-import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.Proxies;
import org.jboss.webbeans.util.Reflections;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/FacadeImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/FacadeImpl.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/FacadeImpl.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -24,7 +24,7 @@
import java.util.HashSet;
import java.util.Set;
-import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
/**
* Common implementation for binding-type-based helpers
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -48,7 +48,7 @@
import org.jboss.webbeans.bootstrap.api.Service;
import org.jboss.webbeans.injection.resolution.ResolvableWBClass;
import org.jboss.webbeans.introspector.WBAnnotated;
-import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.ListComparator;
import org.jboss.webbeans.util.Names;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -46,8 +46,8 @@
import org.jboss.webbeans.literal.CurrentLiteral;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.metadata.MergedStereotypes;
-import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MergedStereotypes;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
import org.jboss.webbeans.util.Reflections;
/**
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -45,7 +45,7 @@
import org.jboss.webbeans.introspector.WBMember;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Reflections;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -44,7 +44,7 @@
import org.jboss.webbeans.introspector.WBParameter;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
import org.jboss.webbeans.persistence.PersistenceApiAbstraction;
import org.jboss.webbeans.persistence.spi.JpaServices;
import org.jboss.webbeans.resources.spi.ResourceServices;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -61,7 +61,7 @@
ClassTransformer classTransformer = getManager().getServices().get(ClassTransformer.class);
if (!clazz.isAnnotation() && !clazz.isEnum())
{
- classes.add(classTransformer.classForName(clazz));
+ classes.add(classTransformer.loadClass(clazz));
}
return this;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployer.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployer.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -48,7 +48,7 @@
for (Extension extension : extensions)
{
@SuppressWarnings("unchecked")
- WBClass<Extension> clazz = (WBClass<Extension>) classTransformer.classForName(extension.getClass());
+ WBClass<Extension> clazz = (WBClass<Extension>) classTransformer.loadClass(extension.getClass());
ExtensionBean bean = ExtensionBean.of(getManager(), clazz, extension);
addBean(bean);
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -51,7 +51,7 @@
import org.jboss.webbeans.log.Log;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.messaging.spi.JmsServices;
-import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
import org.jboss.webbeans.persistence.PersistenceApiAbstraction;
import org.jboss.webbeans.persistence.spi.JpaServices;
import org.jboss.webbeans.resources.ClassTransformer;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventObserver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventObserver.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventObserver.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -25,7 +25,7 @@
import javax.enterprise.inject.Current;
import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
import org.jboss.webbeans.util.Reflections;
import org.jboss.webbeans.util.Strings;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -117,7 +117,7 @@
public Set<FieldInjectionPoint<?>> call() throws Exception
{
- return Beans.getFieldInjectionPoints(manager.getServices().get(ClassTransformer.class).classForName(instance.getClass()), nonContextualBean);
+ return Beans.getFieldInjectionPoints(manager.getServices().get(ClassTransformer.class).loadClass(instance.getClass()), nonContextualBean);
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBType.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBType.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBType.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -61,7 +61,7 @@
this._simpleName = rawType.getSimpleName();
if (rawType.getSuperclass() != null)
{
- this.superclass = classTransformer.classForName(rawType.getSuperclass());
+ this.superclass = classTransformer.loadClass(rawType.getSuperclass());
}
else
{
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/AnnotationModel.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/AnnotationModel.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/AnnotationModel.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -1,124 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.metadata;
-
-import java.lang.annotation.Annotation;
-
-import org.jboss.webbeans.DefinitionException;
-import org.jboss.webbeans.introspector.WBAnnotation;
-import org.jboss.webbeans.resources.ClassTransformer;
-
-/**
- * Abstract representation of an annotation model
- *
- * @author Pete Muir
- */
-public abstract class AnnotationModel<T extends Annotation>
-{
- // The underlying annotation
- private WBAnnotation<T> annotatedAnnotation;
- // Is the data valid?
- private boolean valid;
-
- /**
- * Constructor
- *
- * @param type The annotation type
- */
- public AnnotationModel(Class<T> type, ClassTransformer transformer)
- {
- this.annotatedAnnotation = transformer.annotationTypeForName(type);
- init();
- }
-
- /**
- * Initializes the type and validates it
- */
- protected void init()
- {
- initType();
- initValid();
- }
-
- /**
- * Initializes the type
- */
- protected void initType()
- {
- if (!Annotation.class.isAssignableFrom(getRawType()))
- {
- throw new DefinitionException(getMetaAnnotation().toString() + " can only be applied to an annotation, it was applied to " + getRawType());
- }
- }
-
- /**
- * Validates the data for correct annotation
- */
- protected void initValid()
- {
- this.valid = annotatedAnnotation.isAnnotationPresent(getMetaAnnotation());
- }
-
- /**
- * Gets the type of the annotation
- *
- * @return The type
- */
- public Class<T> getRawType()
- {
- return annotatedAnnotation.getJavaClass();
- }
-
- /**
- * Gets the meta-annotation that should be present
- *
- * @return
- */
- protected abstract Class<? extends Annotation> getMetaAnnotation();
-
- /**
- * Indicates if the annotation is valid
- *
- * @return True if valid, false otherwise
- */
- public boolean isValid()
- {
- return valid;
- }
-
- /**
- * Gets the annotated annotation
- *
- * @return The annotation
- */
- protected WBAnnotation<T> getAnnotatedAnnotation()
- {
- return annotatedAnnotation;
- }
-
- /**
- * Gets a string representation of the annotation model
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- return (isValid() ? "Valid" : "Invalid") + " annotation model for " + getRawType();
- }
-
-}
\ No newline at end of file
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/BindingTypeModel.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/BindingTypeModel.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/BindingTypeModel.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -1,174 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.metadata;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Set;
-
-import javax.enterprise.inject.BindingType;
-import javax.enterprise.inject.NonBinding;
-
-import org.jboss.webbeans.DefinitionException;
-import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.util.Reflections;
-
-/**
- *
- * Model of a binding type
- *
- * @author Pete Muir
- *
- */
-public class BindingTypeModel<T extends Annotation> extends AnnotationModel<T>
-{
- // The non-binding types
- private Set<WBMethod<?>> nonBindingTypes;
-
- /**
- * Constructor
- *
- * @param type The type
- */
- public BindingTypeModel(Class<T> type, ClassTransformer transformer)
- {
- super(type, transformer);
- }
-
- /**
- * Initializes the non-binding types and validates the members
- */
- @Override
- protected void init()
- {
- super.init();
- initNonBindingTypes();
- checkArrayAndAnnotationValuedMembers();
- }
-
- /**
- * Validates the members
- */
- private void checkArrayAndAnnotationValuedMembers()
- {
- for (WBMethod<?> annotatedMethod : getAnnotatedAnnotation().getMembers())
- {
- if ((Reflections.isArrayType(annotatedMethod.getJavaClass()) || Annotation.class.isAssignableFrom(annotatedMethod.getJavaClass())) && !nonBindingTypes.contains(annotatedMethod))
- {
- throw new DefinitionException("Member of array type or annotation type must be annotated @NonBinding " + annotatedMethod);
- }
- }
-
- }
-
- /**
- * Gets the meta-annotation type
- *
- * @return The BindingType class
- */
- @Override
- protected Class<? extends Annotation> getMetaAnnotation()
- {
- return BindingType.class;
- }
-
- /**
- * Indicates if there are non-binding types present
- *
- * @return True if present, false otherwise
- */
- public boolean hasNonBindingTypes()
- {
- return nonBindingTypes.size() > 0;
- }
-
- /**
- * Gets the non-binding types
- *
- * @return A set of non-binding types, or an empty set if there are none
- * present
- */
- public Set<WBMethod<?>> getNonBindingTypes()
- {
- return nonBindingTypes;
- }
-
- /**
- * Initializes the non-binding types
- */
- protected void initNonBindingTypes()
- {
- nonBindingTypes = getAnnotatedAnnotation().getAnnotatedMembers(NonBinding.class);
- }
-
- /**
- * Comparator for checking equality
- *
- * @param instance The instance to check against
- * @param other The other binding type
- * @return True if equal, false otherwise
- */
- public boolean isEqual(Annotation instance, Annotation other)
- {
- if (instance.annotationType().equals(getRawType()) && other.annotationType().equals(getRawType()))
- {
- for (WBMethod<?> annotatedMethod : getAnnotatedAnnotation().getMembers())
- {
- if (!nonBindingTypes.contains(annotatedMethod))
- {
- try
- {
- Object thisValue = annotatedMethod.invoke(instance);
- Object thatValue = annotatedMethod.invoke(other);
- if (!thisValue.equals(thatValue))
- {
- return false;
- }
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e);
- }
- catch (InvocationTargetException e)
- {
- throw new RuntimeException(e);
- }
-
- }
- }
- return true;
- }
- return false;
- }
-
- /**
- * Gets a string representation of the binding type model
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- return (isValid() ? "Valid" : "Invalid") + " binding type model for " + getRawType() + " with non-binding types " + getNonBindingTypes();
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MergedStereotypes.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MergedStereotypes.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MergedStereotypes.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -1,167 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.metadata;
-
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.webbeans.BeanManagerImpl;
-
-/**
- * Meta model for the merged stereotype for a bean
- *
- * @author Pete Muir
- */
-public class MergedStereotypes<T, E>
-{
- // The possible deployment types
- private final Map<Class<? extends Annotation>, Annotation> possibleDeploymentTypes;
- // The possible scope types
- private final Set<Annotation> possibleScopeTypes;
- // Is the bean name defaulted?
- private boolean beanNameDefaulted;
- // The required types
- private final Set<Class<?>> requiredTypes;
- // The supported scopes
- private final Set<Class<? extends Annotation>> supportedScopes;
-
- private final BeanManagerImpl manager;
-
- /**
- * Constructor
- *
- * @param stereotypeAnnotations The stereotypes to merge
- */
- public MergedStereotypes(Set<Annotation> stereotypeAnnotations, BeanManagerImpl manager)
- {
- this.possibleDeploymentTypes = new HashMap<Class<? extends Annotation>, Annotation>();
- this.possibleScopeTypes = new HashSet<Annotation>();
- this.requiredTypes = new HashSet<Class<?>>();
- this.supportedScopes = new HashSet<Class<? extends Annotation>>();
- this.manager = manager;
- merge(stereotypeAnnotations);
- }
-
- /**
- * Perform the merge
- *
- * @param stereotypeAnnotations The stereotype annotations
- */
- protected void merge(Set<Annotation> stereotypeAnnotations)
- {
- for (Annotation stereotypeAnnotation : stereotypeAnnotations)
- {
- // Retrieve and merge all metadata from stereotypes
- StereotypeModel<?> stereotype = manager.getServices().get(MetaDataCache.class).getStereotype(stereotypeAnnotation.annotationType());
- if (stereotype == null)
- {
- throw new IllegalStateException("Stereotype " + stereotypeAnnotation + " not registered with container");
- }
- if (stereotype.getDefaultDeploymentType() != null)
- {
- possibleDeploymentTypes.put(stereotype.getDefaultDeploymentType().annotationType(), stereotype.getDefaultDeploymentType());
- }
- if (stereotype.getDefaultScopeType() != null)
- {
- possibleScopeTypes.add(stereotype.getDefaultScopeType());
- }
- requiredTypes.addAll(stereotype.getRequiredTypes());
- supportedScopes.addAll(stereotype.getSupportedScopes());
- if (stereotype.isBeanNameDefaulted())
- {
- beanNameDefaulted = true;
- }
- }
- }
-
- /**
- * Returns the possible deployment typess
- *
- * @return The deployment types
- */
- public Map<Class<? extends Annotation>, Annotation> getPossibleDeploymentTypes()
- {
- return possibleDeploymentTypes;
- }
-
- /**
- * Returns the possible scope types
- *
- * @return The scope types
- */
- public Set<Annotation> getPossibleScopeTypes()
- {
- return possibleScopeTypes;
- }
-
- /**
- * Indicates if the name i defaulted
- *
- * @return True if defaulted, false if not
- */
- public boolean isBeanNameDefaulted()
- {
- return beanNameDefaulted;
- }
-
- /**
- * Returns the required types
- *
- * @return The required types
- */
- public Set<Class<?>> getRequiredTypes()
- {
- return requiredTypes;
- }
-
- /**
- * Returns the supported scopes
- *
- * @return The supported scopes
- */
- public Set<Class<? extends Annotation>> getSupportedScopes()
- {
- return supportedScopes;
- }
-
- /**
- * Indicates if the bean was declared in XML
- *
- * @return True if declared in XML, else false
- */
- public boolean isDeclaredInXml()
- {
- return false;
- }
-
- /**
- * Gets a string representation of the merged stereotypes
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- return "Merged stereotype model with possible deployment types " +
- possibleDeploymentTypes + ", required types " + requiredTypes +
- ", possible scopes " + possibleScopeTypes + " and supported scopes " + supportedScopes;
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MetaDataCache.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MetaDataCache.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MetaDataCache.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -1,130 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.metadata;
-
-import java.lang.annotation.Annotation;
-import java.util.concurrent.Callable;
-
-import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.util.collections.ConcurrentCache;
-
-/**
- * Metadata singleton for holding EJB metadata, scope models etc.
- *
- * @author Pete Muir
- *
- */
-public class MetaDataCache implements Service
-{
-
- // The stereotype models
- private ConcurrentCache<Class<? extends Annotation>, StereotypeModel<?>> stereotypes = new ConcurrentCache<Class<? extends Annotation>, StereotypeModel<?>>();
- // The scope models
- private ConcurrentCache<Class<? extends Annotation>, ScopeModel<?>> scopes = new ConcurrentCache<Class<? extends Annotation>, ScopeModel<?>>();
- // The binding type models
- private ConcurrentCache<Class<? extends Annotation>, BindingTypeModel<?>> bindingTypes = new ConcurrentCache<Class<? extends Annotation>, BindingTypeModel<?>>();
-
- private final ClassTransformer classTransformer;
-
- public MetaDataCache(ClassTransformer classTransformer)
- {
- this.classTransformer = classTransformer;
- }
-
- /**
- * Gets a stereotype model
- *
- * Adds the model if it is not present.
- *
- * @param <T> The type
- * @param stereotype The stereotype
- * @return The stereotype model
- */
- public <T extends Annotation> StereotypeModel<T> getStereotype(final Class<T> stereotype)
- {
- return stereotypes.putIfAbsent(stereotype, new Callable<StereotypeModel<T>>()
- {
-
- public StereotypeModel<T> call() throws Exception
- {
- return new StereotypeModel<T>(stereotype, classTransformer);
- }
- });
- }
-
- /**
- * Gets a scope model
- *
- * Adds the model if it is not present.
- *
- * @param <T> The type
- * @param scopeType The scope type
- * @return The scope type model
- */
- public <T extends Annotation> ScopeModel<T> getScopeModel(final Class<T> scopeType)
- {
- return scopes.putIfAbsent(scopeType, new Callable<ScopeModel<T>>()
- {
-
- public ScopeModel<T> call() throws Exception
- {
- return new ScopeModel<T>(scopeType, classTransformer);
- }
-
- });
- }
-
- /**
- * Gets a binding type model.
- *
- * Adds the model if it is not present.
- *
- * @param <T> The type
- * @param bindingType The binding type
- * @return The binding type model
- */
- public <T extends Annotation> BindingTypeModel<T> getBindingTypeModel(final Class<T> bindingType)
- {
- return bindingTypes.putIfAbsent(bindingType, new Callable<BindingTypeModel<T>>()
- {
-
- public BindingTypeModel<T> call() throws Exception
- {
- return new BindingTypeModel<T>(bindingType, classTransformer);
- }
-
- });
- }
-
- /**
- * Gets a string representation
- *
- * @return A string representation
- */
- @Override
- public String toString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("Metadata cache\n");
- buffer.append("Registered binding type models: " + bindingTypes.size() + "\n");
- buffer.append("Registered scope type models: " + scopes.size() + "\n");
- buffer.append("Registered stereotype models: " + stereotypes.size() + "\n");
- return buffer.toString();
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/ScopeModel.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/ScopeModel.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/ScopeModel.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -1,89 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.metadata;
-
-import java.lang.annotation.Annotation;
-
-import javax.enterprise.context.ScopeType;
-
-import org.jboss.webbeans.resources.ClassTransformer;
-
-/**
- *
- * Model of a scope
- *
- * @author Pete Muir
- *
- */
-public class ScopeModel<T extends Annotation> extends AnnotationModel<T>
-{
- /**
- * Constrctor
- *
- * @param scope The scope type
- */
- public ScopeModel(Class<T> scope, ClassTransformer classTransformer)
- {
- super(scope, classTransformer);
- }
-
- /**
- * Indicates if the scope is "normal"
- *
- * @return True if normal, false otherwise
- */
- public boolean isNormal()
- {
- return getAnnotatedAnnotation().getAnnotation(ScopeType.class).normal();
- }
-
- /**
- * Indicates if the scope is "passivating"
- *
- * @return True if passivating, false otherwise
- */
- public boolean isPassivating()
- {
- return getAnnotatedAnnotation().getAnnotation(ScopeType.class).passivating();
- }
-
- /**
- * Gets the corresponding meta-annotation type class
- *
- * @return The ScopeType class
- */
- @Override
- protected Class<? extends Annotation> getMetaAnnotation()
- {
- return ScopeType.class;
- }
-
- /**
- * Gets a string representation of the scope model
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- String valid = isValid() ? "Valid " : "Invalid";
- String normal = isNormal() ? "normal " : "non-normal ";
- String passivating = isPassivating() ? "passivating " : "pon-passivating ";
- return valid + normal + passivating + " scope model for " + getRawType();
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/StereotypeModel.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/StereotypeModel.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/StereotypeModel.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -1,259 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.metadata;
-
-import java.lang.annotation.Annotation;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.enterprise.context.ScopeType;
-import javax.enterprise.inject.BindingType;
-import javax.enterprise.inject.Named;
-import javax.enterprise.inject.deployment.DeploymentType;
-import javax.enterprise.inject.stereotype.Stereotype;
-import javax.interceptor.InterceptorBindingType;
-
-import org.jboss.webbeans.DefinitionException;
-import org.jboss.webbeans.resources.ClassTransformer;
-
-/**
- * A meta model for a stereotype, allows us to cache a stereotype and to
- * validate it
- *
- * @author Pete Muir
- *
- */
-public class StereotypeModel<T extends Annotation> extends AnnotationModel<T>
-{
- // The default deployment type
- private Annotation defaultDeploymentType;
- // The default scope type
- private Annotation defaultScopeType;
- // Is the bean name defaulted
- private boolean beanNameDefaulted;
- // The supported scopes
- private Set<Class<? extends Annotation>> supportedScopes;
- // The required types
- private Set<Class<?>> requiredTypes;
- // The interceptor bindings
- private Set<Annotation> interceptorBindings;
-
- /**
- * Constructor
- *
- * @param sterotype The stereotype
- */
- public StereotypeModel(Class<T> sterotype, ClassTransformer transformer)
- {
- super(sterotype, transformer);
- initDefaultDeploymentType();
- initDefaultScopeType();
- initBeanNameDefaulted();
- initSupportedScopes();
- initRequiredTypes();
- initInterceptorBindings();
- checkBindings();
- }
-
- /**
- * Validates the binding types
- */
- private void checkBindings()
- {
- Set<Annotation> bindings = getAnnotatedAnnotation().getMetaAnnotations(BindingType.class);
- if (bindings.size() > 0)
- {
- throw new DefinitionException("Cannot declare binding types on a stereotype " + getAnnotatedAnnotation());
- }
- }
-
- /**
- * Initializes the interceptor bindings
- */
- private void initInterceptorBindings()
- {
- interceptorBindings = getAnnotatedAnnotation().getMetaAnnotations(InterceptorBindingType.class);
- }
-
- /**
- * Initializes the supported scopes
- */
- private void initSupportedScopes()
- {
- this.supportedScopes = new HashSet<Class<? extends Annotation>>();
- Class<? extends Annotation>[] supportedScopes = getAnnotatedAnnotation().getAnnotation(Stereotype.class).supportedScopes();
- if (supportedScopes.length > 0)
- {
- this.supportedScopes.addAll(Arrays.asList(supportedScopes));
- }
- }
-
- /**
- * Initializes the required types
- */
- private void initRequiredTypes()
- {
- this.requiredTypes = new HashSet<Class<?>>();
- Class<?>[] requiredTypes = getAnnotatedAnnotation().getAnnotation(Stereotype.class).requiredTypes();
- if (requiredTypes.length > 0)
- {
- this.requiredTypes.addAll(Arrays.asList(requiredTypes));
- }
- }
-
- /**
- * Initializes the bean name defaulted
- */
- private void initBeanNameDefaulted()
- {
- if (getAnnotatedAnnotation().isAnnotationPresent(Named.class))
- {
- if (!"".equals(getAnnotatedAnnotation().getAnnotation(Named.class).value()))
- {
- throw new DefinitionException("Cannot specify a value for a @Named stereotype " + getAnnotatedAnnotation());
- }
- beanNameDefaulted = true;
- }
- }
-
- /**
- * Initializes the default scope type
- */
- private void initDefaultScopeType()
- {
- Set<Annotation> scopeTypes = getAnnotatedAnnotation().getMetaAnnotations(ScopeType.class);
- if (scopeTypes.size() > 1)
- {
- throw new DefinitionException("At most one scope type may be specified for " + getAnnotatedAnnotation());
- }
- else if (scopeTypes.size() == 1)
- {
- this.defaultScopeType = scopeTypes.iterator().next();
- }
- }
-
- /**
- * Initializes the default deployment type
- */
- private void initDefaultDeploymentType()
- {
- Set<Annotation> deploymentTypes = getAnnotatedAnnotation().getMetaAnnotations(DeploymentType.class);
- if (deploymentTypes.size() > 1)
- {
- throw new DefinitionException("At most one deployment type may be specified on " + getAnnotatedAnnotation());
- }
- else if (deploymentTypes.size() == 1)
- {
- this.defaultDeploymentType = deploymentTypes.iterator().next();
- }
- }
-
- /**
- * Get the default deployment type the stereotype specifies
- *
- * @return The default deployment type, or null if none is specified
- */
- public Annotation getDefaultDeploymentType()
- {
- return defaultDeploymentType;
- }
-
- /**
- * Get the default scope type the stereotype specifies
- *
- * @return The default scope type, or null if none is specified
- */
- public Annotation getDefaultScopeType()
- {
- return defaultScopeType;
- }
-
- /**
- * Get any interceptor bindings the the stereotype specifies
- *
- * @return The interceptor bindings, or an empty set if none are specified.
- */
- public Set<Annotation> getInterceptorBindings()
- {
- return interceptorBindings;
- }
-
- /**
- * Indicates if the bean name is defaulted
- *
- * @return True if defaulted, false otherwise
- */
- public boolean isBeanNameDefaulted()
- {
- return beanNameDefaulted;
- }
-
- /**
- * Gets the supported scopes
- *
- * @return A set of supported scopes, or an empty set if none are specified
- */
- public Set<Class<? extends Annotation>> getSupportedScopes()
- {
- return supportedScopes;
- }
-
- /**
- * Gets the required types
- *
- * @return A set of required types, or an empty set if none are specified
- */
- public Set<Class<?>> getRequiredTypes()
- {
- return requiredTypes;
- }
-
- /**
- * Gets the type
- *
- * @return The type
- */
- @Deprecated
- public Class<? extends Annotation> getStereotypeClass()
- {
- return getRawType();
- }
-
- /**
- * Gets a string representation of the stereotype
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- return "Stereotype model with required types " + requiredTypes + " and supported scopes " + supportedScopes;
- }
-
- /**
- * Gets the meta-annotation type
- *
- * @return The Stereotype class
- */
- @Override
- protected Class<? extends Annotation> getMetaAnnotation()
- {
- return Stereotype.class;
- }
-
-}
Copied: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/AnnotationModel.java (from rev 2896, ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/AnnotationModel.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/AnnotationModel.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/AnnotationModel.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.metadata.cache;
+
+import java.lang.annotation.Annotation;
+
+import org.jboss.webbeans.DefinitionException;
+import org.jboss.webbeans.introspector.WBAnnotation;
+import org.jboss.webbeans.resources.ClassTransformer;
+
+/**
+ * Abstract representation of an annotation model
+ *
+ * @author Pete Muir
+ */
+public abstract class AnnotationModel<T extends Annotation>
+{
+ // The underlying annotation
+ private WBAnnotation<T> annotatedAnnotation;
+ // Is the data valid?
+ private boolean valid;
+
+ /**
+ * Constructor
+ *
+ * @param type The annotation type
+ */
+ public AnnotationModel(Class<T> type, ClassTransformer transformer)
+ {
+ this.annotatedAnnotation = transformer.loadAnnotation(type);
+ init();
+ }
+
+ /**
+ * Initializes the type and validates it
+ */
+ protected void init()
+ {
+ initType();
+ initValid();
+ }
+
+ /**
+ * Initializes the type
+ */
+ protected void initType()
+ {
+ if (!Annotation.class.isAssignableFrom(getRawType()))
+ {
+ throw new DefinitionException(getMetaAnnotation().toString() + " can only be applied to an annotation, it was applied to " + getRawType());
+ }
+ }
+
+ /**
+ * Validates the data for correct annotation
+ */
+ protected void initValid()
+ {
+ this.valid = annotatedAnnotation.isAnnotationPresent(getMetaAnnotation());
+ }
+
+ /**
+ * Gets the type of the annotation
+ *
+ * @return The type
+ */
+ public Class<T> getRawType()
+ {
+ return annotatedAnnotation.getJavaClass();
+ }
+
+ /**
+ * Gets the meta-annotation that should be present
+ *
+ * @return
+ */
+ protected abstract Class<? extends Annotation> getMetaAnnotation();
+
+ /**
+ * Indicates if the annotation is valid
+ *
+ * @return True if valid, false otherwise
+ */
+ public boolean isValid()
+ {
+ return valid;
+ }
+
+ /**
+ * Gets the annotated annotation
+ *
+ * @return The annotation
+ */
+ protected WBAnnotation<T> getAnnotatedAnnotation()
+ {
+ return annotatedAnnotation;
+ }
+
+ /**
+ * Gets a string representation of the annotation model
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ return (isValid() ? "Valid" : "Invalid") + " annotation model for " + getRawType();
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/AnnotationModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/BindingTypeModel.java (from rev 2896, ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/BindingTypeModel.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/BindingTypeModel.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/BindingTypeModel.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -0,0 +1,174 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.metadata.cache;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Set;
+
+import javax.enterprise.inject.BindingType;
+import javax.enterprise.inject.NonBinding;
+
+import org.jboss.webbeans.DefinitionException;
+import org.jboss.webbeans.introspector.WBMethod;
+import org.jboss.webbeans.resources.ClassTransformer;
+import org.jboss.webbeans.util.Reflections;
+
+/**
+ *
+ * Model of a binding type
+ *
+ * @author Pete Muir
+ *
+ */
+public class BindingTypeModel<T extends Annotation> extends AnnotationModel<T>
+{
+ // The non-binding types
+ private Set<WBMethod<?>> nonBindingTypes;
+
+ /**
+ * Constructor
+ *
+ * @param type The type
+ */
+ public BindingTypeModel(Class<T> type, ClassTransformer transformer)
+ {
+ super(type, transformer);
+ }
+
+ /**
+ * Initializes the non-binding types and validates the members
+ */
+ @Override
+ protected void init()
+ {
+ super.init();
+ initNonBindingTypes();
+ checkArrayAndAnnotationValuedMembers();
+ }
+
+ /**
+ * Validates the members
+ */
+ private void checkArrayAndAnnotationValuedMembers()
+ {
+ for (WBMethod<?> annotatedMethod : getAnnotatedAnnotation().getMembers())
+ {
+ if ((Reflections.isArrayType(annotatedMethod.getJavaClass()) || Annotation.class.isAssignableFrom(annotatedMethod.getJavaClass())) && !nonBindingTypes.contains(annotatedMethod))
+ {
+ throw new DefinitionException("Member of array type or annotation type must be annotated @NonBinding " + annotatedMethod);
+ }
+ }
+
+ }
+
+ /**
+ * Gets the meta-annotation type
+ *
+ * @return The BindingType class
+ */
+ @Override
+ protected Class<? extends Annotation> getMetaAnnotation()
+ {
+ return BindingType.class;
+ }
+
+ /**
+ * Indicates if there are non-binding types present
+ *
+ * @return True if present, false otherwise
+ */
+ public boolean hasNonBindingTypes()
+ {
+ return nonBindingTypes.size() > 0;
+ }
+
+ /**
+ * Gets the non-binding types
+ *
+ * @return A set of non-binding types, or an empty set if there are none
+ * present
+ */
+ public Set<WBMethod<?>> getNonBindingTypes()
+ {
+ return nonBindingTypes;
+ }
+
+ /**
+ * Initializes the non-binding types
+ */
+ protected void initNonBindingTypes()
+ {
+ nonBindingTypes = getAnnotatedAnnotation().getAnnotatedMembers(NonBinding.class);
+ }
+
+ /**
+ * Comparator for checking equality
+ *
+ * @param instance The instance to check against
+ * @param other The other binding type
+ * @return True if equal, false otherwise
+ */
+ public boolean isEqual(Annotation instance, Annotation other)
+ {
+ if (instance.annotationType().equals(getRawType()) && other.annotationType().equals(getRawType()))
+ {
+ for (WBMethod<?> annotatedMethod : getAnnotatedAnnotation().getMembers())
+ {
+ if (!nonBindingTypes.contains(annotatedMethod))
+ {
+ try
+ {
+ Object thisValue = annotatedMethod.invoke(instance);
+ Object thatValue = annotatedMethod.invoke(other);
+ if (!thisValue.equals(thatValue))
+ {
+ return false;
+ }
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Gets a string representation of the binding type model
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ return (isValid() ? "Valid" : "Invalid") + " binding type model for " + getRawType() + " with non-binding types " + getNonBindingTypes();
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/BindingTypeModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MergedStereotypes.java (from rev 2896, ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MergedStereotypes.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MergedStereotypes.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MergedStereotypes.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -0,0 +1,167 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.metadata.cache;
+
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.webbeans.BeanManagerImpl;
+
+/**
+ * Meta model for the merged stereotype for a bean
+ *
+ * @author Pete Muir
+ */
+public class MergedStereotypes<T, E>
+{
+ // The possible deployment types
+ private final Map<Class<? extends Annotation>, Annotation> possibleDeploymentTypes;
+ // The possible scope types
+ private final Set<Annotation> possibleScopeTypes;
+ // Is the bean name defaulted?
+ private boolean beanNameDefaulted;
+ // The required types
+ private final Set<Class<?>> requiredTypes;
+ // The supported scopes
+ private final Set<Class<? extends Annotation>> supportedScopes;
+
+ private final BeanManagerImpl manager;
+
+ /**
+ * Constructor
+ *
+ * @param stereotypeAnnotations The stereotypes to merge
+ */
+ public MergedStereotypes(Set<Annotation> stereotypeAnnotations, BeanManagerImpl manager)
+ {
+ this.possibleDeploymentTypes = new HashMap<Class<? extends Annotation>, Annotation>();
+ this.possibleScopeTypes = new HashSet<Annotation>();
+ this.requiredTypes = new HashSet<Class<?>>();
+ this.supportedScopes = new HashSet<Class<? extends Annotation>>();
+ this.manager = manager;
+ merge(stereotypeAnnotations);
+ }
+
+ /**
+ * Perform the merge
+ *
+ * @param stereotypeAnnotations The stereotype annotations
+ */
+ protected void merge(Set<Annotation> stereotypeAnnotations)
+ {
+ for (Annotation stereotypeAnnotation : stereotypeAnnotations)
+ {
+ // Retrieve and merge all metadata from stereotypes
+ StereotypeModel<?> stereotype = manager.getServices().get(MetaDataCache.class).getStereotype(stereotypeAnnotation.annotationType());
+ if (stereotype == null)
+ {
+ throw new IllegalStateException("Stereotype " + stereotypeAnnotation + " not registered with container");
+ }
+ if (stereotype.getDefaultDeploymentType() != null)
+ {
+ possibleDeploymentTypes.put(stereotype.getDefaultDeploymentType().annotationType(), stereotype.getDefaultDeploymentType());
+ }
+ if (stereotype.getDefaultScopeType() != null)
+ {
+ possibleScopeTypes.add(stereotype.getDefaultScopeType());
+ }
+ requiredTypes.addAll(stereotype.getRequiredTypes());
+ supportedScopes.addAll(stereotype.getSupportedScopes());
+ if (stereotype.isBeanNameDefaulted())
+ {
+ beanNameDefaulted = true;
+ }
+ }
+ }
+
+ /**
+ * Returns the possible deployment typess
+ *
+ * @return The deployment types
+ */
+ public Map<Class<? extends Annotation>, Annotation> getPossibleDeploymentTypes()
+ {
+ return possibleDeploymentTypes;
+ }
+
+ /**
+ * Returns the possible scope types
+ *
+ * @return The scope types
+ */
+ public Set<Annotation> getPossibleScopeTypes()
+ {
+ return possibleScopeTypes;
+ }
+
+ /**
+ * Indicates if the name i defaulted
+ *
+ * @return True if defaulted, false if not
+ */
+ public boolean isBeanNameDefaulted()
+ {
+ return beanNameDefaulted;
+ }
+
+ /**
+ * Returns the required types
+ *
+ * @return The required types
+ */
+ public Set<Class<?>> getRequiredTypes()
+ {
+ return requiredTypes;
+ }
+
+ /**
+ * Returns the supported scopes
+ *
+ * @return The supported scopes
+ */
+ public Set<Class<? extends Annotation>> getSupportedScopes()
+ {
+ return supportedScopes;
+ }
+
+ /**
+ * Indicates if the bean was declared in XML
+ *
+ * @return True if declared in XML, else false
+ */
+ public boolean isDeclaredInXml()
+ {
+ return false;
+ }
+
+ /**
+ * Gets a string representation of the merged stereotypes
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ return "Merged stereotype model with possible deployment types " +
+ possibleDeploymentTypes + ", required types " + requiredTypes +
+ ", possible scopes " + possibleScopeTypes + " and supported scopes " + supportedScopes;
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MergedStereotypes.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:mergeinfo
+
Copied: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MetaDataCache.java (from rev 2896, ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MetaDataCache.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MetaDataCache.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MetaDataCache.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -0,0 +1,130 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.metadata.cache;
+
+import java.lang.annotation.Annotation;
+import java.util.concurrent.Callable;
+
+import org.jboss.webbeans.bootstrap.api.Service;
+import org.jboss.webbeans.resources.ClassTransformer;
+import org.jboss.webbeans.util.collections.ConcurrentCache;
+
+/**
+ * Metadata singleton for holding EJB metadata, scope models etc.
+ *
+ * @author Pete Muir
+ *
+ */
+public class MetaDataCache implements Service
+{
+
+ // The stereotype models
+ private ConcurrentCache<Class<? extends Annotation>, StereotypeModel<?>> stereotypes = new ConcurrentCache<Class<? extends Annotation>, StereotypeModel<?>>();
+ // The scope models
+ private ConcurrentCache<Class<? extends Annotation>, ScopeModel<?>> scopes = new ConcurrentCache<Class<? extends Annotation>, ScopeModel<?>>();
+ // The binding type models
+ private ConcurrentCache<Class<? extends Annotation>, BindingTypeModel<?>> bindingTypes = new ConcurrentCache<Class<? extends Annotation>, BindingTypeModel<?>>();
+
+ private final ClassTransformer classTransformer;
+
+ public MetaDataCache(ClassTransformer classTransformer)
+ {
+ this.classTransformer = classTransformer;
+ }
+
+ /**
+ * Gets a stereotype model
+ *
+ * Adds the model if it is not present.
+ *
+ * @param <T> The type
+ * @param stereotype The stereotype
+ * @return The stereotype model
+ */
+ public <T extends Annotation> StereotypeModel<T> getStereotype(final Class<T> stereotype)
+ {
+ return stereotypes.putIfAbsent(stereotype, new Callable<StereotypeModel<T>>()
+ {
+
+ public StereotypeModel<T> call() throws Exception
+ {
+ return new StereotypeModel<T>(stereotype, classTransformer);
+ }
+ });
+ }
+
+ /**
+ * Gets a scope model
+ *
+ * Adds the model if it is not present.
+ *
+ * @param <T> The type
+ * @param scopeType The scope type
+ * @return The scope type model
+ */
+ public <T extends Annotation> ScopeModel<T> getScopeModel(final Class<T> scopeType)
+ {
+ return scopes.putIfAbsent(scopeType, new Callable<ScopeModel<T>>()
+ {
+
+ public ScopeModel<T> call() throws Exception
+ {
+ return new ScopeModel<T>(scopeType, classTransformer);
+ }
+
+ });
+ }
+
+ /**
+ * Gets a binding type model.
+ *
+ * Adds the model if it is not present.
+ *
+ * @param <T> The type
+ * @param bindingType The binding type
+ * @return The binding type model
+ */
+ public <T extends Annotation> BindingTypeModel<T> getBindingTypeModel(final Class<T> bindingType)
+ {
+ return bindingTypes.putIfAbsent(bindingType, new Callable<BindingTypeModel<T>>()
+ {
+
+ public BindingTypeModel<T> call() throws Exception
+ {
+ return new BindingTypeModel<T>(bindingType, classTransformer);
+ }
+
+ });
+ }
+
+ /**
+ * Gets a string representation
+ *
+ * @return A string representation
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("Metadata cache\n");
+ buffer.append("Registered binding type models: " + bindingTypes.size() + "\n");
+ buffer.append("Registered scope type models: " + scopes.size() + "\n");
+ buffer.append("Registered stereotype models: " + stereotypes.size() + "\n");
+ return buffer.toString();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/ScopeModel.java (from rev 2896, ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/ScopeModel.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/ScopeModel.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/ScopeModel.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.metadata.cache;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.context.ScopeType;
+
+import org.jboss.webbeans.resources.ClassTransformer;
+
+/**
+ *
+ * Model of a scope
+ *
+ * @author Pete Muir
+ *
+ */
+public class ScopeModel<T extends Annotation> extends AnnotationModel<T>
+{
+ /**
+ * Constrctor
+ *
+ * @param scope The scope type
+ */
+ public ScopeModel(Class<T> scope, ClassTransformer classTransformer)
+ {
+ super(scope, classTransformer);
+ }
+
+ /**
+ * Indicates if the scope is "normal"
+ *
+ * @return True if normal, false otherwise
+ */
+ public boolean isNormal()
+ {
+ return getAnnotatedAnnotation().getAnnotation(ScopeType.class).normal();
+ }
+
+ /**
+ * Indicates if the scope is "passivating"
+ *
+ * @return True if passivating, false otherwise
+ */
+ public boolean isPassivating()
+ {
+ return getAnnotatedAnnotation().getAnnotation(ScopeType.class).passivating();
+ }
+
+ /**
+ * Gets the corresponding meta-annotation type class
+ *
+ * @return The ScopeType class
+ */
+ @Override
+ protected Class<? extends Annotation> getMetaAnnotation()
+ {
+ return ScopeType.class;
+ }
+
+ /**
+ * Gets a string representation of the scope model
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ String valid = isValid() ? "Valid " : "Invalid";
+ String normal = isNormal() ? "normal " : "non-normal ";
+ String passivating = isPassivating() ? "passivating " : "pon-passivating ";
+ return valid + normal + passivating + " scope model for " + getRawType();
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/ScopeModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java (from rev 2896, ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/StereotypeModel.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -0,0 +1,259 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.metadata.cache;
+
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.ScopeType;
+import javax.enterprise.inject.BindingType;
+import javax.enterprise.inject.Named;
+import javax.enterprise.inject.deployment.DeploymentType;
+import javax.enterprise.inject.stereotype.Stereotype;
+import javax.interceptor.InterceptorBindingType;
+
+import org.jboss.webbeans.DefinitionException;
+import org.jboss.webbeans.resources.ClassTransformer;
+
+/**
+ * A meta model for a stereotype, allows us to cache a stereotype and to
+ * validate it
+ *
+ * @author Pete Muir
+ *
+ */
+public class StereotypeModel<T extends Annotation> extends AnnotationModel<T>
+{
+ // The default deployment type
+ private Annotation defaultDeploymentType;
+ // The default scope type
+ private Annotation defaultScopeType;
+ // Is the bean name defaulted
+ private boolean beanNameDefaulted;
+ // The supported scopes
+ private Set<Class<? extends Annotation>> supportedScopes;
+ // The required types
+ private Set<Class<?>> requiredTypes;
+ // The interceptor bindings
+ private Set<Annotation> interceptorBindings;
+
+ /**
+ * Constructor
+ *
+ * @param sterotype The stereotype
+ */
+ public StereotypeModel(Class<T> sterotype, ClassTransformer transformer)
+ {
+ super(sterotype, transformer);
+ initDefaultDeploymentType();
+ initDefaultScopeType();
+ initBeanNameDefaulted();
+ initSupportedScopes();
+ initRequiredTypes();
+ initInterceptorBindings();
+ checkBindings();
+ }
+
+ /**
+ * Validates the binding types
+ */
+ private void checkBindings()
+ {
+ Set<Annotation> bindings = getAnnotatedAnnotation().getMetaAnnotations(BindingType.class);
+ if (bindings.size() > 0)
+ {
+ throw new DefinitionException("Cannot declare binding types on a stereotype " + getAnnotatedAnnotation());
+ }
+ }
+
+ /**
+ * Initializes the interceptor bindings
+ */
+ private void initInterceptorBindings()
+ {
+ interceptorBindings = getAnnotatedAnnotation().getMetaAnnotations(InterceptorBindingType.class);
+ }
+
+ /**
+ * Initializes the supported scopes
+ */
+ private void initSupportedScopes()
+ {
+ this.supportedScopes = new HashSet<Class<? extends Annotation>>();
+ Class<? extends Annotation>[] supportedScopes = getAnnotatedAnnotation().getAnnotation(Stereotype.class).supportedScopes();
+ if (supportedScopes.length > 0)
+ {
+ this.supportedScopes.addAll(Arrays.asList(supportedScopes));
+ }
+ }
+
+ /**
+ * Initializes the required types
+ */
+ private void initRequiredTypes()
+ {
+ this.requiredTypes = new HashSet<Class<?>>();
+ Class<?>[] requiredTypes = getAnnotatedAnnotation().getAnnotation(Stereotype.class).requiredTypes();
+ if (requiredTypes.length > 0)
+ {
+ this.requiredTypes.addAll(Arrays.asList(requiredTypes));
+ }
+ }
+
+ /**
+ * Initializes the bean name defaulted
+ */
+ private void initBeanNameDefaulted()
+ {
+ if (getAnnotatedAnnotation().isAnnotationPresent(Named.class))
+ {
+ if (!"".equals(getAnnotatedAnnotation().getAnnotation(Named.class).value()))
+ {
+ throw new DefinitionException("Cannot specify a value for a @Named stereotype " + getAnnotatedAnnotation());
+ }
+ beanNameDefaulted = true;
+ }
+ }
+
+ /**
+ * Initializes the default scope type
+ */
+ private void initDefaultScopeType()
+ {
+ Set<Annotation> scopeTypes = getAnnotatedAnnotation().getMetaAnnotations(ScopeType.class);
+ if (scopeTypes.size() > 1)
+ {
+ throw new DefinitionException("At most one scope type may be specified for " + getAnnotatedAnnotation());
+ }
+ else if (scopeTypes.size() == 1)
+ {
+ this.defaultScopeType = scopeTypes.iterator().next();
+ }
+ }
+
+ /**
+ * Initializes the default deployment type
+ */
+ private void initDefaultDeploymentType()
+ {
+ Set<Annotation> deploymentTypes = getAnnotatedAnnotation().getMetaAnnotations(DeploymentType.class);
+ if (deploymentTypes.size() > 1)
+ {
+ throw new DefinitionException("At most one deployment type may be specified on " + getAnnotatedAnnotation());
+ }
+ else if (deploymentTypes.size() == 1)
+ {
+ this.defaultDeploymentType = deploymentTypes.iterator().next();
+ }
+ }
+
+ /**
+ * Get the default deployment type the stereotype specifies
+ *
+ * @return The default deployment type, or null if none is specified
+ */
+ public Annotation getDefaultDeploymentType()
+ {
+ return defaultDeploymentType;
+ }
+
+ /**
+ * Get the default scope type the stereotype specifies
+ *
+ * @return The default scope type, or null if none is specified
+ */
+ public Annotation getDefaultScopeType()
+ {
+ return defaultScopeType;
+ }
+
+ /**
+ * Get any interceptor bindings the the stereotype specifies
+ *
+ * @return The interceptor bindings, or an empty set if none are specified.
+ */
+ public Set<Annotation> getInterceptorBindings()
+ {
+ return interceptorBindings;
+ }
+
+ /**
+ * Indicates if the bean name is defaulted
+ *
+ * @return True if defaulted, false otherwise
+ */
+ public boolean isBeanNameDefaulted()
+ {
+ return beanNameDefaulted;
+ }
+
+ /**
+ * Gets the supported scopes
+ *
+ * @return A set of supported scopes, or an empty set if none are specified
+ */
+ public Set<Class<? extends Annotation>> getSupportedScopes()
+ {
+ return supportedScopes;
+ }
+
+ /**
+ * Gets the required types
+ *
+ * @return A set of required types, or an empty set if none are specified
+ */
+ public Set<Class<?>> getRequiredTypes()
+ {
+ return requiredTypes;
+ }
+
+ /**
+ * Gets the type
+ *
+ * @return The type
+ */
+ @Deprecated
+ public Class<? extends Annotation> getStereotypeClass()
+ {
+ return getRawType();
+ }
+
+ /**
+ * Gets a string representation of the stereotype
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ return "Stereotype model with required types " + requiredTypes + " and supported scopes " + supportedScopes;
+ }
+
+ /**
+ * Gets the meta-annotation type
+ *
+ * @return The Stereotype class
+ */
+ @Override
+ protected Class<? extends Annotation> getMetaAnnotation()
+ {
+ return Stereotype.class;
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/resources/ClassTransformer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resources/ClassTransformer.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/resources/ClassTransformer.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -26,7 +26,7 @@
import org.jboss.webbeans.introspector.jlr.WBClassImpl;
import org.jboss.webbeans.util.collections.ConcurrentCache;
-public class ClassTransformer implements Service
+public class ClassTransformer implements Service
{
private final ConcurrentCache<Class<?>, WBClass<?>> classes;
@@ -42,30 +42,29 @@
annotations = new ConcurrentCache<Class<?>, WBAnnotation<?>>();
}
- public <T> WBClass<T> classForName(final Class<T> clazz)
+ public <T> WBClass<T> loadClass(final Class<T> clazz)
{
return classes.putIfAbsent(clazz, new Callable<WBClass<T>>()
- {
+ {
public WBClass<T> call() throws Exception
{
return WBClassImpl.of(clazz, transformer);
}
- });
+ });
}
- public <T extends Annotation> WBAnnotation<T> annotationTypeForName(final Class<T> clazz)
+ public <T extends Annotation> WBAnnotation<T> loadAnnotation(final Class<T> clazz)
{
return annotations.putIfAbsent(clazz, new Callable<WBAnnotation<T>>()
- {
-
+ {
public WBAnnotation<T> call() throws Exception
{
return WBAnnotationImpl.of(clazz, transformer);
}
- });
+ });
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -32,8 +32,8 @@
import org.jboss.webbeans.injection.FieldInjectionPoint;
import org.jboss.webbeans.introspector.WBClass;
import org.jboss.webbeans.introspector.WBField;
-import org.jboss.webbeans.metadata.BindingTypeModel;
-import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.BindingTypeModel;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
/**
* Helper class for bean inspection
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/context/PassivatingContextTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/context/PassivatingContextTest.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/context/PassivatingContextTest.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -6,7 +6,7 @@
import javax.enterprise.context.SessionScoped;
import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
import org.testng.annotations.Test;
@Artifact
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/StereotypesTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/StereotypesTest.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/StereotypesTest.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -5,7 +5,7 @@
import javax.enterprise.context.RequestScoped;
import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.webbeans.metadata.StereotypeModel;
+import org.jboss.webbeans.metadata.cache.StereotypeModel;
import org.jboss.webbeans.resources.ClassTransformer;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;
15 years, 6 months
[webbeans-commits] Webbeans SVN: r2902 - ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard and 6 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-06-26 13:03:09 -0400 (Fri, 26 Jun 2009)
New Revision: 2902
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/ExtensionBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/serviceProvider/
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/serviceProvider/ServiceLoader.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/BeforeBeanDiscoveryObserver.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/javax.enterprise.inject.spi.Extension
Removed:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeBeanDiscoveryImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverFactory.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/ExtensionsTest.java
Log:
Start on container lifecycle events
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-06-26 15:53:39 UTC (rev 2901)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-06-26 17:03:09 UTC (rev 2902)
@@ -40,9 +40,11 @@
import org.jboss.webbeans.bean.AbstractClassBean;
import org.jboss.webbeans.bean.DecoratorBean;
+import org.jboss.webbeans.bean.DisposalMethodBean;
import org.jboss.webbeans.bean.NewEnterpriseBean;
import org.jboss.webbeans.bean.NewSimpleBean;
import org.jboss.webbeans.bean.RIBean;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.bootstrap.api.Service;
import org.jboss.webbeans.injection.resolution.ResolvableWBClass;
import org.jboss.webbeans.introspector.WBAnnotated;
@@ -170,7 +172,7 @@
}
}
- public void validateDeployment(BeanManagerImpl manager)
+ public void validateDeployment(BeanManagerImpl manager, BeanDeployerEnvironment environment)
{
List<RIBean<?>> specializedBeans = new ArrayList<RIBean<?>>();
for (Bean<?> bean : manager.getBeans())
@@ -185,6 +187,7 @@
}
}
validateEnabledDecoratorClasses(manager);
+ validateDisposalMethods(environment);
}
@@ -204,6 +207,23 @@
}
}
}
+
+ private void validateDisposalMethods(BeanDeployerEnvironment environment)
+ {
+ Set<DisposalMethodBean<?>> all = new HashSet<DisposalMethodBean<?>>(environment.getAllDisposalBeans());
+ Set<DisposalMethodBean<?>> resolved = new HashSet<DisposalMethodBean<?>>(environment.getResolvedDisposalBeans());
+ if (all.size() > 0 && !resolved.containsAll(all))
+ {
+ StringBuffer buff = new StringBuffer();
+ buff.append("The following Disposal methods where not resolved\n");
+ all.removeAll(resolved);
+ for (DisposalMethodBean<?> bean : all)
+ {
+ buff.append(bean.toString());
+ }
+ throw new UnsatisfiedResolutionException(buff.toString());
+ }
+ }
private static boolean hasHigherPrecedence(Class<? extends Annotation> deploymentType, Class<? extends Annotation> otherDeploymentType, BeanManagerImpl manager)
{
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/ExtensionBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/ExtensionBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/ExtensionBean.java 2009-06-26 17:03:09 UTC (rev 2902)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.bean.standard;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Extension;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.introspector.WBClass;
+
+/**
+ * @author pmuir
+ *
+ */
+public class ExtensionBean extends AbstractStandardBean<Extension>
+{
+
+ private final WBClass<Extension> clazz;
+ private final Extension instance;
+
+ public static ExtensionBean of(BeanManagerImpl manager, WBClass<Extension> clazz, Extension instance)
+ {
+ return new ExtensionBean(manager, clazz, instance);
+ }
+
+ protected ExtensionBean(BeanManagerImpl manager, WBClass<Extension> clazz, Extension instance)
+ {
+ super(manager);
+ this.clazz = clazz;
+ this.instance = instance;
+ }
+
+ @Override
+ public Class<Extension> getType()
+ {
+ return clazz.getJavaClass();
+ }
+
+ public Set<Type> getTypes()
+ {
+ return clazz.getTypeClosure();
+ }
+
+ @Override
+ public boolean isProxyable()
+ {
+ return clazz.isProxyable();
+ }
+
+ public Extension create(CreationalContext<Extension> creationalContext)
+ {
+ return instance;
+ }
+
+ public void destroy(Extension instance, CreationalContext<Extension> creationalContext)
+ {
+ // No-op
+ }
+
+ @Override
+ public Class<? extends Annotation> getScopeType()
+ {
+ return ApplicationScoped.class;
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/ExtensionBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java (from rev 2896, ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java 2009-06-26 17:03:09 UTC (rev 2902)
@@ -0,0 +1,334 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.bootstrap;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.BindingType;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Initializer;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.deployment.DeploymentType;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.Realizes;
+import org.jboss.webbeans.bean.AbstractClassBean;
+import org.jboss.webbeans.bean.DecoratorBean;
+import org.jboss.webbeans.bean.DisposalMethodBean;
+import org.jboss.webbeans.bean.EnterpriseBean;
+import org.jboss.webbeans.bean.NewEnterpriseBean;
+import org.jboss.webbeans.bean.NewSimpleBean;
+import org.jboss.webbeans.bean.ProducerFieldBean;
+import org.jboss.webbeans.bean.ProducerMethodBean;
+import org.jboss.webbeans.bean.RIBean;
+import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.ejb.EJBApiAbstraction;
+import org.jboss.webbeans.event.ObserverFactory;
+import org.jboss.webbeans.event.ObserverImpl;
+import org.jboss.webbeans.introspector.WBClass;
+import org.jboss.webbeans.introspector.WBField;
+import org.jboss.webbeans.introspector.WBMethod;
+import org.jboss.webbeans.introspector.WrappedWBField;
+import org.jboss.webbeans.introspector.WrappedWBMethod;
+import org.jboss.webbeans.jsf.JsfApiAbstraction;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.servlet.ServletApiAbstraction;
+import org.jboss.webbeans.util.Reflections;
+
+public class AbstractBeanDeployer
+{
+
+ private static final LogProvider log = Logging.getLogProvider(AbstractBeanDeployer.class);
+
+ private final BeanManagerImpl manager;
+ private final BeanDeployerEnvironment environment;
+
+ public AbstractBeanDeployer(BeanManagerImpl manager, BeanDeployerEnvironment environment)
+ {
+ this.manager = manager;
+ this.environment = environment;
+ }
+
+ protected BeanManagerImpl getManager()
+ {
+ return manager;
+ }
+
+ public <T> AbstractBeanDeployer addBean(RIBean<T> bean)
+ {
+ this.environment.addBean(bean);
+ return this;
+ }
+
+ public AbstractBeanDeployer deploy()
+ {
+ Set<RIBean<?>> beans = environment.getBeans();
+ // ensure that all disposal methods are initialized before initializing
+ // the rest of the beans
+ for (DecoratorBean<?> bean : environment.getDecorators())
+ {
+ bean.initialize(environment);
+ manager.addRIBean(bean);
+ log.debug("Bean: " + bean);
+ }
+ for (RIBean<?> bean : beans)
+ {
+ bean.initialize(environment);
+ manager.addRIBean(bean);
+ log.debug("Bean: " + bean);
+ }
+ for (ObserverImpl<?> observer : environment.getObservers())
+ {
+ observer.initialize();
+ log.debug("Observer : " + observer);
+ manager.addObserver(observer);
+ }
+
+ return this;
+ }
+
+ /**
+ * Creates the sub bean for an class (simple or enterprise) bean
+ *
+ * @param bean
+ * The class bean
+ *
+ */
+ protected <T> void createSubBeans(AbstractClassBean<T> bean)
+ {
+ // TODO I don't think this is needed due to validation
+ manager.getResolver().addInjectionPoints(bean.getAnnotatedInjectionPoints());
+
+ createProducerMethods(bean, bean.getAnnotatedItem());
+ createProducerFields(bean, bean.getAnnotatedItem());
+ createObserverMethods(bean, bean.getAnnotatedItem());
+ createDisposalMethods(bean, bean.getAnnotatedItem());
+
+ if (bean.getAnnotatedItem().isAnnotationPresent(Realizes.class))
+ {
+ createRealizedProducerMethods(bean, bean.getAnnotatedItem());
+ createRealizedProducerFields(bean, bean.getAnnotatedItem());
+ createRealizedObserverMethods(bean, bean.getAnnotatedItem());
+ }
+
+ }
+
+ protected void createProducerMethods(AbstractClassBean<?> declaringBean, WBClass<?> annotatedClass)
+ {
+ for (WBMethod<?> method : annotatedClass.getDeclaredAnnotatedMethods(Produces.class))
+ {
+ createProducerMethod(declaringBean, method);
+ }
+ }
+
+ protected void createDisposalMethods(AbstractClassBean<?> declaringBean, WBClass<?> annotatedClass)
+ {
+ for (WBMethod<?> method : annotatedClass.getDeclaredMethodsWithAnnotatedParameters(Disposes.class))
+ {
+ DisposalMethodBean<?> disposalBean = DisposalMethodBean.of(manager, method, declaringBean);
+ environment.addDisposalBean(disposalBean);
+ }
+ }
+
+ protected <T> void createProducerMethod(AbstractClassBean<?> declaringBean, WBMethod<T> annotatedMethod)
+ {
+ ProducerMethodBean<T> bean = ProducerMethodBean.of(annotatedMethod, declaringBean, manager);
+ addBean(bean);
+ manager.getResolver().addInjectionPoints(bean.getAnnotatedInjectionPoints());
+ }
+
+ protected void createRealizedProducerMethods(AbstractClassBean<?> declaringBean, WBClass<?> realizingClass)
+ {
+ WBClass<?> realizedClass = realizingClass.getSuperclass();
+ for (WBMethod<?> realizedMethod : realizedClass.getDeclaredAnnotatedMethods(Produces.class))
+ {
+ createProducerMethod(declaringBean, realizeProducerMethod(realizedMethod, realizingClass));
+ }
+ }
+
+ protected void createRealizedProducerFields(AbstractClassBean<?> declaringBean, WBClass<?> realizingClass)
+ {
+ WBClass<?> realizedClass = realizingClass.getSuperclass();
+ for (final WBField<?> realizedField : realizedClass.getDeclaredAnnotatedFields(Produces.class))
+ {
+ createProducerField(declaringBean, realizeProducerField(realizedField, realizingClass));
+ }
+ }
+
+ protected <T> void createProducerField(AbstractClassBean<?> declaringBean, WBField<T> field)
+ {
+ ProducerFieldBean<T> bean = ProducerFieldBean.of(field, declaringBean, manager);
+ addBean(bean);
+ }
+
+ protected void createProducerFields(AbstractClassBean<?> declaringBean, WBClass<?> annotatedClass)
+ {
+ for (WBField<?> field : annotatedClass.getDeclaredAnnotatedFields(Produces.class))
+ {
+ createProducerField(declaringBean, field);
+ }
+ }
+
+ protected void createObserverMethods(RIBean<?> declaringBean, WBClass<?> annotatedClass)
+ {
+ for (WBMethod<?> method : annotatedClass.getDeclaredMethodsWithAnnotatedParameters(Observes.class))
+ {
+ createObserverMethod(declaringBean, method);
+ }
+ }
+
+ protected void createRealizedObserverMethods(AbstractClassBean<?> declaringBean, WBClass<?> realizingClass)
+ {
+ createObserverMethods(declaringBean, realizingClass.getSuperclass());
+ }
+
+ protected void createObserverMethod(RIBean<?> declaringBean, WBMethod<?> method)
+ {
+ ObserverImpl<?> observer = ObserverFactory.create(method, declaringBean, manager);
+ environment.getObservers().add(observer);
+ }
+
+ protected <T> void createSimpleBean(WBClass<T> annotatedClass)
+ {
+ SimpleBean<T> bean = SimpleBean.of(annotatedClass, manager);
+ addBean(bean);
+ createSubBeans(bean);
+ addBean(NewSimpleBean.of(annotatedClass, manager));
+ }
+
+ protected <T> void createDecorator(WBClass<T> annotatedClass)
+ {
+ DecoratorBean<T> bean = DecoratorBean.of(annotatedClass, manager);
+ addBean(bean);
+ }
+
+ protected <T> void createEnterpriseBean(WBClass<T> annotatedClass)
+ {
+ // TODO Don't create enterprise bean if it has no local interfaces!
+ EnterpriseBean<T> bean = EnterpriseBean.of(annotatedClass, manager, environment);
+ addBean(bean);
+ createSubBeans(bean);
+ addBean(NewEnterpriseBean.of(annotatedClass, manager, environment));
+ }
+
+ /**
+ * Indicates if the type is a simple Web Bean
+ *
+ * @param type
+ * The type to inspect
+ * @return True if simple Web Bean, false otherwise
+ */
+ protected boolean isTypeManagedBeanOrDecorator(WBClass<?> clazz)
+ {
+ Class<?> rawType = clazz.getJavaClass();
+ EJBApiAbstraction ejbApiAbstraction = manager.getServices().get(EJBApiAbstraction.class);
+ JsfApiAbstraction jsfApiAbstraction = manager.getServices().get(JsfApiAbstraction.class);
+ ServletApiAbstraction servletApiAbstraction = manager.getServices().get(ServletApiAbstraction.class);
+ return !clazz.isNonStaticMemberClass() &&
+ !Reflections.isParameterizedType(rawType) &&
+ !servletApiAbstraction.SERVLET_CLASS.isAssignableFrom(rawType) &&
+ !servletApiAbstraction.FILTER_CLASS.isAssignableFrom(rawType) &&
+ !servletApiAbstraction.SERVLET_CONTEXT_LISTENER_CLASS.isAssignableFrom(rawType) &&
+ !servletApiAbstraction.HTTP_SESSION_LISTENER_CLASS.isAssignableFrom(rawType) &&
+ !servletApiAbstraction.SERVLET_REQUEST_LISTENER_CLASS.isAssignableFrom(rawType) &&
+ !ejbApiAbstraction.ENTERPRISE_BEAN_CLASS.isAssignableFrom(rawType) &&
+ !jsfApiAbstraction.UICOMPONENT_CLASS.isAssignableFrom(rawType) &&
+ hasSimpleWebBeanConstructor(clazz);
+ }
+
+ private static boolean hasSimpleWebBeanConstructor(WBClass<?> type)
+ {
+ return type.getNoArgsConstructor() != null || type.getAnnotatedConstructors(Initializer.class).size() > 0;
+ }
+
+ private static <T> WBMethod<T> realizeProducerMethod(final WBMethod<T> method, final WBClass<?> realizingClass)
+ {
+ return new WrappedWBMethod<T>(method, realizingClass.getMetaAnnotations(BindingType.class))
+ {
+
+ @Override
+ public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+ {
+ if (metaAnnotationType.equals(DeploymentType.class))
+ {
+ return realizingClass.getMetaAnnotations(DeploymentType.class);
+ }
+ else
+ {
+ return super.getMetaAnnotations(metaAnnotationType);
+ }
+ }
+
+ @Override
+ public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+ {
+ if (metaAnnotationType.equals(DeploymentType.class))
+ {
+ return realizingClass.getDeclaredMetaAnnotations(DeploymentType.class);
+ }
+ else
+ {
+ return super.getDeclaredMetaAnnotations(metaAnnotationType);
+ }
+ }
+
+ };
+ }
+
+ private static <T> WBField<T> realizeProducerField(final WBField<T> field, final WBClass<?> realizingClass)
+ {
+ return new WrappedWBField<T>(field, realizingClass.getMetaAnnotations(BindingType.class))
+ {
+
+ @Override
+ public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+ {
+ if (metaAnnotationType.equals(DeploymentType.class))
+ {
+ return realizingClass.getMetaAnnotations(DeploymentType.class);
+ }
+ else
+ {
+ return super.getMetaAnnotations(metaAnnotationType);
+ }
+ }
+
+ @Override
+ public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+ {
+ if (metaAnnotationType.equals(DeploymentType.class))
+ {
+ return realizingClass.getDeclaredMetaAnnotations(DeploymentType.class);
+ }
+ else
+ {
+ return super.getDeclaredMetaAnnotations(metaAnnotationType);
+ }
+ }
+
+ };
+ }
+
+ public BeanDeployerEnvironment getBeanDeployerEnvironment()
+ {
+ return environment;
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-06-26 15:53:39 UTC (rev 2901)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-06-26 17:03:09 UTC (rev 2902)
@@ -1,416 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bootstrap;
-
-import java.lang.annotation.Annotation;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.decorator.Decorator;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.BindingType;
-import javax.enterprise.inject.Disposes;
-import javax.enterprise.inject.Initializer;
-import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.UnsatisfiedResolutionException;
-import javax.enterprise.inject.deployment.DeploymentType;
-
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.Realizes;
-import org.jboss.webbeans.bean.AbstractClassBean;
-import org.jboss.webbeans.bean.DecoratorBean;
-import org.jboss.webbeans.bean.DisposalMethodBean;
-import org.jboss.webbeans.bean.EnterpriseBean;
-import org.jboss.webbeans.bean.NewEnterpriseBean;
-import org.jboss.webbeans.bean.NewSimpleBean;
-import org.jboss.webbeans.bean.ProducerFieldBean;
-import org.jboss.webbeans.bean.ProducerMethodBean;
-import org.jboss.webbeans.bean.RIBean;
-import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.ejb.EJBApiAbstraction;
-import org.jboss.webbeans.ejb.EjbDescriptorCache;
-import org.jboss.webbeans.event.ObserverFactory;
-import org.jboss.webbeans.event.ObserverImpl;
-import org.jboss.webbeans.introspector.WBClass;
-import org.jboss.webbeans.introspector.WBField;
-import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.introspector.WrappedWBField;
-import org.jboss.webbeans.introspector.WrappedWBMethod;
-import org.jboss.webbeans.jsf.JsfApiAbstraction;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.servlet.ServletApiAbstraction;
-import org.jboss.webbeans.util.Reflections;
-
-public class BeanDeployer
-{
-
- private static final LogProvider log = Logging.getLogProvider(BeanDeployer.class);
-
- private final BeanDeployerEnvironment environment;
- private final Set<WBClass<?>> classes;
- private final BeanManagerImpl manager;
- private final ClassTransformer classTransformer;
-
-
- public BeanDeployer(BeanManagerImpl manager, EjbDescriptorCache ejbDescriptors)
- {
- this.manager = manager;
- this.environment = new BeanDeployerEnvironment(ejbDescriptors, manager);
- this.classes = new HashSet<WBClass<?>>();
- this.classTransformer = new ClassTransformer();
- }
-
- public <T> BeanDeployer addBean(RIBean<T> bean)
- {
- this.environment.addBean(bean);
- return this;
- }
-
- public BeanDeployer addBeans(Iterable<? extends RIBean<?>> beans)
- {
- for (RIBean<?> bean : beans)
- {
- addBean(bean);
- }
- return this;
- }
-
- public BeanDeployer addClass(Class<?> clazz)
- {
- if (!clazz.isAnnotation() && !clazz.isEnum())
- {
- classes.add(classTransformer.classForName(clazz));
- }
- return this;
- }
-
- public BeanDeployer addClasses(Iterable<Class<?>> classes)
- {
- for (Class<?> clazz : classes)
- {
- addClass(clazz);
- }
- return this;
- }
-
- public BeanDeployer addClasses(Collection<WBClass<?>> classes)
- {
- classes.addAll(classes);
- return this;
- }
-
- public BeanDeployer createBeans()
- {
- for (WBClass<?> clazz : classes)
- {
- if (environment.getEjbDescriptors().containsKey(clazz.getJavaClass()))
- {
- createEnterpriseBean(clazz);
- }
- else
- {
- boolean managedBeanOrDecorator = isTypeManagedBeanOrDecorator(clazz);
- if (managedBeanOrDecorator && clazz.isAnnotationPresent(Decorator.class))
- {
- createDecorator(clazz);
- }
- else if (managedBeanOrDecorator && !clazz.isAbstract())
- {
- createSimpleBean(clazz);
- }
- }
- }
- return this;
- }
-
- public BeanDeployer deploy()
- {
- Set<RIBean<?>> beans = environment.getBeans();
- // ensure that all disposal methods are initialized before initializing
- // the rest of the beans
- for (DecoratorBean<?> bean : environment.getDecorators())
- {
- bean.initialize(environment);
- manager.addRIBean(bean);
- log.debug("Bean: " + bean);
- }
- for (RIBean<?> bean : beans)
- {
- bean.initialize(environment);
- manager.addRIBean(bean);
- log.debug("Bean: " + bean);
- }
- for (ObserverImpl<?> observer : environment.getObservers())
- {
- observer.initialize();
- log.debug("Observer : " + observer);
- manager.addObserver(observer);
- }
-
- // TODO: move to boot
- checkDisposalMethods();
-
- return this;
- }
-
-
- private void checkDisposalMethods() {
- Set<DisposalMethodBean<?>> all = new HashSet<DisposalMethodBean<?>>(environment.getAllDisposalBeans());
- Set<DisposalMethodBean<?>> resolved = new HashSet<DisposalMethodBean<?>>(environment.getResolvedDisposalBeans());
- if(all.size()>0 && !resolved.containsAll(all)) {
- StringBuffer buff = new StringBuffer();
- buff.append("The following Disposal methods where not resolved\n");
- all.removeAll(resolved);
- for(DisposalMethodBean<?> bean: all) {
- buff.append(bean.toString());
- }
- throw new UnsatisfiedResolutionException(buff.toString());
- }
- }
-
- public BeanDeployerEnvironment getBeanDeployerEnvironment()
- {
- return environment;
- }
-
- /**
- * Creates a Web Bean from a bean abstraction and adds it to the set of
- * created beans
- *
- * Also creates the implicit field- and method-level beans, if present
- *
- * @param bean
- * The bean representation
- */
- protected <T> void createBean(AbstractClassBean<T> bean, final WBClass<T> annotatedClass)
- {
-
- addBean(bean);
-
- manager.getResolver().addInjectionPoints(bean.getAnnotatedInjectionPoints());
-
- createProducerMethods(bean, annotatedClass);
- createProducerFields(bean, annotatedClass);
- createObserverMethods(bean, annotatedClass);
- createDisposalMethods(bean, annotatedClass);
-
- if (annotatedClass.isAnnotationPresent(Realizes.class))
- {
- createRealizedProducerMethods(bean, annotatedClass);
- createRealizedProducerFields(bean, annotatedClass);
- createRealizedObserverMethods(bean, annotatedClass);
- }
- }
-
- private void createProducerMethods(AbstractClassBean<?> declaringBean, WBClass<?> annotatedClass)
- {
- for (WBMethod<?> method : annotatedClass.getDeclaredAnnotatedMethods(Produces.class))
- {
- createProducerMethod(declaringBean, method);
- }
- }
-
- private void createDisposalMethods(AbstractClassBean<?> declaringBean, WBClass<?> annotatedClass)
- {
- for (WBMethod<?> method : annotatedClass.getDeclaredMethodsWithAnnotatedParameters(Disposes.class))
- {
- DisposalMethodBean<?> disposalBean = DisposalMethodBean.of(manager, method, declaringBean);
- environment.addDisposalBean(disposalBean);
- }
- }
-
- private <T> void createProducerMethod(AbstractClassBean<?> declaringBean, WBMethod<T> annotatedMethod)
- {
- ProducerMethodBean<T> bean = ProducerMethodBean.of(annotatedMethod, declaringBean, manager);
- addBean(bean);
- manager.getResolver().addInjectionPoints(bean.getAnnotatedInjectionPoints());
- }
-
- private void createRealizedProducerMethods(AbstractClassBean<?> declaringBean, WBClass<?> realizingClass)
- {
- WBClass<?> realizedClass = realizingClass.getSuperclass();
- for (WBMethod<?> realizedMethod : realizedClass.getDeclaredAnnotatedMethods(Produces.class))
- {
- createProducerMethod(declaringBean, realizeProducerMethod(realizedMethod, realizingClass));
- }
- }
-
- private void createRealizedProducerFields(AbstractClassBean<?> declaringBean, WBClass<?> realizingClass)
- {
- WBClass<?> realizedClass = realizingClass.getSuperclass();
- for (final WBField<?> realizedField : realizedClass.getDeclaredAnnotatedFields(Produces.class))
- {
- createProducerField(declaringBean, realizeProducerField(realizedField, realizingClass));
- }
- }
-
- private <T> void createProducerField(AbstractClassBean<?> declaringBean, WBField<T> field)
- {
- ProducerFieldBean<T> bean = ProducerFieldBean.of(field, declaringBean, manager);
- addBean(bean);
- }
-
- private void createProducerFields(AbstractClassBean<?> declaringBean, WBClass<?> annotatedClass)
- {
- for (WBField<?> field : annotatedClass.getDeclaredAnnotatedFields(Produces.class))
- {
- createProducerField(declaringBean, field);
- }
- }
-
- private void createObserverMethods(AbstractClassBean<?> declaringBean, WBClass<?> annotatedClass)
- {
- for (WBMethod<?> method : annotatedClass.getDeclaredMethodsWithAnnotatedParameters(Observes.class))
- {
- createObserverMethod(declaringBean, method);
- }
- }
-
- private void createRealizedObserverMethods(AbstractClassBean<?> declaringBean, WBClass<?> realizingClass)
- {
- createObserverMethods(declaringBean, realizingClass.getSuperclass());
- }
-
- private void createObserverMethod(AbstractClassBean<?> declaringBean, WBMethod<?> method)
- {
- ObserverImpl<?> observer = ObserverFactory.create(method, declaringBean, manager);
- environment.getObservers().add(observer);
- }
-
- private <T> void createSimpleBean(WBClass<T> annotatedClass)
- {
- SimpleBean<T> bean = SimpleBean.of(annotatedClass, manager);
- createBean(bean, annotatedClass);
- addBean(NewSimpleBean.of(annotatedClass, manager));
- }
-
- private <T> void createDecorator(WBClass<T> annotatedClass)
- {
- DecoratorBean<T> bean = DecoratorBean.of(annotatedClass, manager);
- addBean(bean);
- }
-
- private <T> void createEnterpriseBean(WBClass<T> annotatedClass)
- {
- // TODO Don't create enterprise bean if it has no local interfaces!
- EnterpriseBean<T> bean = EnterpriseBean.of(annotatedClass, manager, environment);
- createBean(bean, annotatedClass);
- addBean(NewEnterpriseBean.of(annotatedClass, manager, environment));
- }
-
- /**
- * Indicates if the type is a simple Web Bean
- *
- * @param type
- * The type to inspect
- * @return True if simple Web Bean, false otherwise
- */
- private boolean isTypeManagedBeanOrDecorator(WBClass<?> clazz)
- {
- Class<?> rawType = clazz.getJavaClass();
- EJBApiAbstraction ejbApiAbstraction = manager.getServices().get(EJBApiAbstraction.class);
- JsfApiAbstraction jsfApiAbstraction = manager.getServices().get(JsfApiAbstraction.class);
- ServletApiAbstraction servletApiAbstraction = manager.getServices().get(ServletApiAbstraction.class);
- return !clazz.isNonStaticMemberClass() &&
- !Reflections.isParameterizedType(rawType) &&
- !servletApiAbstraction.SERVLET_CLASS.isAssignableFrom(rawType) &&
- !servletApiAbstraction.FILTER_CLASS.isAssignableFrom(rawType) &&
- !servletApiAbstraction.SERVLET_CONTEXT_LISTENER_CLASS.isAssignableFrom(rawType) &&
- !servletApiAbstraction.HTTP_SESSION_LISTENER_CLASS.isAssignableFrom(rawType) &&
- !servletApiAbstraction.SERVLET_REQUEST_LISTENER_CLASS.isAssignableFrom(rawType) &&
- !ejbApiAbstraction.ENTERPRISE_BEAN_CLASS.isAssignableFrom(rawType) &&
- !jsfApiAbstraction.UICOMPONENT_CLASS.isAssignableFrom(rawType) &&
- hasSimpleWebBeanConstructor(clazz);
- }
-
- private static boolean hasSimpleWebBeanConstructor(WBClass<?> type)
- {
- return type.getNoArgsConstructor() != null || type.getAnnotatedConstructors(Initializer.class).size() > 0;
- }
-
- private static <T> WBMethod<T> realizeProducerMethod(final WBMethod<T> method, final WBClass<?> realizingClass)
- {
- return new WrappedWBMethod<T>(method, realizingClass.getMetaAnnotations(BindingType.class))
- {
-
- @Override
- public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
- {
- if (metaAnnotationType.equals(DeploymentType.class))
- {
- return realizingClass.getMetaAnnotations(DeploymentType.class);
- }
- else
- {
- return super.getMetaAnnotations(metaAnnotationType);
- }
- }
-
- @Override
- public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
- {
- if (metaAnnotationType.equals(DeploymentType.class))
- {
- return realizingClass.getDeclaredMetaAnnotations(DeploymentType.class);
- }
- else
- {
- return super.getDeclaredMetaAnnotations(metaAnnotationType);
- }
- }
-
- };
- }
-
- private static <T> WBField<T> realizeProducerField(final WBField<T> field, final WBClass<?> realizingClass)
- {
- return new WrappedWBField<T>(field, realizingClass.getMetaAnnotations(BindingType.class))
- {
-
- @Override
- public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
- {
- if (metaAnnotationType.equals(DeploymentType.class))
- {
- return realizingClass.getMetaAnnotations(DeploymentType.class);
- }
- else
- {
- return super.getMetaAnnotations(metaAnnotationType);
- }
- }
-
- @Override
- public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
- {
- if (metaAnnotationType.equals(DeploymentType.class))
- {
- return realizingClass.getDeclaredMetaAnnotations(DeploymentType.class);
- }
- else
- {
- return super.getDeclaredMetaAnnotations(metaAnnotationType);
- }
- }
-
- };
- }
-
-}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-06-26 17:03:09 UTC (rev 2902)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.bootstrap;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.decorator.Decorator;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.bean.RIBean;
+import org.jboss.webbeans.ejb.EjbDescriptorCache;
+import org.jboss.webbeans.introspector.WBClass;
+import org.jboss.webbeans.resources.ClassTransformer;
+
+/**
+ * @author pmuir
+ *
+ */
+public class BeanDeployer extends AbstractBeanDeployer
+{
+
+ private final Set<WBClass<?>> classes;
+
+ /**
+ * @param manager
+ * @param ejbDescriptors
+ */
+ public BeanDeployer(BeanManagerImpl manager, EjbDescriptorCache ejbDescriptors)
+ {
+ super(manager, new BeanDeployerEnvironment(ejbDescriptors, manager));
+ this.classes = new HashSet<WBClass<?>>();
+ }
+
+ public AbstractBeanDeployer addBeans(Iterable<? extends RIBean<?>> beans)
+ {
+ for (RIBean<?> bean : beans)
+ {
+ addBean(bean);
+ }
+ return this;
+ }
+
+ public AbstractBeanDeployer addClass(Class<?> clazz)
+ {
+ ClassTransformer classTransformer = getManager().getServices().get(ClassTransformer.class);
+ if (!clazz.isAnnotation() && !clazz.isEnum())
+ {
+ classes.add(classTransformer.classForName(clazz));
+ }
+ return this;
+ }
+
+ public AbstractBeanDeployer addClasses(Iterable<Class<?>> classes)
+ {
+ for (Class<?> clazz : classes)
+ {
+ addClass(clazz);
+ }
+ return this;
+ }
+
+ public AbstractBeanDeployer addClasses(Collection<WBClass<?>> classes)
+ {
+ classes.addAll(classes);
+ return this;
+ }
+
+ public AbstractBeanDeployer createBeans()
+ {
+ for (WBClass<?> clazz : classes)
+ {
+ if (getBeanDeployerEnvironment().getEjbDescriptors().containsKey(clazz.getJavaClass()))
+ {
+ createEnterpriseBean(clazz);
+ }
+ else
+ {
+ boolean managedBeanOrDecorator = isTypeManagedBeanOrDecorator(clazz);
+ if (managedBeanOrDecorator && clazz.isAnnotationPresent(Decorator.class))
+ {
+ createDecorator(clazz);
+ }
+ else if (managedBeanOrDecorator && !clazz.isAbstract())
+ {
+ createSimpleBean(clazz);
+ }
+ }
+ }
+ return this;
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeBeanDiscoveryImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeBeanDiscoveryImpl.java 2009-06-26 15:53:39 UTC (rev 2901)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeBeanDiscoveryImpl.java 2009-06-26 17:03:09 UTC (rev 2902)
@@ -9,8 +9,7 @@
public void addBindingType(Class<? extends Annotation> bindingType)
{
- throw new RuntimeException("Not Yet Implemented");
-
+
}
public void addInterceptorBindingType(Class<? extends Annotation> bindingType)
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployer.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployer.java 2009-06-26 17:03:09 UTC (rev 2902)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.bootstrap;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Extension;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.bean.standard.ExtensionBean;
+import org.jboss.webbeans.ejb.EjbDescriptorCache;
+import org.jboss.webbeans.introspector.WBClass;
+import org.jboss.webbeans.resources.ClassTransformer;
+
+/**
+ * @author pmuir
+ *
+ */
+public class ExtensionBeanDeployer extends AbstractBeanDeployer
+{
+
+ private final Set<Extension> extensions;
+
+ public ExtensionBeanDeployer(BeanManagerImpl manager)
+ {
+ super(manager, new BeanDeployerEnvironment(new EjbDescriptorCache(), manager));
+ this.extensions = new HashSet<Extension>();
+ }
+
+ public AbstractBeanDeployer createBeans()
+ {
+ ClassTransformer classTransformer = getManager().getServices().get(ClassTransformer.class);
+ for (Extension extension : extensions)
+ {
+ @SuppressWarnings("unchecked")
+ WBClass<Extension> clazz = (WBClass<Extension>) classTransformer.classForName(extension.getClass());
+
+ ExtensionBean bean = ExtensionBean.of(getManager(), clazz, extension);
+ addBean(bean);
+ createObserverMethods(bean, clazz);
+ }
+ return this;
+ }
+
+ public void addExtensions(Iterable<Extension> extensions)
+ {
+ for (Extension extension : extensions)
+ {
+ addExtension(extension);
+ }
+ }
+
+ public void addExtension(Extension extension)
+ {
+ this.extensions.add(extension);
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-06-26 15:53:39 UTC (rev 2901)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-06-26 17:03:09 UTC (rev 2902)
@@ -16,6 +16,8 @@
*/
package org.jboss.webbeans.bootstrap;
+import javax.enterprise.inject.spi.Extension;
+
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.DefinitionException;
@@ -59,6 +61,7 @@
import org.jboss.webbeans.servlet.HttpSessionManager;
import org.jboss.webbeans.servlet.ServletApiAbstraction;
import org.jboss.webbeans.transaction.spi.TransactionServices;
+import org.jboss.webbeans.util.serviceProvider.ServiceLoader;
import org.jboss.webbeans.ws.spi.WebServices;
import org.jboss.webbeans.xml.BeansXmlParser;
@@ -81,6 +84,7 @@
// The Web Beans manager
private BeanManagerImpl manager;
+
public WebBeansBootstrap()
{
// initialize default services
@@ -146,9 +150,8 @@
*
* @param classes The classes to register as Web Beans
*/
- protected void registerBeans(Iterable<Class<?>> classes, EjbDescriptorCache ejbDescriptors)
+ protected void registerBeans(Iterable<Class<?>> classes, BeanDeployer beanDeployer)
{
- BeanDeployer beanDeployer = new BeanDeployer(manager, ejbDescriptors);
beanDeployer.addClasses(classes);
beanDeployer.addBean(ManagerBean.of(manager));
beanDeployer.addBean(InjectionPointBean.of(manager));
@@ -165,6 +168,11 @@
beanDeployer.createBeans().deploy();
}
+ private void registerExtensionBeans(Iterable<Extension> instances, AbstractBeanDeployer beanDeployer)
+ {
+
+ }
+
public void boot()
{
synchronized (this)
@@ -177,9 +185,13 @@
{
throw new IllegalStateException("No application context BeanStore set");
}
+
+ parseBeansXml();
+
beginApplication(getApplicationContext());
BeanStore requestBeanStore = new ConcurrentHashMapBeanStore();
beginDeploy(requestBeanStore);
+
EjbDescriptorCache ejbDescriptors = new EjbDescriptorCache();
if (getServices().contains(EjbServices.class))
{
@@ -188,35 +200,48 @@
ejbDescriptors.addAll(getServices().get(EjbServices.class).discoverEjbs());
}
- BeansXmlParser parser = new BeansXmlParser(getServices().get(ResourceLoader.class), getServices().get(WebBeanDiscovery.class).discoverWebBeansXml());
- parser.parse();
+ // TODO Should use a separate event manager for sending bootstrap events
+ ExtensionBeanDeployer extensionBeanDeployer = new ExtensionBeanDeployer(manager);
+ extensionBeanDeployer.addExtensions(ServiceLoader.load(Extension.class));
+ extensionBeanDeployer.createBeans().deploy();
- if (parser.getEnabledDeploymentTypes() != null)
- {
- manager.setEnabledDeploymentTypes(parser.getEnabledDeploymentTypes());
- }
- if (parser.getEnabledDecoratorClasses() != null)
- {
- manager.setEnabledDecoratorClasses(parser.getEnabledDecoratorClasses());
- }
- if (parser.getEnabledInterceptorClasses() != null)
- {
- manager.setEnabledInterceptorClasses(parser.getEnabledInterceptorClasses());
- }
- log.debug("Deployment types: " + manager.getEnabledDeploymentTypes());
+ BeanDeployer beanDeployer = new BeanDeployer(manager, ejbDescriptors);
+
fireBeforeBeanDiscoveryEvent();
- registerBeans(getServices().get(WebBeanDiscovery.class).discoverWebBeanClasses(), ejbDescriptors);
+ registerBeans(getServices().get(WebBeanDiscovery.class).discoverWebBeanClasses(), beanDeployer);
fireAfterBeanDiscoveryEvent();
log.debug("Web Beans initialized. Validating beans.");
- getServices().get(Validator.class).validateDeployment(manager);
+ getServices().get(Validator.class).validateDeployment(manager, beanDeployer.getBeanDeployerEnvironment());
// TODO I don't really think this is needed anymore, as we validate all points
manager.getResolver().resolveInjectionPoints();
fireAfterDeploymentValidationEvent();
endDeploy(requestBeanStore);
}
}
+
+ private void parseBeansXml()
+ {
+ BeansXmlParser parser = new BeansXmlParser(getServices().get(ResourceLoader.class), getServices().get(WebBeanDiscovery.class).discoverWebBeansXml());
+ parser.parse();
+
+ if (parser.getEnabledDeploymentTypes() != null)
+ {
+ manager.setEnabledDeploymentTypes(parser.getEnabledDeploymentTypes());
+ }
+ if (parser.getEnabledDecoratorClasses() != null)
+ {
+ manager.setEnabledDecoratorClasses(parser.getEnabledDecoratorClasses());
+ }
+ if (parser.getEnabledInterceptorClasses() != null)
+ {
+ manager.setEnabledInterceptorClasses(parser.getEnabledInterceptorClasses());
+ }
+ log.debug("Enabled deployment types: " + manager.getEnabledDeploymentTypes());
+ log.debug("Enabled decorator types: " + manager.getEnabledDecoratorClasses());
+ log.debug("Enabled interceptor types: " + manager.getEnabledInterceptorClasses());
+ }
- protected void fireBeforeBeanDiscoveryEvent()
+ private void fireBeforeBeanDiscoveryEvent()
{
BeforeBeanDiscoveryImpl event = new BeforeBeanDiscoveryImpl();
try
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java 2009-06-26 15:53:39 UTC (rev 2901)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java 2009-06-26 17:03:09 UTC (rev 2902)
@@ -84,13 +84,13 @@
{
for (EventObserver<?> observer : manager.getRegisteredObservers().get(type))
{
- log.debug("Checking observer " + observer + " to see if it is interested in event [" + event + "]");
+ log.trace("Checking observer " + observer + " to see if it is interested in event [" + event + "]");
if (observer.isObserverInterested(bindings))
{
@SuppressWarnings("unchecked")
Observer<T> o = (Observer<T>) observer.getObserver();
interestedObservers.add(o);
- log.debug("Added observer " + observer + " for event [" + event + "]");
+ log.trace("Added observer " + observer + " for event [" + event + "]");
}
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverFactory.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverFactory.java 2009-06-26 15:53:39 UTC (rev 2901)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverFactory.java 2009-06-26 17:03:09 UTC (rev 2902)
@@ -17,7 +17,7 @@
package org.jboss.webbeans.event;
import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bean.AbstractClassBean;
+import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.introspector.WBMethod;
import org.jboss.webbeans.transaction.spi.TransactionServices;
@@ -37,7 +37,7 @@
* @param manager The Web Beans manager
* @return An observer implementation built from the method abstraction
*/
- public static <T> ObserverImpl<T> create(WBMethod<?> method, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+ public static <T> ObserverImpl<T> create(WBMethod<?> method, RIBean<?> declaringBean, BeanManagerImpl manager)
{
ObserverImpl<T> result = null;
if (manager.getServices().contains(TransactionServices.class) && TransactionalObserverImpl.isObserverMethodTransactional(method))
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/serviceProvider/ServiceLoader.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/serviceProvider/ServiceLoader.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/serviceProvider/ServiceLoader.java 2009-06-26 17:03:09 UTC (rev 2902)
@@ -0,0 +1,280 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.util.serviceProvider;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logging;
+
+/**
+ * This class handles looking up service providers on the class path. It
+ * implements the <a href="http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html#Service%2..."
+ * >Service Provider section of the JAR File Specification</a>.
+ *
+ * The Service Provider programmatic lookup was not specified prior to Java 6 so
+ * this interface allows use of the specification prior to Java 6.
+ *
+ * The API is copied from <a
+ * href="http://java.sun.com/javase/6/docs/api/java/util/ServiceLoader.html"
+ * >java.util.ServiceLoader</a>
+ *
+ * @author Pete Muir
+ * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
+ */
+public class ServiceLoader<S> implements Iterable<S>
+{
+
+ private Log log = Logging.getLog(ServiceLoader.class);
+
+ private static final String SERVICES = "META-INF/services/";
+
+ /**
+ * Creates a new service loader for the given service type, using the current
+ * thread's context class loader.
+ *
+ * An invocation of this convenience method of the form
+ *
+ * {@code ServiceLoader.load(service)</code>}
+ *
+ * is equivalent to
+ *
+ * <code>ServiceLoader.load(service,
+ * Thread.currentThread().getContextClassLoader())</code>
+ *
+ * @param service The interface or abstract class representing the service
+ * @return A new service loader
+ */
+ public static <S> ServiceLoader<S> load(Class<S> service)
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ return load(service, loader);
+ }
+
+ /**
+ * Creates a new service loader for the given service type and class loader.
+ *
+ * @param service The interface or abstract class representing the service
+ * @param loader The class loader to be used to load provider-configuration
+ * files and provider classes, or null if the system class loader
+ * (or, failing that, the bootstrap class loader) is to be used
+ * @return A new service loader
+ */
+ public static <S> ServiceLoader<S> load(Class<S> service, ClassLoader loader)
+ {
+ if (loader == null)
+ {
+ loader = service.getClassLoader();
+ }
+ return new ServiceLoader<S>(service, loader);
+ }
+
+ /**
+ * Creates a new service loader for the given service type, using the
+ * extension class loader.
+ *
+ * This convenience method simply locates the extension class loader, call it
+ * extClassLoader, and then returns
+ *
+ * <code>ServiceLoader.load(service, extClassLoader)</code>
+ *
+ * If the extension class loader cannot be found then the system class loader
+ * is used; if there is no system class loader then the bootstrap class
+ * loader is used.
+ *
+ * This method is intended for use when only installed providers are desired.
+ * The resulting service will only find and load providers that have been
+ * installed into the current Java virtual machine; providers on the
+ * application's class path will be ignored.
+ *
+ * @param service The interface or abstract class representing the service
+ * @return A new service loader
+ */
+ public static <S> ServiceLoader<S> loadInstalled(Class<S> service)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ private final String serviceFile;
+ private final ClassLoader loader;
+
+ private Set<S> providers;
+
+ private ServiceLoader(Class<S> service, ClassLoader loader)
+ {
+ this.loader = loader;
+ this.serviceFile = SERVICES + service.getName();
+ }
+
+ /**
+ * Clear this loader's provider cache so that all providers will be reloaded.
+ *
+ * After invoking this method, subsequent invocations of the iterator method
+ * will lazily look up and instantiate providers from scratch, just as is
+ * done by a newly-created loader.
+ *
+ * This method is intended for use in situations in which new providers can
+ * be installed into a running Java virtual machine.
+ */
+ public void reload()
+ {
+ providers = new HashSet<S>();
+ Enumeration<URL> enumeration = null;
+ boolean errorOccurred = false;
+
+ try
+ {
+ enumeration = loader.getResources(serviceFile);
+ }
+ catch (IOException ioe)
+ {
+ errorOccurred = true;
+ }
+
+ if (!errorOccurred)
+ {
+ while (enumeration.hasMoreElements())
+ {
+ try
+ {
+ final URL url = enumeration.nextElement();
+ final InputStream is = url.openStream();
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+
+ String line = reader.readLine();
+ while (null != line)
+ {
+ try
+ {
+ final int comment = line.indexOf('#');
+
+ if (comment > -1)
+ {
+ line = line.substring(0, comment);
+ }
+
+ line.trim();
+
+ if (line.length() > 0)
+ {
+ try
+ {
+ @SuppressWarnings("unchecked")
+ Class<? extends S> clazz = (Class<? extends S>) loader.loadClass(line);
+ S instance = clazz.newInstance();
+ providers.add(instance);
+ }
+ catch (NoClassDefFoundError e)
+ {
+ log.warn("Error loading #0", line, e);
+ throw e;
+ }
+ catch (InstantiationException e)
+ {
+ log.warn("Error loading #0", line, e);
+ throw e;
+ }
+ catch (IllegalAccessException e)
+ {
+ log.warn("Error loading #0", line, e);
+ throw e;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ // try the next line
+ }
+
+ line = reader.readLine();
+ }
+ }
+ catch (Exception e)
+ {
+ // try the next file
+ }
+ }
+ }
+ }
+
+
+
+ /**
+ * Lazily loads the available providers of this loader's service.
+ *
+ * The iterator returned by this method first yields all of the elements of
+ * the provider cache, in instantiation order. It then lazily loads and
+ * instantiates any remaining providers, adding each one to the cache in
+ * turn.
+ *
+ * To achieve laziness the actual work of parsing the available
+ * provider-configuration files and instantiating providers must be done by
+ * the iterator itself. Its hasNext and next methods can therefore throw a
+ * ServiceConfigurationError if a provider-configuration file violates the
+ * specified format, or if it names a provider class that cannot be found and
+ * instantiated, or if the result of instantiating the class is not
+ * assignable to the service type, or if any other kind of exception or error
+ * is thrown as the next provider is located and instantiated. To write
+ * robust code it is only necessary to catch ServiceConfigurationError when
+ * using a service iterator.
+ *
+ * If such an error is thrown then subsequent invocations of the iterator
+ * will make a best effort to locate and instantiate the next available
+ * provider, but in general such recovery cannot be guaranteed.
+ *
+ * Design Note Throwing an error in these cases may seem extreme. The
+ * rationale for this behavior is that a malformed provider-configuration
+ * file, like a malformed class file, indicates a serious problem with the
+ * way the Java virtual machine is configured or is being used. As such it is
+ * preferable to throw an error rather than try to recover or, even worse,
+ * fail silently.
+ *
+ * The iterator returned by this method does not support removal. Invoking
+ * its remove method will cause an UnsupportedOperationException to be
+ * thrown.
+ *
+ * @return An iterator that lazily loads providers for this loader's service
+ */
+ public Iterator<S> iterator()
+ {
+ if (providers == null)
+ {
+ reload();
+ }
+ return providers.iterator();
+ }
+
+ /**
+ * Returns a string describing this service.
+ *
+ * @return A descriptive string
+ */
+ @Override
+ public String toString()
+ {
+ return "Services for " + serviceFile;
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/serviceProvider/ServiceLoader.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/BeforeBeanDiscoveryObserver.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/BeforeBeanDiscoveryObserver.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/BeforeBeanDiscoveryObserver.java 2009-06-26 17:03:09 UTC (rev 2902)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.deployment.lifecycle;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+
+/**
+ * @author pmuir
+ *
+ */
+public class BeforeBeanDiscoveryObserver implements Extension
+{
+
+ private static boolean observed;
+
+ /**
+ * @return the observed
+ */
+ public static boolean isObserved()
+ {
+ return observed;
+ }
+
+ /**
+ * @param observed the observed to set
+ */
+ public static void setObserved(boolean observed)
+ {
+ BeforeBeanDiscoveryObserver.observed = observed;
+ }
+
+
+ public void observe(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
+ {
+ setObserved(true);
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/BeforeBeanDiscoveryObserver.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/ExtensionsTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/ExtensionsTest.java 2009-06-26 15:53:39 UTC (rev 2901)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/ExtensionsTest.java 2009-06-26 17:03:09 UTC (rev 2902)
@@ -18,6 +18,9 @@
import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
import org.testng.annotations.Test;
/**
@@ -25,13 +28,17 @@
*
*/
@Artifact
+@Resources({
+ @Resource(source="javax.enterprise.inject.spi.Extension", destination="WEB-INF/classes/META-INF/services/javax.enterprise.inject.spi.Extension")
+})
+@IntegrationTest
public class ExtensionsTest extends AbstractJSR299Test
{
@Test
public void testBeforeBeanDiscoveryEventIsCalled()
{
-
+ assert BeforeBeanDiscoveryObserver.isObserved();
}
}
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/javax.enterprise.inject.spi.Extension
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/javax.enterprise.inject.spi.Extension (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/javax.enterprise.inject.spi.Extension 2009-06-26 17:03:09 UTC (rev 2902)
@@ -0,0 +1 @@
+org.jboss.jsr299.tck.tests.deployment.lifecycle.BeforeBeanDiscoveryObserver
15 years, 6 months
[webbeans-commits] Webbeans SVN: r2901 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle: broken2 and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-06-26 11:53:39 -0400 (Fri, 26 Jun 2009)
New Revision: 2901
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/ExtensionsTest.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DeploymentTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken2/AfterBeanDiscoveryFailureTest.java
Log:
Tests need a lot more work
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DeploymentTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DeploymentTest.java 2009-06-26 12:41:22 UTC (rev 2900)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DeploymentTest.java 2009-06-26 15:53:39 UTC (rev 2901)
@@ -27,6 +27,8 @@
* Tests related to the final deployment phase of the lifecycle.
*
* Spec version: 20090519 (sort of)
+ *
+ * PLM: THis test is a total mess and needs rewriting for 20090519 :-)
*
* @author David Allen
*/
@@ -34,11 +36,12 @@
public class DeploymentTest extends AbstractJSR299Test
{
@Test
- @SpecAssertions({
- @SpecAssertion(section = "11.5.2", id = "a"),
- @SpecAssertion(section = "11.5.3", id = "a"),
- @SpecAssertion(section = "11.5.3", id = "d")
- })
+ @SpecAssertion(id="unknown", section="unknown")
+// @SpecAssertions({
+// @SpecAssertion(section = "11.5.2", id = "a"),
+// @SpecAssertion(section = "11.5.3", id = "a"),
+// @SpecAssertion(section = "11.5.3", id = "d")
+// })
public void testDeployedManagerEvent()
{
assert ManagerObserver.isManagerDeployed();
@@ -58,9 +61,10 @@
}
@Test(groups = { "ri-broken" })
- @SpecAssertions({
- @SpecAssertion(section = "11.2", id = "ac")
- })
+ @SpecAssertion(id="unknown", section="unknown")
+// @SpecAssertions({
+// @SpecAssertion(section = "11.2", id = "ac")
+// })
public void testOnlyEnabledBeansDeployed()
{
assert !getBeans(User.class).isEmpty();
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/ExtensionsTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/ExtensionsTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/ExtensionsTest.java 2009-06-26 15:53:39 UTC (rev 2901)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.deployment.lifecycle;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+/**
+ * @author pmuir
+ *
+ */
+@Artifact
+public class ExtensionsTest extends AbstractJSR299Test
+{
+
+ @Test
+ public void testBeforeBeanDiscoveryEventIsCalled()
+ {
+
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/ExtensionsTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken2/AfterBeanDiscoveryFailureTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken2/AfterBeanDiscoveryFailureTest.java 2009-06-26 12:41:22 UTC (rev 2900)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken2/AfterBeanDiscoveryFailureTest.java 2009-06-26 15:53:39 UTC (rev 2901)
@@ -44,7 +44,6 @@
@SpecAssertions({
@SpecAssertion(section = "11.5.2", id = "a"),
@SpecAssertion(section = "12.2", id = "e"),
- @SpecAssertion(section = "11.5.3", id = "a"),
@SpecAssertion(section = "12.2", id = "f")
})
public void testDeploymentFailsDuringValidation()
15 years, 6 months
[webbeans-commits] Webbeans SVN: r2900 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/bootstrap and 3 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-06-26 08:41:22 -0400 (Fri, 26 Jun 2009)
New Revision: 2900
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java
Removed:
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansELResolverImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducerTest.java
Log:
Split BeanValidator up a bit
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-06-26 12:14:33 UTC (rev 2899)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-06-26 12:41:22 UTC (rev 2900)
@@ -78,7 +78,6 @@
import org.jboss.webbeans.event.EventManager;
import org.jboss.webbeans.event.EventObserver;
import org.jboss.webbeans.event.ObserverImpl;
-import org.jboss.webbeans.injection.NonContextualInjector;
import org.jboss.webbeans.injection.resolution.DecoratorResolver;
import org.jboss.webbeans.injection.resolution.ResolvableFactory;
import org.jboss.webbeans.injection.resolution.ResolvableWBClass;
@@ -192,7 +191,6 @@
private transient final EventManager eventManager;
private transient final Resolver resolver;
private transient final Resolver decoratorResolver;
- private final transient NonContextualInjector nonContextualInjector;
private final transient ELResolver webbeansELResolver;
/*
@@ -293,7 +291,6 @@
this.resolver = new Resolver(this, beans);
this.decoratorResolver = new DecoratorResolver(this, decorators);
this.eventManager = new EventManager(this);
- this.nonContextualInjector = new NonContextualInjector(this);
this.webbeansELResolver = new WebBeansELResolverImpl(this);
this.childActivities = new CopyOnWriteArraySet<BeanManagerImpl>();
this.currentInjectionPoint = new ThreadLocal<Stack<InjectionPoint>>()
@@ -337,6 +334,7 @@
*
* @see javax.enterprise.inject.spi.BeanManager#addBean(javax.inject.manager.Bean)
*/
+ @Deprecated
public void addBean(Bean<?> bean)
{
synchronized (bean)
@@ -375,6 +373,11 @@
return eventManager.getObservers(event, bindings);
}
+ public <T> Set<ObserverMethod<T, ?>> resolveObserverMethods(T event, Annotation... bindings)
+ {
+ throw new UnsupportedOperationException();
+ }
+
private void checkEventType(Type eventType)
{
Type[] types;
@@ -420,6 +423,14 @@
{
return Collections.unmodifiableList(enabledDecoratorClasses);
}
+
+ /**
+ * @return the enabledInterceptorClasses
+ */
+ public List<Class<?>> getEnabledInterceptorClasses()
+ {
+ return Collections.unmodifiableList(enabledInterceptorClasses);
+ }
/**
* Set the enabled deployment types
@@ -573,11 +584,13 @@
*
* @see javax.enterprise.inject.spi.BeanManager#addContext(javax.enterprise.context.spi.Context)
*/
+ @Deprecated
public void addContext(Context context)
{
contexts.put(context.getScopeType(), context);
}
+ @Deprecated
public void addObserver(Observer<?> observer, Annotation... bindings)
{
addObserver(observer, eventManager.getTypeOfObserver(observer), bindings);
@@ -589,6 +602,7 @@
* @param <T>
* @param observer
*/
+ @Deprecated
public <T> void addObserver(ObserverImpl<T> observer)
{
addObserver(observer, observer.getEventType(), observer.getBindingsAsArray());
@@ -602,6 +616,7 @@
* @param bindings
* @return
*/
+ @Deprecated
public void addObserver(Observer<?> observer, Type eventType, Annotation... bindings)
{
checkEventType(eventType);
@@ -612,6 +627,7 @@
}
}
+ @Deprecated
public void removeObserver(Observer<?> observer)
{
eventManager.removeObserver(observer);
@@ -681,7 +697,7 @@
}
- public Object getInjectableReference(Bean<?> bean, CreationalContext<?> creationalContext)
+ public Object getReference(Bean<?> bean, CreationalContext<?> creationalContext)
{
bean = getMostSpecializedBean(bean);
if (creationalContext instanceof CreationalContextImpl)
@@ -705,14 +721,13 @@
}
}
- /*
- * TODO this is not correct, as the current implementation of getInstance
- * does not pay attention to what type the resulting instance needs to
- * implement
- */
public Object getReference(Bean<?> bean, Type beanType, CreationalContext<?> creationalContext)
{
- return getInjectableReference(bean, creationalContext);
+ if (!bean.getTypes().contains(beanType))
+ {
+ throw new IllegalArgumentException("The given beanType is not a type " + beanType +" of the bean " + bean );
+ }
+ return getReference(bean, creationalContext);
}
@SuppressWarnings("unchecked")
@@ -740,12 +755,12 @@
}
else
{
- return getInjectableReference(resolvedBean, creationalContextImpl);
+ return getReference(resolvedBean, creationalContextImpl);
}
}
else
{
- return getInjectableReference(resolvedBean, creationalContext);
+ return getReference(resolvedBean, creationalContext);
}
}
finally
@@ -821,11 +836,6 @@
// TODO Fix this cast and make the resolver return a list
return new ArrayList(decoratorResolver.get(ResolvableFactory.of(types, bindings)));
}
-
- public List<Decorator<?>> resolveDecorators(Contextual<?> bean)
- {
- throw new UnsupportedOperationException();
- }
/**
* Resolves a list of interceptors based on interception type and interceptor
@@ -1056,9 +1066,9 @@
return (Bean<X>) key;
}
- public void validate(InjectionPoint injectionPoint)
+ public void validate(InjectionPoint ij)
{
- throw new UnsupportedOperationException("Not yet implemented");
+ getServices().get(Validator.class).validateInjectionPoint(ij, this);
}
public Set<Annotation> getInterceptorBindingTypeDefinition(Class<? extends Annotation> bindingType)
@@ -1104,6 +1114,26 @@
@Deprecated
public <X> Bean<? extends X> getHighestPrecedenceBean(Set<Bean<? extends X>> beans)
{
+ return resolve(beans);
+ }
+
+ public ELResolver getELResolver()
+ {
+ return webbeansELResolver;
+ }
+
+ public <T> CreationalContextImpl<T> createCreationalContext(Contextual<T> contextual)
+ {
+ return new CreationalContextImpl<T>(contextual);
+ }
+
+ public <T> AnnotatedType<T> createAnnotatedType(Class<T> type)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public <X> Bean<? extends X> resolve(Set<Bean<? extends X>> beans)
+ {
if (beans.size() == 1)
{
return beans.iterator().next();
@@ -1133,39 +1163,5 @@
sortedBeans.addAll(beans);
return sortedBeans.last();
}
-
- public ELResolver getELResolver()
- {
- return webbeansELResolver;
- }
-
- public <T> CreationalContextImpl<T> createCreationalContext(Contextual<T> contextual)
- {
- return new CreationalContextImpl<T>(contextual);
- }
- /* (non-Javadoc)
- * @see javax.enterprise.inject.spi.BeanManager#createAnnotatedType(java.lang.Class)
- */
- public <T> AnnotatedType<T> createAnnotatedType(Class<T> type)
- {
- throw new UnsupportedOperationException();
- }
-
- /* (non-Javadoc)
- * @see javax.enterprise.inject.spi.BeanManager#resolve(java.util.Set)
- */
- public <X> Bean<? extends X> resolve(Set<Bean<? extends X>> beans)
- {
- return getHighestPrecedenceBean(beans);
- }
-
- /* (non-Javadoc)
- * @see javax.enterprise.inject.spi.BeanManager#resolveObserverMethods(java.lang.Object, java.lang.annotation.Annotation[])
- */
- public <T> Set<ObserverMethod<T, ?>> resolveObserverMethods(T event, Annotation... bindings)
- {
- throw new UnsupportedOperationException();
- }
-
}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-06-26 12:14:33 UTC (rev 2899)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-06-26 12:41:22 UTC (rev 2900)
@@ -1,218 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.enterprise.context.Dependent;
-import javax.enterprise.event.Event;
-import javax.enterprise.inject.AmbiguousResolutionException;
-import javax.enterprise.inject.Instance;
-import javax.enterprise.inject.New;
-import javax.enterprise.inject.UnproxyableResolutionException;
-import javax.enterprise.inject.UnsatisfiedResolutionException;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.Decorator;
-import javax.enterprise.inject.spi.InjectionPoint;
-
-import org.jboss.webbeans.bean.AbstractClassBean;
-import org.jboss.webbeans.bean.DecoratorBean;
-import org.jboss.webbeans.bean.NewEnterpriseBean;
-import org.jboss.webbeans.bean.NewSimpleBean;
-import org.jboss.webbeans.bean.RIBean;
-import org.jboss.webbeans.injection.resolution.ResolvableWBClass;
-import org.jboss.webbeans.introspector.WBAnnotated;
-import org.jboss.webbeans.metadata.MetaDataCache;
-import org.jboss.webbeans.util.Beans;
-import org.jboss.webbeans.util.ListComparator;
-import org.jboss.webbeans.util.Names;
-import org.jboss.webbeans.util.Proxies;
-import org.jboss.webbeans.util.Reflections;
-
-/**
- * Checks a list of beans for DeploymentExceptions and their subclasses
- *
- * @author Nicklas Karlsson
- *
- */
-public class BeanValidator
-{
-
- private final BeanManagerImpl manager;
-
- public BeanValidator(BeanManagerImpl manager)
- {
- this.manager = manager;
- }
-
- /**
- * Validates the beans
- *
- * @param beans The beans to validate
- */
- public void validate()
- {
- final List<RIBean<?>> specializedBeans = new ArrayList<RIBean<?>>();
- for (Bean<?> bean : manager.getBeans())
- {
- for (InjectionPoint injectionPoint : bean.getInjectionPoints())
- {
- if (injectionPoint.getAnnotated().getAnnotation(New.class) != null && injectionPoint.getBindings().size() > 1)
- {
- throw new DefinitionException("The injection point " + injectionPoint + " is annotated with @New which cannot be combined with other binding types");
- }
- if (injectionPoint.getType() instanceof ParameterizedType)
- {
- ParameterizedType parameterizedType = (ParameterizedType) injectionPoint.getType();
- for (Type type : parameterizedType.getActualTypeArguments())
- {
- if (type instanceof TypeVariable)
- {
- throw new DefinitionException("Injection point cannot have a type variable type parameter " + injectionPoint);
- }
- if (type instanceof WildcardType)
- {
- throw new DefinitionException("Injection point cannot have a wildcard type parameter " + injectionPoint);
- }
- }
- }
- checkFacadeInjectionPoint(injectionPoint, Instance.class);
- checkFacadeInjectionPoint(injectionPoint, Event.class);
- Annotation[] bindings = injectionPoint.getBindings().toArray(new Annotation[0]);
- WBAnnotated<?, ?> annotatedItem = ResolvableWBClass.of(injectionPoint.getType(), bindings, manager);
- Set<?> resolvedBeans = manager.getInjectableBeans(injectionPoint);
- if (resolvedBeans.isEmpty())
- {
- throw new UnsatisfiedResolutionException("The injection point " + injectionPoint + " with binding types " + Names.annotationsToString(injectionPoint.getBindings()) + " in " + bean + " has unsatisfied dependencies with binding types ");
- }
- if (resolvedBeans.size() > 1)
- {
- throw new AmbiguousResolutionException("The injection point " + injectionPoint + " with binding types " + Names.annotationsToString(injectionPoint.getBindings()) + " in " + bean + " has ambiguous dependencies");
- }
- Bean<?> resolvedBean = (Bean<?>) resolvedBeans.iterator().next();
- if (manager.getServices().get(MetaDataCache.class).getScopeModel(resolvedBean.getScopeType()).isNormal() && !Proxies.isTypeProxyable(injectionPoint.getType()))
- {
- throw new UnproxyableResolutionException("The injection point " + injectionPoint + " has non-proxyable dependencies");
- }
- if (Reflections.isPrimitive(annotatedItem.getJavaClass()) && resolvedBean.isNullable())
- {
- throw new NullableDependencyException("The injection point " + injectionPoint + " has nullable dependencies");
- }
- if (Beans.isPassivatingBean(bean, manager) && !resolvedBean.isSerializable() && resolvedBean.getScopeType().equals(Dependent.class))
- {
- throw new UnserializableDependencyException("The bean " + bean + " declares a passivating scope but has non-serializable dependency: " + resolvedBean);
- }
- }
- if (bean instanceof RIBean && !(bean instanceof NewSimpleBean) && !(bean instanceof NewEnterpriseBean))
- {
- RIBean<?> abstractBean = (RIBean<?>) bean;
- if (abstractBean.isSpecializing())
- {
- if (!hasHigherPrecedence(bean.getDeploymentType(), abstractBean.getSpecializedBean().getDeploymentType()))
- {
- throw new InconsistentSpecializationException("Specializing bean must have a higher precedence deployment type than the specialized bean: " + bean);
- }
- if (specializedBeans.contains(abstractBean.getSpecializedBean()))
- {
- throw new InconsistentSpecializationException("Two beans cannot specialize the same bean: " + bean);
- }
- specializedBeans.add(abstractBean.getSpecializedBean());
- }
- if (Beans.isPassivatingBean(bean, manager) && bean instanceof AbstractClassBean)
- {
- AbstractClassBean<?> classBean = (AbstractClassBean<?>) bean;
- if (classBean.hasDecorators())
- {
- for (Decorator<?> decorator : classBean.getDecorators())
- {
- if (!decorator.isSerializable())
- {
- throw new UnserializableDependencyException("The bean " + bean + " declares a passivating scope but has non-serializable decorator: " + decorator);
- }
- }
- }
-
- }
- }
- boolean normalScoped = manager.getServices().get(MetaDataCache.class).getScopeModel(bean.getScopeType()).isNormal();
- if (normalScoped && !Beans.isBeanProxyable(bean))
- {
- throw new UnproxyableResolutionException("Normal scoped bean " + bean + " is not proxyable");
- }
- }
-
- validateEnabledDecoratorClasses();
-
- }
-
- private void validateEnabledDecoratorClasses()
- {
- // TODO Move building this list to the boot or sth
- Set<Class<?>> decoratorBeanClasses = new HashSet<Class<?>>();
- for (DecoratorBean<?> bean : manager.getDecorators())
- {
- decoratorBeanClasses.add(bean.getType());
- }
- for (Class<?> clazz : manager.getEnabledDecoratorClasses())
- {
- if (!decoratorBeanClasses.contains(clazz))
- {
- throw new DeploymentException("Enabled decorator class " + clazz + " is not the bean class of at least one decorator bean (detected decorator beans " + decoratorBeanClasses + ")");
- }
- }
- }
-
- private boolean hasHigherPrecedence(Class<? extends Annotation> deploymentType, Class<? extends Annotation> otherDeploymentType)
- {
- Comparator<Class<? extends Annotation>> comparator = new ListComparator<Class<? extends Annotation>>(manager.getEnabledDeploymentTypes());
- return comparator.compare(deploymentType, otherDeploymentType) > 0;
- }
-
- private void checkFacadeInjectionPoint(InjectionPoint injectionPoint, Class<?> type)
- {
- if (injectionPoint.getAnnotated().getBaseType().equals(type))
- {
- if (injectionPoint.getType() instanceof ParameterizedType)
- {
- ParameterizedType parameterizedType = (ParameterizedType) injectionPoint.getType();
- if (parameterizedType.getActualTypeArguments()[0] instanceof TypeVariable)
- {
- throw new DefinitionException("An injection point of type " + type + " cannot have a type variable type parameter " + injectionPoint);
- }
- if (parameterizedType.getActualTypeArguments()[0] instanceof WildcardType)
- {
- throw new DefinitionException("An injection point of type " + type + " cannot have a wildcard type parameter " + injectionPoint);
- }
- }
- else
- {
- throw new DefinitionException("An injection point of type " + type + " must have a type parameter " + injectionPoint);
- }
- }
-
- }
-
-}
Copied: ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java (from rev 2898, ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-06-26 12:41:22 UTC (rev 2900)
@@ -0,0 +1,238 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.AmbiguousResolutionException;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.UnproxyableResolutionException;
+import javax.enterprise.inject.UnsatisfiedResolutionException;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.webbeans.bean.AbstractClassBean;
+import org.jboss.webbeans.bean.DecoratorBean;
+import org.jboss.webbeans.bean.NewEnterpriseBean;
+import org.jboss.webbeans.bean.NewSimpleBean;
+import org.jboss.webbeans.bean.RIBean;
+import org.jboss.webbeans.bootstrap.api.Service;
+import org.jboss.webbeans.injection.resolution.ResolvableWBClass;
+import org.jboss.webbeans.introspector.WBAnnotated;
+import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.util.Beans;
+import org.jboss.webbeans.util.ListComparator;
+import org.jboss.webbeans.util.Names;
+import org.jboss.webbeans.util.Proxies;
+import org.jboss.webbeans.util.Reflections;
+
+/**
+ * Checks a list of beans for DeploymentExceptions and their subclasses
+ *
+ * @author Nicklas Karlsson
+ *
+ */
+public class Validator implements Service
+{
+
+ private void validateBean(Bean<?> bean, BeanManagerImpl beanManager)
+ {
+ for (InjectionPoint ij : bean.getInjectionPoints())
+ {
+ validateInjectionPoint(ij, beanManager);
+ }
+ boolean normalScoped = beanManager.getServices().get(MetaDataCache.class).getScopeModel(bean.getScopeType()).isNormal();
+ if (normalScoped && !Beans.isBeanProxyable(bean))
+ {
+ throw new UnproxyableResolutionException("Normal scoped bean " + bean + " is not proxyable");
+ }
+ }
+
+ /**
+ * Validate an RIBean.
+ *
+ * This includes validating whether two beans specialize the same bean
+ *
+ * @param bean the bean to validate
+ * @param beanManager the current manager
+ * @param specializedBeans the existing specialized beans
+ */
+ private void validateRIBean(RIBean<?> bean, BeanManagerImpl beanManager, List<RIBean<?>> specializedBeans)
+ {
+ validateBean(bean, beanManager);
+ if (!(bean instanceof NewSimpleBean) && !(bean instanceof NewEnterpriseBean))
+ {
+ RIBean<?> abstractBean = bean;
+ if (abstractBean.isSpecializing())
+ {
+ if (!hasHigherPrecedence(bean.getDeploymentType(), abstractBean.getSpecializedBean().getDeploymentType(), beanManager))
+ {
+ throw new InconsistentSpecializationException("Specializing bean must have a higher precedence deployment type than the specialized bean: " + bean);
+ }
+ if (specializedBeans.contains(abstractBean.getSpecializedBean()))
+ {
+ throw new InconsistentSpecializationException("Two beans cannot specialize the same bean: " + bean);
+ }
+ specializedBeans.add(abstractBean.getSpecializedBean());
+ }
+ if (Beans.isPassivatingBean(bean, beanManager) && bean instanceof AbstractClassBean)
+ {
+ AbstractClassBean<?> classBean = (AbstractClassBean<?>) bean;
+ if (classBean.hasDecorators())
+ {
+ for (Decorator<?> decorator : classBean.getDecorators())
+ {
+ if (!decorator.isSerializable())
+ {
+ throw new UnserializableDependencyException("The bean " + bean + " declares a passivating scope but has non-serializable decorator: " + decorator);
+ }
+ }
+ }
+
+ }
+ }
+
+ }
+
+ public void validateInjectionPoint(InjectionPoint ij, BeanManagerImpl beanManager)
+ {
+ if (ij.getAnnotated().getAnnotation(New.class) != null && ij.getBindings().size() > 1)
+ {
+ throw new DefinitionException("The injection point " + ij + " is annotated with @New which cannot be combined with other binding types");
+ }
+ if (ij.getType() instanceof ParameterizedType)
+ {
+ ParameterizedType parameterizedType = (ParameterizedType) ij.getType();
+ for (Type type : parameterizedType.getActualTypeArguments())
+ {
+ if (type instanceof TypeVariable)
+ {
+ throw new DefinitionException("Injection point cannot have a type variable type parameter " + ij);
+ }
+ if (type instanceof WildcardType)
+ {
+ throw new DefinitionException("Injection point cannot have a wildcard type parameter " + ij);
+ }
+ }
+ }
+ checkFacadeInjectionPoint(ij, Instance.class);
+ checkFacadeInjectionPoint(ij, Event.class);
+ Annotation[] bindings = ij.getBindings().toArray(new Annotation[0]);
+ WBAnnotated<?, ?> annotatedItem = ResolvableWBClass.of(ij.getType(), bindings, beanManager);
+ Set<?> resolvedBeans = beanManager.getInjectableBeans(ij);
+ if (resolvedBeans.isEmpty())
+ {
+ throw new UnsatisfiedResolutionException("The injection point " + ij + " with binding types " + Names.annotationsToString(ij.getBindings()) + " in " + ij.getBean() + " has unsatisfied dependencies with binding types ");
+ }
+ if (resolvedBeans.size() > 1)
+ {
+ throw new AmbiguousResolutionException("The injection point " + ij + " with binding types " + Names.annotationsToString(ij.getBindings()) + " in " + ij.getBean() + " has ambiguous dependencies");
+ }
+ Bean<?> resolvedBean = (Bean<?>) resolvedBeans.iterator().next();
+ if (beanManager.getServices().get(MetaDataCache.class).getScopeModel(resolvedBean.getScopeType()).isNormal() && !Proxies.isTypeProxyable(ij.getType()))
+ {
+ throw new UnproxyableResolutionException("The injection point " + ij + " has non-proxyable dependencies");
+ }
+ if (Reflections.isPrimitive(annotatedItem.getJavaClass()) && resolvedBean.isNullable())
+ {
+ throw new NullableDependencyException("The injection point " + ij + " has nullable dependencies");
+ }
+ if (Beans.isPassivatingBean(ij.getBean(), beanManager) && !resolvedBean.isSerializable() && resolvedBean.getScopeType().equals(Dependent.class))
+ {
+ throw new UnserializableDependencyException("The bean " + ij.getBean() + " declares a passivating scope but has non-serializable dependency: " + resolvedBean);
+ }
+ }
+
+ public void validateDeployment(BeanManagerImpl manager)
+ {
+ List<RIBean<?>> specializedBeans = new ArrayList<RIBean<?>>();
+ for (Bean<?> bean : manager.getBeans())
+ {
+ if (bean instanceof RIBean)
+ {
+ validateRIBean((RIBean<?>) bean, manager, specializedBeans);
+ }
+ else
+ {
+ validateBean(bean, manager);
+ }
+ }
+ validateEnabledDecoratorClasses(manager);
+
+ }
+
+ private void validateEnabledDecoratorClasses(BeanManagerImpl beanManager)
+ {
+ // TODO Move building this list to the boot or sth
+ Set<Class<?>> decoratorBeanClasses = new HashSet<Class<?>>();
+ for (DecoratorBean<?> bean : beanManager.getDecorators())
+ {
+ decoratorBeanClasses.add(bean.getType());
+ }
+ for (Class<?> clazz : beanManager.getEnabledDecoratorClasses())
+ {
+ if (!decoratorBeanClasses.contains(clazz))
+ {
+ throw new DeploymentException("Enabled decorator class " + clazz + " is not the bean class of at least one decorator bean (detected decorator beans " + decoratorBeanClasses + ")");
+ }
+ }
+ }
+
+ private static boolean hasHigherPrecedence(Class<? extends Annotation> deploymentType, Class<? extends Annotation> otherDeploymentType, BeanManagerImpl manager)
+ {
+ Comparator<Class<? extends Annotation>> comparator = new ListComparator<Class<? extends Annotation>>(manager.getEnabledDeploymentTypes());
+ return comparator.compare(deploymentType, otherDeploymentType) > 0;
+ }
+
+ private static void checkFacadeInjectionPoint(InjectionPoint injectionPoint, Class<?> type)
+ {
+ if (injectionPoint.getAnnotated().getBaseType().equals(type))
+ {
+ if (injectionPoint.getType() instanceof ParameterizedType)
+ {
+ ParameterizedType parameterizedType = (ParameterizedType) injectionPoint.getType();
+ if (parameterizedType.getActualTypeArguments()[0] instanceof TypeVariable)
+ {
+ throw new DefinitionException("An injection point of type " + type + " cannot have a type variable type parameter " + injectionPoint);
+ }
+ if (parameterizedType.getActualTypeArguments()[0] instanceof WildcardType)
+ {
+ throw new DefinitionException("An injection point of type " + type + " cannot have a wildcard type parameter " + injectionPoint);
+ }
+ }
+ else
+ {
+ throw new DefinitionException("An injection point of type " + type + " must have a type parameter " + injectionPoint);
+ }
+ }
+
+ }
+
+}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-06-26 12:14:33 UTC (rev 2899)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-06-26 12:41:22 UTC (rev 2900)
@@ -17,10 +17,10 @@
package org.jboss.webbeans.bootstrap;
import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.BeanValidator;
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.DefinitionException;
import org.jboss.webbeans.DeploymentException;
+import org.jboss.webbeans.Validator;
import org.jboss.webbeans.bean.standard.EventBean;
import org.jboss.webbeans.bean.standard.InjectionPointBean;
import org.jboss.webbeans.bean.standard.InstanceBean;
@@ -132,6 +132,7 @@
// TODO expose AnnotatedClass on SPI and allow container to provide impl of this via ResourceLoader
getServices().add(ClassTransformer.class, new ClassTransformer());
getServices().add(MetaDataCache.class, new MetaDataCache(getServices().get(ClassTransformer.class)));
+ getServices().add(Validator.class, new Validator());
}
public BeanManagerImpl getManager()
@@ -207,7 +208,7 @@
registerBeans(getServices().get(WebBeanDiscovery.class).discoverWebBeanClasses(), ejbDescriptors);
fireAfterBeanDiscoveryEvent();
log.debug("Web Beans initialized. Validating beans.");
- new BeanValidator(manager).validate();
+ getServices().get(Validator.class).validateDeployment(manager);
// TODO I don't really think this is needed anymore, as we validate all points
manager.getResolver().resolveInjectionPoints();
fireAfterDeploymentValidationEvent();
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansELResolverImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansELResolverImpl.java 2009-06-26 12:14:33 UTC (rev 2899)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansELResolverImpl.java 2009-06-26 12:41:22 UTC (rev 2900)
@@ -137,7 +137,7 @@
CreationalContext<?> creationalContext = manager.createCreationalContext(bean);
if (bean != null)
{
- holder.setValue(manager.getInjectableReference(bean, creationalContext));
+ holder.setValue(manager.getReference(bean, creationalContext));
}
creationalContext.release();
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2009-06-26 12:14:33 UTC (rev 2899)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2009-06-26 12:41:22 UTC (rev 2900)
@@ -176,7 +176,7 @@
{
creationalContext = manager.createCreationalContext(observerBean);
}
- instance = manager.getInjectableReference(observerBean, creationalContext);
+ instance = manager.getReference(observerBean, creationalContext);
if (instance == null)
{
return;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducerTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducerTest.java 2009-06-26 12:14:33 UTC (rev 2899)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducerTest.java 2009-06-26 12:41:22 UTC (rev 2900)
@@ -40,7 +40,6 @@
@Test
public void testNoParameterizedCollectionInjection()
{
- assert getCurrentManager().getInstanceByType(Collection.class).size() == 3;
NoParameterizedCollectionInjection item = getCurrentManager().getInstanceByType(NoParameterizedCollectionInjection.class);
assert item.getFieldInjection().size() == 3;
15 years, 6 months
[webbeans-commits] Webbeans SVN: r2899 - in ri/trunk/tests/src: test/java/org/jboss/jsr299/tck/tests and 2 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-06-26 08:14:33 -0400 (Fri, 26 Jun 2009)
New Revision: 2899
Added:
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractCow.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractFarmHouse.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractHorse.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractKennel.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractStable.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AnotherDeploymentType.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Cow.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/CowDung.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Cuddly.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Dog.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Donkey.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Dung.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/FarmAnimalDeploymentType.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/FarmHouse.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Horse.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/HorseDung.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/LabradorKennel.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/RealizationTest.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Smelly.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Stable.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Tame.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/TameCow.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/TameHorse.java
Modified:
ri/trunk/tests/src/main/java/org/jboss/webbeans/test/AbstractWebBeansTest.java
Log:
Moved realization tests from TCK to webbeans-core-test
Modified: ri/trunk/tests/src/main/java/org/jboss/webbeans/test/AbstractWebBeansTest.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/test/AbstractWebBeansTest.java 2009-06-26 11:43:37 UTC (rev 2898)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/test/AbstractWebBeansTest.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -8,6 +8,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.net.URL;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
@@ -93,6 +94,31 @@
}
+ /**
+ * Checks if all annotations are in a given set of annotations
+ *
+ * @param annotations The annotation set
+ * @param annotationTypes The annotations to match
+ * @return True if match, false otherwise
+ */
+ public boolean annotationSetMatches(Set<? extends Annotation> annotations, Class<? extends Annotation>... annotationTypes)
+ {
+ List<Class<? extends Annotation>> annotationTypeList = new ArrayList<Class<? extends Annotation>>();
+ annotationTypeList.addAll(Arrays.asList(annotationTypes));
+ for (Annotation annotation : annotations)
+ {
+ if (annotationTypeList.contains(annotation.annotationType()))
+ {
+ annotationTypeList.remove(annotation.annotationType());
+ }
+ else
+ {
+ return false;
+ }
+ }
+ return annotationTypeList.size() == 0;
+ }
+
protected List<Class<? extends Annotation>> getEnabledDeploymentTypes()
{
return getDefaultDeploymentTypes();
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractCow.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractCow.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractCow.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+
+abstract class AbstractCow
+{
+
+ @Produces @RequestScoped @Smelly @FarmAnimalDeploymentType CowDung getDung()
+ {
+ return new CowDung();
+ }
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractCow.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractFarmHouse.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractFarmHouse.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractFarmHouse.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,13 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+import javax.enterprise.event.Observes;
+
+abstract class AbstractFarmHouse
+{
+
+ public void observeTameCows(@Observes @Tame Cow cow)
+ {
+
+ }
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractFarmHouse.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractHorse.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractHorse.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractHorse.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+
+abstract class AbstractHorse
+{
+
+ @Produces @Smelly @RequestScoped @FarmAnimalDeploymentType private HorseDung dung = new HorseDung();
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractHorse.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractKennel.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractKennel.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractKennel.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,15 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+import javax.enterprise.inject.Produces;
+
+@AnotherDeploymentType
+class AbstractKennel
+{
+
+ @Produces @Cuddly public Dog get()
+ {
+ return new Dog() {};
+ }
+
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractKennel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractStable.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractStable.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractStable.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+import javax.enterprise.inject.Produces;
+
+@AnotherDeploymentType
+abstract class AbstractStable
+{
+
+ private @Produces @Cuddly Donkey donkey = new Donkey();
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AbstractStable.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AnotherDeploymentType.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AnotherDeploymentType.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AnotherDeploymentType.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+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.enterprise.inject.deployment.DeploymentType;
+
+@Target( { TYPE, METHOD })
+@Retention(RUNTIME)
+@Documented
+@DeploymentType
+@interface AnotherDeploymentType
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/AnotherDeploymentType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Cow.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Cow.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Cow.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+import org.jboss.webbeans.Realizes;
+
+@Realizes @AnotherDeploymentType
+class Cow extends AbstractCow
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Cow.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/CowDung.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/CowDung.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/CowDung.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+class CowDung extends Dung
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/CowDung.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Cuddly.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Cuddly.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Cuddly.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+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.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.stereotype.Stereotype;
+
+@Stereotype
+@Target( { TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@RequestScoped
+@interface Cuddly
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Cuddly.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Dog.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Dog.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Dog.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+interface Dog
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Dog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Donkey.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Donkey.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Donkey.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+class Donkey
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Donkey.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Dung.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Dung.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Dung.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+class Dung
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Dung.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/FarmAnimalDeploymentType.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/FarmAnimalDeploymentType.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/FarmAnimalDeploymentType.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+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.enterprise.inject.deployment.DeploymentType;
+
+@Target( { TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@Documented
+@DeploymentType
+@interface FarmAnimalDeploymentType
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/FarmAnimalDeploymentType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/FarmHouse.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/FarmHouse.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/FarmHouse.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+import org.jboss.webbeans.Realizes;
+
+@Smelly @Realizes
+class FarmHouse extends AbstractFarmHouse
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/FarmHouse.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Horse.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Horse.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Horse.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+import org.jboss.webbeans.Realizes;
+
+@AnotherDeploymentType @Realizes
+class Horse extends AbstractHorse
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Horse.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/HorseDung.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/HorseDung.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/HorseDung.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+class HorseDung extends Dung
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/HorseDung.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/LabradorKennel.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/LabradorKennel.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/LabradorKennel.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+import org.jboss.webbeans.Realizes;
+
+@Realizes
+@FarmAnimalDeploymentType
+class LabradorKennel extends AbstractKennel
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/LabradorKennel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/RealizationTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/RealizationTest.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/RealizationTest.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,128 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.AnnotationLiteral;
+import javax.enterprise.inject.Any;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * Spec version: PRD2
+ *
+ */
+@Artifact
+@BeansXml("beans.xml")
+public class RealizationTest extends AbstractWebBeansTest
+{
+
+ private static Annotation SMELLY_LITERAL = new AnnotationLiteral<Smelly>()
+ {
+ };
+ private static Annotation TAME_LITERAL = new AnnotationLiteral<Tame>()
+ {
+ };
+
+ @Test
+ public void testRealizedBeanWithProducerMethodHasSameScope()
+ {
+ assert getBeans(CowDung.class, SMELLY_LITERAL).size() == 1;
+ assert getBeans(CowDung.class, SMELLY_LITERAL).iterator().next().getScopeType().equals(RequestScoped.class);
+ }
+
+ @Test
+ public void testRealizedBeanWithProducerMethodHasDeploymentTypeOfRealizingClass()
+ {
+ assert getBeans(CowDung.class, SMELLY_LITERAL).size() == 1;
+ assert getBeans(CowDung.class, SMELLY_LITERAL).iterator().next().getDeploymentType().equals(AnotherDeploymentType.class);
+ }
+
+ @Test
+ public void testRealizedBeanWithProducerMethodHasSameBindings()
+ {
+ assert getCurrentManager().getBeans(CowDung.class, SMELLY_LITERAL).size() == 1;
+ assert getCurrentManager().getBeans(CowDung.class, SMELLY_LITERAL).iterator().next().getBindings().size() == 2;
+ assert getCurrentManager().getBeans(CowDung.class, SMELLY_LITERAL).iterator().next().getBindings().contains(SMELLY_LITERAL);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testRealizedBeanWithProducerMethodHasBindingsOfMethodAndRealizingType()
+ {
+ assert getCurrentManager().getBeans(CowDung.class, SMELLY_LITERAL, TAME_LITERAL).size() == 1;
+ assert getCurrentManager().getBeans(CowDung.class, SMELLY_LITERAL, TAME_LITERAL).iterator().next().getBindings().size() == 3;
+ assert annotationSetMatches(getCurrentManager().getBeans(CowDung.class, SMELLY_LITERAL, TAME_LITERAL).iterator().next().getBindings(), Smelly.class, Tame.class, Any.class);
+ }
+
+ @Test
+ public void testRealizedBeanWithProducerMethodHasSameStereotypes()
+ {
+ assert getBeans(Dog.class).size() == 1;
+ assert getBeans(Dog.class).iterator().next().getScopeType().equals(RequestScoped.class);
+ }
+
+ @Test
+ public void testRealizedBeanWithProducerFieldHasSameScope()
+ {
+ assert getBeans(HorseDung.class, SMELLY_LITERAL).size() == 1;
+ assert getBeans(HorseDung.class, SMELLY_LITERAL).iterator().next().getScopeType().equals(RequestScoped.class);
+ }
+
+ @Test
+ public void testRealizedBeanWithProducerFieldHasDeploymentTypeOfRealizingClass()
+ {
+ assert getBeans(HorseDung.class, SMELLY_LITERAL).size() == 1;
+ assert getBeans(HorseDung.class, SMELLY_LITERAL).iterator().next().getDeploymentType().equals(AnotherDeploymentType.class);
+ }
+
+ @Test
+ public void testRealizedBeanWithProducerFieldHasSameBindings()
+ {
+ assert getCurrentManager().getBeans(HorseDung.class, SMELLY_LITERAL).size() == 1;
+ assert getCurrentManager().getBeans(HorseDung.class, SMELLY_LITERAL).iterator().next().getBindings().size() == 2;
+ assert getCurrentManager().getBeans(HorseDung.class, SMELLY_LITERAL).iterator().next().getBindings().contains(SMELLY_LITERAL);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testRealizedBeanWithProducerFieldHasBindingsOfMethodAndRealizingType()
+ {
+ assert getCurrentManager().getBeans(HorseDung.class, SMELLY_LITERAL, TAME_LITERAL).size() == 1;
+ assert getCurrentManager().getBeans(HorseDung.class, SMELLY_LITERAL, TAME_LITERAL).iterator().next().getBindings().size() == 3;
+ assert annotationSetMatches(getCurrentManager().getBeans(HorseDung.class, SMELLY_LITERAL, TAME_LITERAL).iterator().next().getBindings(), Smelly.class, Tame.class, Any.class);
+ }
+
+ @Test
+ public void testRealizedBeanWithProducerFieldHasSameStereotypes()
+ {
+ assert getBeans(Donkey.class).size() == 1;
+ assert getBeans(Donkey.class).iterator().next().getScopeType().equals(RequestScoped.class);
+ }
+
+ @Test(groups = "stub")
+ public void testDisposalMethodInherited()
+ {
+ assert false;
+ }
+
+ @Test(groups = "stub")
+ public void testRealizedDisposalMethodHasBindingsOfMethodAndRealizingType()
+ {
+ assert false;
+ }
+
+ @Test
+ public void testObserverMethodInheritedAndHasSameBindings()
+ {
+ assert getCurrentManager().resolveObservers(new Cow(), new AnnotationLiteral<Tame>()
+ {
+ }).size() == 1;
+ assert getCurrentManager().resolveObservers(new Cow(), SMELLY_LITERAL).size() == 0;
+ }
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/RealizationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Smelly.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Smelly.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Smelly.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@interface Smelly
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Smelly.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Stable.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Stable.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Stable.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+import org.jboss.webbeans.Realizes;
+
+@Realizes @FarmAnimalDeploymentType
+class Stable extends AbstractStable
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Stable.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Tame.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Tame.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Tame.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@interface Tame
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/Tame.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/TameCow.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/TameCow.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/TameCow.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+import org.jboss.webbeans.Realizes;
+
+@Realizes @Tame
+class TameCow extends AbstractCow
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/TameCow.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/TameHorse.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/TameHorse.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/TameHorse.java 2009-06-26 12:14:33 UTC (rev 2899)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.inheritance.realization;
+
+import org.jboss.webbeans.Realizes;
+
+@Realizes @Tame
+class TameHorse extends AbstractHorse
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/TameHorse.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 6 months
[webbeans-commits] Webbeans SVN: r2898 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-06-26 07:43:37 -0400 (Fri, 26 Jun 2009)
New Revision: 2898
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/AnyInjectionTest.java
Log:
WBRI-282
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-06-26 11:27:58 UTC (rev 2897)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-06-26 11:43:37 UTC (rev 2898)
@@ -30,7 +30,6 @@
import javax.enterprise.context.Dependent;
import javax.enterprise.event.Event;
import javax.enterprise.inject.AmbiguousResolutionException;
-import javax.enterprise.inject.Any;
import javax.enterprise.inject.Instance;
import javax.enterprise.inject.New;
import javax.enterprise.inject.UnproxyableResolutionException;
@@ -38,7 +37,6 @@
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.Decorator;
import javax.enterprise.inject.spi.InjectionPoint;
-import javax.inject.Obtains;
import org.jboss.webbeans.bean.AbstractClassBean;
import org.jboss.webbeans.bean.DecoratorBean;
@@ -101,8 +99,8 @@
}
}
}
- checkFacadeInjectionPoint(injectionPoint, Obtains.class, Instance.class);
- checkFacadeInjectionPoint(injectionPoint, Any.class, Event.class);
+ checkFacadeInjectionPoint(injectionPoint, Instance.class);
+ checkFacadeInjectionPoint(injectionPoint, Event.class);
Annotation[] bindings = injectionPoint.getBindings().toArray(new Annotation[0]);
WBAnnotated<?, ?> annotatedItem = ResolvableWBClass.of(injectionPoint.getType(), bindings, manager);
Set<?> resolvedBeans = manager.getInjectableBeans(injectionPoint);
@@ -193,29 +191,25 @@
return comparator.compare(deploymentType, otherDeploymentType) > 0;
}
- private void checkFacadeInjectionPoint(InjectionPoint injectionPoint, Class<? extends Annotation> annotationType, Class<?> type)
+ private void checkFacadeInjectionPoint(InjectionPoint injectionPoint, Class<?> type)
{
- if (injectionPoint.getAnnotated().isAnnotationPresent(annotationType))
+ if (injectionPoint.getAnnotated().getBaseType().equals(type))
{
if (injectionPoint.getType() instanceof ParameterizedType)
{
ParameterizedType parameterizedType = (ParameterizedType) injectionPoint.getType();
- if (!type.isAssignableFrom((Class<?>) parameterizedType.getRawType()))
- {
- throw new DefinitionException("An injection point annotated " + annotationType + " must have type " + type + " " + injectionPoint);
- }
if (parameterizedType.getActualTypeArguments()[0] instanceof TypeVariable)
{
- throw new DefinitionException("An injection point annotated " + annotationType + " cannot have a type variable type parameter " + injectionPoint);
+ throw new DefinitionException("An injection point of type " + type + " cannot have a type variable type parameter " + injectionPoint);
}
if (parameterizedType.getActualTypeArguments()[0] instanceof WildcardType)
{
- throw new DefinitionException("An injection point annotated " + annotationType + " cannot have a wildcard type parameter " + injectionPoint);
+ throw new DefinitionException("An injection point of type " + type + " cannot have a wildcard type parameter " + injectionPoint);
}
}
else
{
- throw new DefinitionException("An injection point annotated " + annotationType + " must have a type parameter " + injectionPoint);
+ throw new DefinitionException("An injection point of type " + type + " must have a type parameter " + injectionPoint);
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/AnyInjectionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/AnyInjectionTest.java 2009-06-26 11:27:58 UTC (rev 2897)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/AnyInjectionTest.java 2009-06-26 11:43:37 UTC (rev 2898)
@@ -7,7 +7,7 @@
@Artifact
public class AnyInjectionTest extends AbstractJSR299Test
{
- @Test(groups = "ri-broken")
+ @Test
public void testAnyInjectionIfExactlyOneBeanForType()
{
assert getInstanceByType(Customer.class).drink != null;
15 years, 6 months
[webbeans-commits] Webbeans SVN: r2897 - in ri/trunk/tests: src/test/java/org/jboss/jsr299/tck/tests/activities and 11 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-06-26 07:27:58 -0400 (Fri, 26 Jun 2009)
New Revision: 2897
Added:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/ActivitiesTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Cow.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Dummy.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Field.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Fox.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/NightTime.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Tame.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/AbstractFactory.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/DummyParent.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/IntFactory.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/IntegerFactory.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/SomeBean.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/Wbri279Test.java
Removed:
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/ActivitiesTest.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Cow.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Dummy.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Field.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Fox.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/NightTime.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Tame.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/child/
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/current/
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/javaeepkg/
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/parser/schema/
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/BeanWithInjection.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/MyBean.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/SameBeanTypeInChildActivityTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/SpecialBindingType.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Cow.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Donkey.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Dummy.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Dusk.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/ELCurrentActivityTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/EventCurrentActivityTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Field.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Horse.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/InactiveScopeTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/InjectedManagerCurrentActivityTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/InstanceCurrentActivityTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/JndiManagerCurrentActivityTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/NightTime.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/NonNormalScope.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/NonNormalScopeTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Tame.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/AlteStadt.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/DirectOrderProcessor.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/DirectOrderProcessorLocal.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/FrankfurtAmMain.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/GeschichtslosStadt.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/Giessen.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/GrossStadt.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/GutenbergMuseum.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/IndirectOrderProcessor.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/IntermediateOrderProcessor.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/Kassel.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/KleinStadt.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/LandgraffenSchloss.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/Mainz.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/Marburg.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/MockCreationalContext.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/NeueStadt.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/OrderProcessor.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/OrderProcessorLocal.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/RoemerPassage.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/Schloss.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/SchoeneStadt.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/UniStadt.java
ri/trunk/tests/unit-tests.xml
Log:
Fix packaging of some tests, WBRI-279
Deleted: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/ActivitiesTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/ActivitiesTest.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/ActivitiesTest.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,290 +0,0 @@
-package org.jboss.jsr299.tck.tests.activities;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Member;
-import java.lang.reflect.Type;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.enterprise.context.Dependent;
-import javax.enterprise.context.spi.Context;
-import javax.enterprise.context.spi.Contextual;
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.event.Observer;
-import javax.enterprise.inject.AnnotationLiteral;
-import javax.enterprise.inject.UnsatisfiedResolutionException;
-import javax.enterprise.inject.deployment.Production;
-import javax.enterprise.inject.spi.Annotated;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.InjectionPoint;
-
-import org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle.MockCreationalContext;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.webbeans.bean.ForwardingBean;
-import org.jboss.webbeans.literal.CurrentLiteral;
-import org.jboss.webbeans.test.AbstractWebBeansTest;
-import org.testng.annotations.Test;
-
-
-/**
- *
- * Spec version: 20090519
- *
- */
-@Artifact
-public class ActivitiesTest extends AbstractWebBeansTest
-{
-
- private static final Set<Annotation> DEFAULT_BINDINGS = new HashSet<Annotation>();
-
- static
- {
- DEFAULT_BINDINGS.add(new CurrentLiteral());
- }
-
- private Bean<?> createDummyBean(BeanManager beanManager, final Type injectionPointType)
- {
- final Set<InjectionPoint> injectionPoints = new HashSet<InjectionPoint>();
- final Set<Type> types = new HashSet<Type>();
- final Set<Annotation> bindings = new HashSet<Annotation>();
- bindings.add(new AnnotationLiteral<Tame>() {});
- types.add(Object.class);
- final Bean<?> bean = new Bean<Object>()
- {
-
- public Set<Annotation> getBindings()
- {
- return bindings;
- }
-
- public Class<? extends Annotation> getDeploymentType()
- {
- return Production.class;
- }
-
- public Set<InjectionPoint> getInjectionPoints()
- {
- return injectionPoints;
- }
-
- public String getName()
- {
- return null;
- }
-
- public Class<? extends Annotation> getScopeType()
- {
- return Dependent.class;
- }
-
- public Set<Type> getTypes()
- {
- return types;
- }
-
- public boolean isNullable()
- {
- return false;
- }
-
- public boolean isSerializable()
- {
- return false;
- }
-
- public Object create(CreationalContext<Object> creationalContext)
- {
- return null;
- }
-
- public void destroy(Object instance, CreationalContext<Object> creationalContext)
- {
-
- }
-
- };
- InjectionPoint injectionPoint = new InjectionPoint()
- {
-
- public Bean<?> getBean()
- {
- return bean;
- }
-
- public Set<Annotation> getBindings()
- {
- return DEFAULT_BINDINGS;
- }
-
- public Member getMember()
- {
- return null;
- }
-
- public Type getType()
- {
- return injectionPointType;
- }
-
- public Annotated getAnnotated()
- {
- return null;
- }
-
- public boolean isDelegate()
- {
- return false;
- }
-
- public boolean isTransient()
- {
- return false;
- }
-
- };
- injectionPoints.add(injectionPoint);
- return bean;
- }
-
- private static class DummyContext implements Context
- {
-
- public <T> T get(Contextual<T> contextual)
- {
- return null;
- }
-
- public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
- {
- return null;
- }
-
- public Class<? extends Annotation> getScopeType()
- {
- return Dummy.class;
- }
-
- public boolean isActive()
- {
- return false;
- }
-
- }
-
- @Test
- public void testBeanBelongingToParentActivityBelongsToChildActivity()
- {
- assert getBeans(Cow.class).size() == 1;
- Contextual<?> bean = getBeans(Cow.class).iterator().next();
- BeanManager childActivity = getCurrentManager().createActivity();
- assert childActivity.getBeans(Cow.class).size() == 1;
- assert childActivity.getBeans(Cow.class).iterator().next().equals(bean);
- }
-
- @Test
- public void testBeanBelongingToParentActivityCanBeInjectedIntoChildActivityBean()
- {
- assert getBeans(Cow.class).size() == 1;
- Contextual<?> bean = getBeans(Cow.class).iterator().next();
- BeanManager childActivity = getCurrentManager().createActivity();
- Bean<?> dummyBean = createDummyBean(childActivity, Cow.class);
- childActivity.addBean(dummyBean);
- assert childActivity.getInjectableReference(dummyBean.getInjectionPoints().iterator().next(), new MockCreationalContext<Cow>()) != null;
- }
-
- @Test
- public void testObserverBelongingToParentActivityBelongsToChildActivity()
- {
- assert getCurrentManager().resolveObservers(new NightTime()).size() == 1;
- Observer<?> observer = getCurrentManager().resolveObservers(new NightTime()).iterator().next();
- BeanManager childActivity = getCurrentManager().createActivity();
- assert childActivity.resolveObservers(new NightTime()).size() == 1;
- assert childActivity.resolveObservers(new NightTime()).iterator().next().equals(observer);
- }
-
- @Test
- public void testObserverBelongingToParentFiresForChildActivity()
- {
- Fox.setObserved(false);
- BeanManager childActivity = getCurrentManager().createActivity();
- childActivity.fireEvent(new NightTime());
- assert Fox.isObserved();
- }
-
- @Test
- public void testContextObjectBelongingToParentBelongsToChild()
- {
- Context context = new DummyContext()
- {
-
- @Override
- public boolean isActive()
- {
- return true;
- }
-
- };
- getCurrentManager().addContext(context);
- BeanManager childActivity = getCurrentManager().createActivity();
- assert childActivity.getContext(Dummy.class) != null;
- }
-
- @Test
- public void testBeanBelongingToChildActivityCannotBeInjectedIntoParentActivityBean()
- {
- assert getBeans(Cow.class).size() == 1;
- BeanManager childActivity = getCurrentManager().createActivity();
- Bean<?> dummyBean = createDummyBean(childActivity, Cow.class);
- childActivity.addBean(dummyBean);
- assert getBeans(Object.class, new AnnotationLiteral<Tame>() {}).size() == 0;
- }
-
- @Test(expectedExceptions=UnsatisfiedResolutionException.class)
- public void testInstanceProcessedByParentActivity()
- {
- Context dummyContext = new DummyContext();
- getCurrentManager().addContext(dummyContext);
- assert getBeans(Cow.class).size() == 1;
- final Bean<Cow> bean = getBeans(Cow.class).iterator().next();
- BeanManager childActivity = getCurrentManager().createActivity();
- final Set<Annotation> bindingTypes = new HashSet<Annotation>();
- bindingTypes.add(new AnnotationLiteral<Tame>() {});
- childActivity.addBean(new ForwardingBean<Cow>()
- {
-
- @Override
- protected Bean<Cow> delegate()
- {
- return bean;
- }
-
- @Override
- public Set<Annotation> getBindings()
- {
- return bindingTypes;
- }
-
- });
- createContextualInstance(Field.class).get();
- }
-
- @Test
- public void testObserverBelongingToChildDoesNotFireForParentActivity()
- {
- BeanManager childActivity = getCurrentManager().createActivity();
- Observer<NightTime> observer = new Observer<NightTime>()
- {
-
- public boolean notify(NightTime event)
- {
- assert false;
- return false;
- }
-
- };
- childActivity.addObserver(observer);
- getCurrentManager().fireEvent(new NightTime());
- }
-
-}
Deleted: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Cow.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Cow.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Cow.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,6 +0,0 @@
-package org.jboss.jsr299.tck.tests.activities;
-
-class Cow
-{
-
-}
Deleted: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Dummy.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Dummy.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Dummy.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,23 +0,0 @@
-/**
- *
- */
-package org.jboss.jsr299.tck.tests.activities;
-
-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.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.enterprise.context.ScopeType;
-
-@Target( { TYPE, METHOD, FIELD })
-@Retention(RUNTIME)
-@Documented
-@ScopeType
-@Inherited
-@interface Dummy {}
\ No newline at end of file
Deleted: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Field.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Field.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Field.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,16 +0,0 @@
-package org.jboss.jsr299.tck.tests.activities;
-
-import javax.enterprise.inject.Instance;
-import javax.inject.Obtains;
-
-class Field
-{
-
- @Obtains @Tame Instance<Cow> instance;
-
- public Cow get()
- {
- return instance.get();
- }
-
-}
Deleted: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Fox.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Fox.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Fox.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,25 +0,0 @@
-package org.jboss.jsr299.tck.tests.activities;
-
-import javax.enterprise.event.Observes;
-
-class Fox
-{
-
- private static boolean observed = false;
-
- public void observe(@Observes NightTime nighttime)
- {
- observed = true;
- }
-
- public static boolean isObserved()
- {
- return observed;
- }
-
- public static void setObserved(boolean observed)
- {
- Fox.observed = observed;
- }
-
-}
Deleted: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/NightTime.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/NightTime.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/NightTime.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,6 +0,0 @@
-package org.jboss.jsr299.tck.tests.activities;
-
-class NightTime
-{
-
-}
Deleted: ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Tame.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Tame.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Tame.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,22 +0,0 @@
-package org.jboss.jsr299.tck.tests.activities;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.enterprise.inject.BindingType;
-
-@Target( { TYPE, METHOD, PARAMETER, FIELD })
-@Retention(RUNTIME)
-@Documented
-@BindingType
-@interface Tame
-{
-
-}
Copied: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/ActivitiesTest.java (from rev 2896, ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/ActivitiesTest.java)
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/ActivitiesTest.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/ActivitiesTest.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -0,0 +1,290 @@
+package org.jboss.webbeans.test.unit.activities;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observer;
+import javax.enterprise.inject.AnnotationLiteral;
+import javax.enterprise.inject.UnsatisfiedResolutionException;
+import javax.enterprise.inject.deployment.Production;
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.webbeans.bean.ForwardingBean;
+import org.jboss.webbeans.literal.CurrentLiteral;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle.MockCreationalContext;
+import org.testng.annotations.Test;
+
+
+/**
+ *
+ * Spec version: 20090519
+ *
+ */
+@Artifact
+public class ActivitiesTest extends AbstractWebBeansTest
+{
+
+ private static final Set<Annotation> DEFAULT_BINDINGS = new HashSet<Annotation>();
+
+ static
+ {
+ DEFAULT_BINDINGS.add(new CurrentLiteral());
+ }
+
+ private Bean<?> createDummyBean(BeanManager beanManager, final Type injectionPointType)
+ {
+ final Set<InjectionPoint> injectionPoints = new HashSet<InjectionPoint>();
+ final Set<Type> types = new HashSet<Type>();
+ final Set<Annotation> bindings = new HashSet<Annotation>();
+ bindings.add(new AnnotationLiteral<Tame>() {});
+ types.add(Object.class);
+ final Bean<?> bean = new Bean<Object>()
+ {
+
+ public Set<Annotation> getBindings()
+ {
+ return bindings;
+ }
+
+ public Class<? extends Annotation> getDeploymentType()
+ {
+ return Production.class;
+ }
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return injectionPoints;
+ }
+
+ public String getName()
+ {
+ return null;
+ }
+
+ public Class<? extends Annotation> getScopeType()
+ {
+ return Dependent.class;
+ }
+
+ public Set<Type> getTypes()
+ {
+ return types;
+ }
+
+ public boolean isNullable()
+ {
+ return false;
+ }
+
+ public boolean isSerializable()
+ {
+ return false;
+ }
+
+ public Object create(CreationalContext<Object> creationalContext)
+ {
+ return null;
+ }
+
+ public void destroy(Object instance, CreationalContext<Object> creationalContext)
+ {
+
+ }
+
+ };
+ InjectionPoint injectionPoint = new InjectionPoint()
+ {
+
+ public Bean<?> getBean()
+ {
+ return bean;
+ }
+
+ public Set<Annotation> getBindings()
+ {
+ return DEFAULT_BINDINGS;
+ }
+
+ public Member getMember()
+ {
+ return null;
+ }
+
+ public Type getType()
+ {
+ return injectionPointType;
+ }
+
+ public Annotated getAnnotated()
+ {
+ return null;
+ }
+
+ public boolean isDelegate()
+ {
+ return false;
+ }
+
+ public boolean isTransient()
+ {
+ return false;
+ }
+
+ };
+ injectionPoints.add(injectionPoint);
+ return bean;
+ }
+
+ private static class DummyContext implements Context
+ {
+
+ public <T> T get(Contextual<T> contextual)
+ {
+ return null;
+ }
+
+ public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
+ {
+ return null;
+ }
+
+ public Class<? extends Annotation> getScopeType()
+ {
+ return Dummy.class;
+ }
+
+ public boolean isActive()
+ {
+ return false;
+ }
+
+ }
+
+ @Test
+ public void testBeanBelongingToParentActivityBelongsToChildActivity()
+ {
+ assert getBeans(Cow.class).size() == 1;
+ Contextual<?> bean = getBeans(Cow.class).iterator().next();
+ BeanManager childActivity = getCurrentManager().createActivity();
+ assert childActivity.getBeans(Cow.class).size() == 1;
+ assert childActivity.getBeans(Cow.class).iterator().next().equals(bean);
+ }
+
+ @Test
+ public void testBeanBelongingToParentActivityCanBeInjectedIntoChildActivityBean()
+ {
+ assert getBeans(Cow.class).size() == 1;
+ Contextual<?> bean = getBeans(Cow.class).iterator().next();
+ BeanManager childActivity = getCurrentManager().createActivity();
+ Bean<?> dummyBean = createDummyBean(childActivity, Cow.class);
+ childActivity.addBean(dummyBean);
+ assert childActivity.getInjectableReference(dummyBean.getInjectionPoints().iterator().next(), new MockCreationalContext<Cow>()) != null;
+ }
+
+ @Test
+ public void testObserverBelongingToParentActivityBelongsToChildActivity()
+ {
+ assert getCurrentManager().resolveObservers(new NightTime()).size() == 1;
+ Observer<?> observer = getCurrentManager().resolveObservers(new NightTime()).iterator().next();
+ BeanManager childActivity = getCurrentManager().createActivity();
+ assert childActivity.resolveObservers(new NightTime()).size() == 1;
+ assert childActivity.resolveObservers(new NightTime()).iterator().next().equals(observer);
+ }
+
+ @Test
+ public void testObserverBelongingToParentFiresForChildActivity()
+ {
+ Fox.setObserved(false);
+ BeanManager childActivity = getCurrentManager().createActivity();
+ childActivity.fireEvent(new NightTime());
+ assert Fox.isObserved();
+ }
+
+ @Test
+ public void testContextObjectBelongingToParentBelongsToChild()
+ {
+ Context context = new DummyContext()
+ {
+
+ @Override
+ public boolean isActive()
+ {
+ return true;
+ }
+
+ };
+ getCurrentManager().addContext(context);
+ BeanManager childActivity = getCurrentManager().createActivity();
+ assert childActivity.getContext(Dummy.class) != null;
+ }
+
+ @Test
+ public void testBeanBelongingToChildActivityCannotBeInjectedIntoParentActivityBean()
+ {
+ assert getBeans(Cow.class).size() == 1;
+ BeanManager childActivity = getCurrentManager().createActivity();
+ Bean<?> dummyBean = createDummyBean(childActivity, Cow.class);
+ childActivity.addBean(dummyBean);
+ assert getBeans(Object.class, new AnnotationLiteral<Tame>() {}).size() == 0;
+ }
+
+ @Test(expectedExceptions=UnsatisfiedResolutionException.class)
+ public void testInstanceProcessedByParentActivity()
+ {
+ Context dummyContext = new DummyContext();
+ getCurrentManager().addContext(dummyContext);
+ assert getBeans(Cow.class).size() == 1;
+ final Bean<Cow> bean = getBeans(Cow.class).iterator().next();
+ BeanManager childActivity = getCurrentManager().createActivity();
+ final Set<Annotation> bindingTypes = new HashSet<Annotation>();
+ bindingTypes.add(new AnnotationLiteral<Tame>() {});
+ childActivity.addBean(new ForwardingBean<Cow>()
+ {
+
+ @Override
+ protected Bean<Cow> delegate()
+ {
+ return bean;
+ }
+
+ @Override
+ public Set<Annotation> getBindings()
+ {
+ return bindingTypes;
+ }
+
+ });
+ createContextualInstance(Field.class).get();
+ }
+
+ @Test
+ public void testObserverBelongingToChildDoesNotFireForParentActivity()
+ {
+ BeanManager childActivity = getCurrentManager().createActivity();
+ Observer<NightTime> observer = new Observer<NightTime>()
+ {
+
+ public boolean notify(NightTime event)
+ {
+ assert false;
+ return false;
+ }
+
+ };
+ childActivity.addObserver(observer);
+ getCurrentManager().fireEvent(new NightTime());
+ }
+
+}
Copied: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Cow.java (from rev 2896, ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Cow.java)
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Cow.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Cow.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.test.unit.activities;
+
+class Cow
+{
+
+}
Copied: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Dummy.java (from rev 2896, ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Dummy.java)
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Dummy.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Dummy.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -0,0 +1,23 @@
+/**
+ *
+ */
+package org.jboss.webbeans.test.unit.activities;
+
+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.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.context.ScopeType;
+
+@Target( { TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@Documented
+@ScopeType
+@Inherited
+@interface Dummy {}
\ No newline at end of file
Copied: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Field.java (from rev 2896, ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Field.java)
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Field.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Field.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -0,0 +1,16 @@
+package org.jboss.webbeans.test.unit.activities;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Obtains;
+
+class Field
+{
+
+ @Obtains @Tame Instance<Cow> instance;
+
+ public Cow get()
+ {
+ return instance.get();
+ }
+
+}
Copied: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Fox.java (from rev 2896, ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Fox.java)
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Fox.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Fox.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -0,0 +1,25 @@
+package org.jboss.webbeans.test.unit.activities;
+
+import javax.enterprise.event.Observes;
+
+class Fox
+{
+
+ private static boolean observed = false;
+
+ public void observe(@Observes NightTime nighttime)
+ {
+ observed = true;
+ }
+
+ public static boolean isObserved()
+ {
+ return observed;
+ }
+
+ public static void setObserved(boolean observed)
+ {
+ Fox.observed = observed;
+ }
+
+}
Copied: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/NightTime.java (from rev 2896, ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/NightTime.java)
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/NightTime.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/NightTime.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.test.unit.activities;
+
+class NightTime
+{
+
+}
Copied: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Tame.java (from rev 2896, ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/Tame.java)
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Tame.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/Tame.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -0,0 +1,22 @@
+package org.jboss.webbeans.test.unit.activities;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@interface Tame
+{
+
+}
Copied: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child (from rev 2896, ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/child)
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/BeanWithInjection.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/child/BeanWithInjection.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/BeanWithInjection.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.activities.child;
+package org.jboss.webbeans.test.unit.activities.child;
class BeanWithInjection
{
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/MyBean.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/child/MyBean.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/MyBean.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.activities.child;
+package org.jboss.webbeans.test.unit.activities.child;
@SpecialBindingType
class MyBean
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/SameBeanTypeInChildActivityTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/child/SameBeanTypeInChildActivityTest.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/SameBeanTypeInChildActivityTest.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.activities.child;
+package org.jboss.webbeans.test.unit.activities.child;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
@@ -99,7 +99,7 @@
return bean;
}
- @Test(groups = { "ri-broken" }, expectedExceptions = { InjectionException.class })
+ @Test(groups = { "broken" }, expectedExceptions = { InjectionException.class })
public void testSameBeanTypeInChildAsParentInjection()
{
BeanManager childActivity = getCurrentManager().createActivity();
@@ -107,7 +107,7 @@
childActivity.addBean(anotherMyBean);
}
- @Test(groups = { "ri-broken" }, expectedExceptions = { InjectionException.class })
+ @Test(groups = { "broken" }, expectedExceptions = { InjectionException.class })
public void testSameBeanTypeInChildAsIndirectParentInjection()
{
WebBeansManager childActivity = getCurrentManager().createActivity();
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/SpecialBindingType.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/child/SpecialBindingType.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/SpecialBindingType.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.activities.child;
+package org.jboss.webbeans.test.unit.activities.child;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
Copied: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current (from rev 2896, ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/current)
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Cow.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/current/Cow.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Cow.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.activities.current;
+package org.jboss.webbeans.test.unit.activities.current;
class Cow
{
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Donkey.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/current/Donkey.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Donkey.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.activities.current;
+package org.jboss.webbeans.test.unit.activities.current;
import javax.enterprise.inject.spi.BeanManager;
import javax.naming.InitialContext;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Dummy.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/current/Dummy.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Dummy.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,7 +1,7 @@
/**
*
*/
-package org.jboss.jsr299.tck.tests.activities.current;
+package org.jboss.webbeans.test.unit.activities.current;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Dusk.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/current/Dusk.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Dusk.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.activities.current;
+package org.jboss.webbeans.test.unit.activities.current;
import javax.enterprise.event.Event;
import javax.enterprise.inject.Any;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/ELCurrentActivityTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/current/ELCurrentActivityTest.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/ELCurrentActivityTest.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.activities.current;
+package org.jboss.webbeans.test.unit.activities.current;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/EventCurrentActivityTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/current/EventCurrentActivityTest.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/EventCurrentActivityTest.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.activities.current;
+package org.jboss.webbeans.test.unit.activities.current;
import java.lang.annotation.Annotation;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Field.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/current/Field.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Field.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.activities.current;
+package org.jboss.webbeans.test.unit.activities.current;
import javax.enterprise.inject.Instance;
import javax.inject.Obtains;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Horse.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/current/Horse.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Horse.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.activities.current;
+package org.jboss.webbeans.test.unit.activities.current;
import javax.enterprise.inject.Current;
import javax.enterprise.inject.spi.BeanManager;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/InactiveScopeTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/current/InactiveScopeTest.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/InactiveScopeTest.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.activities.current;
+package org.jboss.webbeans.test.unit.activities.current;
import java.lang.annotation.Annotation;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/InjectedManagerCurrentActivityTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/current/InjectedManagerCurrentActivityTest.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/InjectedManagerCurrentActivityTest.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.activities.current;
+package org.jboss.webbeans.test.unit.activities.current;
import java.lang.annotation.Annotation;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/InstanceCurrentActivityTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/current/InstanceCurrentActivityTest.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/InstanceCurrentActivityTest.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.activities.current;
+package org.jboss.webbeans.test.unit.activities.current;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/JndiManagerCurrentActivityTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/current/JndiManagerCurrentActivityTest.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/JndiManagerCurrentActivityTest.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.activities.current;
+package org.jboss.webbeans.test.unit.activities.current;
import java.lang.annotation.Annotation;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/NightTime.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/current/NightTime.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/NightTime.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.activities.current;
+package org.jboss.webbeans.test.unit.activities.current;
class NightTime
{
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/NonNormalScope.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/current/NonNormalScope.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/NonNormalScope.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,7 +1,7 @@
/**
*
*/
-package org.jboss.jsr299.tck.tests.activities.current;
+package org.jboss.webbeans.test.unit.activities.current;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/NonNormalScopeTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/current/NonNormalScopeTest.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/NonNormalScopeTest.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.activities.current;
+package org.jboss.webbeans.test.unit.activities.current;
import java.lang.annotation.Annotation;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Tame.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/activities/current/Tame.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/Tame.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.activities.current;
+package org.jboss.webbeans.test.unit.activities.current;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
Copied: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle (from rev 2896, ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle)
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/AlteStadt.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/AlteStadt.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/AlteStadt.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.ejb.Local;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/DirectOrderProcessor.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/DirectOrderProcessor.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/DirectOrderProcessor.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.ejb.Stateful;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/DirectOrderProcessorLocal.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/DirectOrderProcessorLocal.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/DirectOrderProcessorLocal.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.ejb.Local;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import java.util.Arrays;
import java.util.HashSet;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/FrankfurtAmMain.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/FrankfurtAmMain.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/FrankfurtAmMain.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.ejb.Remove;
import javax.ejb.Stateful;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/GeschichtslosStadt.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/GeschichtslosStadt.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/GeschichtslosStadt.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.ejb.Local;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/Giessen.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/Giessen.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/Giessen.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
public class Giessen implements NeueStadt, GeschichtslosStadt
{
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/GrossStadt.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/GrossStadt.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/GrossStadt.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.ejb.Local;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/GutenbergMuseum.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/GutenbergMuseum.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/GutenbergMuseum.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
public class GutenbergMuseum
{
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/IndirectOrderProcessor.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/IndirectOrderProcessor.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/IndirectOrderProcessor.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.ejb.Stateful;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/IntermediateOrderProcessor.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/IntermediateOrderProcessor.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/IntermediateOrderProcessor.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
class IntermediateOrderProcessor extends OrderProcessor
{
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/Kassel.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/Kassel.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/Kassel.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/KleinStadt.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/KleinStadt.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/KleinStadt.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.ejb.Local;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/LandgraffenSchloss.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/LandgraffenSchloss.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/LandgraffenSchloss.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.annotation.PreDestroy;
import javax.ejb.Remove;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/Mainz.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/Mainz.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/Mainz.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.annotation.PostConstruct;
import javax.ejb.Stateless;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/Marburg.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/Marburg.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/Marburg.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.ejb.Remove;
import javax.ejb.Stateful;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/MockCreationalContext.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/MockCreationalContext.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/MockCreationalContext.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.enterprise.context.spi.CreationalContext;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/NeueStadt.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/NeueStadt.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/NeueStadt.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.ejb.Local;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/OrderProcessor.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/OrderProcessor.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/OrderProcessor.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/OrderProcessorLocal.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/OrderProcessorLocal.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/OrderProcessorLocal.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.ejb.Local;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/RoemerPassage.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/RoemerPassage.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/RoemerPassage.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
class RoemerPassage
{
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/Schloss.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/Schloss.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/Schloss.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.ejb.Local;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/SchoeneStadt.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/SchoeneStadt.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/SchoeneStadt.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.ejb.Local;
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/UniStadt.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/UniStadt.java 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/enterprise/lifecycle/UniStadt.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+package org.jboss.webbeans.test.unit.implementation.enterprise.lifecycle;
import javax.ejb.Local;
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/AbstractFactory.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/AbstractFactory.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/AbstractFactory.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -0,0 +1,8 @@
+package org.jboss.webbeans.test.unit.lookup.wbri279;
+
+public abstract class AbstractFactory<T>
+{
+
+ public abstract T createObject();
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/AbstractFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/DummyParent.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/DummyParent.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/DummyParent.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.test.unit.lookup.wbri279;
+
+public class DummyParent
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/DummyParent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/IntFactory.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/IntFactory.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/IntFactory.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -0,0 +1,19 @@
+package org.jboss.webbeans.test.unit.lookup.wbri279;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.BindingType;
+
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target( { TYPE, FIELD, METHOD })
+@BindingType
+public @interface IntFactory
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/IntFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/IntegerFactory.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/IntegerFactory.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/IntegerFactory.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.test.unit.lookup.wbri279;
+
+@IntFactory
+public class IntegerFactory extends AbstractFactory<Integer>
+{
+
+ public static final Integer VALUE = 123;
+
+ public Integer createObject()
+ {
+ return VALUE;
+ }
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/IntegerFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/SomeBean.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/SomeBean.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/SomeBean.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.test.unit.lookup.wbri279;
+
+public class SomeBean
+{
+
+ @IntFactory
+ IntegerFactory integerFactory;
+
+ public String getObjectAsString()
+ {
+ return integerFactory.createObject().toString();
+ }
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/SomeBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/Wbri279Test.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/Wbri279Test.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/Wbri279Test.java 2009-06-26 11:27:58 UTC (rev 2897)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.test.unit.lookup.wbri279;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author pmuir
+ *
+ */
+@Artifact
+public class Wbri279Test extends AbstractWebBeansTest
+{
+
+ @Test(description="WBRI-279")
+ public void testLookupOfGenericTypeSubclass()
+ {
+ assert createContextualInstance(SomeBean.class).getObjectAsString().equals(IntegerFactory.VALUE.toString());
+ }
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/wbri279/Wbri279Test.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/tests/unit-tests.xml
===================================================================
--- ri/trunk/tests/unit-tests.xml 2009-06-25 23:12:36 UTC (rev 2896)
+++ ri/trunk/tests/unit-tests.xml 2009-06-26 11:27:58 UTC (rev 2897)
@@ -43,11 +43,11 @@
<packages>
<!-- <package name="org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle" />-->
<package name="org.jboss.webbeans.test.examples" />
- <package name="org.jboss.webbeans.test.unit.bootstrap" />
+
<package name="org.jboss.webbeans.test.unit.activities" />
<package name="org.jboss.webbeans.test.unit.activities.current" />
<package name="org.jboss.webbeans.test.unit.activities.child" />
- <package name="org.jboss.webbeans.test.unit.bootstrap.ordering" />
+ <package name="org.jboss.webbeans.test.unit.bootstrap" />
<package name="org.jboss.webbeans.test.unit.bootstrap.environments" />
<package name="org.jboss.webbeans.test.unit.bootstrap.environments.multipleEnterprise" />
<package name="org.jboss.webbeans.test.unit.bootstrap.environments.multipleEnterpriseAndSimple" />
@@ -61,19 +61,22 @@
<package name="org.jboss.webbeans.test.unit.implementation" />
<package name="org.jboss.webbeans.test.unit.implementation.annotatedItem" />
<package name="org.jboss.webbeans.test.unit.implementation.enterpise" />
+ <package name="org.jboss.webbeans.test.unit.implementation.enterpise.lifecycle" />
<package name="org.jboss.webbeans.test.unit.implementation.enterprise.sbi" />
<package name="org.jboss.webbeans.test.unit.implementation.event" />
+ <package name="org.jboss.webbeans.test.unit.implementation.exceptions" />
+ <package name="org.jboss.webbeans.test.unit.implementation.named" />
<package name="org.jboss.webbeans.test.unit.implementation.newsimple" />
<package name="org.jboss.webbeans.test.unit.implementation.producer.field" />
<package name="org.jboss.webbeans.test.unit.implementation.producer.method" />
<package name="org.jboss.webbeans.test.unit.implementation.proxy" />
<package name="org.jboss.webbeans.test.unit.implementation.proxy.enterprise" />
<package name="org.jboss.webbeans.test.unit.lookup" />
+ <package name="org.jboss.webbeans.test.unit.lookup.circular" />
+ <package name="org.jboss.webbeans.test.unit.lookup.wbri279" />
<package name="org.jboss.webbeans.test.unit.manager" />
- <package name="org.jboss.webbeans.test.unit.lookup.circular" />
+ <package name="org.jboss.webbeans.test.unit.servlet" />
<package name="org.jboss.webbeans.test.unit.xml.deploy" />
- <package name="org.jboss.webbeans.test.unit.xml.parser" />
- <package name="org.jboss.webbeans.test.unit.xml.parser.schema" />
</packages>
</test>
15 years, 6 months