[webbeans-commits] Webbeans SVN: r1450 - in tck/trunk/impl/src: main/java/org/jboss/webbeans/tck/unit/definition/stereotype and 3 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Sun Feb 8 08:21:00 EST 2009
Author: dallen6
Date: 2009-02-08 08:21:00 -0500 (Sun, 08 Feb 2009)
New Revision: 1450
Modified:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/event/EventTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/definition/stereotype/StereotypeDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/EventTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/commonAnnotations/ResourceInjectionTest.java
tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/test/impl/InContainerTestRunnerTest.java
Log:
Minor test enhancements/additions.
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/event/EventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/event/EventTest.java 2009-02-07 18:58:27 UTC (rev 1449)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/integration/event/EventTest.java 2009-02-08 13:21:00 UTC (rev 1450)
@@ -31,7 +31,7 @@
*
* @author David Allen
*
- * Spec version: PRD2
+ * Spec version: Public Release Draft 2
*
*/
public class EventTest extends AbstractTest
@@ -97,9 +97,35 @@
}
/**
+ * If the observer method is an asynchronous transactional observer method
+ * and there is currently a JTA transaction in progress, the observer object
+ * calls the observer method asynchronously during the after transaction
+ * completion phase.
+ */
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "7.5.8", id = "unknown")
+ public void testAsynchronousTransactionalObserverCalledAfterCompletion()
+ {
+ assert false;
+ }
+
+ /**
+ * Otherwise, if the observer method is a transactional observer method and
+ * there is currently a JTA transaction in progress, the observer object
+ * calls the observer method during the appropriate transaction completion
+ * phase.
+ */
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "7.5.8", id = "unknown")
+ public void testTransactionalObserverMethodCalledDuringTransactionCompletionPhase()
+ {
+ assert false;
+ }
+
+ /**
*
*/
- @Test(groups = { "events", "integration" , "broken"})
+ @Test(groups = { "events", "integration", "broken" })
@SpecAssertion(section = "7.5.8", id = "unknown")
public void testEnterpriseBeanObserverMethodCalledWithCallerContext()
{
@@ -121,4 +147,29 @@
assert false;
}
+ /**
+ * Otherwise, if the observer method is a @BeforeTransactionCompletion
+ * transactional observer method, it is called within the context of the
+ * transaction that is about to complete and with the same client security
+ * context and lifecycle contexts.
+ */
+ @Test(groups = { "stub", "events", "integration" })
+ @SpecAssertion(section = "7.5.9", id = "unknown")
+ public void testBeforeTransactionCompletionObserverMethodContexts()
+ {
+ assert false;
+ }
+
+ /**
+ * Otherwise, if the observer method is any other kind of transactional
+ * observer method, it is called in an unspecified transaction context, but
+ * with the same client security context and lifecycle contexts as the
+ * transaction that just completed.
+ */
+ @Test(groups = { "stub", "events", "integration" })
+ @SpecAssertion(section = "7.5.9", id = "unknown")
+ public void testOtherTransactionalObserverMethodContexts()
+ {
+ assert false;
+ }
}
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/definition/stereotype/StereotypeDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/definition/stereotype/StereotypeDefinitionTest.java 2009-02-07 18:58:27 UTC (rev 1449)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/definition/stereotype/StereotypeDefinitionTest.java 2009-02-08 13:21:00 UTC (rev 1450)
@@ -18,11 +18,11 @@
/**
*
* Spec version: PRD2
- *
+ *
*/
public class StereotypeDefinitionTest extends AbstractTest
{
-
+
@Override
protected List<Class<? extends Annotation>> getEnabledDeploymentTypes()
{
@@ -31,9 +31,10 @@
deploymentTypes.add(HornedAnimalDeploymentType.class);
return deploymentTypes;
}
-
+
/**
- * TODO Difficult to test since all user defined stereotypes are not known here
+ * TODO Difficult to test since all user defined stereotypes are not known
+ * here
*/
@Test(groups = { "underInvestigation", "annotationDefinition" })
@SpecAssertion(section = "2.7.1", id = "unknown")
@@ -41,9 +42,10 @@
{
assert false;
}
-
+
/**
- * TODO Difficult to test since all user defined stereotypes are not known here
+ * TODO Difficult to test since all user defined stereotypes are not known
+ * here
*/
@Test(groups = { "underInvestigation", "annotationDefinition" }, expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "2.7.1", id = "unknown")
@@ -51,9 +53,10 @@
{
assert false;
}
-
+
/**
- * TODO If the stereotype does not have a stereotype annotation, then it isn't one and is difficult to test
+ * TODO If the stereotype does not have a stereotype annotation, then it
+ * isn't one and is difficult to test
*/
@Test(groups = { "underInvestigation", "annotationDefinition" })
@SpecAssertion(section = "2.7.1", id = "unknown")
@@ -61,7 +64,7 @@
{
assert false;
}
-
+
@Test
@SpecAssertion(section = "2.7.1.1", id = "unknown")
public void testStereotypeWithScopeType()
@@ -69,7 +72,7 @@
Bean<Moose> moose = createSimpleBean(Moose.class);
assert moose.getScopeType().equals(RequestScoped.class);
}
-
+
@Test
@SpecAssertion(section = "2.7.1.1", id = "unknown")
public void testStereotypeWithoutScopeType()
@@ -77,42 +80,44 @@
Bean<Reindeer> reindeer = createSimpleBean(Reindeer.class);
assert reindeer.getScopeType().equals(Dependent.class);
}
-
- @Test(groups = "stub")
+
+ @Test( groups = "broken" )
@SpecAssertion(section = "2.7.1.2", id = "unknown")
public void testStereotypeWithoutInterceptors()
{
- assert false;
+ deployBeans(Goldfish.class);
+ Goldfish aGoldfish = manager.getInstanceByType(Goldfish.class);
+ assert aGoldfish != null;
}
-
+
@Test(groups = { "stub", "interceptors" })
@SpecAssertion(section = "2.7.1.2", id = "unknown")
public void testStereotypeWithInterceptors()
{
assert false;
}
-
+
@Test(expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "2.7.1.1", id = "unknown")
public void testStereotypeWithTooManyScopeTypes()
{
deployBeans(Elk_Broken.class);
}
-
+
@Test(expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "2.7.1.1", id = "unknown")
public void testStereotypeWithTooManyDeploymentTypes()
{
deployBeans(Gazelle_Broken.class);
}
-
+
@Test(expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "2.7.1.3", id = "unknown")
public void testStereotypeWithNonEmptyNamed()
{
deployBeans(FallowDeer_Broken.class);
}
-
+
@Test(expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "2.7.1", id = "unknown")
public void testStereotypeWithBindingTypes()
@@ -121,10 +126,7 @@
}
@Test
- @SpecAssertions({
- @SpecAssertion(section = "2.7.2", id = "unknown"),
- @SpecAssertion(section = "2.7.4", id = "unknown")
- })
+ @SpecAssertions( { @SpecAssertion(section = "2.7.2", id = "unknown"), @SpecAssertion(section = "2.7.4", id = "unknown") })
public void testMultipleStereotypes()
{
Bean<HighlandCow> highlandCow = createSimpleBean(HighlandCow.class);
@@ -133,48 +135,36 @@
assert highlandCow.getScopeType().equals(RequestScoped.class);
assert highlandCow.getDeploymentType().equals(HornedAnimalDeploymentType.class);
}
-
+
@Test
- @SpecAssertions({
- @SpecAssertion(section = "2.7.2", id = "unknown"),
- @SpecAssertion(section = "2.7.4", id = "unknown")
- })
+ @SpecAssertions( { @SpecAssertion(section = "2.7.2", id = "unknown"), @SpecAssertion(section = "2.7.4", id = "unknown") })
public void testMultipleStereotypesMergesScopes()
{
Bean<Springbok> springbok = createSimpleBean(Springbok.class);
assert springbok.getScopeType().equals(ApplicationScoped.class);
}
-
+
@Test(expectedExceptions = DefinitionException.class)
- @SpecAssertions({
- @SpecAssertion(section = "2.7.2", id = "unknown"),
- @SpecAssertion(section = "2.7.4", id = "unknown")
- })
+ @SpecAssertions( { @SpecAssertion(section = "2.7.2", id = "unknown"), @SpecAssertion(section = "2.7.4", id = "unknown") })
public void testMultipleStereotypesMergesRequiredTypes()
{
deployBeans(Antelope_Broken.class);
}
-
+
@Test(expectedExceptions = DefinitionException.class)
- @SpecAssertions({
- @SpecAssertion(section = "2.7.2", id = "unknown"),
- @SpecAssertion(section = "2.7.4", id = "unknown")
- })
+ @SpecAssertions( { @SpecAssertion(section = "2.7.2", id = "unknown"), @SpecAssertion(section = "2.7.4", id = "unknown") })
public void testMultipleStereotypesWithMultipleDeploymentTypes()
{
deployBeans(Goat_Broken.class);
}
-
+
@Test(expectedExceptions = DefinitionException.class)
- @SpecAssertions({
- @SpecAssertion(section = "2.7.2", id = "unknown"),
- @SpecAssertion(section = "2.7.4", id = "unknown")
- })
+ @SpecAssertions( { @SpecAssertion(section = "2.7.2", id = "unknown"), @SpecAssertion(section = "2.7.4", id = "unknown") })
public void testMultipleStereotypesWithMultipleScopeTypes()
{
deployBeans(Deer_Broken.class);
}
-
+
@Test(groups = { "stub", "webbeansxml" })
@SpecAssertion(section = "2.7.3", id = "unknown")
public void testStereotypeDeclaredInXmlIgnoresJavaStereotypes()
@@ -186,7 +176,7 @@
// AnnotatedClass<HighlandCow> cooXmlAnnotatedItem = new
// SimpleAnnotatedClass<HighlandCow>(HighlandCow.class,
// cooXmlAnnotations);
-
+
/*
* SimpleBean<HighlandCow> coo = createSimpleBean(HighlandCow.class,
* cooXmlAnnotatedItem); assert
@@ -198,7 +188,7 @@
*/
assert false;
}
-
+
@Test(groups = { "stub", "webbeansxml" })
@SpecAssertion(section = "2.7.3", id = "unknown")
public void testStereotypeDeclaredInXmlIgnoresJavaBindingTypes()
@@ -212,66 +202,56 @@
// AnnotatedClass<HighlandCow> cooXmlAnnotatedItem = new
// SimpleAnnotatedClass<HighlandCow>(HighlandCow.class,
// cooXmlAnnotations);
-
+
/*
* SimpleBean<HighlandCow> coo = createSimpleBean(HighlandCow.class,
* cooXmlAnnotatedItem); assert coo.getBindingTypes().size() == 1; assert
* coo.getBindingTypes().contains(new SynchronousAnnotationLiteral());
*/
assert false;
-
+
}
-
+
@Test
- @SpecAssertions({
- @SpecAssertion(section = "2.7.1.4", id = "unknown"),
- @SpecAssertion(section = "2.7.4", id = "unknown")
- })
+ @SpecAssertions( { @SpecAssertion(section = "2.7.1.4", id = "unknown"), @SpecAssertion(section = "2.7.4", id = "unknown") })
public void testRequiredTypeIsImplemented()
{
assert createSimpleBean(HighlandCow.class).getTypes().contains(Animal.class);
}
-
+
@Test(expectedExceptions = DefinitionException.class)
- @SpecAssertions({
- @SpecAssertion(section = "2.7.1.4", id = "unknown"),
- @SpecAssertion(section = "2.7.4", id = "unknown")
- })
+ @SpecAssertions( { @SpecAssertion(section = "2.7.1.4", id = "unknown"), @SpecAssertion(section = "2.7.4", id = "unknown") })
public void testRequiredTypeIsNotImplemented()
{
deployBeans(Chair_Broken.class);
}
-
+
@Test
- @SpecAssertions({
- @SpecAssertion(section = "2.7.1.4", id = "unknown"),
- @SpecAssertion(section = "2.7.4", id = "unknown")
- })
+ @SpecAssertions( { @SpecAssertion(section = "2.7.1.4", id = "unknown"), @SpecAssertion(section = "2.7.4", id = "unknown") })
public void testScopeIsSupported()
{
assert createSimpleBean(Goldfish.class).getScopeType().equals(RequestScoped.class);
}
-
+
@Test(expectedExceptions = DefinitionException.class)
- @SpecAssertions({
- @SpecAssertion(section = "2.7.1.4", id = "unknown"),
- @SpecAssertion(section = "2.7.4", id = "unknown")
- })
+ @SpecAssertions( { @SpecAssertion(section = "2.7.1.4", id = "unknown"), @SpecAssertion(section = "2.7.4", id = "unknown") })
public void testScopeIsNotSupported()
{
createSimpleBean(Carp_Broken.class);
}
-
- @Test @SpecAssertion(section="4.1", id = "unknown")
+
+ @Test
+ @SpecAssertion(section = "4.1", id = "unknown")
public void testStereotypeDeclaredInheritedIsInherited() throws Exception
{
assert createSimpleBean(BorderCollie.class).getScopeType().equals(RequestScoped.class);
}
-
- @Test @SpecAssertion(section="4.1", id = "unknown")
+
+ @Test
+ @SpecAssertion(section = "4.1", id = "unknown")
public void testStereotypeNotDeclaredInheritedIsNotInherited()
{
assert createSimpleBean(ShetlandPony.class).getDeploymentType().equals(Production.class);
}
-
+
}
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/EventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/EventTest.java 2009-02-07 18:58:27 UTC (rev 1449)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/EventTest.java 2009-02-08 13:21:00 UTC (rev 1450)
@@ -26,7 +26,7 @@
* @author Nicklas Karlsson
* @author David Allen
*
- * Spec version: PRD2
+ * Spec version: Public Release Draft 2
*/
public class EventTest extends AbstractTest
{
@@ -90,13 +90,20 @@
}
}
+ /**
+ * The event types of the event include all superclasses and interfaces of
+ * the class of the event object.
+ *
+ * @throws Exception
+ */
@Test(groups = { "events" })
@SpecAssertion(section = "7.1", id = "unknown")
public void testEventTypeIncludesAllSuperclassesAndInterfacesOfEventObject() throws Exception
{
// Fire a single complex type of event with many observers
deployBeans(AllEventTypesObserver.class);
- new RunInDependentContext() {
+ new RunInDependentContext()
+ {
@Override
protected void execute() throws Exception
@@ -105,10 +112,13 @@
manager.fireEvent(new ComplexEvent());
assert theObserver.getTotalEventsObserved() == 4;
}
-
+
}.run();
}
+ /**
+ * The Manager interface provides a method for firing events:
+ */
@Test(groups = { "events" })
@SpecAssertion(section = "7.2", id = "unknown")
public void testManagerFireEvent()
@@ -122,14 +132,14 @@
}
/**
+ * An event object is an instance of a concrete Java class with no type
+ * variables or wildcards.
+ *
* If the type of the event object passed to fireEvent() contains type
* variables or wildcards, an IllegalArgumentException is thrown
*/
@Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
- @SpecAssertions({
- @SpecAssertion(section = "7.1", id = "unknown"),
- @SpecAssertion(section = "7.2", id = "unknown")
- })
+ @SpecAssertions( { @SpecAssertion(section = "7.1", id = "unknown"), @SpecAssertion(section = "7.2", id = "unknown") })
public void testManagerFireEventWithEventTypeParametersFails()
{
ATemplatedEventType<String> anEvent = new ATemplatedEventType<String>();
@@ -137,14 +147,14 @@
}
/**
+ * An event object is an instance of a concrete Java class with no type
+ * variables or wildcards.
+ *
* If the type of the event object passed to fireEvent() contains type
* variables or wildcards, an IllegalArgumentException is thrown
*/
@Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
- @SpecAssertions({
- @SpecAssertion(section = "7.1", id = "unknown"),
- @SpecAssertion(section = "7.2", id = "unknown")
- })
+ @SpecAssertions( { @SpecAssertion(section = "7.1", id = "unknown"), @SpecAssertion(section = "7.2", id = "unknown") })
public void testManagerFireEventWithEventTypeWildcardsFails()
{
// Although the above test is really the same as with a wildcard, we will
@@ -154,11 +164,18 @@
manager.fireEvent(anEventOnAnyType);
}
+ /**
+ * An event binding type is just an ordinary binding type as specified in
+ * Section 2.3.2, “Defining new binding types” with the exception that it may
+ * be declared @Target({FIELD, PARAMETER}). More formally, an event binding
+ * type is a Java annotation defined as @Target({FIELD, PARAMETER}) or
+ *
+ * @Target({METHOD, FIELD, PARAMETER, TYPE}) and @Retention(RUNTIME). All
+ * event binding types must specify the
+ * javax.inject.BindingType meta-annotation.
+ */
@Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
- @SpecAssertions({
- @SpecAssertion(section = "7.1", id = "unknown"),
- @SpecAssertion(section = "7.2", id = "unknown")
- })
+ @SpecAssertions( { @SpecAssertion(section = "7.1", id = "unknown"), @SpecAssertion(section = "7.2", id = "unknown") })
public void testManagerFireEventWithNonBindingAnnotationsFails()
{
// The specs are not exactly clear on what is supposed to happen here,
@@ -169,6 +186,10 @@
manager.fireEvent(anEvent, new AnimalStereotypeAnnotationLiteral());
}
+ /**
+ * An observer instance may be registered with the container by calling
+ * Manager.addObserver():
+ */
@Test(groups = { "events" })
@SpecAssertion(section = "7.3", id = "unknown")
public void testManagerAddObserver()
@@ -218,6 +239,10 @@
assert foundObserver;
}
+ /**
+ * An observer instance may be deregistered by calling
+ * Manager.removeObserver():
+ */
@Test(groups = { "events" })
@SpecAssertion(section = "7.3", id = "unknown")
public void testManagerRemoveObserver()
@@ -252,6 +277,10 @@
assert resolvedObservers.isEmpty();
}
+ /**
+ * If two instances of the same binding type are passed to addObserver() or
+ * removeObserver(), a DuplicateBinding- TypeException is thrown.
+ */
@Test(groups = { "events" }, expectedExceptions = { DuplicateBindingTypeException.class })
@SpecAssertion(section = "7.3", id = "unknown")
public void testMultipleInstancesOfSameBindingTypeWhenAddingObserverFails()
@@ -260,6 +289,10 @@
manager.addObserver(observer, AnEventType.class, new RoleBinding("Admin"), new TameAnnotationLiteral(), new TameAnnotationLiteral());
}
+ /**
+ * If an instance of an annotation that is not a binding type is passed to
+ * addObserver() or removeObserver(), an IllegalArgumentException is thrown.
+ */
@Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
@SpecAssertion(section = "7.3", id = "unknown")
public void testNonBindingTypePassedToAddObserverFails()
@@ -268,6 +301,10 @@
manager.addObserver(observer, AnEventType.class, new AnimalStereotypeAnnotationLiteral());
}
+ /**
+ * If two instances of the same binding type are passed to addObserver() or
+ * removeObserver(), a DuplicateBinding- TypeException is thrown.
+ */
@Test(groups = { "events" }, expectedExceptions = { DuplicateBindingTypeException.class })
@SpecAssertion(section = "7.3", id = "unknown")
public void testMultipleInstancesOfSameBindingTypeWhenRemovingObserverFails()
@@ -277,6 +314,10 @@
manager.removeObserver(observer, AnEventType.class, new RoleBinding("Admin"), new TameAnnotationLiteral(), new TameAnnotationLiteral());
}
+ /**
+ * If an instance of an annotation that is not a binding type is passed to
+ * addObserver() or removeObserver(), an IllegalArgumentException is thrown.
+ */
@Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
@SpecAssertion(section = "7.3", id = "unknown")
public void testNonBindingTypePassedToRemoveObserverFails()
@@ -286,11 +327,13 @@
manager.removeObserver(observer, AnEventType.class, new AnimalStereotypeAnnotationLiteral());
}
+ /**
+ * An event consumer will be notified of an event if the observed event type
+ * it specifies is one of the event types of the event, and if all the
+ * observed event bindings it specifies are event bindings of the event.
+ */
@Test(groups = { "events" })
- @SpecAssertions({
- @SpecAssertion(section = "7.1", id = "unknown"),
- @SpecAssertion(section = "7.4", id = "unknown")
- })
+ @SpecAssertions( { @SpecAssertion(section = "7.1", id = "unknown"), @SpecAssertion(section = "7.4", id = "unknown") })
public void testConsumerNotifiedWhenEventTypeAndAllBindingsMatch()
{
AnObserver observer1 = new AnObserver();
@@ -306,6 +349,11 @@
assert observer2.wasNotified;
}
+ /**
+ * Observers may throw exceptions. If an observer throws an exception, the
+ * exception aborts processing of the event. No oth- er observers of that
+ * event will be called. The fireEvent() method rethrows the exception.
+ */
@Test(groups = { "events" })
@SpecAssertion(section = "7.4", id = "unknown")
public void testObserverThrowsExceptionAbortsNotifications()
@@ -333,6 +381,10 @@
assert observer.wasNotified ^ anotherObserver.wasNotified;
}
+ /**
+ * There may be arbitrarily many observer methods with the same event
+ * parameter type and bindings.
+ */
@Test(groups = { "events" })
@SpecAssertion(section = "7.5", id = "unknown")
public void testMultipleObserverMethodsOK()
@@ -350,11 +402,29 @@
assert resolvedIntegerObservers.size() == 1;
}
+ /**
+ * If the bean is a session bean, the observer method must be a business
+ * method of the EJB or a static method of the bean class.
+ */
+ @Test(groups = { "events" }, expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = "7.5", id = "unknown")
+ public void testObserverMethodOnEnterpriseBeanNotBusinessMethodOrStaticFails()
+ {
+ deployBeans(TibetanTerrier.class);
+ Set<Bean<Object>> beans = manager.resolveByType(Object.class);
+ assert beans.size() >= 2;
+ @SuppressWarnings("unused")
+ Set<Observer<String>> observers = manager.resolveObservers("An event");
+ }
+
+ /**
+ * Each observer method must have exactly one event parameter, of the same
+ * type as the event type it observes. When searching for observer methods
+ * for an event, the container considers the type and bindings of the event
+ * parameter.
+ */
@Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
- @SpecAssertions({
- @SpecAssertion(section = "7.5.1", id = "unknown"),
- @SpecAssertion(section = "7.5.2", id = "unknown")
- })
+ @SpecAssertions( { @SpecAssertion(section = "7.5.1", id = "unknown"), @SpecAssertion(section = "7.5.2", id = "unknown") })
public void testObserverMethodMustHaveOnlyOneEventParameter()
{
deployBeans(YorkshireTerrier_Broken.class);
@@ -363,6 +433,10 @@
assert beans != null;
}
+ /**
+ * If the type of the event parameter contains type variables or wildcards, a
+ * DefinitionException is thrown by the container at deployment time.
+ */
@Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
@SpecAssertion(section = "7.5.1", id = "unknown")
public void testObserverMethodCannotObserveParameterizedEvents()
@@ -372,6 +446,10 @@
assert beans != null;
}
+ /**
+ * If the event parameter does not explicitly declare any binding, the
+ * observer method observes events with no binding.
+ */
@Test(groups = { "events" })
@SpecAssertion(section = "7.5.1", id = "unknown")
public void testObserverMethodWithoutBindingTypesObservesEventsWithoutBindingTypes()
@@ -386,6 +464,11 @@
assert resolvedObservers.size() == 2;
}
+ /**
+ * If an observer method is annotated @Produces, or @Initializer or has a
+ * parameter annotated @Disposes, a Defini- tionException is thrown by the
+ * container at deployment time.
+ */
@Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
@SpecAssertion(section = "7.5.2", id = "unknown")
public void testObserverMethodAnnotatedProducesFails()
@@ -395,6 +478,11 @@
assert beans != null;
}
+ /**
+ * If an observer method is annotated @Produces, or @Initializer or has a
+ * parameter annotated @Disposes, a Defini- tionException is thrown by the
+ * container at deployment time.
+ */
@Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
@SpecAssertion(section = "7.5.2", id = "unknown")
public void testObserverMethodAnnotatedInitializerFails()
@@ -404,6 +492,11 @@
assert beans != null;
}
+ /**
+ * If an observer method is annotated @Produces, or @Initializer or has a
+ * parameter annotated @Disposes, a Defini- tionException is thrown by the
+ * container at deployment time.
+ */
@Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
@SpecAssertion(section = "7.5.2", id = "unknown")
public void testObserverMethodWithDisposesParamFails()
@@ -413,6 +506,9 @@
assert beans != null;
}
+ /**
+ * The event parameter may declare bindings:
+ */
@Test(groups = { "events" })
@SpecAssertion(section = "7.5.2", id = "unknown")
public void testObserverMethodMayHaveMultipleBindingTypes()
@@ -427,22 +523,42 @@
}
- @Test(groups = { "stub", "events" })
+ /**
+ * When an observer method is declared in XML, the container ignores binding
+ * annotations applied to the Java method para- meters.
+ */
+ @Test(groups = { "stub", "events", "webbeansxml" })
@SpecAssertion(section = "7.5.3", id = "unknown")
public void testXMLDefinedObserverMethodIgnoresBindingAnnotations()
{
assert false;
}
- @Test(groups = { "stub", "events" })
+ /**
+ * If the bean class of a bean declared in XML does not have a method with
+ * parameters that match those declared in XML, a DefinitionException is
+ * thrown by the container at deployment time.
+ */
+ @Test(groups = { "stub", "events", "webbeansxml" })
@SpecAssertion(section = "7.5.3", id = "unknown")
public void testXMLDefinedObserverNotFindingImplementationMethodFails()
{
assert false;
}
+ /**
+ * In addition to the event parameter, observer methods may declare
+ * additional parameters, which may declare bindings. The container calls the
+ * method Manager.getInstanceToInject() defined in Section 5.7.1, “Resolving
+ * dependencies” to determine a value for each parameter of an observer
+ * method and calls the observer method with those parameter values.
+ *
+ * To invoke an observer method, the container must pass the event object to
+ * the event parameter and the object returned by
+ * Manager.getInstanceToInject() to each of the other parameters.
+ */
@Test(groups = { "events" })
- @SpecAssertion(section = "7.5.4", id = "unknown")
+ @SpecAssertions( { @SpecAssertion(section = "7.5.4", id = "unknown"), @SpecAssertion(section = "7.5.8", id = "unknown") })
public void testObserverMethodReceivesInjectionsOnNonObservesParameters()
{
deployBeans(BananaSpider.class);
@@ -451,8 +567,9 @@
}
/**
- * Tests that a conditional observer is not notified of events until after it
- * is created by some other separate action.
+ * Conditional observer methods are observer methods which are notified of an
+ * event only if an instance of the bean that defines the observer method
+ * already exists in the current context.
*/
@Test(groups = { "events" })
@SpecAssertion(section = "7.5.5", id = "unknown")
@@ -482,24 +599,91 @@
}
}
+ /**
+ * A transactional observer method may not specify more than one of the four
+ * types. If a transactional observer method specifies more than one of the
+ * four types, a DefinitionException is thrown by the container at deployment
+ * time.
+ */
@Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
- @SpecAssertion(section = "7.1", id = "unknown")
+ @SpecAssertion(section = "7.5.6", id = "unknown")
public void testTransactionalObserverCanOnlyObserveSinglePhase()
{
deployBeans(TooManyPhases_Broken.class);
}
- @Test(groups = { "events" }, expectedExceptions=DefinitionException.class)
- @SpecAssertion(section = "7.5", id = "unknown")
- public void testObserverMethodOnEnterpriseBeanNotBusinessMethodOrStaticFails()
+ /**
+ * Asynchronous observer methods are observer methods which receive event
+ * notifications asynchronously.
+ *
+ * An asynchronous observer method may be declared by annotating the event
+ * parameter of the observer method javax.event.Asynchronously or in XML by a
+ * child <Asynchronously> element of the <Observes> element.
+ */
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "7.5.7", id = "unknown")
+ public void testAsynchronousObserverIsAsynchronous()
{
- deployBeans(TibetanTerrier.class);
- Set<Bean<Object>> beans = manager.resolveByType(Object.class);
- assert beans.size() >= 2;
- @SuppressWarnings("unused")
- Set<Observer<String>> observers = manager.resolveObservers("An event");
+ assert false;
}
+ /**
+ * An asynchronous observer method may be declared by annotating the event
+ * parameter of the observer method javax.event.Asynchronously or in XML by a
+ * child <Asynchronously> element of the <Observes> element.
+ */
+ @Test(groups = { "stub", "events", "webbeansxml" })
+ @SpecAssertion(section = "7.5.7", id = "unknown")
+ public void testAsynchronousObserverDeclaredByXML()
+ {
+ assert false;
+ }
+
+ /**
+ * An asynchronous observer method may also be a transactional observer
+ * method.
+ */
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "7.5.7", id = "unknown")
+ public void testAsynchronousObserverAlsoTransactional()
+ {
+ assert false;
+ }
+
+ /**
+ * An asynchronous observer method may also be a transactional observer
+ * method. However, it may not be a before completion observer method or a
+ * conditional observer method. If an asynchronous observer method is
+ * specified as a before completion or conditional observer method, a
+ * DefinitionException is thrown by the container at deployment time.
+ */
+ @Test(groups = { "stub", "events" }, expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = "7.5.7", id = "unknown")
+ public void testAsynchronousObserverAsBeforeCompletionObserverFails()
+ {
+ assert false;
+ }
+
+ /**
+ * An asynchronous observer method may also be a transactional observer
+ * method. However, it may not be a before completion observer method or a
+ * conditional observer method. If an asynchronous observer method is
+ * specified as a before completion or conditional observer method, a
+ * DefinitionException is thrown by the container at deployment time.
+ */
+ @Test(groups = { "stub", "events" }, expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = "7.5.7", id = "unknown")
+ public void testAsynchronousObserverAsConditionalObserverFails()
+ {
+ assert false;
+ }
+
+ /**
+ * For every observer method of an enabled bean, the container is responsible
+ * for providing and registering an appropriate implementation of the
+ * Observer interface, that delegates event notifications to the observer
+ * method.
+ */
@Test(groups = { "events" })
@SpecAssertion(section = "7.5.8", id = "unknown")
public void testObserverMethodRegistration()
@@ -514,9 +698,78 @@
assert resolvedObservers.size() == 2;
}
+ /**
+ * Otherwise, if the observer method is an asynchronous observer method, the
+ * container calls the observer method asynchronously.
+ */
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "7.5.8", id = "unknown")
+ public void testAsynchronousObserverMethodCalledAsynchronously()
+ {
+ assert false;
+ }
+
+ /**
+ * Otherwise, the container calls the observer immediately.
+ */
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "7.5.8", id = "unknown")
+ public void testObserverMethodCalledImmediately()
+ {
+ assert false;
+ }
+
+ /**
+ * If the observer method is static, the container must invoke the method.
+ */
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "7.5.8", id = "unknown")
+ public void testStaticObserverMethodInvoked()
+ {
+ assert false;
+ }
+
+ /**
+ * Otherwise, if the observer method is non-static, the container must:
+ *
+ * • obtain the Bean object for the most specialized bean that specializes
+ * the bean which declares the observer method, and then
+ *
+ * • obtain the context object by calling Manager.getContext(), passing the
+ * bean scope, then
+ *
+ * • obtain an instance of the bean by calling Context.get(), passing the
+ * Bean instance representing the bean, together with a CreationalContext
+ * unless this observer method is a conditional observer method, and then
+ *
+ * • if the get() method returned a non-null value, invoke the observer
+ * method on the returned instance
+ */
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "7.5.8", id = "unknown")
+ public void testObserverMethodInvocationProcess()
+ {
+ assert false;
+ }
+
+ /**
+ * If the observer is a transactional or asynchronous observer method, any
+ * exception is caught and logged by the container.
+ */
+ @Test(groups = { "stubs", "events" }, expectedExceptions = { TeaCupPomeranian.OversizedException.class })
+ @SpecAssertion(section = "7.5.8", id = "unknown")
+ public void testAsynchronousObserverThrowsNonCheckedExceptionIsRethrown()
+ {
+ assert false;
+ }
+
+ /**
+ * Otherwise, the exception is rethrown by the notify() method of the
+ * observer object.
+ */
@Test(groups = { "events" }, expectedExceptions = { TeaCupPomeranian.OversizedException.class })
@SpecAssertion(section = "7.5.8", id = "unknown")
- public void testNonTransactionalObserverThrownNonCheckedExceptionIsRethrown()
+ public void testNonTransactionalObserverThrowsNonCheckedExceptionIsRethrown()
{
deployBeans(TeaCupPomeranian.class);
Set<Bean<Object>> beans = manager.resolveByType(Object.class);
@@ -524,9 +777,13 @@
manager.fireEvent("Another event");
}
+ /**
+ * If the exception is a checked exception, it is wrapped and rethrown as an
+ * (unchecked) ObserverException.
+ */
@Test(groups = { "events" }, expectedExceptions = { ObserverException.class })
@SpecAssertion(section = "7.5.8", id = "unknown")
- public void testNonTransactionalObserverThrownCheckedExceptionIsWrappedAndRethrown()
+ public void testNonTransactionalObserverThrowsCheckedExceptionIsWrappedAndRethrown()
{
deployBeans(TeaCupPomeranian.class);
Set<Bean<Object>> beans = manager.resolveByType(Object.class);
@@ -534,6 +791,52 @@
manager.fireEvent(new Integer(1));
}
+ /**
+ * Otherwise, if the observer method is non-static, the container must:
+ *
+ * • obtain the Bean object for the most specialized bean that specializes
+ * the bean which declares the observer method, and then
+ *
+ */
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "7.5.8", id = "unknown")
+ public void testObserverCalledOnMostSpecializedInstance()
+ {
+ Shop.deliveryObservedBy = null;
+ deployBeans(FarmShop.class, Shop.class);
+ manager.fireEvent(new Delivery());
+ assert Shop.deliveryObservedBy.equals(FarmShop.class.getName());
+ }
+
+ /**
+ * If the observer method is an asynchronous observer method, it is called
+ * with no active transaction, no client security context and with a new
+ * request context that is destroyed when the observer method returns. The
+ * application context is also active.
+ */
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "7.5.9", id = "unknown")
+ public void testAsynchronousObserverMethodContexts()
+ {
+ assert false;
+ }
+
+ /**
+ * Otherwise, the observer method is called in the same transaction context,
+ * client security context and lifecycle contexts as the invocation of
+ * Event.fire().
+ */
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "7.5.9", id = "unknown")
+ public void testObserverMethodCalledInSameContexts()
+ {
+ assert false;
+ }
+
+ /**
+ * If two instances of the same binding type are passed to fire() or
+ * observes(), a DuplicateBindingTypeException is thrown.
+ */
@Test(groups = { "events" }, expectedExceptions = { DuplicateBindingTypeException.class })
@SpecAssertion(section = "7.6", id = "unknown")
public void testDuplicateBindingsToFireFails()
@@ -551,6 +854,10 @@
}
}
+ /**
+ * If two instances of the same binding type are passed to fire() or
+ * observes(), a DuplicateBindingTypeException is thrown.
+ */
@Test(groups = { "events" }, expectedExceptions = { DuplicateBindingTypeException.class })
@SpecAssertion(section = "7.6", id = "unknown")
public void testDuplicateBindingsToObservesFails()
@@ -568,6 +875,10 @@
}
}
+ /**
+ * If an instance of an annotation that is not a binding type is passed to
+ * fire() or observes(), an IllegalArgumentException is thrown.
+ */
@Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
@SpecAssertion(section = "7.6", id = "unknown")
public void testNonBindingTypePassedToFireFails()
@@ -585,6 +896,10 @@
}
}
+ /**
+ * If an instance of an annotation that is not a binding type is passed to
+ * fire() or observes(), an IllegalArgumentException is thrown.
+ */
@Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
@SpecAssertion(section = "7.6", id = "unknown")
public void testNonBindingTypePassedToObservesFails()
@@ -602,6 +917,10 @@
}
}
+ /**
+ * The @Fires annotation or <Fires> element may be applied to any injection
+ * point of type Event, where an actual type parameter is specified.
+ */
@Test(groups = { "events" })
@SpecAssertion(section = "7.6", id = "unknown")
public void testFiresAnnotationOnEventTypes()
@@ -665,6 +984,12 @@
}
}
+ /**
+ * If the type of the injection point is not of type Event, if no actual type
+ * parameter is specified, or if the type parameter contains a type variable
+ * or wildcard, a DefinitionException is thrown by the container at
+ * deployment time.
+ */
@Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
@SpecAssertion(section = "7.6", id = "unknown")
public void testFiresAnnotationOnNonEventTypeInjectionPointFails()
@@ -682,6 +1007,12 @@
}
}
+ /**
+ * If the type of the injection point is not of type Event, if no actual type
+ * parameter is specified, or if the type parameter contains a type variable
+ * or wildcard, a DefinitionException is thrown by the container at
+ * deployment time.
+ */
@Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
@SpecAssertion(section = "7.6", id = "unknown")
public void testFiresAnnotationOnInjectionPointWithoutTypeParameterFails()
@@ -699,6 +1030,12 @@
}
}
+ /**
+ * If the type of the injection point is not of type Event, if no actual type
+ * parameter is specified, or if the type parameter contains a type variable
+ * or wildcard, a DefinitionException is thrown by the container at
+ * deployment time.
+ */
@Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
@SpecAssertion(section = "7.6", id = "unknown")
public void testFiresAnnotationOnInjectionPointWithWildcardedTypeParameterFails()
@@ -716,6 +1053,12 @@
}
}
+ /**
+ * If the type of the injection point is not of type Event, if no actual type
+ * parameter is specified, or if the type parameter con- tains a type
+ * variable or wildcard, a DefinitionException is thrown by the container at
+ * deployment time.
+ */
@Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
@SpecAssertion(section = "7.6", id = "unknown")
public void testFiresAnnotationOnInjectionPointWithTypeVariabledTypeParameterFails()
@@ -733,6 +1076,12 @@
}
}
+ /**
+ * Whenever the @Fires annotation appears at an injection point, an implicit
+ * bean exists with:
+ *
+ * • exactly the bean type and bindings that appear at the injection point,
+ */
@Test(groups = { "events" })
@SpecAssertion(section = "7.6", id = "unknown")
public void testImplicitEventBeanMatchesAPITypeOfInectionPoint()
@@ -754,6 +1103,12 @@
}
}
+ /**
+ * Whenever the @Fires annotation appears at an injection point, an implicit
+ * bean exists with:
+ *
+ * • exactly the bean type and bindings that appear at the injection point,
+ */
@Test(groups = { "events" })
@SpecAssertion(section = "7.6", id = "unknown")
public void testImplicitEventBeanMatchesBindingAnnotationsOfInjectionPoint()
@@ -775,6 +1130,9 @@
}
}
+ /**
+ * deployment type @Standard,
+ */
@Test(groups = { "events" })
@SpecAssertion(section = "7.6", id = "unknown")
public void testImplicitEventBeanHasStandardDeploymentType()
@@ -798,6 +1156,9 @@
}
}
+ /**
+ * @Dependent scope,
+ */
@Test(groups = { "events" })
@SpecAssertion(section = "7.6", id = "unknown")
public void testImplicitEventBeanHasDependentScope()
@@ -821,50 +1182,110 @@
}
}
- //TODO The manager related tests require intercepting all calls
+ /**
+ * no bean name, and
+ */
+ @Test(groups = { "events", "stub" })
+ @SpecAssertion(section = "7.6", id = "unknown")
+ public void testImplicitEventBeanHasNoName()
+ {
+ assert false;
+ }
+
+ /**
+ * an implementation provided automatically by the container.
+ */
+ @Test(groups = { "events", "stub" })
+ @SpecAssertion(section = "7.6", id = "unknown")
+ public void testImplicitEventBeanProvidedByContainer()
+ {
+ assert false;
+ }
+
+ /**
+ * The fire() method of the provided implementation of Event must call
+ * Manager.fireEvent(), passing the following parameters:
+ *
+ * • the event object passed to Event.fire()
+ */
+ // TODO The manager related tests require intercepting all calls
// to it to verify that the correct calls are made.
- @Test(groups = { "stub", "events", "underInvestigation" })
+ @Test(groups = { "events", "underInvestigation" })
@SpecAssertion(section = "7.6", id = "unknown")
public void testFireMethodCallsManagerFireWithEventObject()
{
assert false;
}
- @Test(groups = { "stub", "events", "underInvestigation" })
+ /**
+ * The fire() method of the provided implementation of Event must call
+ * Manager.fireEvent(), passing the following parameters:
+ *
+ * • all bindings declared at the injection point, except @Fires
+ */
+ @Test(groups = { "events", "underInvestigation" })
@SpecAssertion(section = "7.6", id = "unknown")
- public void testFireMethodCallsManagerFireWithBindingAnnotationsExceptObservable()
+ public void testFireMethodCallsManagerFireWithBindingAnnotationsExceptFires()
{
assert false;
}
- @Test(groups = { "stub", "events", "underInvestigation" })
+ /**
+ * The fire() method of the provided implementation of Event must call
+ * Manager.fireEvent(), passing the following parameters:
+ *
+ * • all bindings passed to Event.fire()
+ */
+ @Test(groups = { "events", "underInvestigation" })
@SpecAssertion(section = "7.6", id = "unknown")
public void testFireMethodCallsManagerFireWithAllBindingAnnotationInstances()
{
assert false;
}
- @Test(groups = { "stub", "events", "underInvestigation" })
+ /**
+ * The observe() method of the provided implementation of Event must call
+ * Manager.addObserver(), passing the following parameters:
+ *
+ * • the observer object passed to Event.observe()
+ */
+ @Test(groups = { "events", "underInvestigation" })
@SpecAssertion(section = "7.6", id = "unknown")
public void testObserveMethodCallsManagerAddObserverWithObserverObject()
{
assert false;
}
- @Test(groups = { "stub", "events", "underInvestigation" })
+ /**
+ * The observe() method of the provided implementation of Event must call
+ * Manager.addObserver(), passing the following parameters:
+ *
+ * • all bindings declared at the injection point, except @Fires
+ */
+ @Test(groups = { "events", "underInvestigation" })
@SpecAssertion(section = "7.6", id = "unknown")
- public void testObserveMethodCallsManagerAddObserverWithAllBindingAnnotationsExceptObservable()
+ public void testObserveMethodCallsManagerAddObserverWithAllBindingAnnotationsExceptFires()
{
assert false;
}
- @Test(groups = { "stub", "events", "underInvestigation" })
+ /**
+ * The observe() method of the provided implementation of Event must call
+ * Manager.addObserver(), passing the following parameters:
+ *
+ * • all bindings passed to Event.observe()
+ */
+ @Test(groups = { "events", "underInvestigation" })
@SpecAssertion(section = "7.6", id = "unknown")
public void testObserveMethodCallsManagerAddObserverWithAllBindingAnnotationInstance()
{
assert false;
}
+ /**
+ * If the type of the event object passed to resolveObservers() contains type
+ * variables or wildcards, an IllegalArgumentException is thrown.
+ */
@Test(groups = { "events" })
@SpecAssertion(section = "7.7", id = "unknown")
public void testEventObjectContainsTypeVariablesWhenResolvingFails()
@@ -878,6 +1299,10 @@
Set<?> resolvedObservers = manager.resolveObservers(eventToFire);
}
+ /**
+ * If the type of the event object passed to resolveObservers() contains type
+ * variables or wildcards, an IllegalArgumentException is thrown.
+ */
@Test(groups = { "broken", "events" }, expectedExceptions = { IllegalArgumentException.class })
@SpecAssertion(section = "7.7", id = "unknown")
public void testEventObjectContainsWildcardsWhenResolvingFails()
@@ -888,10 +1313,15 @@
private void eventObjectContainsWildcards(ArrayList<? extends Object> eventToFire)
{
@SuppressWarnings("unused")
- //TODO There does not seem to be a way to get wildcarded types pass through
+ // TODO There does not seem to be a way to get wildcarded types pass
+ // through
Set<?> resolvedObservers = manager.resolveObservers(eventToFire);
}
+ /**
+ * If two instances of the same binding type are passed to
+ * resolveObservers(), a DuplicateBindingTypeException is thrown.
+ */
@Test(groups = { "events" }, expectedExceptions = { DuplicateBindingTypeException.class })
@SpecAssertion(section = "7.7", id = "unknown")
public void testDuplicateBindingTypesWhenResolvingFails()
@@ -902,6 +1332,10 @@
Set<Observer<AnEventType>> resolvedObservers = manager.resolveObservers(new AnEventType(), new BindingTypeABinding(), new BindingTypeABinding());
}
+ /**
+ * If an instance of an annotation that is not a binding type is passed to
+ * resolveObservers(), an IllegalArgumentException is thrown.
+ */
@Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
@SpecAssertion(section = "7.7", id = "unknown")
public void testNonBindingTypeAnnotationWhenResolvingFails()
@@ -914,6 +1348,10 @@
assert !resolvedObservers.isEmpty();
}
+ /**
+ * the event object must be assignable to the observed event type, taking
+ * type parameters into consideration, and
+ */
@Test(groups = { "events" })
@SpecAssertion(section = "7.7", id = "unknown")
public void testResolvingChecksEventType()
@@ -927,6 +1365,10 @@
assert emptyObserverSet.isEmpty();
}
+ /**
+ * the event object must be assignable to the observed event type, taking
+ * type parameters into consideration, and
+ */
@Test(groups = { "broken", "events" })
@SpecAssertion(section = "7.7", id = "unknown")
public void testResolvingChecksTypeParameters()
@@ -943,6 +1385,11 @@
assert resolvedObservers.size() == 1;
}
+ /**
+ * for each observed event binding, (a) an instance of the binding type must
+ * have been passed to fireEvent() and (b) any member values of the binding
+ * type must match the member values of the instance passed to fireEvent().
+ */
@Test(groups = { "events" })
@SpecAssertion(section = "7.7", id = "unknown")
public void testResolvingChecksBindingTypes()
@@ -955,6 +1402,11 @@
assert resolvedObservers.size() == 1;
}
+ /**
+ * for each observed event binding, (a) an instance of the binding type must
+ * have been passed to fireEvent() and (b) any member values of the binding
+ * type must match the member values of the instance passed to fireEvent().
+ */
@Test(groups = { "events" })
@SpecAssertion(section = "7.7", id = "unknown")
public void testResolvingChecksBindingTypeMembers()
@@ -967,6 +1419,11 @@
assert resolvedObservers.size() == 1;
}
+ /**
+ * By default, Java implementation reuse is assumed. In this case, the
+ * producer, disposal and observer methods of the first bean are not
+ * inherited by the second bean.
+ */
@Test(groups = { "events", "inheritance" })
@SpecAssertion(section = "4.", id = "unknown")
public void testNonStaticObserverMethodNotInherited()
@@ -975,13 +1432,4 @@
assert manager.resolveObservers(new Egg()).isEmpty();
}
- @Test
- @SpecAssertion(section = "7.5.8", id = "unknown")
- public void testObserverCalledOnMostSpecializedInstance()
- {
- Shop.deliveryObservedBy = null;
- deployBeans(FarmShop.class, Shop.class);
- manager.fireEvent(new Delivery());
- assert Shop.deliveryObservedBy.equals(FarmShop.class.getName());
- }
}
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/commonAnnotations/ResourceInjectionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/commonAnnotations/ResourceInjectionTest.java 2009-02-07 18:58:27 UTC (rev 1449)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/commonAnnotations/ResourceInjectionTest.java 2009-02-08 13:21:00 UTC (rev 1450)
@@ -6,28 +6,114 @@
/**
*
- * Spec version: PRD2
- *
+ * Spec version: Public Release Draft 2
+ *
*/
public class ResourceInjectionTest extends AbstractTest
{
-
- @Test(groups="stub") @SpecAssertion(section="3.10", id = "unknown")
+ /**
+ * The following functionality is provided by the container when annotations
+ * are applied to the bean class of a simple bean:
+ *
+ * • dependency injection via (@EJB), (@Resource), @PersistenceUnit and
+ * @PersistenceContext.
+ */
+ @Test(groups = "stub")
+ @SpecAssertion(section = "3.10", id = "unknown")
public void testInjectionOfPersistenceContext()
{
assert false;
}
-
- @Test(groups="stub") @SpecAssertion(section="3.10", id = "unknown")
+
+ /**
+ * The following functionality is provided by the container when annotations
+ * are applied to the bean class of a simple bean:
+ *
+ * • dependency injection via (@EJB), (@Resource), @PersistenceUnit and
+ * @PersistenceContext.
+ */
+ @Test(groups = "stub")
+ @SpecAssertion(section = "3.10", id = "unknown")
+ public void testInjectionOfPersistenceUnit()
+ {
+ assert false;
+ }
+
+ /**
+ * The following functionality is provided by the container when annotations
+ * are applied to the bean class of a simple bean:
+ *
+ * • dependency injection via (@EJB), (@Resource), @PersistenceUnit and
+ * @PersistenceContext.
+ */
+ @Test(groups = "stub")
+ @SpecAssertion(section = "3.10", id = "unknown")
public void testInjectionOfResource()
{
assert false;
}
-
- @Test(groups="stub") @SpecAssertion(section="3.10", id = "unknown")
+
+ /**
+ * The following functionality is provided by the container when annotations
+ * are applied to the bean class of a simple bean:
+ *
+ * • dependency injection via (@EJB), (@Resource), @PersistenceUnit and
+ * @PersistenceContext.
+ */
+ @Test(groups = "stub")
+ @SpecAssertion(section = "3.10", id = "unknown")
public void testInjectionOfEJB()
{
assert false;
}
-
+
+ /**
+ * The following functionality is provided by the container when annotations
+ * are applied to the bean class of a simple bean:
+ *
+ * • @PostConstruct and @PreDestroy callbacks
+ */
+ @Test(groups = "stub")
+ @SpecAssertion(section = "3.10", id = "unknown")
+ public void testPostConstructCallback()
+ {
+ assert false;
+ }
+
+ /**
+ * The following functionality is provided by the container when annotations
+ * are applied to the bean class of a simple bean:
+ *
+ * • @PostConstruct and @PreDestroy callbacks
+ */
+ @Test(groups = "stub")
+ @SpecAssertion(section = "3.10", id = "unknown")
+ public void testPreDestroyCallback()
+ {
+ assert false;
+ }
+
+ /**
+ * The following functionality is provided by the container when annotations
+ * are applied to the bean class of a simple bean:
+ *
+ * • interception, as defined in javax.interceptor
+ */
+ @Test(groups = "stub")
+ @SpecAssertion(section = "3.10", id = "unknown")
+ public void testStandardInterceptor()
+ {
+ assert false;
+ }
+
+ /**
+ * @PersistenceContext(type=EXTENDED) is not supported for simple beans.
+ */
+ @Test(groups = "stub")
+ @SpecAssertion(section = "3.10", id = "unknown")
+ public void testExtendedPersistenceContextNotSupported()
+ {
+ assert false;
+ }
+
}
Modified: tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/test/impl/InContainerTestRunnerTest.java
===================================================================
--- tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/test/impl/InContainerTestRunnerTest.java 2009-02-07 18:58:27 UTC (rev 1449)
+++ tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/test/impl/InContainerTestRunnerTest.java 2009-02-08 13:21:00 UTC (rev 1450)
@@ -56,11 +56,11 @@
//@Test
public void testRunner()
{
- TestSuite testSuite = new TestSuite();
- testSuite.setWriteDeployedArchivesToDisk(true);
- testSuite.setDeploymentDelay(0);
- MockInContainerTestRunner runner = new MockInContainerTestRunner(testSuite, new MockContainers());
- runner.run();
+// TestSuite testSuite = new TestSuite();
+// testSuite.setWriteDeployedArchivesToDisk(true);
+// testSuite.setDeploymentDelay(0);
+// MockInContainerTestRunner runner = new MockInContainerTestRunner(testSuite, new MockContainers());
+// runner.run();
}
}
More information about the weld-commits
mailing list