[webbeans-commits] Webbeans SVN: r2904 - in tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/event/broken and 13 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Fri Jun 26 15:48:38 EDT 2009
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;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at BindingType
+ at 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
+ */
+ at 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;
-
- at Stereotype()
- at Target( { TYPE, METHOD, FIELD })
- at Retention(RUNTIME)
- at RequestScoped
- at 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;
-
- at 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;
-
- at 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;
-
- at 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
- *
- */
- at 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;
-
- at 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
+ */
+ at 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;
-
- at 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;
-
- at BindingType
- at Retention(RUNTIME)
- at 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;
-
- at Target( { TYPE, METHOD, PARAMETER, FIELD })
- at Retention(RUNTIME)
- at Documented
- at BindingType
- at 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;
- at Tame
- at Named("Teddy")
-class TeaCupPomeranian
+ at 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;
+
+ at Stereotype
+ at Target( { TYPE, METHOD, FIELD })
+ at Retention(RUNTIME)
+ at RequestScoped
+ at 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;
+
+ at 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;
+
+ at 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;
+
+ at 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
+ *
+ */
+ at 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
+ *
+ */
+ at 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;
+
+ at 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;
+
+ at BindingType
+ at Retention(RUNTIME)
+ at 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;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at BindingType
+ at 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;
- at Tame
- at Named("Teddy")
-class TeaCupPomeranian
+ at 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>
More information about the weld-commits
mailing list