[webbeans-commits] Webbeans SVN: r2905 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer: register and 1 other directory.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Fri Jun 26 15:58:30 EDT 2009


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
+ */
+ at 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;
+
+ at BindingType
+ at Retention(RUNTIME)
+ at 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;
-
- 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;
-   }
-
-
-}




More information about the weld-commits mailing list