[webbeans-commits] Webbeans SVN: r2197 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Tue Mar 24 19:39:31 EDT 2009


Author: shane.bryzak at jboss.com
Date: 2009-03-24 19:39:31 -0400 (Tue, 24 Mar 2009)
New Revision: 2197

Added:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/IndirectStockWatcher.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/IntermediateStockWatcher.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/StockPrice.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/StockWatcher.java
Modified:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java
Log:
test for 4.2.di

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java	2009-03-24 23:33:28 UTC (rev 2196)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java	2009-03-24 23:39:31 UTC (rev 2197)
@@ -844,5 +844,28 @@
 
       }.run();
    }
+   
+   @Test(groups = { "events", "inheritance" })
+   @SpecAssertion(section = "4.2", id = "di")
+   public void testNonStaticObserverMethodNotIndirectlyInherited() throws Exception
+   {
+      new RunInDependentContext()
+      {
 
+         @Override
+         protected void execute() throws Exception
+         {
+            Set<Observer<StockPrice>> observers = getCurrentManager().resolveObservers(new StockPrice());
+            assert observers.size() == 1;
+
+            // Notify the observer so we can confirm that it
+            // is a method only on StockWatcher, and not IntermediateStockWatcher 
+            // or IndirectStockWatcher
+            observers.iterator().next().notify(new StockPrice());
+            assert StockWatcher.getObserverClazz().equals(StockWatcher.class);
+         }
+
+      }.run();
+   }   
+
 }

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/IndirectStockWatcher.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/IndirectStockWatcher.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/IndirectStockWatcher.java	2009-03-24 23:39:31 UTC (rev 2197)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.event;
+
+class IndirectStockWatcher extends IntermediateStockWatcher
+{
+
+}

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/IntermediateStockWatcher.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/IntermediateStockWatcher.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/IntermediateStockWatcher.java	2009-03-24 23:39:31 UTC (rev 2197)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.event;
+
+class IntermediateStockWatcher extends StockWatcher
+{
+
+}

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/StockPrice.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/StockPrice.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/StockPrice.java	2009-03-24 23:39:31 UTC (rev 2197)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.event;
+
+class StockPrice
+{
+
+}

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/StockWatcher.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/StockWatcher.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/StockWatcher.java	2009-03-24 23:39:31 UTC (rev 2197)
@@ -0,0 +1,18 @@
+package org.jboss.jsr299.tck.tests.event;
+
+import javax.event.Observes;
+
+class StockWatcher
+{
+   private static Class<?> observerClazz;
+   
+   public void observeStockPrice(@Observes StockPrice price)
+   {
+      observerClazz = this.getClass();
+   }
+
+   public static Class<?> getObserverClazz()
+   {
+      return observerClazz;
+   }
+}




More information about the weld-commits mailing list