[webbeans-commits] Webbeans SVN: r474 - in ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb: invalid and 2 other directories.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-12-08 07:43:15 -0500 (Mon, 08 Dec 2008)
New Revision: 474
Added:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanDeclarationTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanRemoveMethodTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanSpecializationTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Armant.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/AustralianTerrier.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Beagle.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/BorderTerrier.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/BostonTerrier.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Boxer.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Bullmastiff.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/CairnsTerrier.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/ChowChow.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Dachshund.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/FoxTerrier.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/GoldenRetriever.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/GreatDane.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/GreaterDane.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Greyhound.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Husky.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/IrishTerrier.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/JackRussellTerrier.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Pekingese.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Poodle.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Pug.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Pumi.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Rottweiler.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/RussellTerrier.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Saluki.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Spitz.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Terrier.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/TibetanTerrier.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/YorkshireTerrier.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/BullTerrier.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Hound.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/HoundOfBaskerville.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Koirus.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Laika.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Pitbull.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Pomeranian.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Toller.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/WelshCorgie.java
Removed:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/lifecycle/
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/invalid/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/
Log:
remove obsoleted lifecycle test, restructured
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanDeclarationTest.java (from rev 473, 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/EnterpriseBeanDeclarationTest.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanDeclarationTest.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,368 @@
+package org.jboss.webbeans.test.ejb;
+
+import javax.webbeans.DefinitionException;
+import javax.webbeans.DeploymentException;
+
+import org.jboss.webbeans.bean.EnterpriseBean;
+import org.jboss.webbeans.test.AbstractTest;
+import org.jboss.webbeans.test.SpecAssertion;
+import org.jboss.webbeans.test.SpecVersion;
+import org.jboss.webbeans.test.beans.Giraffe;
+import org.jboss.webbeans.test.beans.Leopard;
+import org.jboss.webbeans.test.ejb.invalid.Beagle;
+import org.jboss.webbeans.test.ejb.invalid.Boxer;
+import org.jboss.webbeans.test.ejb.invalid.Bullmastiff;
+import org.jboss.webbeans.test.ejb.invalid.Dachshund;
+import org.jboss.webbeans.test.ejb.invalid.GreatDane;
+import org.jboss.webbeans.test.ejb.invalid.Greyhound;
+import org.jboss.webbeans.test.ejb.invalid.Husky;
+import org.jboss.webbeans.test.ejb.invalid.IrishTerrier;
+import org.jboss.webbeans.test.ejb.invalid.Pekingese;
+import org.jboss.webbeans.test.ejb.invalid.Pug;
+import org.jboss.webbeans.test.ejb.valid.Laika;
+import org.jboss.webbeans.test.ejb.valid.Pitbull;
+import org.jboss.webbeans.util.BeanFactory;
+import org.testng.annotations.Test;
+
+@SpecVersion("20081206")
+@SuppressWarnings("unused")
+public class EnterpriseBeanDeclarationTest extends AbstractTest
+{
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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()
+ {
+ 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()
+ {
+ EnterpriseBean<Pekingese> pekingese = BeanFactory.createEnterpriseBean(Pekingese.class);
+ }
+
+ /**
+ * 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()
+ {
+ assert false;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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()
+ {
+ EnterpriseBean<Laika> laika = BeanFactory.createEnterpriseBean(Laika.class);
+ assert laika.getTypes().contains(Object.class);
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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()
+ {
+ EnterpriseBean<Pitbull> pitbull = BeanFactory.createEnterpriseBean(Pitbull.class);
+ 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;
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanDeclarationTest.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanRemoveMethodTest.java (from rev 473, 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/EnterpriseBeanRemoveMethodTest.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanRemoveMethodTest.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,353 @@
+package org.jboss.webbeans.test.ejb;
+
+import javax.webbeans.DefinitionException;
+import javax.webbeans.RequestScoped;
+import javax.webbeans.UnremovedException;
+
+import org.jboss.webbeans.bean.EnterpriseBean;
+import org.jboss.webbeans.contexts.RequestContext;
+import org.jboss.webbeans.test.AbstractTest;
+import org.jboss.webbeans.test.SpecAssertion;
+import org.jboss.webbeans.test.SpecVersion;
+import org.jboss.webbeans.test.ejb.invalid.Armant;
+import org.jboss.webbeans.test.ejb.invalid.GoldenRetriever;
+import org.jboss.webbeans.test.ejb.invalid.JackRussellTerrier;
+import org.jboss.webbeans.test.ejb.invalid.Poodle;
+import org.jboss.webbeans.test.ejb.invalid.Pumi;
+import org.jboss.webbeans.test.ejb.invalid.Rottweiler;
+import org.jboss.webbeans.test.ejb.invalid.RussellTerrier;
+import org.jboss.webbeans.test.ejb.invalid.Saluki;
+import org.jboss.webbeans.test.ejb.invalid.Spitz;
+import org.jboss.webbeans.test.ejb.valid.Koirus;
+import org.jboss.webbeans.test.ejb.valid.Toller;
+import org.jboss.webbeans.test.ejb.valid.WelshCorgie;
+import org.jboss.webbeans.util.BeanFactory;
+import org.testng.annotations.Test;
+
+@SpecVersion("20081206")
+@SuppressWarnings("unused")
+public class EnterpriseBeanRemoveMethodTest extends AbstractTest
+{
+ public static boolean visited = false;
+
+ /**
+ * EJB spec
+ */
+ @Test(groups = { "enterpriseBeans", "removeMethod" }, expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = "3.3.5")
+ public void testStatelessEnterpriseBeansWithRemoveMethodsFails()
+ {
+ EnterpriseBean<Armant> bean = BeanFactory.createEnterpriseBean(Armant.class);
+ }
+
+ /**
+ * 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.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.visited;
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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);
+ context.destroy();
+ }
+
+ /**
+ * 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);
+ RequestContext context = (RequestContext) manager.getContext(RequestScoped.class);
+ Toller instance = context.get(bean, true);
+ instance.bye();
+ instance = context.get(bean, false);
+ assert instance == null;
+ }
+
+ /**
+ * 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());
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ // 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()
+ {
+ assert false;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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;
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanRemoveMethodTest.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanSpecializationTest.java (from rev 473, 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/EnterpriseBeanSpecializationTest.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanSpecializationTest.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,139 @@
+package org.jboss.webbeans.test.ejb;
+
+import javax.webbeans.DefinitionException;
+import javax.webbeans.DeploymentException;
+
+import org.jboss.webbeans.bean.EnterpriseBean;
+import org.jboss.webbeans.test.AbstractTest;
+import org.jboss.webbeans.test.SpecAssertion;
+import org.jboss.webbeans.test.SpecVersion;
+import org.jboss.webbeans.test.ejb.invalid.GreaterDane;
+import org.jboss.webbeans.test.ejb.valid.Hound;
+import org.jboss.webbeans.test.ejb.valid.HoundOfBaskerville;
+import org.jboss.webbeans.util.BeanFactory;
+import org.testng.annotations.Test;
+
+@SpecVersion("20081206")
+@SuppressWarnings("unused")
+public class EnterpriseBeanSpecializationTest extends AbstractTest
+{
+ /**
+ * 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);
+ EnterpriseBean<HoundOfBaskerville> houndOfBaskerville = BeanFactory.createEnterpriseBean(HoundOfBaskerville.class);
+ assert compareBindingTypesOK(hound, houndOfBaskerville);
+ }
+
+ private boolean compareBindingTypesOK(EnterpriseBean<Hound> hound, EnterpriseBean<HoundOfBaskerville> houndOfBaskerville)
+ {
+ if (hound.getBindingTypes().size() != houndOfBaskerville.getBindingTypes().size())
+ {
+ return false;
+ }
+ if (!hound.getBindingTypes().containsAll(houndOfBaskerville.getBindingTypes()))
+ {
+ return false;
+ }
+ if (!houndOfBaskerville.getBindingTypes().containsAll(hound.getBindingTypes()))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * if Y has a name, X has the same name as Y.
+ */
+ @Test(groups = { "specialization", "enterpriseBeans" })
+ @SpecAssertion(section = "3.3.6")
+ public void testSpecializingBeanInheritsNameIfAny()
+ {
+ EnterpriseBean<HoundOfBaskerville> houndOfBaskerville = BeanFactory.createEnterpriseBean(HoundOfBaskerville.class);
+ assert houndOfBaskerville.getName().equals("Pongo");
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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" })
+ @SpecAssertion(section = "3.3")
+ public void testMultipleEnabledSpecializedEnterpriseBeanFails()
+ {
+ assert false;
+ }
+
+ @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" })
+ @SpecAssertion(section = "3.3.6")
+ public void testXMLDefinedSpecializingEnterpriseBeanNotImplementingAnnotationDefinedEnterpriseBeanFails()
+ {
+ assert false;
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanSpecializationTest.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Armant.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/Armant.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Armant.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Armant.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,13 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Stateless;
+import javax.webbeans.Destructor;
+
+@Stateless
+public class Armant
+{
+ @Destructor
+ public void bye() {
+
+ }
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/AustralianTerrier.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/AustralianTerrier.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/AustralianTerrier.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/AustralianTerrier.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,16 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Stateless;
+import javax.webbeans.Initializer;
+import javax.webbeans.Observes;
+import javax.webbeans.manager.Initialized;
+import javax.webbeans.manager.Manager;
+
+@Stateless
+public class AustralianTerrier
+{
+ @Initializer
+ public void observeInitialized(@Observes @Initialized Manager manager)
+ {
+ }
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/AustralianTerrier.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Beagle.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/Beagle.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Beagle.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Beagle.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Stateless;
+import javax.webbeans.RequestScoped;
+
+@Stateless
+@RequestScoped
+public class Beagle
+{
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/BorderTerrier.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/BorderTerrier.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/BorderTerrier.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/BorderTerrier.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,16 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Stateless;
+import javax.webbeans.Observes;
+import javax.webbeans.Produces;
+import javax.webbeans.manager.Initialized;
+import javax.webbeans.manager.Manager;
+
+@Stateless
+public class BorderTerrier
+{
+ @Produces
+ public void observeInitialized(@Observes @Initialized Manager manager)
+ {
+ }
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/BorderTerrier.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/BostonTerrier.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/BostonTerrier.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/BostonTerrier.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/BostonTerrier.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.webbeans.Observes;
+
+@Stateless
+public class BostonTerrier
+{
+ public void observesBadEvent(@Observes List<String> someArray)
+ {
+ }
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/BostonTerrier.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Boxer.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/Boxer.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Boxer.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Boxer.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Stateless;
+import javax.webbeans.ConversationScoped;
+
+@Stateless
+@ConversationScoped
+public class Boxer
+{
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Bullmastiff.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/Bullmastiff.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Bullmastiff.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Bullmastiff.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Stateless;
+import javax.webbeans.SessionScoped;
+
+@Stateless
+@SessionScoped
+public class Bullmastiff
+{
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/CairnsTerrier.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/CairnsTerrier.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/CairnsTerrier.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/CairnsTerrier.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,17 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Stateless;
+import javax.webbeans.Destructor;
+import javax.webbeans.Observes;
+import javax.webbeans.manager.Initialized;
+import javax.webbeans.manager.Manager;
+
+@Stateless
+public class CairnsTerrier
+{
+ @Destructor
+ public void observeInitialized(@Observes @Initialized Manager manager)
+ {
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/CairnsTerrier.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/ChowChow.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/ChowChow.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/ChowChow.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/ChowChow.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Stateful;
+import javax.webbeans.RequestScoped;
+
+@Stateful
+@RequestScoped
+public class ChowChow
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/ChowChow.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Dachshund.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/Dachshund.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Dachshund.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Dachshund.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Stateless;
+import javax.webbeans.ApplicationScoped;
+
+@Stateless
+@ApplicationScoped
+public class Dachshund
+{
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/FoxTerrier.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/FoxTerrier.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/FoxTerrier.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/FoxTerrier.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,16 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Stateless;
+import javax.webbeans.Disposes;
+import javax.webbeans.Observes;
+import javax.webbeans.manager.Initialized;
+import javax.webbeans.manager.Manager;
+
+@Stateless
+public class FoxTerrier
+{
+ public void observeInitialized(@Observes @Initialized Manager manager, @Disposes String badParam)
+ {
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/FoxTerrier.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/GoldenRetriever.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/GoldenRetriever.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/GoldenRetriever.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/GoldenRetriever.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,18 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.webbeans.Destructor;
+import javax.webbeans.Disposes;
+import javax.webbeans.RequestScoped;
+
+@Stateful
+@RequestScoped
+public class GoldenRetriever
+{
+ @Remove @Destructor
+ public void bye(@Disposes Object something) {
+
+ }
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/GreatDane.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/GreatDane.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/GreatDane.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/GreatDane.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,7 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+
+public class GreatDane
+{
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/GreaterDane.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/GreaterDane.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/GreaterDane.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/GreaterDane.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Stateless;
+import javax.webbeans.Specializes;
+
+@Specializes
+@Stateless
+public class GreaterDane extends GreatDane
+{
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Greyhound.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/Greyhound.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Greyhound.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Greyhound.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,12 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.webbeans.RequestScoped;
+
+import org.jboss.webbeans.test.annotations.Singleton;
+
+@Singleton
+@RequestScoped
+public class Greyhound
+{
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Husky.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/Husky.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Husky.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Husky.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,12 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.webbeans.ConversationScoped;
+
+import org.jboss.webbeans.test.annotations.Singleton;
+
+@Singleton
+@ConversationScoped
+public class Husky
+{
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/IrishTerrier.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/IrishTerrier.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/IrishTerrier.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/IrishTerrier.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,12 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.webbeans.SessionScoped;
+
+import org.jboss.webbeans.test.annotations.Singleton;
+
+@Singleton
+@SessionScoped
+public class IrishTerrier
+{
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/JackRussellTerrier.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/JackRussellTerrier.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/JackRussellTerrier.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/JackRussellTerrier.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,18 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.webbeans.Destructor;
+import javax.webbeans.Observes;
+import javax.webbeans.RequestScoped;
+
+@Stateful
+@RequestScoped
+public class JackRussellTerrier
+{
+ @Remove @Destructor
+ public void bye(@Observes Object something) {
+
+ }
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Pekingese.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/Pekingese.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Pekingese.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Pekingese.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Stateless;
+import javax.webbeans.Decorator;
+
+@Stateless
+@Decorator
+public class Pekingese
+{
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Poodle.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/Poodle.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Poodle.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Poodle.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,21 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.webbeans.RequestScoped;
+
+@Stateful
+@RequestScoped
+public class Poodle
+{
+ @Remove
+ public void bye() {
+
+ }
+
+ @Remove
+ public void byebye() {
+
+ }
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Pug.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/Pug.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Pug.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Pug.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Stateless;
+import javax.webbeans.Interceptor;
+
+@Stateless
+@Interceptor
+public class Pug
+{
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Pumi.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/Pumi.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Pumi.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Pumi.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Stateful;
+import javax.webbeans.RequestScoped;
+
+@Stateful
+@RequestScoped
+public class Pumi
+{
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Rottweiler.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/Rottweiler.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Rottweiler.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Rottweiler.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,21 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Stateful;
+import javax.webbeans.Destructor;
+import javax.webbeans.RequestScoped;
+
+@Stateful
+@RequestScoped
+public class Rottweiler
+{
+ @Destructor
+ public void bye() {
+
+ }
+
+ @Destructor
+ public void bye2() {
+
+ }
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/RussellTerrier.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/RussellTerrier.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/RussellTerrier.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/RussellTerrier.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,16 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Stateful;
+import javax.webbeans.Destructor;
+import javax.webbeans.RequestScoped;
+
+@Stateful
+@RequestScoped
+public class RussellTerrier
+{
+ @Destructor
+ public void bye() {
+
+ }
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Saluki.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/Saluki.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Saluki.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Saluki.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,17 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.webbeans.Initializer;
+import javax.webbeans.RequestScoped;
+
+@Stateful
+@RequestScoped
+public class Saluki
+{
+ @Remove @Initializer
+ public void bye() {
+
+ }
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Spitz.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/Spitz.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Spitz.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Spitz.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,17 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.webbeans.Produces;
+import javax.webbeans.RequestScoped;
+
+@Stateful
+@RequestScoped
+public class Spitz
+{
+ @Remove @Produces
+ public void bye() {
+
+ }
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Terrier.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/Terrier.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Terrier.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Terrier.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,9 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Local;
+
+@Local
+public interface Terrier
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Terrier.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/TibetanTerrier.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/TibetanTerrier.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/TibetanTerrier.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/TibetanTerrier.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Stateless;
+import javax.webbeans.Observes;
+import javax.webbeans.manager.Initialized;
+import javax.webbeans.manager.Manager;
+
+@Stateless
+public class TibetanTerrier implements Terrier
+{
+ public void observeInitialized(@Observes @Initialized Manager manager)
+ {
+ }
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/TibetanTerrier.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/YorkshireTerrier.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/invalid/YorkshireTerrier.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/YorkshireTerrier.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/YorkshireTerrier.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.test.ejb.invalid;
+
+import javax.ejb.Stateless;
+import javax.webbeans.Observes;
+import javax.webbeans.manager.Initialized;
+import javax.webbeans.manager.Manager;
+
+@Stateless
+public class YorkshireTerrier
+{
+ public void observeInitialized(@Observes @Initialized Manager manager, @Observes Boxer anotherDog)
+ {
+ }
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/YorkshireTerrier.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:mergeinfo
+
Deleted: 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:35:45 UTC (rev 473)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanDeclarationTest.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -1,368 +0,0 @@
-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;
-import org.jboss.webbeans.test.SpecAssertion;
-import org.jboss.webbeans.test.SpecVersion;
-import org.jboss.webbeans.test.beans.Giraffe;
-import org.jboss.webbeans.test.beans.Leopard;
-import org.jboss.webbeans.test.ejb.model.invalid.Beagle;
-import org.jboss.webbeans.test.ejb.model.invalid.Boxer;
-import org.jboss.webbeans.test.ejb.model.invalid.Bullmastiff;
-import org.jboss.webbeans.test.ejb.model.invalid.Dachshund;
-import org.jboss.webbeans.test.ejb.model.invalid.GreatDane;
-import org.jboss.webbeans.test.ejb.model.invalid.Greyhound;
-import org.jboss.webbeans.test.ejb.model.invalid.Husky;
-import org.jboss.webbeans.test.ejb.model.invalid.IrishTerrier;
-import org.jboss.webbeans.test.ejb.model.invalid.Pekingese;
-import org.jboss.webbeans.test.ejb.model.invalid.Pug;
-import org.jboss.webbeans.test.ejb.model.valid.Laika;
-import org.jboss.webbeans.test.ejb.model.valid.Pitbull;
-import org.jboss.webbeans.util.BeanFactory;
-import org.testng.annotations.Test;
-
-@SpecVersion("20081206")
-@SuppressWarnings("unused")
-public class EnterpriseBeanDeclarationTest extends AbstractTest
-{
-
- /**
- * 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);
- }
-
- /**
- * 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);
- }
-
- /**
- * 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);
- }
-
- /**
- * 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);
- }
-
- /**
- * 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);
- }
-
- /**
- * 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);
- }
-
- /**
- * 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);
- }
-
- /**
- * 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);
- }
-
- /**
- * 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);
- }
-
- /**
- * 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()
- {
- 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()
- {
- EnterpriseBean<Pekingese> pekingese = BeanFactory.createEnterpriseBean(Pekingese.class);
- }
-
- /**
- * 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()
- {
- assert false;
- }
-
- /**
- * 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;
- }
-
- /**
- * 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;
- }
-
- /**
- * 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;
- }
-
- /**
- * 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;
- }
-
- /**
- * 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;
- }
-
- /**
- * 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;
- }
-
- /**
- * 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()
- {
- EnterpriseBean<Laika> laika = BeanFactory.createEnterpriseBean(Laika.class);
- assert laika.getTypes().contains(Object.class);
- }
-
- /**
- * 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;
- }
-
- /**
- * 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;
- }
-
- /**
- * 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);
- }
-
- /**
- * 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()
- {
- EnterpriseBean<Pitbull> pitbull = BeanFactory.createEnterpriseBean(Pitbull.class);
- 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;
- }
-
-}
Deleted: 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:35:45 UTC (rev 473)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanRemoveMethodTest.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -1,353 +0,0 @@
-package org.jboss.webbeans.test.ejb.model;
-
-import javax.webbeans.DefinitionException;
-import javax.webbeans.RequestScoped;
-import javax.webbeans.UnremovedException;
-
-import org.jboss.webbeans.bean.EnterpriseBean;
-import org.jboss.webbeans.contexts.RequestContext;
-import org.jboss.webbeans.test.AbstractTest;
-import org.jboss.webbeans.test.SpecAssertion;
-import org.jboss.webbeans.test.SpecVersion;
-import org.jboss.webbeans.test.ejb.model.invalid.Armant;
-import org.jboss.webbeans.test.ejb.model.invalid.GoldenRetriever;
-import org.jboss.webbeans.test.ejb.model.invalid.JackRussellTerrier;
-import org.jboss.webbeans.test.ejb.model.invalid.Poodle;
-import org.jboss.webbeans.test.ejb.model.invalid.Pumi;
-import org.jboss.webbeans.test.ejb.model.invalid.Rottweiler;
-import org.jboss.webbeans.test.ejb.model.invalid.RussellTerrier;
-import org.jboss.webbeans.test.ejb.model.invalid.Saluki;
-import org.jboss.webbeans.test.ejb.model.invalid.Spitz;
-import org.jboss.webbeans.test.ejb.model.valid.Koirus;
-import org.jboss.webbeans.test.ejb.model.valid.Toller;
-import org.jboss.webbeans.test.ejb.model.valid.WelshCorgie;
-import org.jboss.webbeans.util.BeanFactory;
-import org.testng.annotations.Test;
-
-@SpecVersion("20081206")
-@SuppressWarnings("unused")
-public class EnterpriseBeanRemoveMethodTest extends AbstractTest
-{
- public static boolean visited = false;
-
- /**
- * EJB spec
- */
- @Test(groups = { "enterpriseBeans", "removeMethod" }, expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = "3.3.5")
- public void testStatelessEnterpriseBeansWithRemoveMethodsFails()
- {
- EnterpriseBean<Armant> bean = BeanFactory.createEnterpriseBean(Armant.class);
- }
-
- /**
- * 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.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.visited;
- }
-
- /**
- * 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);
- }
-
- /**
- * 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);
- }
-
- /**
- * 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);
- context.destroy();
- }
-
- /**
- * 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);
- RequestContext context = (RequestContext) manager.getContext(RequestScoped.class);
- Toller instance = context.get(bean, true);
- instance.bye();
- instance = context.get(bean, false);
- assert instance == null;
- }
-
- /**
- * 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());
- }
-
- /**
- * 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;
- }
-
- /**
- * 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);
- }
-
- /**
- * 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);
- }
-
- /**
- * 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);
- }
-
- /**
- * 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);
- }
-
- /**
- * 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);
- }
-
- /**
- * 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);
- }
-
- // 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()
- {
- assert false;
- }
-
- /**
- * 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;
- }
-
- /**
- * 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;
- }
-
- /**
- * 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;
- }
-
-}
Deleted: 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:35:45 UTC (rev 473)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanSpecializationTest.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -1,139 +0,0 @@
-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;
-import org.jboss.webbeans.test.SpecAssertion;
-import org.jboss.webbeans.test.SpecVersion;
-import org.jboss.webbeans.test.ejb.model.invalid.GreaterDane;
-import org.jboss.webbeans.test.ejb.model.valid.Hound;
-import org.jboss.webbeans.test.ejb.model.valid.HoundOfBaskerville;
-import org.jboss.webbeans.util.BeanFactory;
-import org.testng.annotations.Test;
-
-@SpecVersion("20081206")
-@SuppressWarnings("unused")
-public class EnterpriseBeanSpecializationTest extends AbstractTest
-{
- /**
- * 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);
- EnterpriseBean<HoundOfBaskerville> houndOfBaskerville = BeanFactory.createEnterpriseBean(HoundOfBaskerville.class);
- assert compareBindingTypesOK(hound, houndOfBaskerville);
- }
-
- private boolean compareBindingTypesOK(EnterpriseBean<Hound> hound, EnterpriseBean<HoundOfBaskerville> houndOfBaskerville)
- {
- if (hound.getBindingTypes().size() != houndOfBaskerville.getBindingTypes().size())
- {
- return false;
- }
- if (!hound.getBindingTypes().containsAll(houndOfBaskerville.getBindingTypes()))
- {
- return false;
- }
- if (!houndOfBaskerville.getBindingTypes().containsAll(hound.getBindingTypes()))
- {
- return false;
- }
- return true;
- }
-
- /**
- * if Y has a name, X has the same name as Y.
- */
- @Test(groups = { "specialization", "enterpriseBeans" })
- @SpecAssertion(section = "3.3.6")
- public void testSpecializingBeanInheritsNameIfAny()
- {
- EnterpriseBean<HoundOfBaskerville> houndOfBaskerville = BeanFactory.createEnterpriseBean(HoundOfBaskerville.class);
- assert houndOfBaskerville.getName().equals("Pongo");
- }
-
- /**
- * 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;
- }
-
- /**
- * 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;
- }
-
- /**
- * 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" })
- @SpecAssertion(section = "3.3")
- public void testMultipleEnabledSpecializedEnterpriseBeanFails()
- {
- assert false;
- }
-
- @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" })
- @SpecAssertion(section = "3.3.6")
- public void testXMLDefinedSpecializingEnterpriseBeanNotImplementingAnnotationDefinedEnterpriseBeanFails()
- {
- assert false;
- }
-
-}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/BullTerrier.java (from rev 473, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/BullTerrier.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/BullTerrier.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/BullTerrier.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,15 @@
+package org.jboss.webbeans.test.ejb.valid;
+
+import javax.ejb.Stateless;
+import javax.webbeans.Observes;
+
+import org.jboss.webbeans.test.annotations.Role;
+import org.jboss.webbeans.test.annotations.Tame;
+
+@Stateless
+public class BullTerrier
+{
+ public void observesBadEvent(@Observes @Role("Admin") @Tame String someEvent)
+ {
+ }
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/BullTerrier.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Hound.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/Hound.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Hound.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Hound.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,18 @@
+package org.jboss.webbeans.test.ejb.valid;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.webbeans.Named;
+
+import org.jboss.webbeans.test.annotations.Tame;
+
+@Stateful
+@Tame
+@Named("Pongo")
+public class Hound
+{
+ @Remove
+ public void bye() {
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Hound.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/HoundOfBaskerville.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/HoundOfBaskerville.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/HoundOfBaskerville.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/HoundOfBaskerville.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.ejb.valid;
+
+import javax.ejb.Stateful;
+import javax.webbeans.Specializes;
+
+@Specializes
+@Stateful
+public class HoundOfBaskerville extends Hound
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/HoundOfBaskerville.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Koirus.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/Koirus.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Koirus.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Koirus.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.test.ejb.valid;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.webbeans.Dependent;
+
+@Stateful
+@Dependent
+public class Koirus
+{
+ @Remove
+ public void bye(Object param) {
+ }
+}
\ No newline at end of file
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Koirus.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Laika.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/Laika.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Laika.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Laika.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,12 @@
+package org.jboss.webbeans.test.ejb.valid;
+
+import javax.webbeans.ApplicationScoped;
+
+import org.jboss.webbeans.test.annotations.Singleton;
+
+@Singleton
+@ApplicationScoped
+public class Laika
+{
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Pitbull.java (from rev 473, 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/valid/Pitbull.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Pitbull.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,21 @@
+package org.jboss.webbeans.test.ejb.valid;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.webbeans.ApplicationScoped;
+import javax.webbeans.Destructor;
+import javax.webbeans.Named;
+
+import org.jboss.webbeans.test.ejb.EnterpriseBeanRemoveMethodTest;
+
+@Stateful
+@ApplicationScoped
+@Named
+public class Pitbull
+{
+
+ @Remove @Destructor
+ public void bye() {
+ EnterpriseBeanRemoveMethodTest.visited = true;
+ }
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Pomeranian.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/Pomeranian.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Pomeranian.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Pomeranian.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,23 @@
+package org.jboss.webbeans.test.ejb.valid;
+
+import javax.ejb.Stateful;
+import javax.webbeans.Named;
+import javax.webbeans.Observes;
+import javax.webbeans.manager.Initialized;
+import javax.webbeans.manager.Manager;
+
+import org.jboss.webbeans.test.annotations.Tame;
+
+@Stateful
+@Tame
+@Named("Teddy")
+public class Pomeranian
+{
+ public void observeInitialized(@Observes @Initialized Manager manager)
+ {
+ }
+
+ public static void staticallyObserveInitialized(@Observes @Initialized Manager manager)
+ {
+ }
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Pomeranian.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Toller.java (from rev 473, 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/valid/Toller.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Toller.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,17 @@
+package org.jboss.webbeans.test.ejb.valid;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.webbeans.RequestScoped;
+
+import org.jboss.webbeans.test.ejb.EnterpriseBeanRemoveMethodTest;
+
+@Stateful
+@RequestScoped
+public class Toller
+{
+ @Remove
+ public void bye() {
+ EnterpriseBeanRemoveMethodTest.visited = true;
+ }
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Toller.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/WelshCorgie.java (from rev 465, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/WelshCorgie.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/WelshCorgie.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/WelshCorgie.java 2008-12-08 12:43:15 UTC (rev 474)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.ejb.valid;
+
+import javax.ejb.Stateful;
+import javax.webbeans.Dependent;
+
+@Stateful
+@Dependent
+public class WelshCorgie
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/WelshCorgie.java
___________________________________________________________________
Name: svn:mergeinfo
+
16 years, 3 months
[webbeans-commits] Webbeans SVN: r473 - in ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model: valid and 1 other directory.
by webbeans-commits@lists.jboss.org
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;
-@SpecVersion("PDR")
+@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;
-@SpecVersion("PDR")
+@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;
-@SpecVersion("PDR")
+@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;
}
}
16 years, 3 months
[webbeans-commits] Webbeans SVN: r472 - in ri/trunk/webbeans-ri/src: test/java/org/jboss/webbeans/test and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2008-12-08 07:17:28 -0500 (Mon, 08 Dec 2008)
New Revision: 472
Added:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/BullTerrier.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventObserver.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewEventTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/Pomeranian.java
Log:
Fixed some more bugs with observer methods and implemented the tests through 8.5.2 for events.
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventObserver.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventObserver.java 2008-12-08 11:15:09 UTC (rev 471)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventObserver.java 2008-12-08 12:17:28 UTC (rev 472)
@@ -18,11 +18,10 @@
package org.jboss.webbeans.event;
import java.lang.annotation.Annotation;
-import java.util.Arrays;
-import java.util.HashSet;
+import java.util.ArrayList;
import java.util.List;
-import java.util.Set;
+import javax.webbeans.Current;
import javax.webbeans.DuplicateBindingTypeException;
import javax.webbeans.Observer;
@@ -61,31 +60,33 @@
{
this.observer = observer;
this.eventType = eventType;
- this.eventBindings = Arrays.asList(eventBindings);
+ this.eventBindings = new ArrayList<Annotation>();
checkEventBindings(eventBindings);
}
/**
* Checks that each event binding specified on the observer is indeed a
* binding type (annotated with @BindingType) and that there are no duplicate
- * bindings specified.
- *
- * @param observerEventBindings The list of event bindings for the observer
+ * bindings specified. If the @Current binding type is found, it is removed
+ * since this is only a default supplied by the container but no applicable
+ * for the actual event objects which get fired.
*/
- private void checkEventBindings(Annotation[] observerEventBindings)
+ private void checkEventBindings(Annotation[] bindingAnnotations)
{
- Set<Annotation> checkedBindings = new HashSet<Annotation>();
- for (Annotation annotation : observerEventBindings)
+ for (Annotation annotation : bindingAnnotations)
{
if (!Reflections.isBindingType(annotation))
{
throw new IllegalArgumentException(annotation + " is not a binding type for " + this);
}
- if (checkedBindings.contains(annotation))
+ if (eventBindings.contains(annotation))
{
throw new DuplicateBindingTypeException(annotation + " is already present in the bindings list for " + this);
}
- checkedBindings.add(annotation);
+ if (!annotation.annotationType().equals(Current.class))
+ {
+ eventBindings.add(annotation);
+ }
}
}
@@ -162,6 +163,7 @@
return result;
}
+ @SuppressWarnings("unchecked")
@Override
public boolean equals(Object other)
{
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewEventTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewEventTest.java 2008-12-08 11:15:09 UTC (rev 471)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewEventTest.java 2008-12-08 12:17:28 UTC (rev 472)
@@ -25,6 +25,7 @@
import org.jboss.webbeans.test.ejb.model.invalid.FoxTerrier;
import org.jboss.webbeans.test.ejb.model.invalid.TibetanTerrier;
import org.jboss.webbeans.test.ejb.model.invalid.YorkshireTerrier;
+import org.jboss.webbeans.test.ejb.model.valid.BullTerrier;
import org.jboss.webbeans.test.ejb.model.valid.Pomeranian;
import org.jboss.webbeans.test.mock.MockManagerImpl;
import org.jboss.webbeans.util.BeanFactory;
@@ -76,8 +77,9 @@
{
SimpleBean<MyTest> myTestBean = BeanFactory.createSimpleBean(MyTest.class);
boolean found = false;
- for (AnnotatedField field : myTestBean.getInjectableFields()) {
- if ( field.isAnnotationPresent(Observable.class) )
+ for (AnnotatedField field : myTestBean.getInjectableFields())
+ {
+ if (field.isAnnotationPresent(Observable.class))
{
EventBean eventBean = BeanFactory.createEventBean(field);
Event<Param> event = eventBean.create();
@@ -439,6 +441,20 @@
}
@Test(groups = { "events" })
+ @SpecAssertion(section = "8.5.1")
+ public void testObserverMethodWithoutBindingTypesObservesEventsWithoutBindingTypes()
+ {
+ // This observer has no binding types specified
+ Set<AbstractBean<?, ?>> beans = bootstrap.createBeans(Pomeranian.class);
+ assert beans.size() == 1;
+
+ // Resolve registered observers with an event containing no binding types
+ Set<Observer<String>> resolvedObservers = manager.resolveObservers("A new event");
+ assert !resolvedObservers.isEmpty();
+ assert resolvedObservers.size() == 1;
+ }
+
+ @Test(groups = { "events" })
@SpecAssertion(section = "8.5.2")
public void testObserverMethodAnnotatedProducesFails()
{
@@ -506,11 +522,18 @@
assert definitionException;
}
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.5.1")
- public void testObserverMethodWithoutBindingTypesObservesEventsWithoutBindingTypes()
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "8.5.2")
+ public void testObserverMethodMayHaveMultipleBindingTypes()
{
- assert false;
+ Set<AbstractBean<?, ?>> beans = bootstrap.createBeans(BullTerrier.class);
+ assert beans != null;
+ // If we can resolve the observer with the two binding types,
+ // then it worked
+ Set<Observer<String>> resolvedObservers = manager.resolveObservers("An event object", new RoleBinding("Admin"), new TameAnnotationLiteral());
+ assert !resolvedObservers.isEmpty();
+ assert resolvedObservers.size() == 1;
+
}
@Test(groups = { "stub", "events" })
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/BullTerrier.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/BullTerrier.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/BullTerrier.java 2008-12-08 12:17:28 UTC (rev 472)
@@ -0,0 +1,15 @@
+package org.jboss.webbeans.test.ejb.model.valid;
+
+import javax.ejb.Stateless;
+import javax.webbeans.Observes;
+
+import org.jboss.webbeans.test.annotations.Role;
+import org.jboss.webbeans.test.annotations.Tame;
+
+@Stateless
+public class BullTerrier
+{
+ public void observesBadEvent(@Observes @Role("Admin") @Tame String someEvent)
+ {
+ }
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/BullTerrier.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/Pomeranian.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/Pomeranian.java 2008-12-08 11:15:09 UTC (rev 471)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/valid/Pomeranian.java 2008-12-08 12:17:28 UTC (rev 472)
@@ -17,6 +17,10 @@
{
}
+ public void observeSimpleString(@Observes String someString)
+ {
+ }
+
public static void staticallyObserveInitialized(@Observes @Initialized Manager manager)
{
}
16 years, 3 months
[webbeans-commits] Webbeans SVN: r471 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-12-08 06:15:09 -0500 (Mon, 08 Dec 2008)
New Revision: 471
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java
Log:
minor output tunings
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java 2008-12-08 10:47:05 UTC (rev 470)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java 2008-12-08 11:15:09 UTC (rev 471)
@@ -11,8 +11,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.webbeans.Observes;
-
import org.jboss.webbeans.ejb.EjbMetaData;
/**
@@ -23,9 +21,15 @@
*/
public class Names
{
-
+ // Pattern for recognizing strings with leading capital letter
private static Pattern CAPITAL_LETTERS = Pattern.compile("\\p{Upper}{1}\\p{Lower}*");
+ /**
+ * Gets a string representation of the scope type annotation
+ *
+ * @param scopeType The scope type
+ * @return A string representation
+ */
public static String scopeTypeToString(Class<? extends Annotation> scopeType)
{
String scopeName = scopeType.getSimpleName();
@@ -38,6 +42,12 @@
return result.toString();
}
+ /**
+ * Gets EJB type from metadata
+ *
+ * @param ejbMetaData The EJB meta data
+ * @return The EJB type
+ */
public static String ejbTypeFromMetaData(EjbMetaData<?> ejbMetaData)
{
if (ejbMetaData.isMessageDriven())
@@ -59,7 +69,13 @@
return "unknown";
}
- public static int count(@Observes final Iterable<?> iterable)
+ /**
+ * Counts item in an iteratble
+ *
+ * @param iterable The iteraboe
+ * @return The count
+ */
+ public static int count(final Iterable<?> iterable)
{
int count = 0;
for (Iterator<?> i = iterable.iterator(); i.hasNext();)
@@ -69,6 +85,13 @@
return count;
}
+ /**
+ * Converts a list of strings to a String with given delimeter
+ *
+ * @param list The list
+ * @param delimiter The delimeter
+ * @return The string representation
+ */
private static String list2String(List<String> list, String delimiter)
{
StringBuilder buffer = new StringBuilder();
@@ -80,6 +103,12 @@
return buffer.toString();
}
+ /**
+ * Parses a reflection modifier to a list of string
+ *
+ * @param modifier The modifier to parse
+ * @return The resulting string list
+ */
private static List<String> parseModifiers(int modifier)
{
List<String> modifiers = new ArrayList<String>();
@@ -134,6 +163,12 @@
return modifiers;
}
+ /**
+ * Gets a string representation from an array of annotations
+ *
+ * @param annotations The annotations
+ * @return The string representation
+ */
private static String annotations2String(Annotation[] annotations)
{
StringBuilder buffer = new StringBuilder();
@@ -145,48 +180,73 @@
return buffer.toString();
}
+ /**
+ * Gets a string representation from a field
+ *
+ * @param field The field
+ * @return The string representation
+ */
public static String field2String(Field field)
{
- return " Field " +
- annotations2String(field.getAnnotations()) +
- list2String(parseModifiers(field.getModifiers()), " ") +
- field.getName() + ";";
+ if (!field.isAccessible())
+ {
+ field.setAccessible(true);
+ }
+ return " Field " + annotations2String(field.getAnnotations()) + list2String(parseModifiers(field.getModifiers()), " ") + field.getName() + ";\n";
}
+ /**
+ * Gets the string representation from a method
+ *
+ * @param method The method
+ * @return The string representation
+ */
public static String method2String(Method method)
{
- return " Method " +
- method.getReturnType().getSimpleName() + " " +
- annotations2String(method.getAnnotations()) +
- list2String(parseModifiers(method.getModifiers()), " ") +
- method.getName() + "(" +
- parameters2String(method.getParameterTypes(), method.getParameterAnnotations()) +
- ");";
+ if (!method.isAccessible())
+ {
+ method.setAccessible(true);
+ }
+ return " Method " + method.getReturnType().getSimpleName() + " " + annotations2String(method.getAnnotations()) + list2String(parseModifiers(method.getModifiers()), " ") + method.getName() + "(" + parameters2String(method.getParameterTypes(), method.getParameterAnnotations(), false) + ");\n";
}
-
+
+ /**
+ * Gets a string representation from an annotation
+ *
+ * @param annotation The annotation
+ * @return The string representation
+ */
public static String annotation2String(Annotation annotation)
{
- return "Annotation " +
- annotations2String(annotation.annotationType().getAnnotations()) +
- annotation.annotationType().getSimpleName();
+ return "Annotation " + annotations2String(annotation.annotationType().getAnnotations()) + annotation.annotationType().getSimpleName();
}
-
- public static String constructor2String(Constructor<?> method)
+
+ /**
+ * Gets a string representation from a method
+ *
+ * @param constructor The method
+ * @return The string representation
+ */
+ public static String constructor2String(Constructor<?> constructor)
{
- return " Constructor " +
- annotations2String(method.getAnnotations()) +
- list2String(parseModifiers(method.getModifiers()), " ") +
- method.getName() + "(" +
- parameters2String(method.getParameterTypes(), method.getParameterAnnotations()) +
- ");";
+ return " Constructor " + annotations2String(constructor.getAnnotations()) + list2String(parseModifiers(constructor.getModifiers()), " ") + constructor.getDeclaringClass().getSimpleName() + "(" + parameters2String(constructor.getParameterTypes(), constructor.getParameterAnnotations(), true) + ");\n";
}
- private static String parameters2String(Class<?>[] parameterTypes, Annotation[][] annotations)
+ /**
+ * Gets a string representation from a list of parameters and their
+ * annotations
+ *
+ * @param parameterTypes The parameters
+ * @param annotations The annotation map
+ * @return The string representation
+ */
+ private static String parameters2String(Class<?>[] parameterTypes, Annotation[][] annotations, boolean constructor)
{
StringBuilder buffer = new StringBuilder();
- for (int i = 0; i < parameterTypes.length; i++)
+ int start = constructor ? 1 : 0;
+ for (int i = start; i < parameterTypes.length; i++)
{
- if (i > 0)
+ if (i > start)
{
buffer.append(", ");
}
@@ -195,26 +255,39 @@
return buffer.toString();
}
+ /**
+ * Gets a string representation from a type
+ *
+ * @param clazz The type
+ * @return The string representation
+ */
public static String type2String(Class<?> clazz)
{
return annotations2String(clazz.getAnnotations()) + clazz.getName();
}
-
- public static String class2String(Class<?> clazz) {
+
+ /**
+ * Gets a string representation from a class
+ *
+ * @param clazz The class
+ * @return The string representation
+ */
+ public static String class2String(Class<?> clazz)
+ {
StringBuilder buffer = new StringBuilder();
- buffer.append("Class " + type2String(clazz));
- buffer.append("\n");
+ buffer.append("Class " + type2String(clazz) + "\n");
for (Field field : clazz.getFields())
{
buffer.append(field2String(field));
- buffer.append("\n");
}
- buffer.append("\n");
+ for (Constructor<?> constructor : clazz.getConstructors())
+ {
+ buffer.append(constructor2String(constructor));
+ }
for (Method method : clazz.getMethods())
{
buffer.append(method2String(method));
- buffer.append("\n");
- }
+ }
return buffer.toString();
}
16 years, 3 months
[webbeans-commits] Webbeans SVN: r470 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-12-08 05:47:05 -0500 (Mon, 08 Dec 2008)
New Revision: 470
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AnnotationModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/BindingTypeModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ScopeModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java
Log:
toString simplifications
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AnnotationModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AnnotationModel.java 2008-12-08 10:24:07 UTC (rev 469)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AnnotationModel.java 2008-12-08 10:47:05 UTC (rev 470)
@@ -113,17 +113,23 @@
}
/**
- * Gets a string representation of the annotation
+ * Gets a string representation of the annotation model
*
* @return The string representation
*/
@Override
public String toString()
{
+ return (isValid() ? "Valid" : "Invalid") + " annotation model for " + getType();
+ }
+
+ public String toDetailedString()
+ {
StringBuilder buffer = new StringBuilder();
buffer.append("AnnotationModel:\n");
buffer.append("Annotated annotation: " + getAnnotatedAnnotation().toString());
buffer.append("Valid: " + isValid());
return buffer.toString();
}
+
}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/BindingTypeModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/BindingTypeModel.java 2008-12-08 10:24:07 UTC (rev 469)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/BindingTypeModel.java 2008-12-08 10:47:05 UTC (rev 470)
@@ -147,13 +147,18 @@
}
/**
- * Gets a string representation of the stereotype
+ * Gets a string representation of the binding type model
*
* @return The string representation
*/
@Override
public String toString()
{
+ return (isValid() ? "Valid" : "Invalid") + " binding type model for " + getType() + " with non-binding types " + getNonBindingTypes();
+ }
+
+ public String toDetailedString()
+ {
StringBuilder buffer = new StringBuilder();
buffer.append("BindingTypeModel:\n");
buffer.append(super.toString());
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java 2008-12-08 10:24:07 UTC (rev 469)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java 2008-12-08 10:47:05 UTC (rev 470)
@@ -157,6 +157,18 @@
@Override
public String toString()
{
+ return "Merged stereotype model with possible deployment types " +
+ possibleDeploymentTypes + ", required types " + requiredTypes +
+ ", possible scopes " + possibleScopeTypes + " and supported scopes " + supportedScopes;
+ }
+
+ /**
+ * Gets a string representation of the merged stereotypes
+ *
+ * @return The string representation
+ */
+ public String toDetailedString()
+ {
StringBuilder buffer = new StringBuilder();
buffer.append("Merged stereotypes:\n");
buffer.append("Bean name defaulted: " + beanNameDefaulted + "\n");
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ScopeModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ScopeModel.java 2008-12-08 10:24:07 UTC (rev 469)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ScopeModel.java 2008-12-08 10:47:05 UTC (rev 470)
@@ -72,13 +72,21 @@
}
/**
- * Gets a string representation of the stereotype
+ * Gets a string representation of the scope model
*
* @return The string representation
*/
@Override
public String toString()
{
+ String valid = isValid() ? "Valid " : "Invalid";
+ String normal = isNormal() ? "normal " : "non-normal ";
+ String passivating = isPassivating() ? "passivating " : "pon-passivating ";
+ return valid + normal + passivating + " scope model for " + getType();
+ }
+
+ public String toDetailedString()
+ {
StringBuilder buffer = new StringBuilder();
buffer.append("ScopeModel:\n");
buffer.append(super.toString());
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java 2008-12-08 10:24:07 UTC (rev 469)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java 2008-12-08 10:47:05 UTC (rev 470)
@@ -243,6 +243,11 @@
@Override
public String toString()
{
+ return "Stereotype model with required types " + requiredTypes + " and supported scopes " + supportedScopes;
+ }
+
+ public String toDetailedString()
+ {
StringBuilder buffer = new StringBuilder();
buffer.append("StereotypeModel:\n");
buffer.append(super.toString());
16 years, 3 months
[webbeans-commits] Webbeans SVN: r469 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans: bean and 2 other directories.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-12-08 05:24:07 -0500 (Mon, 08 Dec 2008)
New Revision: 469
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/InstanceImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/FacadeBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InstanceBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ManagerBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyMethodHandler.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
Log:
docs + toStrings
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/InstanceImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/InstanceImpl.java 2008-12-08 10:01:58 UTC (rev 468)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/InstanceImpl.java 2008-12-08 10:24:07 UTC (rev 469)
@@ -59,6 +59,9 @@
return buffer.toString();
}
+ /**
+ * @see org.jboss.webbeans.FacadeImpl#getFilteredAnnotations
+ */
@Override
protected Set<Class<? extends Annotation>> getFilteredAnnotations()
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2008-12-08 10:01:58 UTC (rev 468)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2008-12-08 10:24:07 UTC (rev 469)
@@ -101,7 +101,7 @@
protected Set<AnnotatedItem<?, ?>> injectionPoints;
private boolean primitive;
-
+
protected ManagerImpl manager;
// Cached values
@@ -169,7 +169,6 @@
/**
* Initializes the deployment types
*/
- @SuppressWarnings("null")
protected void initDeploymentType()
{
Set<Annotation> deploymentTypes = getAnnotatedItem().getMetaAnnotations(DeploymentType.class);
@@ -196,7 +195,7 @@
log.trace("Using default @Production deployment type");
return;
}
-
+
protected abstract Class<? extends Annotation> getDefaultDeploymentType();
/**
@@ -265,7 +264,6 @@
/**
* Initializes the scope type
*/
- @SuppressWarnings("null")
protected void initScopeType()
{
if (getAnnotatedItem().getMetaAnnotations(ScopeType.class).size() > 1)
@@ -539,9 +537,19 @@
return false;
}
+ /**
+ * Returns a string representation
+ *
+ * @return The string representation
+ */
@Override
public String toString()
{
+ return "AbstractBean " + getName();
+ }
+
+ public String toDetailedString()
+ {
StringBuilder buffer = new StringBuilder();
buffer.append("AbstractBean:\n");
buffer.append("Name: " + name + "\n");
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2008-12-08 10:01:58 UTC (rev 468)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2008-12-08 10:24:07 UTC (rev 469)
@@ -112,7 +112,7 @@
{
return getAnnotatedItem().getAnnotatedFields(Produces.class);
}
-
+
public Set<AnnotatedMethod<Object>> getObserverMethods()
{
return getAnnotatedItem().getMethodsWithAnnotatedParameters(Observes.class);
@@ -128,19 +128,19 @@
injectableFields = new HashSet<AnnotatedField<Object>>();
for (AnnotatedField<Object> annotatedField : annotatedItem.getMetaAnnotatedFields(BindingType.class))
{
- if ( !annotatedField.isAnnotationPresent(Produces.class) )
+ if (!annotatedField.isAnnotationPresent(Produces.class))
{
- if (annotatedField.isStatic())
- {
- throw new DefinitionException("Don't place binding annotations on static fields " + annotatedField);
+ if (annotatedField.isStatic())
+ {
+ throw new DefinitionException("Don't place binding annotations on static fields " + annotatedField);
+ }
+ if (annotatedField.isFinal())
+ {
+ throw new DefinitionException("Don't place binding annotations on final fields " + annotatedField);
+ }
+ injectableFields.add(annotatedField);
+ super.injectionPoints.add(annotatedField);
}
- if (annotatedField.isFinal())
- {
- throw new DefinitionException("Don't place binding annotations on final fields " + annotatedField);
- }
- injectableFields.add(annotatedField);
- super.injectionPoints.add(annotatedField);
- }
}
}
@@ -265,9 +265,19 @@
return initializerMethods;
}
+ /**
+ * Returns a string representation
+ *
+ * @return The string representation
+ */
@Override
public String toString()
{
+ return "AbstractClassBean " + getName();
+ }
+
+ public String toDetailedString()
+ {
StringBuilder buffer = new StringBuilder();
buffer.append("AbstractClassBean:\n");
buffer.append(super.toString() + "\n");
@@ -277,7 +287,7 @@
buffer.append(Strings.collectionToString("Producer methods: ", getProducerMethods()));
return buffer.toString();
}
-
+
@Override
protected Class<? extends Annotation> getDefaultDeploymentType()
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java 2008-12-08 10:01:58 UTC (rev 468)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java 2008-12-08 10:24:07 UTC (rev 469)
@@ -23,6 +23,7 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.event.EventImpl;
import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.util.Names;
/**
* An event bean representation
@@ -39,17 +40,38 @@
*
* @param field The underlying field abstraction
*/
- @SuppressWarnings("unchecked")
public EventBean(AnnotatedItem<Event<T>, S> field, ManagerImpl manager)
{
super(field, manager);
}
- @SuppressWarnings("unchecked")
@Override
public Event<T> create()
{
return new EventImpl<T>(manager, getTypeParameter(), getBindingTypesArray());
}
+
+ /**
+ * Returns a string representation
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("Annotated " + Names.scopeTypeToString(getScopeType()));
+ if (getName() == null)
+ {
+ buffer.append(" unnamed event bean");
+ }
+ else
+ {
+ buffer.append(" enterprise bean '" + getName() + "'");
+ }
+ buffer.append(" [" + getType().getName() + "]\n");
+ buffer.append(" API types " + getTypes() + ", binding types " + getBindingTypes() + "\n");
+ return buffer.toString();
+ }
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/FacadeBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/FacadeBean.java 2008-12-08 10:01:58 UTC (rev 468)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/FacadeBean.java 2008-12-08 10:24:07 UTC (rev 469)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.jboss.webbeans.bean;
import java.lang.annotation.Annotation;
@@ -11,6 +28,15 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedItem;
+/**
+ * Facade bean for implicit beans
+ *
+ * @author Gavin King
+ *
+ * @param <T>
+ * @param <S>
+ * @param <P>
+ */
public abstract class FacadeBean<T, S, P> extends AbstractBean<T, S> {
protected AnnotatedItem<T, S> annotatedItem;
@@ -50,6 +76,7 @@
return annotatedItem.getBindingTypesAsArray();
}
+ @SuppressWarnings("unchecked")
protected Class<P> getTypeParameter() {
return (Class<P>) annotatedItem.getType().getTypeParameters()[0].getClass();
}
@@ -94,5 +121,16 @@
protected Class<? extends Annotation> getDefaultDeploymentType() {
return Production.class;
}
+
+ /**
+ * Returns a string representation
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ return "FacadeBean " + getName();
+ }
}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java 2008-12-08 10:01:58 UTC (rev 468)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java 2008-12-08 10:24:07 UTC (rev 469)
@@ -93,12 +93,6 @@
}
@Override
- public String toString()
- {
- return delegate().toString();
- }
-
- @Override
public int hashCode()
{
return delegate().hashCode();
@@ -111,5 +105,16 @@
}
protected abstract Bean<T> delegate();
+
+ /**
+ * Returns a string representation
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ return "ForwardingBean " + getName();
+ }
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InstanceBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InstanceBean.java 2008-12-08 10:01:58 UTC (rev 468)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InstanceBean.java 2008-12-08 10:24:07 UTC (rev 469)
@@ -25,11 +25,12 @@
import org.jboss.webbeans.introspector.AnnotatedItem;
/**
- * An event bean representation
+ * Helper bean for accessing instances
*
- * @author David Allen
- *
+ * @author Gavin King
+ *
* @param <T>
+ * @param <S>
*/
public class InstanceBean<T, S> extends FacadeBean<Instance<T>, S, T>
{
@@ -37,15 +38,19 @@
/**
* Constructor
*
- * @param field The underlying field abstraction
+ * @param field The underlying fields
+ * @param manager The Web Beans manager
*/
- @SuppressWarnings("unchecked")
public InstanceBean(AnnotatedItem<Instance<T>, S> field, ManagerImpl manager)
{
super(field, manager);
}
- @SuppressWarnings("unchecked")
+ /**
+ * Creates the implementing bean
+ *
+ * @return The implementation
+ */
@Override
public Instance<T> create()
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ManagerBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ManagerBean.java 2008-12-08 10:01:58 UTC (rev 468)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ManagerBean.java 2008-12-08 10:24:07 UTC (rev 469)
@@ -1,6 +1,20 @@
-/**
- *
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
+
package org.jboss.webbeans.bean;
import java.lang.annotation.Annotation;
@@ -16,6 +30,12 @@
import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
import org.jboss.webbeans.util.Reflections;
+/**
+ * Helper bean for accessing the Manager
+ *
+ * @author Gavin King
+ *
+ */
public class ManagerBean extends Bean<Manager>
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerBean.java 2008-12-08 10:01:58 UTC (rev 468)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerBean.java 2008-12-08 10:24:07 UTC (rev 469)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.jboss.webbeans.bean;
import java.lang.annotation.Annotation;
@@ -11,6 +28,13 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.util.Names;
+/**
+ *
+ * @author Gavin King
+ *
+ * @param <T>
+ * @param <S>
+ */
public abstract class ProducerBean<T, S> extends AbstractBean<T, S> {
protected AbstractClassBean<?> declaringBean;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2008-12-08 10:01:58 UTC (rev 468)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2008-12-08 10:24:07 UTC (rev 469)
@@ -25,7 +25,7 @@
import org.jboss.webbeans.util.Names;
/**
- * Represents a producer method bean
+ * Represents a producer field bean
*
* @author Pete Muir
*
@@ -39,7 +39,7 @@
/**
* Constructor
*
- * @param method The producer method
+ * @param method The producer field
* @param declaringBean The declaring bean instance
*/
public ProducerFieldBean(Field field, AbstractClassBean<?> declaringBean, ManagerImpl manager)
@@ -50,7 +50,7 @@
/**
* Constructor
*
- * @param method The producer method abstraction
+ * @param method The producer field abstraction
* @param declaringBean The declaring bean
*/
public ProducerFieldBean(AnnotatedField<T> field, AbstractClassBean<?> declaringBean, ManagerImpl manager)
@@ -74,7 +74,7 @@
}
/**
- * Gets the annotated item representing the method
+ * Gets the annotated item representing the field
*
* @return The annotated item
*/
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyMethodHandler.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyMethodHandler.java 2008-12-08 10:01:58 UTC (rev 468)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyMethodHandler.java 2008-12-08 10:24:07 UTC (rev 469)
@@ -84,9 +84,8 @@
public String toString()
{
StringBuilder buffer = new StringBuilder();
- buffer.append("Proxy method handler\n");
- buffer.append("Bean " + (bean == null ? "null" : bean.toString()) + "\n");
- buffer.append("Bean index: " + beanIndex + "\n");
+ String beanInfo = bean == null ? "null bean" : bean.toString();
+ buffer.append("Proxy method handler for " + beanInfo + " with index " + beanIndex);
return buffer.toString();
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java 2008-12-08 10:01:58 UTC (rev 468)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java 2008-12-08 10:24:07 UTC (rev 469)
@@ -165,10 +165,7 @@
@Override
public String toString()
{
- StringBuilder buffer = new StringBuilder();
- buffer.append("Proxy pool\n");
- buffer.append(pool.toString() + "\n");
- return buffer.toString();
+ return "Proxy pool with " + pool.size() + " proxies";
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java 2008-12-08 10:01:58 UTC (rev 468)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java 2008-12-08 10:24:07 UTC (rev 469)
@@ -42,7 +42,7 @@
{
@SuppressWarnings("unchecked")
private static final Set<Class<? extends Annotation>> FILTERED_ANNOTATIONS = new HashSet<Class<? extends Annotation>>(Arrays.asList(Observable.class));
-
+
/**
* Constructor
*
@@ -80,11 +80,14 @@
{
StringBuilder buffer = new StringBuilder();
buffer.append("Observable Event:\n");
- buffer.append(" Event Type: " + type.getName() +"\n");
+ buffer.append(" Event Type: " + type.getName() + "\n");
buffer.append(Strings.collectionToString(" Event Bindings: ", bindingTypes));
return buffer.toString();
}
+ /**
+ * @see org.jboss.webbeans.FacadeImpl#getFilteredAnnotations
+ */
@Override
protected Set<Class<? extends Annotation>> getFilteredAnnotations()
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2008-12-08 10:01:58 UTC (rev 468)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2008-12-08 10:24:07 UTC (rev 469)
@@ -59,7 +59,7 @@
*/
public class ObserverImpl<T> implements Observer<T>
{
- private Bean<?> observerBean;
+ private Bean<?> eventBean;
private final AnnotatedMethod<Object> observerMethod;
private TransactionObservationPhase transactionObservationPhase;
private boolean conditional;
@@ -81,7 +81,7 @@
public ObserverImpl(final AnnotatedMethod<Object> observer, final Bean<?> observerBean, final ManagerImpl manager)
{
this.manager = manager;
- this.observerBean = observerBean;
+ this.eventBean = observerBean;
this.observerMethod = observer;
validateObserverMethod();
initTransactionObservationPhase();
@@ -187,7 +187,7 @@
protected Object getInstance(boolean conditional)
{
// Return the most specialized instance of the component
- return manager.getMostSpecializedInstance(observerBean, conditional);
+ return manager.getMostSpecializedInstance(eventBean, conditional);
}
/**
@@ -226,7 +226,7 @@
{
StringBuilder builder = new StringBuilder();
builder.append("Observer Implentation: \n");
- builder.append(" Observer (Declaring) bean: " + observerBean);
+ builder.append(" Observer (Declaring) bean: " + eventBean);
builder.append(" Observer method: " + observerMethod);
return builder.toString();
}
16 years, 3 months
[webbeans-commits] Webbeans SVN: r468 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans: event and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-12-08 05:01:58 -0500 (Mon, 08 Dec 2008)
New Revision: 468
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/CurrentManager.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/FacadeImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/InstanceImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java
Log:
docs + merging of similar code in FacadeImpl
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/CurrentManager.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/CurrentManager.java 2008-12-08 08:44:08 UTC (rev 467)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/CurrentManager.java 2008-12-08 10:01:58 UTC (rev 468)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.jboss.webbeans;
import org.jboss.webbeans.contexts.ApplicationContext;
@@ -4,16 +21,31 @@
import org.jboss.webbeans.contexts.RequestContext;
import org.jboss.webbeans.contexts.SessionContext;
+/**
+ * Access point for getting/setting current Managager
+ *
+ * @author Gavin King
+ */
public class CurrentManager
{
-
+ // The root manager instance
protected static ManagerImpl rootManager;
+ /**
+ * Gets the root manager
+ *
+ * @return The root manager
+ */
public static ManagerImpl rootManager()
{
return rootManager;
}
+ /**
+ * Sets the root manager
+ *
+ * @param rootManager The root manager
+ */
public static void setRootManager(ManagerImpl rootManager)
{
CurrentManager.rootManager = rootManager;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/FacadeImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/FacadeImpl.java 2008-12-08 08:44:08 UTC (rev 467)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/FacadeImpl.java 2008-12-08 10:01:58 UTC (rev 468)
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.jboss.webbeans;
import java.lang.annotation.Annotation;
@@ -5,75 +22,87 @@
import java.util.Set;
import javax.webbeans.DuplicateBindingTypeException;
-import javax.webbeans.Observable;
import org.jboss.webbeans.util.Reflections;
-public class FacadeImpl<T> {
-
+/**
+ * Common implementation for binding-type-based helpers
+ *
+ * @author Gavin King
+ *
+ * @param <T>
+ */
+public abstract class FacadeImpl<T>
+{
+ // The binding types the helper operates on
protected final Set<? extends Annotation> bindingTypes;
+ // The Web Beans manager
protected final ManagerImpl manager;
+ // The type of the operation
protected final Class<T> type;
/**
- * Validates the binding types
+ * Constructor
*
- * Removes @Observable from the list
- *
- * @param annotations The annotations to validate
- * @return A set of binding type annotations (minus @Observable, if it was
- * present)
+ * @param manager The Web Beans manager
+ * @param eventType The event type
+ * @param bindingTypes The binding types
*/
- protected static Set<Annotation> getBindingTypes(Annotation... annotations) {
- Set<Annotation> result = new HashSet<Annotation>();
- for (Annotation annotation : annotations)
- {
- if (!Reflections.isBindingType(annotation))
- {
- throw new IllegalArgumentException(annotation + " is not a binding type");
- }
- if (!annotation.annotationType().equals(Observable.class))
- {
- result.add(annotation);
- }
- }
- return result;
- }
-
- protected FacadeImpl(ManagerImpl manager, Class<T> eventType, Annotation... bindingTypes) {
+ protected FacadeImpl(ManagerImpl manager, Class<T> eventType, Annotation... bindingTypes)
+ {
this.manager = manager;
this.type = eventType;
- this.bindingTypes = getBindingTypes(bindingTypes);
- }
+ this.bindingTypes = mergeBindingTypes(new HashSet<Annotation>(), bindingTypes);
+ }
/**
- * Validates the binding types and checks for duplicates among the annotations.
+ * Merges and validates the current and new bindings
*
- * @param annotations The annotations to validate
- * @return A set of unique binding type annotations
+ * Checkes with an abstract method for annotations to exclude
+ *
+ * @param currentBindings Existing bindings
+ * @param newBindings New bindings
+ * @return The union of the bindings
*/
- protected Set<Annotation> checkBindingTypes(Annotation... annotations) {
+ protected Set<Annotation> mergeBindingTypes(Set<? extends Annotation> currentBindings, Annotation... newBindings)
+ {
Set<Annotation> result = new HashSet<Annotation>();
- for (Annotation annotation : annotations)
+ result.addAll(currentBindings);
+ for (Annotation newAnnotation : newBindings)
{
- if (!Reflections.isBindingType(annotation))
+ if (!Reflections.isBindingType(newAnnotation))
{
- throw new IllegalArgumentException(annotation + " is not a binding type for " + this);
+ throw new IllegalArgumentException(newAnnotation + " is not a binding type for " + this);
}
- if (result.contains(annotation) || this.bindingTypes.contains(annotation))
+ if (result.contains(newAnnotation))
{
- throw new DuplicateBindingTypeException(annotation + " is already present in the bindings list for " + this);
+ throw new DuplicateBindingTypeException(newAnnotation + " is already present in the bindings list for " + this);
}
- result.add(annotation);
+ if (!getFilteredAnnotations().contains(newAnnotation.annotationType()))
+ {
+ result.add(newAnnotation);
+ }
}
return result;
}
- protected Annotation[] mergeBindings(Annotation... bindingTypes) {
- Set<Annotation> bindingParameters = checkBindingTypes(bindingTypes);
- bindingParameters.addAll(this.bindingTypes);
- Annotation[] bindings = bindingParameters.toArray(new Annotation[0]);
- return bindings;
+ /**
+ * Gets a set of annotation classes to ignore
+ *
+ * @return A set of annotation classes to ignore
+ */
+ protected abstract Set<Class<? extends Annotation>> getFilteredAnnotations();
+
+ /**
+ * Merges the binding this helper operates upon with the parameters
+ *
+ * @param bindingTypes The bindings to merge
+ *
+ * @return The union of the binding types
+ */
+ protected Annotation[] mergeBindings(Annotation... newBindingTypes)
+ {
+ return mergeBindingTypes(bindingTypes, newBindingTypes).toArray(new Annotation[0]);
}
}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/InstanceImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/InstanceImpl.java 2008-12-08 08:44:08 UTC (rev 467)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/InstanceImpl.java 2008-12-08 10:01:58 UTC (rev 468)
@@ -18,6 +18,8 @@
package org.jboss.webbeans;
import java.lang.annotation.Annotation;
+import java.util.Collections;
+import java.util.Set;
import javax.webbeans.Instance;
@@ -57,4 +59,10 @@
return buffer.toString();
}
+ @Override
+ protected Set<Class<? extends Annotation>> getFilteredAnnotations()
+ {
+ return Collections.emptySet();
+ }
+
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java 2008-12-08 08:44:08 UTC (rev 467)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java 2008-12-08 10:01:58 UTC (rev 468)
@@ -18,8 +18,12 @@
package org.jboss.webbeans.event;
import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
import javax.webbeans.Event;
+import javax.webbeans.Observable;
import javax.webbeans.Observer;
import org.jboss.webbeans.FacadeImpl;
@@ -36,6 +40,9 @@
*/
public class EventImpl<T> extends FacadeImpl<T> implements Event<T>
{
+ @SuppressWarnings("unchecked")
+ private static final Set<Class<? extends Annotation>> FILTERED_ANNOTATIONS = new HashSet<Class<? extends Annotation>>(Arrays.asList(Observable.class));
+
/**
* Constructor
*
@@ -78,4 +85,10 @@
return buffer.toString();
}
+ @Override
+ protected Set<Class<? extends Annotation>> getFilteredAnnotations()
+ {
+ return FILTERED_ANNOTATIONS;
+ }
+
}
16 years, 3 months
[webbeans-commits] Webbeans SVN: r467 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans: introspector/jlr and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-12-08 03:44:08 -0500 (Mon, 08 Dec 2008)
New Revision: 467
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
Log:
Moved MergedStereoTypes -> model, removed unused AnnotatedItemImpl
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2008-12-08 08:34:33 UTC (rev 466)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2008-12-08 08:44:08 UTC (rev 467)
@@ -46,6 +46,7 @@
import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem.AnnotationMap;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.model.MergedStereotypes;
import org.jboss.webbeans.util.Reflections;
import org.jboss.webbeans.util.Strings;
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java 2008-12-08 08:34:33 UTC (rev 466)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java 2008-12-08 08:44:08 UTC (rev 467)
@@ -1,171 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.webbeans.bean;
-
-import java.lang.annotation.Annotation;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.webbeans.MetaDataCache;
-import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem.AnnotationMap;
-import org.jboss.webbeans.model.StereotypeModel;
-import org.jboss.webbeans.util.Strings;
-
-/**
- * Meta model for the merged stereotype for a bean
- *
- * @author Pete Muir
- */
-public class MergedStereotypes<T, E>
-{
- // The possible deployment types
- private AnnotationMap possibleDeploymentTypes;
- // The possible scope types
- private Set<Annotation> possibleScopeTypes;
- // Is the bean name defaulted?
- private boolean beanNameDefaulted;
- // The required types
- private Set<Class<?>> requiredTypes;
- // The supported scopes
- private Set<Class<? extends Annotation>> supportedScopes;
-
- /**
- * Constructor
- *
- * @param stereotypeAnnotations The stereotypes to merge
- */
- public MergedStereotypes(Set<Annotation> stereotypeAnnotations)
- {
- possibleDeploymentTypes = new AnnotationMap();
- possibleScopeTypes = new HashSet<Annotation>();
- requiredTypes = new HashSet<Class<?>>();
- supportedScopes = new HashSet<Class<? extends Annotation>>();
- merge(stereotypeAnnotations);
- }
-
- /**
- * Perform the merge
- *
- * @param stereotypeAnnotations The stereotype annotations
- */
- protected void merge(Set<Annotation> stereotypeAnnotations)
- {
- for (Annotation stereotypeAnnotation : stereotypeAnnotations)
- {
- // Retrieve and merge all metadata from stereotypes
- StereotypeModel<?> stereotype = MetaDataCache.instance().getStereotype(stereotypeAnnotation.annotationType());
- if (stereotype == null)
- {
- throw new IllegalStateException("Stereotype " + stereotypeAnnotation + " not registered with container");
- }
- if (stereotype.getDefaultDeploymentType() != null)
- {
- possibleDeploymentTypes.put(stereotype.getDefaultDeploymentType().annotationType(), stereotype.getDefaultDeploymentType());
- }
- if (stereotype.getDefaultScopeType() != null)
- {
- possibleScopeTypes.add(stereotype.getDefaultScopeType());
- }
- requiredTypes.addAll(stereotype.getRequiredTypes());
- supportedScopes.addAll(stereotype.getSupportedScopes());
- if (stereotype.isBeanNameDefaulted())
- {
- beanNameDefaulted = true;
- }
- }
- }
-
- /**
- * Returns the possible deployment typess
- *
- * @return The deployment types
- */
- public AnnotationMap getPossibleDeploymentTypes()
- {
- return possibleDeploymentTypes;
- }
-
- /**
- * Returns the possible scope types
- *
- * @return The scope types
- */
- public Set<Annotation> getPossibleScopeTypes()
- {
- return possibleScopeTypes;
- }
-
- /**
- * Indicates if the name i defaulted
- *
- * @return True if defaulted, false if not
- */
- public boolean isBeanNameDefaulted()
- {
- return beanNameDefaulted;
- }
-
- /**
- * Returns the required types
- *
- * @return The required types
- */
- public Set<Class<?>> getRequiredTypes()
- {
- return requiredTypes;
- }
-
- /**
- * Returns the supported scopes
- *
- * @return The supported scopes
- */
- public Set<Class<? extends Annotation>> getSupportedScopes()
- {
- return supportedScopes;
- }
-
- /**
- * Indicates if the bean was declared in XML
- *
- * @return True if declared in XML, else false
- */
- public boolean isDeclaredInXml()
- {
- return false;
- }
-
- /**
- * Gets a string representation of the merged stereotypes
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("Merged stereotypes:\n");
- buffer.append("Bean name defaulted: " + beanNameDefaulted + "\n");
- buffer.append("Possible deployment types: " + getPossibleDeploymentTypes().toString());
- buffer.append(Strings.collectionToString("Possible scope types: ", getPossibleScopeTypes()));
- buffer.append(Strings.collectionToString("Required types: ", getRequiredTypes()));
- buffer.append(Strings.collectionToString("Supported scopes: ", getSupportedScopes()));
- return buffer.toString();
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java 2008-12-08 08:34:33 UTC (rev 466)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java 2008-12-08 08:44:08 UTC (rev 467)
@@ -1,172 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.webbeans.introspector.jlr;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Arrays;
-
-import org.jboss.webbeans.util.Names;
-import org.jboss.webbeans.util.Strings;
-
-/**
- * Represents an annotated item
- *
- * This class is immutable, and therefore threadsafe
- *
- * @author Pete Muir
- *
- * @param <T>
- * @param <S>
- */
-public class AnnotatedItemImpl<T, S> extends AbstractAnnotatedItem<T, S>
-{
- // The actual type arguments
- private final Type[] actualTypeArguments;
- // The type of the item
- private final Class<T> type;
- // The actual annotations
- private final Annotation[] actualAnnotations;
-
- // Cached string representation
- private String toString;
-
- /**
- * Constructor
- *
- * @param annotations The annotations array of the type
- * @param type The type of the item
- * @param actualTypeArguments The actual type arguments array
- */
- public AnnotatedItemImpl(Annotation[] annotations, Class<T> type, Type[] actualTypeArguments)
- {
- super(buildAnnotationMap(annotations));
- this.type = type;
- this.actualTypeArguments = actualTypeArguments;
- this.actualAnnotations = annotations;
- }
-
- /**
- * Gets the delegate (null)
- *
- * @return null
- *
- * @see org.jboss.webbeans.introspector.AnnotatedItem#getDelegate()
- */
- public S getDelegate()
- {
- return null;
- }
-
- /**
- * Gets the item type
- *
- * @return The type
- *
- * @see org.jboss.webbeans.introspector.AnnotatedItem#getType()
- */
- public Class<T> getType()
- {
- return type;
- }
-
- /**
- * Gets the actual type arguments
- *
- * @return The actual type arguments array
- *
- * @see org.jboss.webbeans.introspector.AnnotatedItem#getActualTypeArguments()
- */
- public Type[] getActualTypeArguments()
- {
- return actualTypeArguments;
- }
-
- /**
- * Gets the actual annotations
- *
- * @return The annotations array
- */
- public Annotation[] getActualAnnotations()
- {
- return actualAnnotations;
- }
-
- /**
- * Indicates if the item is static
- *
- * @return false
- *
- * @see org.jboss.webbeans.introspector.AnnotatedItem#isStatic()
- */
- public boolean isStatic()
- {
- return false;
- }
-
- /**
- * Indicates if the item is final
- *
- * @return false
- *
- * @see org.jboss.webbeans.introspector.AnnotatedItem#isFinal()
- */
- public boolean isFinal()
- {
- return false;
- }
-
- /**
- * Gets the name. Should be overridden
- *
- * @throws IllegalArgumentException.
- *
- * @see org.jboss.webbeans.introspector.AnnotatedItem#getName()
- */
- public String getName()
- {
- throw new IllegalArgumentException("Unable to determine name");
- }
-
- /**
- * Gets a string representation of the item
- *
- * @return A string representation
- */
- @Override
- public String toString()
- {
- if (toString != null)
- {
- return toString;
- }
- toString = "Annotated item " + Names.type2String(getDelegate().getClass());
- return toString;
- }
-
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("AnnotatedItemImpl:\n");
- buffer.append(super.toString() + "\n");
- buffer.append(Strings.collectionToString("Actual type arguments: ", Arrays.asList(getActualTypeArguments())));
- buffer.append(Strings.collectionToString("Actual annotations: ", Arrays.asList(getActualAnnotations())));
- return buffer.toString();
- }
-
-}
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java (from rev 465, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java 2008-12-08 08:44:08 UTC (rev 467)
@@ -0,0 +1,170 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.model;
+
+import java.lang.annotation.Annotation;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.webbeans.MetaDataCache;
+import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem.AnnotationMap;
+import org.jboss.webbeans.util.Strings;
+
+/**
+ * Meta model for the merged stereotype for a bean
+ *
+ * @author Pete Muir
+ */
+public class MergedStereotypes<T, E>
+{
+ // The possible deployment types
+ private AnnotationMap possibleDeploymentTypes;
+ // The possible scope types
+ private Set<Annotation> possibleScopeTypes;
+ // Is the bean name defaulted?
+ private boolean beanNameDefaulted;
+ // The required types
+ private Set<Class<?>> requiredTypes;
+ // The supported scopes
+ private Set<Class<? extends Annotation>> supportedScopes;
+
+ /**
+ * Constructor
+ *
+ * @param stereotypeAnnotations The stereotypes to merge
+ */
+ public MergedStereotypes(Set<Annotation> stereotypeAnnotations)
+ {
+ possibleDeploymentTypes = new AnnotationMap();
+ possibleScopeTypes = new HashSet<Annotation>();
+ requiredTypes = new HashSet<Class<?>>();
+ supportedScopes = new HashSet<Class<? extends Annotation>>();
+ merge(stereotypeAnnotations);
+ }
+
+ /**
+ * Perform the merge
+ *
+ * @param stereotypeAnnotations The stereotype annotations
+ */
+ protected void merge(Set<Annotation> stereotypeAnnotations)
+ {
+ for (Annotation stereotypeAnnotation : stereotypeAnnotations)
+ {
+ // Retrieve and merge all metadata from stereotypes
+ StereotypeModel<?> stereotype = MetaDataCache.instance().getStereotype(stereotypeAnnotation.annotationType());
+ if (stereotype == null)
+ {
+ throw new IllegalStateException("Stereotype " + stereotypeAnnotation + " not registered with container");
+ }
+ if (stereotype.getDefaultDeploymentType() != null)
+ {
+ possibleDeploymentTypes.put(stereotype.getDefaultDeploymentType().annotationType(), stereotype.getDefaultDeploymentType());
+ }
+ if (stereotype.getDefaultScopeType() != null)
+ {
+ possibleScopeTypes.add(stereotype.getDefaultScopeType());
+ }
+ requiredTypes.addAll(stereotype.getRequiredTypes());
+ supportedScopes.addAll(stereotype.getSupportedScopes());
+ if (stereotype.isBeanNameDefaulted())
+ {
+ beanNameDefaulted = true;
+ }
+ }
+ }
+
+ /**
+ * Returns the possible deployment typess
+ *
+ * @return The deployment types
+ */
+ public AnnotationMap getPossibleDeploymentTypes()
+ {
+ return possibleDeploymentTypes;
+ }
+
+ /**
+ * Returns the possible scope types
+ *
+ * @return The scope types
+ */
+ public Set<Annotation> getPossibleScopeTypes()
+ {
+ return possibleScopeTypes;
+ }
+
+ /**
+ * Indicates if the name i defaulted
+ *
+ * @return True if defaulted, false if not
+ */
+ public boolean isBeanNameDefaulted()
+ {
+ return beanNameDefaulted;
+ }
+
+ /**
+ * Returns the required types
+ *
+ * @return The required types
+ */
+ public Set<Class<?>> getRequiredTypes()
+ {
+ return requiredTypes;
+ }
+
+ /**
+ * Returns the supported scopes
+ *
+ * @return The supported scopes
+ */
+ public Set<Class<? extends Annotation>> getSupportedScopes()
+ {
+ return supportedScopes;
+ }
+
+ /**
+ * Indicates if the bean was declared in XML
+ *
+ * @return True if declared in XML, else false
+ */
+ public boolean isDeclaredInXml()
+ {
+ return false;
+ }
+
+ /**
+ * Gets a string representation of the merged stereotypes
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("Merged stereotypes:\n");
+ buffer.append("Bean name defaulted: " + beanNameDefaulted + "\n");
+ buffer.append("Possible deployment types: " + getPossibleDeploymentTypes().toString());
+ buffer.append(Strings.collectionToString("Possible scope types: ", getPossibleScopeTypes()));
+ buffer.append(Strings.collectionToString("Required types: ", getRequiredTypes()));
+ buffer.append(Strings.collectionToString("Supported scopes: ", getSupportedScopes()));
+ return buffer.toString();
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:mergeinfo
+
16 years, 3 months
[webbeans-commits] Webbeans SVN: r466 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans: introspector/jlr and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-12-08 03:34:33 -0500 (Mon, 08 Dec 2008)
New Revision: 466
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java
Log:
more toString simplifications
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerBean.java 2008-12-08 01:09:19 UTC (rev 465)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerBean.java 2008-12-08 08:34:33 UTC (rev 466)
@@ -9,6 +9,7 @@
import javax.webbeans.IllegalProductException;
import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.util.Names;
public abstract class ProducerBean<T, S> extends AbstractBean<T, S> {
@@ -107,5 +108,23 @@
return getAnnotatedItem().isStatic() ?
null : manager.getInstance(getDeclaringBean());
}
+
+ @Override
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("Annotated " + Names.scopeTypeToString(getScopeType()));
+ if (getName() == null)
+ {
+ buffer.append("unnamed producer bean");
+ }
+ else
+ {
+ buffer.append("simple producer bean '" + getName() + "'");
+ }
+ buffer.append(" [" + getType().getName() + "]\n");
+ buffer.append(" API types " + getTypes() + ", binding types " + getBindingTypes() + "\n");
+ return buffer.toString();
+ }
}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2008-12-08 01:09:19 UTC (rev 465)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2008-12-08 08:34:33 UTC (rev 466)
@@ -22,6 +22,7 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.jlr.AnnotatedFieldImpl;
+import org.jboss.webbeans.util.Names;
/**
* Represents a producer method bean
@@ -98,6 +99,23 @@
public String toString()
{
StringBuilder buffer = new StringBuilder();
+ buffer.append("Annotated " + Names.scopeTypeToString(getScopeType()));
+ if (getName() == null)
+ {
+ buffer.append("unnamed producer field bean");
+ }
+ else
+ {
+ buffer.append("simple producer field bean '" + getName() + "'");
+ }
+ buffer.append(" [" + getType().getName() + "]\n");
+ buffer.append(" API types " + getTypes() + ", binding types " + getBindingTypes() + "\n");
+ return buffer.toString();
+ }
+
+ public String toDetailedString()
+ {
+ StringBuilder buffer = new StringBuilder();
buffer.append("ProducerFieldBean:\n");
buffer.append(super.toString() + "\n");
buffer.append("Declaring bean: " + declaringBean.toString() + "\n");
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2008-12-08 01:09:19 UTC (rev 465)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2008-12-08 08:34:33 UTC (rev 466)
@@ -30,6 +30,7 @@
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.introspector.jlr.AnnotatedMethodImpl;
+import org.jboss.webbeans.util.Names;
/**
* Represents a producer method bean
@@ -181,10 +182,28 @@
return removeMethod;
}
+
@Override
public String toString()
{
StringBuilder buffer = new StringBuilder();
+ buffer.append("Annotated " + Names.scopeTypeToString(getScopeType()));
+ if (getName() == null)
+ {
+ buffer.append("unnamed producer method bean");
+ }
+ else
+ {
+ buffer.append("simple producer method bean '" + getName() + "'");
+ }
+ buffer.append(" [" + getType().getName() + "]\n");
+ buffer.append(" API types " + getTypes() + ", binding types " + getBindingTypes() + "\n");
+ return buffer.toString();
+ }
+
+ public String toDetailedString()
+ {
+ StringBuilder buffer = new StringBuilder();
buffer.append("ProducerMethodBean:\n");
buffer.append(super.toString() + "\n");
buffer.append("Declaring bean: " + declaringBean.toString() + "\n");
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-12-08 01:09:19 UTC (rev 465)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-12-08 08:34:33 UTC (rev 466)
@@ -437,13 +437,18 @@
{
return toString;
}
+ toString = "Abstract annotated item " + getName();
+ return toString;
+ }
+
+ public String toDetailedString()
+ {
StringBuilder buffer = new StringBuilder();
buffer.append("AbstractAnnotatedItem:\n");
buffer.append(Strings.collectionToString("Annotations: ", getAnnotations()));
buffer.append(annotationMap == null ? "" : (annotationMap.toString() + "\n"));
buffer.append(metaAnnotationMap == null ? "" : (metaAnnotationMap.toString()) + "\n");
- toString = buffer.toString();
- return toString;
+ return buffer.toString();
}
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java 2008-12-08 01:09:19 UTC (rev 465)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java 2008-12-08 08:34:33 UTC (rev 466)
@@ -156,20 +156,26 @@
*
* @return A string representation
*/
+ @Override
public String toString()
{
if (toString != null)
{
return toString;
}
+ toString = "Abstract annotated member " + getName();
+ return toString;
+ }
+
+ public String toDetailedString()
+ {
StringBuilder buffer = new StringBuilder();
buffer.append("AbstractAnnotatedMember:\n");
buffer.append(super.toString() + "\n");
buffer.append("Final: " + isFinal() + "\n");
buffer.append("Static: " + isStatic() + "\n");
buffer.append("Name: " + getName() + "\n");
- toString = buffer.toString();
- return toString;
+ return buffer.toString();
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java 2008-12-08 01:09:19 UTC (rev 465)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java 2008-12-08 08:34:33 UTC (rev 466)
@@ -106,16 +106,23 @@
}
/**
- * Gets a string representation of the annotated type
+ * Gets a string representation of the type
*
* @return A string representation
*/
+ @Override
public String toString()
{
if (toString != null)
{
return toString;
}
+ toString = "Abstract annotated type " + getName();
+ return toString;
+ }
+
+ public String toDetailedString()
+ {
StringBuilder buffer = new StringBuilder();
buffer.append("AbstractAnnotatedType:\n");
buffer.append(super.toString() + "\n");
@@ -123,8 +130,7 @@
buffer.append("Name: " + getName() + "\n");
buffer.append("Final: " + isFinal() + "\n");
buffer.append("Static: " + isStatic() + "\n");
- toString = buffer.toString();
- return toString;
+ return buffer.toString();
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java 2008-12-08 01:09:19 UTC (rev 465)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java 2008-12-08 08:34:33 UTC (rev 466)
@@ -172,26 +172,32 @@
{
return Collections.unmodifiableSet(annotatedMembers.get(annotationType));
}
-
+
/**
- * Gets a string representation of the constructor
+ * Gets a string representation of the annotation
*
* @return A string representation
*/
+ @Override
public String toString()
{
if (toString != null)
{
return toString;
}
+// toString = "Annotated annotation " + Names.annotation2String(getDelegate());
+ return toString;
+ }
+
+ public String toDetailedString()
+ {
StringBuilder buffer = new StringBuilder();
buffer.append("AnnotatedConstructorImpl:\n");
buffer.append(super.toString() + "\n");
buffer.append("Class: " + clazz.toString() + "\n");
buffer.append(Strings.collectionToString("Members: ", getMembers()));
buffer.append(annotatedMembers == null ? "" : (annotatedMembers.toString() + "\n"));
- toString = buffer.toString();
- return toString;
+ return buffer.toString();
}
protected Class<T> getDelegate()
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2008-12-08 01:09:19 UTC (rev 465)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2008-12-08 08:34:33 UTC (rev 466)
@@ -35,6 +35,7 @@
import org.jboss.webbeans.introspector.AnnotatedConstructor;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
+import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Strings;
import com.google.common.collect.ForwardingMap;
@@ -504,16 +505,23 @@
}
/**
- * Gets a string representation of the constructor
+ * Gets a string representation of the class
*
* @return A string representation
*/
+ @Override
public String toString()
{
if (toString != null)
{
return toString;
}
+ toString = "Annotated class " + Names.class2String(getDelegate());
+ return toString;
+ }
+
+ public String toDetailedString()
+ {
StringBuilder buffer = new StringBuilder();
buffer.append("AnnotatedConstructorImpl:\n");
buffer.append(super.toString() + "\n");
@@ -527,8 +535,7 @@
buffer.append(annotatedMethods == null ? "" : (annotatedMethods.toString() + "\n"));
buffer.append(constructorsByArgumentMap == null ? "" : (constructorsByArgumentMap.toString() + "\n"));
buffer.append(metaAnnotatedFields == null ? "" : (metaAnnotatedFields.toString() + "\n"));
- toString = buffer.toString();
- return toString;
+ return buffer.toString();
}
}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2008-12-08 01:09:19 UTC (rev 465)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2008-12-08 08:34:33 UTC (rev 466)
@@ -33,6 +33,7 @@
import org.jboss.webbeans.introspector.AnnotatedConstructor;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Strings;
/**
@@ -270,12 +271,19 @@
*
* @return A string representation
*/
+ @Override
public String toString()
{
if (toString != null)
{
return toString;
}
+ toString = "Annotated method " + Names.constructor2String(constructor);
+ return toString;
+ }
+
+ public String toDetailedString()
+ {
StringBuilder buffer = new StringBuilder();
buffer.append("AnnotatedConstructorImpl:\n");
buffer.append(super.toString() + "\n");
@@ -286,8 +294,7 @@
buffer.append(constructor.toString() + "\n");
buffer.append(Strings.collectionToString("Parameters: ", getParameters()));
buffer.append(annotatedParameters.toString() + "\n");
- toString = buffer.toString();
- return toString;
+ return buffer.toString();
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java 2008-12-08 01:09:19 UTC (rev 465)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java 2008-12-08 08:34:33 UTC (rev 466)
@@ -27,6 +27,7 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Reflections;
import org.jboss.webbeans.util.Strings;
@@ -127,6 +128,7 @@
Reflections.setAndWrap(getDelegate(), instance, getValue(manager));
}
+ @SuppressWarnings("unchecked")
public T get(Object instance) {
return (T) Reflections.getAndWrap(getDelegate(), instance);
}
@@ -160,12 +162,19 @@
*
* @return A string representation
*/
+ @Override
public String toString()
{
if (toString != null)
{
return toString;
}
+ toString = "Annotated method " + Names.field2String(field);
+ return toString;
+ }
+
+ public String toDetailedString()
+ {
StringBuilder buffer = new StringBuilder();
buffer.append("AnnotatedFieldImpl:\n");
buffer.append(super.toString() + "\n");
@@ -173,8 +182,7 @@
buffer.append("Declaring class:\n");
buffer.append(declaringClass.getName() + "[ " + declaringClass.getType() + "]" + "\n");
buffer.append("Field: " + field + "\n");
- toString = buffer.toString();
- return toString;
+ return buffer.toString();
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java 2008-12-08 01:09:19 UTC (rev 465)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java 2008-12-08 08:34:33 UTC (rev 466)
@@ -21,6 +21,7 @@
import java.lang.reflect.Type;
import java.util.Arrays;
+import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Strings;
/**
@@ -147,19 +148,25 @@
*
* @return A string representation
*/
+ @Override
public String toString()
{
if (toString != null)
{
return toString;
}
+ toString = "Annotated item " + Names.type2String(getDelegate().getClass());
+ return toString;
+ }
+
+ public String toDetailedString()
+ {
StringBuilder buffer = new StringBuilder();
buffer.append("AnnotatedItemImpl:\n");
buffer.append(super.toString() + "\n");
buffer.append(Strings.collectionToString("Actual type arguments: ", Arrays.asList(getActualTypeArguments())));
buffer.append(Strings.collectionToString("Actual annotations: ", Arrays.asList(getActualAnnotations())));
- toString = buffer.toString();
- return toString;
+ return buffer.toString();
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2008-12-08 01:09:19 UTC (rev 465)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2008-12-08 08:34:33 UTC (rev 466)
@@ -32,6 +32,7 @@
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Reflections;
import org.jboss.webbeans.util.Strings;
@@ -293,12 +294,19 @@
*
* @return A string representation
*/
+ @Override
public String toString()
{
if (toString != null)
{
return toString;
}
+ toString = "Annotated method " + Names.method2String(method);
+ return toString;
+ }
+
+ public String toDetailedString()
+ {
StringBuilder buffer = new StringBuilder();
buffer.append("AnnotatedMethodImpl:\n");
buffer.append(super.toString() + "\n");
@@ -310,8 +318,7 @@
buffer.append(method.toString());
buffer.append("Property name: " + propertyName + "\n");
buffer.append(Strings.collectionToString("Parameters: ", getParameters()));
- toString = buffer.toString();
- return toString;
+ return buffer.toString();
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java 2008-12-08 01:09:19 UTC (rev 465)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java 2008-12-08 08:34:33 UTC (rev 466)
@@ -24,8 +24,8 @@
import javax.webbeans.BindingType;
import javax.webbeans.manager.Manager;
-import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedParameter;
+import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Strings;
/**
@@ -152,12 +152,19 @@
*
* @return A string representation
*/
+ @Override
public String toString()
{
if (toString != null)
{
return toString;
}
+ toString = "Annotated parameter " + Names.type2String(getDelegate().getClass());
+ return toString;
+ }
+
+ public String toDetailedString()
+ {
StringBuilder buffer = new StringBuilder();
buffer.append("AnnotatedParameterImpl:\n");
buffer.append(super.toString() + "\n");
@@ -165,8 +172,7 @@
buffer.append("Final: " + _final + "\n");
buffer.append("Static: " + _static + "\n");
buffer.append(Strings.collectionToString("Actual type arguments: ", Arrays.asList(getActualTypeArguments())));
- toString = buffer.toString();
- return toString;
+ return buffer.toString();
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java 2008-12-08 01:09:19 UTC (rev 465)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java 2008-12-08 08:34:33 UTC (rev 466)
@@ -1,10 +1,18 @@
package org.jboss.webbeans.util;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import javax.webbeans.Observes;
+
import org.jboss.webbeans.ejb.EjbMetaData;
/**
@@ -51,7 +59,7 @@
return "unknown";
}
- public static int count(Iterable<?> iterable)
+ public static int count(@Observes final Iterable<?> iterable)
{
int count = 0;
for (Iterator<?> i = iterable.iterator(); i.hasNext();)
@@ -61,4 +69,153 @@
return count;
}
+ private static String list2String(List<String> list, String delimiter)
+ {
+ StringBuilder buffer = new StringBuilder();
+ for (String item : list)
+ {
+ buffer.append(item);
+ buffer.append(delimiter);
+ }
+ return buffer.toString();
+ }
+
+ private static List<String> parseModifiers(int modifier)
+ {
+ List<String> modifiers = new ArrayList<String>();
+ if (Modifier.isPrivate(modifier))
+ {
+ modifiers.add("private");
+ }
+ if (Modifier.isProtected(modifier))
+ {
+ modifiers.add("protected");
+ }
+ if (Modifier.isPublic(modifier))
+ {
+ modifiers.add("public");
+ }
+ if (Modifier.isAbstract(modifier))
+ {
+ modifiers.add("abstract");
+ }
+ if (Modifier.isFinal(modifier))
+ {
+ modifiers.add("final");
+ }
+ if (Modifier.isNative(modifier))
+ {
+ modifiers.add("native");
+ }
+ if (Modifier.isStatic(modifier))
+ {
+ modifiers.add("static");
+ }
+ if (Modifier.isStrict(modifier))
+ {
+ modifiers.add("strict");
+ }
+ if (Modifier.isSynchronized(modifier))
+ {
+ modifiers.add("synchronized");
+ }
+ if (Modifier.isTransient(modifier))
+ {
+ modifiers.add("transient");
+ }
+ if (Modifier.isVolatile(modifier))
+ {
+ modifiers.add("volatile");
+ }
+ if (Modifier.isInterface(modifier))
+ {
+ modifiers.add("interface");
+ }
+ return modifiers;
+ }
+
+ private static String annotations2String(Annotation[] annotations)
+ {
+ StringBuilder buffer = new StringBuilder();
+ for (Annotation annotation : annotations)
+ {
+ buffer.append("@" + annotation.annotationType().getSimpleName());
+ buffer.append(" ");
+ }
+ return buffer.toString();
+ }
+
+ public static String field2String(Field field)
+ {
+ return " Field " +
+ annotations2String(field.getAnnotations()) +
+ list2String(parseModifiers(field.getModifiers()), " ") +
+ field.getName() + ";";
+ }
+
+ public static String method2String(Method method)
+ {
+ return " Method " +
+ method.getReturnType().getSimpleName() + " " +
+ annotations2String(method.getAnnotations()) +
+ list2String(parseModifiers(method.getModifiers()), " ") +
+ method.getName() + "(" +
+ parameters2String(method.getParameterTypes(), method.getParameterAnnotations()) +
+ ");";
+ }
+
+ public static String annotation2String(Annotation annotation)
+ {
+ return "Annotation " +
+ annotations2String(annotation.annotationType().getAnnotations()) +
+ annotation.annotationType().getSimpleName();
+ }
+
+ public static String constructor2String(Constructor<?> method)
+ {
+ return " Constructor " +
+ annotations2String(method.getAnnotations()) +
+ list2String(parseModifiers(method.getModifiers()), " ") +
+ method.getName() + "(" +
+ parameters2String(method.getParameterTypes(), method.getParameterAnnotations()) +
+ ");";
+ }
+
+ private static String parameters2String(Class<?>[] parameterTypes, Annotation[][] annotations)
+ {
+ StringBuilder buffer = new StringBuilder();
+ for (int i = 0; i < parameterTypes.length; i++)
+ {
+ if (i > 0)
+ {
+ buffer.append(", ");
+ }
+ buffer.append(annotations2String(annotations[i]) + type2String(parameterTypes[i]));
+ }
+ return buffer.toString();
+ }
+
+ public static String type2String(Class<?> clazz)
+ {
+ return annotations2String(clazz.getAnnotations()) + clazz.getName();
+ }
+
+ public static String class2String(Class<?> clazz) {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("Class " + type2String(clazz));
+ buffer.append("\n");
+ for (Field field : clazz.getFields())
+ {
+ buffer.append(field2String(field));
+ buffer.append("\n");
+ }
+ buffer.append("\n");
+ for (Method method : clazz.getMethods())
+ {
+ buffer.append(method2String(method));
+ buffer.append("\n");
+ }
+ return buffer.toString();
+ }
+
}
16 years, 3 months
[webbeans-commits] Webbeans SVN: r465 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util.
by webbeans-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2008-12-07 20:09:19 -0500 (Sun, 07 Dec 2008)
New Revision: 465
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java
Log:
fix broken build
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java 2008-12-08 01:07:34 UTC (rev 464)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java 2008-12-08 01:09:19 UTC (rev 465)
@@ -5,12 +5,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.jboss.webbeans.bean.EnterpriseBean;
-import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.contexts.ApplicationContext;
import org.jboss.webbeans.ejb.EjbMetaData;
-import org.jboss.webbeans.test.beans.Chicken;
-import org.jboss.webbeans.test.ejb.model.valid.Laika;
/**
* Utility class to produce friendly names e.g. for debugging
16 years, 3 months