[webbeans-commits] Webbeans SVN: r473 - in ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model: valid and 1 other directory.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Mon Dec 8 07:35:45 EST 2008
Author: nickarls
Date: 2008-12-08 07:35:45 -0500 (Mon, 08 Dec 2008)
New Revision: 473
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanDeclarationTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanRemoveMethodTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanSpecializationTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/Pitbull.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/Toller.java
Log:
EJB definition/specialization/remove method tests reviewed to latest spec
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanDeclarationTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanDeclarationTest.java 2008-12-08 12:17:28 UTC (rev 472)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanDeclarationTest.java 2008-12-08 12:35:45 UTC (rev 473)
@@ -1,6 +1,7 @@
package org.jboss.webbeans.test.ejb.model;
import javax.webbeans.DefinitionException;
+import javax.webbeans.DeploymentException;
import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.test.AbstractTest;
@@ -23,81 +24,163 @@
import org.jboss.webbeans.util.BeanFactory;
import org.testng.annotations.Test;
- at SpecVersion("PDR")
+ at SpecVersion("20081206")
@SuppressWarnings("unused")
public class EnterpriseBeanDeclarationTest extends AbstractTest
{
- @Test
+ /**
+ * An EJB stateless session bean must belong to the @Dependent pseudo-scope.
+ * If an enterprise Web Bean specifies an illegal scope, a
+ * DefinitionException is thrown by the Web Bean manager at initialization
+ * time
+ */
+ @Test(groups = { "enterpriseBeans" })
@SpecAssertion(section = "3.3")
public void testStatelessWithDependentScopeOK()
{
EnterpriseBean<Giraffe> giraffe = BeanFactory.createEnterpriseBean(Giraffe.class);
}
- @Test(expectedExceptions = DefinitionException.class)
+ /**
+ * An EJB stateless session bean must belong to the @Dependent pseudo-scope.
+ * If an enterprise Web Bean specifies an illegal scope, a
+ * DefinitionException is thrown by the Web Bean manager at initialization
+ * time
+ */
+ @Test(groups = { "enterpriseBeans" }, expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3")
public void testStatelessWithRequestScopeFails()
{
EnterpriseBean<Beagle> beagle = BeanFactory.createEnterpriseBean(Beagle.class);
}
- @Test(expectedExceptions = DefinitionException.class)
+ /**
+ * An EJB stateless session bean must belong to the @Dependent pseudo-scope.
+ * If an enterprise Web Bean specifies an illegal scope, a
+ * DefinitionException is thrown by the Web Bean manager at initialization
+ * time
+ */
+
+ @Test(groups = { "enterpriseBeans" }, expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3")
public void testStatelessWithConversationScopeFails()
{
EnterpriseBean<Boxer> boxer = BeanFactory.createEnterpriseBean(Boxer.class);
}
- @Test(expectedExceptions = DefinitionException.class)
+ /**
+ * An EJB stateless session bean must belong to the @Dependent pseudo-scope.
+ * If an enterprise Web Bean specifies an illegal scope, a
+ * DefinitionException is thrown by the Web Bean manager at initialization
+ * time
+ */
+ @Test(groups = { "enterpriseBeans" }, expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3")
public void testStatelessWithSessionScopeFails()
{
EnterpriseBean<Bullmastiff> boxer = BeanFactory.createEnterpriseBean(Bullmastiff.class);
}
- @Test(expectedExceptions = DefinitionException.class)
+ /**
+ * An EJB stateless session bean must belong to the @Dependent pseudo-scope.
+ * If an enterprise Web Bean specifies an illegal scope, a
+ * DefinitionException is thrown by the Web Bean manager at initialization
+ * time
+ */
+ @Test(groups = { "enterpriseBeans" }, expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3")
public void testStatelessWithApplicationScopeFails()
{
EnterpriseBean<Dachshund> dachshund = BeanFactory.createEnterpriseBean(Dachshund.class);
}
- @Test
+ /**
+ * An EJB singleton bean must belong to either the @ApplicationScoped scope
+ * or to the @Dependent pseudo-scope. If an enterprise Web Bean specifies an
+ * illegal scope, a DefinitionException is thrown by the Web Bean manager at
+ * initialization time
+ */
+ @Test(groups = { "enterpriseBeans" })
@SpecAssertion(section = "3.3")
public void testSingletonWithDependentScopeOK()
{
EnterpriseBean<GreatDane> greatDane = BeanFactory.createEnterpriseBean(GreatDane.class);
}
- @Test(expectedExceptions = DefinitionException.class)
+ /**
+ * An EJB singleton bean must belong to either the @ApplicationScoped scope
+ * or to the @Dependent pseudo-scope. If an enterprise Web Bean specifies an
+ * illegal scope, a DefinitionException is thrown by the Web Bean manager at
+ * initialization time
+ */
+ @Test(groups = { "enterpriseBeans" }, expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3")
public void testSingletonWithRequestScopeFails()
{
EnterpriseBean<Greyhound> greyhound = BeanFactory.createEnterpriseBean(Greyhound.class);
}
- @Test(expectedExceptions = DefinitionException.class)
+ /**
+ * An EJB singleton bean must belong to either the @ApplicationScoped scope
+ * or to the @Dependent pseudo-scope. If an enterprise Web Bean specifies an
+ * illegal scope, a DefinitionException is thrown by the Web Bean manager at
+ * initialization time
+ */
+ @Test(groups = { "enterpriseBeans" }, expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3")
public void testSingletonWithConversationScopeFails()
{
EnterpriseBean<Husky> husky = BeanFactory.createEnterpriseBean(Husky.class);
}
- @Test(expectedExceptions = DefinitionException.class)
+ /**
+ * An EJB singleton bean must belong to either the @ApplicationScoped scope
+ * or to the @Dependent pseudo-scope. If an enterprise Web Bean specifies an
+ * illegal scope, a DefinitionException is thrown by the Web Bean manager at
+ * initialization time
+ */
+ @Test(groups = { "enterpriseBeans" }, expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3")
public void testSingletonWithSessionScopeFails()
{
EnterpriseBean<IrishTerrier> irishTerrier = BeanFactory.createEnterpriseBean(IrishTerrier.class);
}
- @Test
+ /**
+ * An EJB singleton bean must belong to either the @ApplicationScoped scope
+ * or to the @Dependent pseudo-scope. If an enterprise Web Bean specifies an
+ * illegal scope, a DefinitionException is thrown by the Web Bean manager at
+ * initialization time
+ */
+ @Test(groups = { "enterpriseBeans" })
@SpecAssertion(section = "3.3")
public void testSingletonWithApplicationScopeOK()
{
EnterpriseBean<Laika> laika = BeanFactory.createEnterpriseBean(Laika.class);
}
+ /**
+ * However, in any deployment, there may be at most one most specialized
+ * enabled enterprise Web Bean for any particular EJB enterprise bean.
+ * Therefore, for each distinct EJB name in a module, there is at most one
+ * Web Bean that may be called at runtime. If there is more than one most
+ * specialized enabled enterprise Web Bean for a particular EJB enterprise
+ * bean, a DeploymentException is thrown by the Web Bean manager at
+ * initialization time.
+ */
+ @Test(groups = { "enterpriseBeans", "stub" }, expectedExceptions = DeploymentException.class)
+ @SpecAssertion(section = "3.3")
+ public void testOnlyOneEnabledSpecializedEnterpriseBeanForImplmentation()
+ {
+ assert false;
+ }
+
+ /**
+ * If the implementation class of an enterprise Web Bean is annotated @Interceptor
+ * or @Decorator, a DefinitionException is thrown by the Web Bean manager at
+ * initialization time.
+ */
@Test(expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3")
public void testEnterpriseBeanInterceptorFails()
@@ -105,6 +188,11 @@
EnterpriseBean<Pug> pug = BeanFactory.createEnterpriseBean(Pug.class);
}
+ /**
+ * If the implementation class of an enterprise Web Bean is annotated @Interceptor
+ * or @Decorator, a DefinitionException is thrown by the Web Bean manager at
+ * initialization time.
+ */
@Test(expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3")
public void testEnterpriseBeanDecoratorFails()
@@ -112,13 +200,22 @@
EnterpriseBean<Pekingese> pekingese = BeanFactory.createEnterpriseBean(Pekingese.class);
}
- @Test(expectedExceptions = DefinitionException.class, groups = {"enterpriseBeans", "stub"})
+ /**
+ * Only one Web Bean per implementation class may be defined using
+ * annotations.
+ */
+ @Test(expectedExceptions = DefinitionException.class, groups = { "enterpriseBeans", "stub" })
@SpecAssertion(section = "3.3")
public void testMultipleAnnotationDefinedEnterpriseBeansWithSameImplementationClassFails()
{
+ // TODO: testable?
assert false;
}
+ /**
+ * Note that multiple enterprise Web Beans may share the same implementation
+ * class. This occurs when Web Beans are defined using XML
+ */
@Test(groups = { "webbeansxml", "enterpriseBeans", "stub" })
@SpecAssertion(section = "3.3")
public void testMultipleXMLDefinedEnterpriseBeansWithSameImplementationClassOK()
@@ -126,49 +223,83 @@
assert false;
}
- @Test(groups={"enterpriseBeans", "stub"})
+ /**
+ * All session beans exposing an EJB 3.x client view and declared via an EJB
+ * component defining annotation on the EJB bean class are Web Beans, and
+ * thus no special declaration is required.
+ */
+ @Test(groups = { "enterpriseBeans", "stub" })
@SpecAssertion(section = "3.3.1")
public void testAnnotatedEnterpriseBean()
{
+ // TODO: dupe?
assert false;
}
- @Test(groups={"enterpriseBeans", "stub"})
+ /**
+ * Additional enterprise Web Beans for these EJBs may be defined using XML,
+ * by specifying the bean class in web-beans.xml.
+ */
+ @Test(groups = { "enterpriseBeans", "webbeansxml", "stub" })
@SpecAssertion(section = "3.3.1")
public void testAnnotatedEnterpriseBeanComplementedWithXML()
{
+ // TODO dupe?
assert false;
}
- @Test(groups={"enterpriseBeans", "ejbjarxml", "stub"})
+ /**
+ * All session beans exposing an EJB 3.x client view and declared in
+ * ejb-jar.xml are also Web Beans.
+ */
+ @Test(groups = { "enterpriseBeans", "ejbjarxml", "stub" })
@SpecAssertion(section = "3.3.1")
public void testEJBJARDefinedEnterpriseBean()
{
+ // TODO dupe?
assert false;
}
- @Test(groups={"enterpriseBeans", "ejbjarxml", "stub"})
+ /**
+ * Additional enterprise Web Beans for these EJBs may be defined using XML,
+ * by specifying the bean class and EJB name in web-beans.xml
+ */
+ @Test(groups = { "enterpriseBeans", "ejbjarxml", "webbeansxml", "stub" })
@SpecAssertion(section = "3.3.1")
public void testEJBJARDefinedEnterpriseBeanComplementedWithXML()
{
+ // TODO dupe?
assert false;
}
- @Test(groups={"enterpriseBeans", "stub"})
+ /**
+ * The set of API types for an enterprise Web Bean contains all local
+ * interfaces of the bean that do not have wildcard type parameters or type
+ * variables and their superinterfaces
+ */
+ @Test(groups = { "enterpriseBeans", "stub" })
@SpecAssertion(section = "3.3.2")
public void testAPITypesAreLocalInterfacesWithoutWildcardTypesOrTypeVariablesWithSuperInterfaces()
{
assert false;
}
- @Test(groups={"enterpriseBeans", "stub"})
+ /**
+ * If the EJB bean has a bean class local view and the bean class is not a
+ * parameterized type, the set of API types contains the bean class and all
+ * superclasses
+ */
+ @Test(groups = { "enterpriseBeans", "stub" })
@SpecAssertion(section = "3.3.2")
public void testEnterpriseBeanWithLocalViewAndParameterizedTypeIncludesBeanClassAndSuperclassesInAPITypes()
{
assert false;
}
- @Test(groups="enterpriseBeans")
+ /**
+ * In addition, java.lang.Object is an API type of every enterprise Web Bean.
+ */
+ @Test(groups = "enterpriseBeans")
@SpecAssertion(section = "3.3.2")
public void testObjectIsInAPITypes()
{
@@ -176,36 +307,47 @@
assert laika.getTypes().contains(Object.class);
}
- @Test(groups={"enterpriseBeans", "stub"})
+ /**
+ * Remote interfaces are not included in the set of API types.
+ */
+ @Test(groups = { "enterpriseBeans", "stub" })
@SpecAssertion(section = "3.3.2")
public void testRemoteInterfacesAreNotInAPITypes()
{
assert false;
}
- @Test(groups={"enterpriseBeans", "producerMethod", "observerMethod", "removeMethod", "webbeansxml", "stub"})
- @SpecAssertion(section = "3.3.4")
- public void testXMLDefinedEnterpriseBeanIgnoresProducerAndDisposalAndObserverAnnotations()
+ /**
+ * Enterprise Web Beans may be declared in web-beans.xml using the bean class
+ * name (for EJBs defined using a component- defining annotation) or bean
+ * class and EJB name (for EJBs defined in ejb-jar.xml). The ejbName
+ * attribute declares the EJB name of an EJB defined in ejb-jar.xml
+ */
+ @Test(groups = { "enterpriseBeans", "webbeansxml", "ejbjarxml", "stub" })
+ @SpecAssertion(section = "3.3")
+ public void testXMLFilesEJBNameUsage()
{
assert false;
}
- @Test(expectedExceptions = DefinitionException.class, groups={"enterpriseBeans", "ejbjarxml", "singletons", "stub"})
- @SpecAssertion(section = "3.3.4")
- public void testXMLDefinedSingletonsFail()
- {
- assert false;
- }
-
- @Test(expectedExceptions = DefinitionException.class, groups="enterpriseBeans")
+ /**
+ * Enterprise Web Beans may not be message-driven beans. If an enterprise Web
+ * Bean declared in XML is a message-driven bean, a DefinitionException is
+ * thrown by the Web Bean manager at initialization time.
+ */
+ @Test(expectedExceptions = DefinitionException.class, groups = "enterpriseBeans")
@SpecAssertion(section = "3.3")
public void testMessageDrivenBeansNotOK()
{
EnterpriseBean<Leopard> Leopard = BeanFactory.createEnterpriseBean(Leopard.class);
}
-
- @Test(groups="enterpriseBeans")
+ /**
+ * The default name for an enterprise Web Bean is the unqualified class name
+ * of the Web Bean implementation class, after converting the first character
+ * to lower case.
+ */
+ @Test(groups = "enterpriseBeans")
@SpecAssertion(section = "3.3.7")
public void testDefaultName()
{
@@ -213,4 +355,14 @@
assert pitbull.getName().equals("pitbull");
}
+ /**
+ * An enterprise bean proxy implements all local interfaces of the EJB.
+ */
+ @Test(groups = { "specialization", "enterpriseBeans", "clientProxy", "stub" })
+ @SpecAssertion(section = "3.3.8")
+ public void testEnterpriseBeanProxyImplementsAllLocalInterfaces()
+ {
+ assert false;
+ }
+
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanRemoveMethodTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanRemoveMethodTest.java 2008-12-08 12:17:28 UTC (rev 472)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanRemoveMethodTest.java 2008-12-08 12:35:45 UTC (rev 473)
@@ -24,59 +24,134 @@
import org.jboss.webbeans.util.BeanFactory;
import org.testng.annotations.Test;
- at SpecVersion("PDR")
+ at SpecVersion("20081206")
@SuppressWarnings("unused")
public class EnterpriseBeanRemoveMethodTest extends AbstractTest
{
+ public static boolean visited = false;
- public static boolean tickle = false;
-
- @Test(groups={"enterpriseBeans", "removeMethod"}, expectedExceptions = DefinitionException.class)
+ /**
+ * EJB spec
+ */
+ @Test(groups = { "enterpriseBeans", "removeMethod" }, expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3.5")
public void testStatelessEnterpriseBeansWithRemoveMethodsFails()
{
EnterpriseBean<Armant> bean = BeanFactory.createEnterpriseBean(Armant.class);
}
- @Test(groups={"enterpriseBeans", "removeMethod", "lifecycle", "stub"})
+ /**
+ * When the Web Bean manager destroys an enterprise Web Bean instance that is
+ * an EJB stateful session bean, it calls the Web Bean remove method
+ */
+ @Test(groups = { "enterpriseBeans", "removeMethod", "lifecycle", "stub" })
@SpecAssertion(section = "3.3.5")
public void testStatefulEnterpriseBeanRemoveMethodCalledWhenDestroyedByManager()
{
- EnterpriseBeanRemoveMethodTest.tickle = false;
+ EnterpriseBeanRemoveMethodTest.visited = false;
EnterpriseBean<Toller> bena = BeanFactory.createEnterpriseBean(Toller.class);
RequestContext context = (RequestContext) manager.getContext(RequestScoped.class);
Toller instance = context.get(bena, true);
context.destroy();
- assert EnterpriseBeanRemoveMethodTest.tickle;
+ assert EnterpriseBeanRemoveMethodTest.visited;
}
- @Test(groups={"enterpriseBeans", "removeMethod"}, expectedExceptions = DefinitionException.class)
+ /**
+ * The Web Bean remove method is a remove method of the EJB stateful session
+ * bean.
+ */
+ @Test(groups = { "enterpriseBeans", "removeMethod", "lifecycle", "stub" })
@SpecAssertion(section = "3.3.5")
+ public void testWebBeanRemoveMethodIsEJBRemoveMethod()
+ {
+ assert false;
+ }
+
+ /**
+ * If an enterprise Web Bean that is a stateful session bean and does not
+ * have a Web Bean remove method declares any scope other than @Dependent, a
+ * DefinitionException is thrown by the Web Bean manager at initialization
+ * time
+ */
+ // TODO: sentenced duplicated in previous paragraph in specs
+ @Test(groups = { "enterpriseBeans", "removeMethod" }, expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = "3.3.5")
public void testStatefulEnterpriseBeanWithoutRemoveMethodMustBeDependentScoped()
{
EnterpriseBean<Pumi> bean = BeanFactory.createEnterpriseBean(Pumi.class);
}
- @Test(groups={"enterpriseBeans", "removeMethod"})
+ /**
+ * If an enterprise Web Bean that is a stateful session bean and does not
+ * have a Web Bean remove method declares any scope other than @Dependent, a
+ * DefinitionException is thrown by the Web Bean manager at initialization
+ * time
+ */
+ // TODO: sentenced duplicated in previous paragraph in specs
+ @Test(groups = { "enterpriseBeans", "removeMethod" })
@SpecAssertion(section = "3.3.5")
public void testStatefulEnterpriseBeanWithoutRemoveMethodMustBeDependentScoped2()
{
EnterpriseBean<WelshCorgie> bean = BeanFactory.createEnterpriseBean(WelshCorgie.class);
}
- @Test(groups={"enterpriseBeans", "removeMethod", "stub"}, expectedExceptions = UnremovedException.class)
+ /**
+ * If an instance of an enterprise Web Bean that is a stateful session bean
+ * and does not have a Web Bean remove method is not explicitly destroyed by
+ * the application before the Web Bean manager attempts to destroy the
+ * instance, an UnremovedException is thrown by the Web Bean manager
+ */
+ // TODO: sentenced duplicated in previous paragraph in specs
+ @Test(groups = { "enterpriseBeans", "removeMethod", "stub" }, expectedExceptions = UnremovedException.class)
@SpecAssertion(section = "3.3.5")
public void testStatefulEnterpriseBeanWithoutRemoveMethodMustBeRemovedByApplicationBeforeManager()
{
EnterpriseBean<Toller> bean = BeanFactory.createEnterpriseBean(Toller.class);
Toller instance = manager.getInstance(bean);
- RequestContext context = (RequestContext) manager
- .getContext(RequestScoped.class);
+ RequestContext context = (RequestContext) manager.getContext(RequestScoped.class);
context.destroy();
}
- @Test(groups={"enterpriseBeans", "removeMethod", "lifecycle", "stub"})
+ /**
+ * If the scope is @Dependent, the application may call any EJB remove method
+ * of an instance of the enterprise Web Bean, but then no parameters will be
+ * passed to the method by the Web Bean manager
+ */
+ @Test(groups = { "enterpriseBeans", "removeMethod", "lifecycle", "stub" })
@SpecAssertion(section = "3.3.5")
+ public void applicationMayCallRemoveMethodOnDependentScopedSessionEnterpriseBeansButNoParametersArePassed()
+ {
+ assert false;
+ }
+
+ /**
+ * If the application directly calls an EJB remove method of an instance of
+ * an enterprise Web Bean that is a stateful session bean and declares any
+ * scope other than @Dependent, an UnsupportedOperationException is thrown.
+ */
+ @Test(groups = { "enterpriseBeans", "removeMethod", "lifecycle", "stub" }, expectedExceptions = UnsupportedOperationException.class)
+ @SpecAssertion(section = "3.3.5")
+ public void applicationCannotCallRemoveMethodOnNonDependentScopedSessionEnterpriseBean()
+ {
+ assert false;
+ }
+
+ /**
+ * If the application directly calls an EJB remove method of an instance of
+ * an enterprise Web Bean that is a stateful session bean and has scope
+ *
+ * @Dependent, the Web Bean manager ignores the instance when instead of
+ * destroying it
+ */
+ @Test(groups = { "enterpriseBeans", "removeMethod", "lifecycle", "stub" })
+ @SpecAssertion(section = "3.3.5")
+ public void applicationMayCallRemoveMethodOnDependentScopedSessionEnterpriseBeansButInstanceIsNotDestroyed()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "enterpriseBeans", "removeMethod", "lifecycle", "stub" })
+ @SpecAssertion(section = "3.3.5")
public void testApplicationRemoveMethodCallRemovesInstanceFromContext()
{
EnterpriseBean<Toller> bean = BeanFactory.createEnterpriseBean(Toller.class);
@@ -87,91 +162,192 @@
assert instance == null;
}
- @Test(groups={"enterpriseBeans", "removeMethod"})
- @SpecAssertion(section = {"3.3.5.1", "3.3.5.2"})
- public void testEnterpriseBeanWithoutDestructorUsesNoArgsRemoveAnnotatedMethodAsRemoveMethod()
+ /**
+ * If an enterprise Web Bean defined using annotations does not explicitly
+ * declare a Web Bean remove method using @Destructor, and exactly one remove
+ * method that accepts no parameters exists, then that remove method is the
+ * Web Bean remove method.
+ */
+ @Test(groups = { "enterpriseBeans", "removeMethod" })
+ @SpecAssertion(section = { "3.3.5.1" })
+ public void testEnterpriseBeanWithoutDestructorUsesNoArgsRemoveAnnotatedMethodAsWebBeansRemoveMethod()
{
EnterpriseBean<Toller> bean = BeanFactory.createEnterpriseBean(Toller.class);
assert "bye".equals(bean.getRemoveMethod().getName());
}
- @Test(groups={"enterpriseBeans", "removeMethod"})
- @SpecAssertion(section = {"3.3.5.1", "3.3.5.2"})
- public void testEnterpriseBeanWithoutDestructorAndNoArgsRemoveAnnotatedMethodHasNoRemoveMethod()
+ /**
+ * Otherwise, if no remove method that accepts no parameters exists, or if
+ * multiple remove methods that accept no parameters exist, the enterprise
+ * Web Bean has no Web Bean remove method.
+ */
+ @Test(groups = { "enterpriseBeans", "removeMethod" })
+ @SpecAssertion(section = { "3.3.5.1" })
+ public void testEnterpriseBeanWithoutDestructorAndNoOrMultipleNoArgsRemoveMethodsHasNoWebBeansRemoveMethod()
{
EnterpriseBean<Koirus> bean = BeanFactory.createEnterpriseBean(Koirus.class);
assert bean.getRemoveMethod() == null;
}
- @Test(groups={"enterpriseBeans", "removeMethod"}, expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = {"3.3.5.1", "3.3.5.2"})
+ /**
+ * If an enterprise Web Bean defined using annotations has more than one
+ * method annotated @Destructor, a DefinitionException is thrown by the Web
+ * Bean manager at initialization time.
+ */
+ @Test(groups = { "enterpriseBeans", "removeMethod" }, expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = { "3.3.5.1" })
public void testMultipleDestructorAnnotatedMethodsFails()
{
EnterpriseBean<Rottweiler> bean = BeanFactory.createEnterpriseBean(Rottweiler.class);
}
- @Test(groups={"enterpriseBeans", "removeMethod"}, expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = {"3.3.5.1", "3.3.5.2"})
+ /**
+ * If an enterprise Web Bean defined using annotations has a method annotated
+ *
+ * @Destructor, and that method is not an EJB remove method, a
+ * DefinitionException is thrown by the Web Bean manager at
+ * initialization time.
+ */
+ @Test(groups = { "enterpriseBeans", "removeMethod" }, expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = { "3.3.5.1" })
public void testDestructorAnnotatedMethodNotRemoveAnnotatedFails()
{
EnterpriseBean<RussellTerrier> bean = BeanFactory.createEnterpriseBean(RussellTerrier.class);
}
- @Test(groups={"enterpriseBeans", "removeMethod"}, expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = {"3.3.5.1", "3.3.5.2"})
+ /**
+ * If a Web Bean remove method is annotated @Initializer or @Produces, has a
+ * parameter annotated @Disposes, or has a parameter annotated @Observes, a
+ * DefinitionException is thrown by the Web Bean manager at initialization
+ * time.
+ */
+ @Test(groups = { "enterpriseBeans", "removeMethod" }, expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = { "3.3.5.1" })
public void testRemoveMethodIsInitializerFails()
{
EnterpriseBean<Saluki> bean = BeanFactory.createEnterpriseBean(Saluki.class);
}
- @Test(groups={"enterpriseBeans", "removeMethod"}, expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = {"3.3.5.1", "3.3.5.2"})
+ /**
+ * If a Web Bean remove method is annotated @Initializer or @Produces, has a
+ * parameter annotated @Disposes, or has a parameter annotated @Observes, a
+ * DefinitionException is thrown by the Web Bean manager at initialization
+ * time.
+ */
+ @Test(groups = { "enterpriseBeans", "removeMethod" }, expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = { "3.3.5.1" })
public void testRemoveMethodIsProducerFails()
{
EnterpriseBean<Spitz> bean = BeanFactory.createEnterpriseBean(Spitz.class);
}
- @Test(groups={"enterpriseBeans", "removeMethod"}, expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = {"3.3.5.1", "3.3.5.2"})
+ /**
+ * If a Web Bean remove method is annotated @Initializer or @Produces, has a
+ * parameter annotated @Disposes, or has a parameter annotated @Observes, a
+ * DefinitionException is thrown by the Web Bean manager at initialization
+ * time.
+ */
+ @Test(groups = { "enterpriseBeans", "removeMethod" }, expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = { "3.3.5.1" })
public void testRemoveMethodWithDisposesParameterFails()
{
EnterpriseBean<GoldenRetriever> bean = BeanFactory.createEnterpriseBean(GoldenRetriever.class);
}
- @Test(groups={"enterpriseBeans", "removeMethod"}, expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = {"3.3.5.1", "3.3.5.2"})
+ /**
+ * If a Web Bean remove method is annotated @Initializer or @Produces, has a
+ * parameter annotated @Disposes, or has a parameter annotated @Observes, a
+ * DefinitionException is thrown by the Web Bean manager at initialization
+ * time.
+ */
+ @Test(groups = { "enterpriseBeans", "removeMethod" }, expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = { "3.3.5.1" })
public void testRemoveMethodWithObservesParameterFails()
{
EnterpriseBean<JackRussellTerrier> bean = BeanFactory.createEnterpriseBean(JackRussellTerrier.class);
}
- @Test(groups={"enterpriseBeans", "removeMethod"}, expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = {"3.3.5.1", "3.3.5.2"})
- public void testMultipleRemoveAnnotationsButNoDestructorFails()
+ // TODO: where did this come from?
+ // @Test(groups = { "enterpriseBeans", "removeMethod" }, expectedExceptions =
+ // DefinitionException.class)
+ // @SpecAssertion(section = { "3.3.5.1", "3.3.5.2" })
+ // public void testMultipleRemoveAnnotationsButNoDestructorFails()
+ // {
+ // EnterpriseBean<Poodle> bean =
+ // BeanFactory.createEnterpriseBean(Poodle.class);
+ // }
+
+ /**
+ * If an enterprise Web Bean defined using XML does not explicitly declare a
+ * Web Bean remove method using XML, and exactly one remove method that
+ * accepts no parameters exists, then that remove method is the Web Bean
+ * remove method
+ */
+ @Test(groups = { "enterpriseBeans", "webbeansxml", "removeMethod", "stub" })
+ @SpecAssertion(section = { "3.3.5.1", "3.3.5.2" })
+ public void testXMLDefinedEnterpriseBeanWithoutDestructorUsesNoArgsRemoveAnnotatedMethodAsWebBeansRemoveMethod()
{
- EnterpriseBean<Poodle> bean = BeanFactory.createEnterpriseBean(Poodle.class);
+ assert false;
}
-
-
- @Test(groups={"enterpriseBeans", "removeMethod", "stub"})
+
+ /**
+ * Otherwise, if no remove method that accepts no parameters exists, or if
+ * multiple remove methods that accept no parameters exist, the enterprise
+ * Web Bean has no Web Bean remove method.
+ */
+ @Test(groups = { "enterpriseBeans", "webbeansxml", "removeMethod", "stub" })
+ @SpecAssertion(section = { "3.3.5.1", "3.3.5.2" })
+ public void testXMLDefinedEnterpriseBeanWithoutDestructorAndNoOrMultipleNoArgsRemoveMethodsHasNoWebBeansRemoveMethod()
+ {
+ assert false;
+ }
+
+ /**
+ * If the implementation class of an enterprise Web Bean declared in XML does
+ * not have an EJB remove method with the name and parameter types declared
+ * in XML, a NonexistentMethodException is thrown by the Web Bean manager at
+ * initialization time
+ */
+ @Test(groups = { "enterpriseBeans", "webbeansxml", "removeMethod", "stub" })
@SpecAssertion(section = "3.3.5.2")
public void testXMLDefinedEnterpriseBeanWithoutMatchingRemoveMethodFails()
{
assert false;
}
- @Test(groups={"enterpriseBeans", "removeMethod", "stub"})
+ /**
+ * If an enterprise Web Bean defined using XML declares more than one Web
+ * Bean remove method in XML, a DefinitionException is thrown by the Web Bean
+ * manager at initialization time.
+ */
+ @Test(groups = { "enterpriseBeans", "webbeansxml", "removeMethod", "stub" })
@SpecAssertion(section = "3.3.5.2")
public void testXMLDefinedEnterpriseBeanWithMultipleRemoveMethodsFails()
{
assert false;
}
- @Test(groups={"enterpriseBeans", "removeMethod", "stub"})
+ /**
+ * When a Web Bean remove method is declared in XML, the Web Bean manager
+ * ignores binding annotations applied to the Java method parameters
+ */
+ @Test(groups = { "enterpriseBeans", "webbeansxml", "removeMethod", "stub" })
@SpecAssertion(section = "3.3.5.2")
public void testXMLDefinedEnterpriseBeanIgnoresBindingAnnotationOnParameters()
{
assert false;
}
+ /**
+ * If the Web Bean remove method has parameters, the Web Bean manager calls
+ * Manager.getInstanceByType() to determine a value for each parameter and
+ * calls the method with these parameter values.
+ */
+ @Test(groups = { "enterpriseBeans", "removeMethod", "stub" })
+ @SpecAssertion(section = "3.3.5.3")
+ public void testRemoveMethodParameterResolving()
+ {
+ assert false;
+ }
+
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanSpecializationTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanSpecializationTest.java 2008-12-08 12:17:28 UTC (rev 472)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanSpecializationTest.java 2008-12-08 12:35:45 UTC (rev 473)
@@ -13,12 +13,31 @@
import org.jboss.webbeans.util.BeanFactory;
import org.testng.annotations.Test;
- at SpecVersion("PDR")
+ at SpecVersion("20081206")
@SuppressWarnings("unused")
public class EnterpriseBeanSpecializationTest extends AbstractTest
{
- @Test(groups={"specialization", "enterpriseBeans"})
+ /**
+ * If an implementation class of an enterprise Web Bean X defined using
+ * annotations is annotated @Specializes, then the implementation class of X
+ * must directly extend the implementation class of another enterprise Web
+ * Bean Y defined using annotations. If the implementation class of X does
+ * not directly extend the implementation class of another enterprise Web
+ * Bean, a DefinitionException is thrown by the Web Bean manager at
+ * initialization time
+ */
+ @Test(groups = { "specialization", "enterpriseBeans", "stub" })
@SpecAssertion(section = "3.3.6")
+ public void testAnnotationDefinedSpecializingEnterpriseBeanMustDirectlyExtendAnotherAnnotationDefinedEnterpriseBean()
+ {
+ assert false;
+ }
+
+ /**
+ * X inherits all binding types of Y
+ */
+ @Test(groups = { "specialization", "enterpriseBeans" })
+ @SpecAssertion(section = "3.3.6")
public void testSpecializingBeanInheritsBindingTypes()
{
EnterpriseBean<Hound> hound = BeanFactory.createEnterpriseBean(Hound.class);
@@ -26,22 +45,27 @@
assert compareBindingTypesOK(hound, houndOfBaskerville);
}
- private boolean compareBindingTypesOK(EnterpriseBean<Hound> hound,
- EnterpriseBean<HoundOfBaskerville> houndOfBaskerville)
+ private boolean compareBindingTypesOK(EnterpriseBean<Hound> hound, EnterpriseBean<HoundOfBaskerville> houndOfBaskerville)
{
- if (hound.getBindingTypes().size() != houndOfBaskerville.getBindingTypes().size()) {
+ if (hound.getBindingTypes().size() != houndOfBaskerville.getBindingTypes().size())
+ {
return false;
}
- if (!hound.getBindingTypes().containsAll(houndOfBaskerville.getBindingTypes())) {
+ if (!hound.getBindingTypes().containsAll(houndOfBaskerville.getBindingTypes()))
+ {
return false;
}
- if (!houndOfBaskerville.getBindingTypes().containsAll(hound.getBindingTypes())) {
+ if (!houndOfBaskerville.getBindingTypes().containsAll(hound.getBindingTypes()))
+ {
return false;
}
return true;
}
- @Test(groups={"specialization", "enterpriseBeans"})
+ /**
+ * if Y has a name, X has the same name as Y.
+ */
+ @Test(groups = { "specialization", "enterpriseBeans" })
@SpecAssertion(section = "3.3.6")
public void testSpecializingBeanInheritsNameIfAny()
{
@@ -49,47 +73,67 @@
assert houndOfBaskerville.getName().equals("Pongo");
}
- @Test(expectedExceptions=DefinitionException.class, groups={"stub", "specialization", "enterpriseBeans"})
+ /**
+ * X must support all local interfaces supported by Y. Otherwise, a
+ * DefinitionException is thrown by the Web Bean manager at initialization
+ * time.
+ */
+ @Test(expectedExceptions = DefinitionException.class, groups = { "stub", "specialization", "enterpriseBeans" })
@SpecAssertion(section = "3.3.6")
public void testSpecializingNotSupportingLocalInterfacesOfSpecializedFails()
{
assert false;
}
- @Test(expectedExceptions=DefinitionException.class, groups={"stub", "specialization", "enterpriseBeans"})
+ /**
+ * if Y supports a bean-class local view, X must also support a bean-class
+ * local view. Otherwise, a DefinitionException is thrown by the Web Bean
+ * manager at initialization time.
+ */
+ @Test(expectedExceptions = DefinitionException.class, groups = { "stub", "specialization", "enterpriseBeans" })
@SpecAssertion(section = "3.3.6")
public void testSpecializingNotSupportingLocalViewOfSpecializedFails()
{
assert false;
}
- @Test(groups={"stub", "specialization", "enterpriseBeans"})
+ /**
+ * We say that X directly specializes Y, and we can be certain that Y will
+ * never be instantiated or called by the Web Bean manager if X is enabled.
+ */
+ @Test(expectedExceptions = DefinitionException.class, groups = { "stub", "specialization", "enterpriseBeans" })
@SpecAssertion(section = "3.3.6")
+ public void EnabledSpecializationOverridesSpecialized()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "specialization", "enterpriseBeans" })
+ @SpecAssertion(section = "3.3.6")
public void testXMLDefinedSpecializationOnAnnotationDefinedBean()
{
assert false;
}
-
- @Test(expectedExceptions = DeploymentException.class, groups={"stub", "enterpriseBeans", "specialization"})
+ @Test(expectedExceptions = DeploymentException.class, groups = { "stub", "enterpriseBeans", "specialization" })
@SpecAssertion(section = "3.3")
public void testMultipleEnabledSpecializedEnterpriseBeanFails()
{
assert false;
}
-
- @Test(expectedExceptions=DefinitionException.class, groups={"specialization", "enterpriseBeans"})
+
+ @Test(expectedExceptions = DefinitionException.class, groups = { "specialization", "enterpriseBeans" })
@SpecAssertion(section = "3.3.6")
public void testAnnotationDefinedSpecializingEnterpriseBeanNotDirectlyExtendingAnnotationDefinedEnterpriseBeanFails()
{
EnterpriseBean<GreaterDane> greaterDane = BeanFactory.createEnterpriseBean(GreaterDane.class);
}
- @Test(expectedExceptions=DefinitionException.class, groups={"stub", "specialization", "enterpriseBeans"})
+ @Test(expectedExceptions = DefinitionException.class, groups = { "stub", "specialization", "enterpriseBeans" })
@SpecAssertion(section = "3.3.6")
public void testXMLDefinedSpecializingEnterpriseBeanNotImplementingAnnotationDefinedEnterpriseBeanFails()
{
- assert false;
+ assert false;
}
-
+
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/Pitbull.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/Pitbull.java 2008-12-08 12:17:28 UTC (rev 472)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/Pitbull.java 2008-12-08 12:35:45 UTC (rev 473)
@@ -16,6 +16,6 @@
@Remove @Destructor
public void bye() {
- EnterpriseBeanRemoveMethodTest.tickle = true;
+ EnterpriseBeanRemoveMethodTest.visited = true;
}
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/Toller.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/Toller.java 2008-12-08 12:17:28 UTC (rev 472)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/Toller.java 2008-12-08 12:35:45 UTC (rev 473)
@@ -12,6 +12,6 @@
{
@Remove
public void bye() {
- EnterpriseBeanRemoveMethodTest.tickle = true;
+ EnterpriseBeanRemoveMethodTest.visited = true;
}
}
More information about the weld-commits
mailing list