Author: shane.bryzak(a)jboss.com
Date: 2009-03-24 19:52:21 -0400 (Tue, 24 Mar 2009)
New Revision: 2198
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/Egg.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/EnterpriseEventInheritenceTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/Farmer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/FarmerLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IndirectStockWatcher.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IndirectStockWatcherLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IntermediateStockWatcher.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/LazyFarmer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/LazyFarmerLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockPrice.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockWatcher.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockWatcherLocal.java
Log:
tests for 4.2.df, 4.2.dl
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/Egg.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/Egg.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/Egg.java 2009-03-24
23:52:21 UTC (rev 2198)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+class Egg
+{
+
+}
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/EnterpriseEventInheritenceTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/EnterpriseEventInheritenceTest.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/EnterpriseEventInheritenceTest.java 2009-03-24
23:52:21 UTC (rev 2198)
@@ -0,0 +1,64 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+import java.util.Set;
+
+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.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.testng.annotations.Test;
+
+/**
+ * Tests for event inheritence with enterprise beans
+ *
+ * @author Shane Bryzak
+ */
+@Artifact
+(a)Packaging(PackagingType.EAR)
+public class EnterpriseEventInheritenceTest extends AbstractJSR299Test
+{
+ @Test(groups = { "events", "inheritance" })
+ @SpecAssertion(section = "4.2", id = "df")
+ public void testNonStaticObserverMethodNotInherited() throws Exception
+ {
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ Set<Observer<Egg>> observers =
getCurrentManager().resolveObservers(new Egg());
+ assert observers.size() == 1;
+
+ // Notify the observer so we can confirm that it
+ // is a method only on Farmer, and not LazyFarmer
+ observers.iterator().next().notify(new Egg());
+ assert Farmer.getObserverClazz().equals(Farmer.class);
+ }
+
+ }.run();
+ }
+
+ @Test(groups = { "events", "inheritance" })
+ @SpecAssertion(section = "4.2", id = "dl")
+ 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 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/enterprise/Farmer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/Farmer.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/Farmer.java 2009-03-24
23:52:21 UTC (rev 2198)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+import javax.ejb.Stateful;
+import javax.event.Observes;
+
+@Stateful
+public class Farmer implements FarmerLocal
+{
+ private static Class<?> observerClazz;
+
+ public void observeEggLaying(@Observes Egg egg)
+ {
+ observerClazz = this.getClass();
+ }
+
+ public static Class<?> getObserverClazz()
+ {
+ return observerClazz;
+ }
+
+}
\ No newline at end of file
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/FarmerLocal.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/FarmerLocal.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/FarmerLocal.java 2009-03-24
23:52:21 UTC (rev 2198)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+import javax.ejb.Local;
+import javax.event.Observes;
+
+@Local
+public interface FarmerLocal
+{
+ void observeEggLaying(@Observes Egg egg);
+}
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IndirectStockWatcher.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IndirectStockWatcher.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IndirectStockWatcher.java 2009-03-24
23:52:21 UTC (rev 2198)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+import javax.ejb.Stateful;
+
+@Stateful
+public class IndirectStockWatcher extends IntermediateStockWatcher implements
IndirectStockWatcherLocal
+{
+
+}
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IndirectStockWatcherLocal.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IndirectStockWatcherLocal.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IndirectStockWatcherLocal.java 2009-03-24
23:52:21 UTC (rev 2198)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface IndirectStockWatcherLocal
+{
+
+}
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IntermediateStockWatcher.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IntermediateStockWatcher.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IntermediateStockWatcher.java 2009-03-24
23:52:21 UTC (rev 2198)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+class IntermediateStockWatcher extends StockWatcher
+{
+
+}
\ No newline at end of file
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/LazyFarmer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/LazyFarmer.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/LazyFarmer.java 2009-03-24
23:52:21 UTC (rev 2198)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+import javax.ejb.Stateful;
+
+@Stateful
+public class LazyFarmer extends Farmer implements LazyFarmerLocal
+{
+
+}
\ No newline at end of file
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/LazyFarmerLocal.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/LazyFarmerLocal.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/LazyFarmerLocal.java 2009-03-24
23:52:21 UTC (rev 2198)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface LazyFarmerLocal
+{
+
+}
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockPrice.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockPrice.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockPrice.java 2009-03-24
23:52:21 UTC (rev 2198)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+class StockPrice
+{
+
+}
\ No newline at end of file
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockWatcher.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockWatcher.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockWatcher.java 2009-03-24
23:52:21 UTC (rev 2198)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+import javax.ejb.Stateful;
+import javax.event.Observes;
+
+@Stateful
+public class StockWatcher implements StockWatcherLocal
+{
+ private static Class<?> observerClazz;
+
+ public void observeStockPrice(@Observes StockPrice price)
+ {
+ observerClazz = this.getClass();
+ }
+
+ public static Class<?> getObserverClazz()
+ {
+ return observerClazz;
+ }
+}
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockWatcherLocal.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockWatcherLocal.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockWatcherLocal.java 2009-03-24
23:52:21 UTC (rev 2198)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+import javax.ejb.Local;
+import javax.event.Observes;
+
+@Local
+public interface StockWatcherLocal
+{
+ void observeStockPrice(@Observes StockPrice price);
+}
Show replies by date