Author: pete.muir(a)jboss.org
Date: 2008-11-13 07:06:36 -0500 (Thu, 13 Nov 2008)
New Revision: 302
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/Bootstrap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/BeanFactory.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BoostrapTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/TarantulaProducer.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/broken/Cougar.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java
Removed:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Cougar.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/util/Util.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ModelManager.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/EnterpriseBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Tests.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClientProxyTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/CommonWebBeanTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DependentContextTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InitializerMethodTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionTests.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanLifecycleTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByNameTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanLifecycleTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypesTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeTest.java
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
Log:
Add Boostrap class and basic tests
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ModelManager.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ModelManager.java 2008-11-13
10:35:56 UTC (rev 301)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ModelManager.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -5,7 +5,6 @@
import java.util.Map;
import org.jboss.webbeans.ejb.EjbMetaData;
-import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.model.AnnotationModel;
import org.jboss.webbeans.model.BindingTypeModel;
import org.jboss.webbeans.model.ScopeModel;
@@ -84,23 +83,23 @@
}
- private class EjbMetaDataMap extends ForwardingMap<AnnotatedClass<?>,
EjbMetaData<?>>
+ private class EjbMetaDataMap extends ForwardingMap<Class<?>,
EjbMetaData<?>>
{
- private Map<AnnotatedClass<?>, EjbMetaData<?>> delegate;
+ private Map<Class<?>, EjbMetaData<?>> delegate;
public EjbMetaDataMap()
{
- delegate = new HashMap<AnnotatedClass<?>, EjbMetaData<?>>();
+ delegate = new HashMap<Class<?>, EjbMetaData<?>>();
}
@Override
- protected Map<AnnotatedClass<?>, EjbMetaData<?>> delegate()
+ protected Map<Class<?>, EjbMetaData<?>> delegate()
{
return delegate;
}
- public <T> EjbMetaData<T> putIfAbsent(AnnotatedClass<T> key)
+ public <T> EjbMetaData<T> putIfAbsent(Class<T> key)
{
if (!containsKey(key))
{
@@ -142,7 +141,7 @@
return bindingTypes.putIfAbsent(bindingType);
}
- public <E> EjbMetaData<E> getEjbMetaData(AnnotatedClass<E> clazz)
+ public <T> EjbMetaData<T> getEjbMetaData(Class<T> clazz)
{
return ejbMetaDataMap.putIfAbsent(clazz);
}
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-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -66,6 +66,11 @@
}
}
+ public Set<AnnotatedMethod<Object>> getProducerMethods()
+ {
+ return getAnnotatedItem().getAnnotatedMethods(Produces.class);
+ }
+
@Override
protected void initInjectionPoints()
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -109,14 +109,14 @@
}
if (!isDefinedInXml())
{
- if
(!getManager().getModelManager().getEjbMetaData(getAnnotatedItem().getSuperclass()).isEjb())
+ if
(!getManager().getModelManager().getEjbMetaData(getAnnotatedItem().getSuperclass().getType()).isEjb())
{
throw new DefinitionException("Annotation defined specializing EJB must
have EJB superclass");
}
}
else
{
- if
(getManager().getModelManager().getEjbMetaData(getAnnotatedItem().getSuperclass()).isEjb())
+ if
(getManager().getModelManager().getEjbMetaData(getAnnotatedItem().getSuperclass().getType()).isEjb())
{
throw new DefinitionException("XML defined specializing EJB must have
annotation defined EJB implementation");
}
@@ -135,7 +135,7 @@
// >1 @Destructor
if (getEjbMetaData().getDestructorMethods().size() > 1)
{
- throw new DefinitionException("Multiple @Destructor methods not
allowed");
+ throw new DefinitionException("Multiple @Destructor methods not allowed on
" + getAnnotatedItem());
}
Modified:
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-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -40,7 +40,7 @@
StereotypeModel<?> stereotype =
manager.getModelManager().getStereotype(stereotypeAnnotation.annotationType());
if (stereotype == null)
{
- throw new NullPointerException("Stereotype " + stereotypeAnnotation
+ " not registered with container");
+ throw new IllegalStateException("Stereotype " +
stereotypeAnnotation + " not registered with container");
}
if (stereotype.getDefaultDeploymentType() != null)
{
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-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -29,8 +29,13 @@
public ProducerMethodBean(Method method, AbstractClassBean<?> declaringBean,
ManagerImpl manager)
{
+ this(new AnnotatedMethodImpl<T>(method, declaringBean.getAnnotatedItem()),
declaringBean, manager);
+ }
+
+ public ProducerMethodBean(AnnotatedMethod<T> method, AbstractClassBean<?>
declaringBean, ManagerImpl manager)
+ {
super(manager);
- this.method = new AnnotatedMethodImpl<T>(method,
declaringBean.getAnnotatedItem());
+ this.method = method;
this.declaringBean = declaringBean;
init();
}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/Bootstrap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/Bootstrap.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/Bootstrap.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -0,0 +1,54 @@
+package org.jboss.webbeans.bootstrap;
+
+import static org.jboss.webbeans.util.BeanFactory.createEnterpriseBean;
+import static org.jboss.webbeans.util.BeanFactory.createProducerMethodBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.bean.AbstractBean;
+import org.jboss.webbeans.bean.AbstractClassBean;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+
+public class Bootstrap
+{
+
+ private ManagerImpl manager;
+
+ public Bootstrap()
+ {
+ this(new ManagerImpl());
+ }
+
+ protected Bootstrap(ManagerImpl manager)
+ {
+ this.manager = manager;
+ }
+
+ public Set<AbstractBean<?, ?>> discoverBeans(Class<?>... classes)
+ {
+ Set<AbstractBean<?, ?>> beans = new HashSet<AbstractBean<?,
?>>();
+ for (Class<?> clazz : classes)
+ {
+ AbstractClassBean<?> bean;
+ if (manager.getModelManager().getEjbMetaData(clazz).isEjb())
+ {
+ bean = createEnterpriseBean(clazz, manager);
+ }
+ else
+ {
+ bean = createSimpleBean(clazz, manager);
+ }
+ beans.add(bean);
+ for (AnnotatedMethod<Object> producerMethod : bean.getProducerMethods())
+ {
+ beans.add(createProducerMethodBean(producerMethod.getType(), producerMethod,
manager, bean));
+ }
+
+ }
+ return beans;
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/Bootstrap.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/BeanFactory.java (from
rev 296, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/util/Util.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/BeanFactory.java
(rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/BeanFactory.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -0,0 +1,46 @@
+package org.jboss.webbeans.util;
+
+import java.lang.reflect.Method;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.bean.AbstractClassBean;
+import org.jboss.webbeans.bean.EnterpriseBean;
+import org.jboss.webbeans.bean.ProducerMethodBean;
+import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.bean.XmlEnterpriseBean;
+import org.jboss.webbeans.bean.XmlSimpleBean;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+
+public class BeanFactory
+{
+ public static <T> SimpleBean<T> createSimpleBean(Class<T> clazz,
ManagerImpl manager)
+ {
+ return new SimpleBean<T>(clazz, manager);
+ }
+
+ public static <T> XmlSimpleBean<T> createXmlSimpleBean(Class<T>
clazz, ManagerImpl manager)
+ {
+ return new XmlSimpleBean<T>(clazz, manager);
+ }
+
+ public static <T> EnterpriseBean<T> createEnterpriseBean(Class<T>
clazz, ManagerImpl manager)
+ {
+ return new EnterpriseBean<T>(clazz, manager);
+ }
+
+ public static <T> XmlEnterpriseBean<T>
createXmlEnterpriseBean(Class<T> clazz, ManagerImpl manager)
+ {
+ return new XmlEnterpriseBean<T>(clazz, manager);
+ }
+
+ public static <T> ProducerMethodBean<T>
createProducerMethodBean(Class<T> type, Method method, ManagerImpl manager,
AbstractClassBean<?> declaringBean)
+ {
+ return new ProducerMethodBean<T>(method, declaringBean, manager);
+ }
+
+ public static <T> ProducerMethodBean<T>
createProducerMethodBean(Class<T> type, AnnotatedMethod<T> method, ManagerImpl
manager, AbstractClassBean<?> declaringBean)
+ {
+ return new ProducerMethodBean<T>(method, declaringBean, manager);
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/BeanFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Tests.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Tests.java 2008-11-13
10:35:56 UTC (rev 301)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Tests.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -5,7 +5,7 @@
import org.jboss.webbeans.bean.ProducerMethodBean;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.test.AbstractTest;
-import org.jboss.webbeans.test.util.Util;
+import org.jboss.webbeans.util.BeanFactory;
import org.testng.annotations.Test;
public class Tests extends AbstractTest
@@ -26,11 +26,11 @@
private void setupGameGenerator() throws NoSuchMethodException
{
- SimpleBean<Game> gameBean = Util.createSimpleBean(Game.class, manager);
- SimpleBean<Generator> generatorBean =
Util.createSimpleBean(Generator.class, manager);
+ SimpleBean<Game> gameBean = BeanFactory.createSimpleBean(Game.class,
manager);
+ SimpleBean<Generator> generatorBean =
BeanFactory.createSimpleBean(Generator.class, manager);
Method method = Generator.class.getDeclaredMethod("next");
method.setAccessible(true);
- ProducerMethodBean<Integer> nextBean =
Util.createProducerMethodBean(int.class, method, manager, generatorBean);
+ ProducerMethodBean<Integer> nextBean =
BeanFactory.createProducerMethodBean(int.class, method, manager, generatorBean);
manager.addBean(gameBean);
manager.addBean(generatorBean);
@@ -65,10 +65,10 @@
private void setupTextTranslator()
{
- SimpleBean<SentenceParser> spBean =
Util.createSimpleBean(SentenceParser.class, manager);
- SimpleBean<SentenceTranslator> stBean =
Util.createSimpleBean(SentenceTranslator.class, manager);
- SimpleBean<MockSentenceTranslator> mstBean =
Util.createSimpleBean(MockSentenceTranslator.class, manager);
- SimpleBean<TextTranslator> ttBean =
Util.createSimpleBean(TextTranslator.class, manager);
+ SimpleBean<SentenceParser> spBean =
BeanFactory.createSimpleBean(SentenceParser.class, manager);
+ SimpleBean<SentenceTranslator> stBean =
BeanFactory.createSimpleBean(SentenceTranslator.class, manager);
+ SimpleBean<MockSentenceTranslator> mstBean =
BeanFactory.createSimpleBean(MockSentenceTranslator.class, manager);
+ SimpleBean<TextTranslator> ttBean =
BeanFactory.createSimpleBean(TextTranslator.class, manager);
manager.addBean(spBean);
manager.addBean(stBean);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -9,6 +9,7 @@
import javax.webbeans.Production;
import javax.webbeans.Standard;
+import org.jboss.webbeans.bootstrap.Bootstrap;
import org.jboss.webbeans.model.StereotypeModel;
import org.jboss.webbeans.test.annotations.AnimalStereotype;
import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
@@ -18,6 +19,7 @@
import org.jboss.webbeans.test.annotations.MammalStereotype;
import org.jboss.webbeans.test.annotations.RequestScopedAnimalStereotype;
import org.jboss.webbeans.test.annotations.RiverFishStereotype;
+import org.jboss.webbeans.test.mock.MockBootstrap;
import org.jboss.webbeans.test.mock.MockManagerImpl;
import org.testng.annotations.BeforeMethod;
@@ -25,12 +27,14 @@
{
protected MockManagerImpl manager;
+ protected Bootstrap bootstrap;
@BeforeMethod
public final void before()
{
manager = new MockManagerImpl();
+ bootstrap = new MockBootstrap(manager);
init();
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,7 +1,7 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createProducerMethodBean;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createProducerMethodBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import java.lang.reflect.Method;
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BoostrapTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BoostrapTest.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BoostrapTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -0,0 +1,102 @@
+package org.jboss.webbeans.test;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.webbeans.bean.AbstractBean;
+import org.jboss.webbeans.test.beans.Elephant;
+import org.jboss.webbeans.test.beans.Panther;
+import org.jboss.webbeans.test.beans.Salmon;
+import org.jboss.webbeans.test.beans.SeaBass;
+import org.jboss.webbeans.test.beans.Sole;
+import org.jboss.webbeans.test.beans.Tarantula;
+import org.jboss.webbeans.test.beans.TarantulaProducer;
+import org.jboss.webbeans.test.beans.Tiger;
+import org.jboss.webbeans.test.beans.Tuna;
+import org.jboss.webbeans.test.ejb.model.valid.Hound;
+import org.testng.annotations.Test;
+
+public class BoostrapTest extends AbstractTest
+{
+ @Test(groups="bootstrap")
+ public void testSingleSimpleBean()
+ {
+ Set<AbstractBean<?, ?>> beans = bootstrap.discoverBeans(Tuna.class);
+ assert beans.size() == 1;
+ assert beans.iterator().next().getType().equals(Tuna.class);
+ }
+
+ @Test(groups="bootstrap")
+ public void testSingleEnterpriseBean()
+ {
+ Set<AbstractBean<?, ?>> beans = bootstrap.discoverBeans(Hound.class);
+ assert beans.size() == 1;
+ assert beans.iterator().next().getType().equals(Hound.class);
+ }
+
+ @Test(groups="bootstrap")
+ public void testMultipleSimpleBean()
+ {
+ Set<AbstractBean<?, ?>> beans = bootstrap.discoverBeans(Tuna.class,
Salmon.class, SeaBass.class, Sole.class);
+ assert beans.size() == 4;
+ Set<Class<?>> classes = new HashSet<Class<?>>();
+ for (AbstractBean<?, ?> bean : beans)
+ {
+ classes.add(bean.getType());
+ }
+ assert classes.contains(Tuna.class);
+ assert classes.contains(Salmon.class);
+ assert classes.contains(SeaBass.class);
+ assert classes.contains(Sole.class);
+ }
+
+ @Test(groups="bootstrap")
+ public void testProducerMethodBean()
+ {
+ Set<AbstractBean<?, ?>> beans =
bootstrap.discoverBeans(TarantulaProducer.class);
+ assert beans.size() == 2;
+ Set<Class<?>> classes = new HashSet<Class<?>>();
+ for (AbstractBean<?, ?> bean : beans)
+ {
+ classes.add(bean.getType());
+ }
+ assert classes.contains(TarantulaProducer.class);
+ assert classes.contains(Tarantula.class);
+ }
+
+ @Test(groups="bootstrap")
+ public void testMultipleEnterpriseBean()
+ {
+ Set<AbstractBean<?, ?>> beans = bootstrap.discoverBeans(Hound.class,
Elephant.class, Panther.class, Tiger.class);
+ assert beans.size() == 4;
+ Set<Class<?>> classes = new HashSet<Class<?>>();
+ for (AbstractBean<?, ?> bean : beans)
+ {
+ classes.add(bean.getType());
+ }
+ assert classes.contains(Hound.class);
+ assert classes.contains(Elephant.class);
+ assert classes.contains(Panther.class);
+ assert classes.contains(Tiger.class);
+ }
+
+ @Test(groups="bootstrap")
+ public void testMultipleEnterpriseAndSimpleBean()
+ {
+ Set<AbstractBean<?, ?>> beans = bootstrap.discoverBeans(Hound.class,
Elephant.class, Panther.class, Tiger.class, Tuna.class, Salmon.class, SeaBass.class,
Sole.class);
+ assert beans.size() == 8;
+ Set<Class<?>> classes = new HashSet<Class<?>>();
+ for (AbstractBean<?, ?> bean : beans)
+ {
+ classes.add(bean.getType());
+ }
+ assert classes.contains(Hound.class);
+ assert classes.contains(Elephant.class);
+ assert classes.contains(Panther.class);
+ assert classes.contains(Tiger.class);
+ assert classes.contains(Tuna.class);
+ assert classes.contains(Salmon.class);
+ assert classes.contains(SeaBass.class);
+ assert classes.contains(Sole.class);
+ }
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BoostrapTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClientProxyTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClientProxyTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClientProxyTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -14,7 +14,7 @@
import org.jboss.webbeans.test.beans.Fox;
import org.jboss.webbeans.test.beans.Tuna;
import org.jboss.webbeans.test.beans.TunedTuna;
-import org.jboss.webbeans.test.util.Util;
+import org.jboss.webbeans.util.BeanFactory;
import org.testng.annotations.Test;
@SpecVersion("PDR")
@@ -25,7 +25,7 @@
@SpecAssertion(section = { "4.4", "4.8" })
public void testClientProxyUsedForNormalScope()
{
- Bean<Tuna> tunaBean = Util.createSimpleBean(Tuna.class, manager);
+ Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class, manager);
Tuna tuna = manager.getInstance(tunaBean);
assert ClientProxy.isProxy(tuna);
}
@@ -34,7 +34,7 @@
@SpecAssertion(section = { "4.4", "4.8" })
public void testClientProxyNotUsedForPseudoScope()
{
- Bean<Fox> foxBean = Util.createSimpleBean(Fox.class, manager);
+ Bean<Fox> foxBean = BeanFactory.createSimpleBean(Fox.class, manager);
Fox fox = manager.getInstance(foxBean);
assert !ClientProxy.isProxy(fox);
}
@@ -55,7 +55,7 @@
@SpecAssertion(section = "4.4")
public void testSimpleWebBeanClientProxyIsSerializable() throws IOException,
ClassNotFoundException
{
- Bean<TunedTuna> tunaBean = Util.createSimpleBean(TunedTuna.class, manager);
+ Bean<TunedTuna> tunaBean = BeanFactory.createSimpleBean(TunedTuna.class,
manager);
TunedTuna tuna = manager.getInstance(tunaBean);
assert ClientProxy.isProxy(tuna);
byte[] bytes = serializeBean(tuna);
@@ -68,7 +68,7 @@
@SpecAssertion(section = "4.4.1")
public void testInjectionPointWithUnproxyableTypeWhichResolvesToNormalScopedWebBean()
{
- Bean<FinalTuna> tunaBean = Util.createSimpleBean(FinalTuna.class, manager);
+ Bean<FinalTuna> tunaBean = BeanFactory.createSimpleBean(FinalTuna.class,
manager);
manager.addBean(tunaBean);
FinalTuna tuna = manager.getInstanceByType(FinalTuna.class);
assert false;
@@ -78,7 +78,7 @@
@SpecAssertion(section = "4.4.2")
public void testClientProxyInvocation()
{
- Bean<TunedTuna> tunaBean = Util.createSimpleBean(TunedTuna.class, manager);
+ Bean<TunedTuna> tunaBean = BeanFactory.createSimpleBean(TunedTuna.class,
manager);
manager.addBean(tunaBean);
TunedTuna tuna = manager.getInstance(tunaBean);
assert ClientProxy.isProxy(tuna);
@@ -87,7 +87,7 @@
@Test(groups = "clientProxy")
public void testProxyCreationDoesImplicitAddBean() {
- Bean<Tuna> tunaBean = Util.createSimpleBean(Tuna.class, manager);
+ Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class, manager);
Tuna tuna = manager.getInstance(tunaBean);
assert manager.getBeans().size() == 2;
}
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/CommonWebBeanTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/CommonWebBeanTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/CommonWebBeanTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,7 +1,7 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createProducerMethodBean;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createProducerMethodBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import java.lang.reflect.Method;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,6 +1,6 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DependentContextTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DependentContextTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DependentContextTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,7 +1,7 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createProducerMethodBean;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createProducerMethodBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import java.lang.reflect.Method;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,6 +1,6 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InitializerMethodTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InitializerMethodTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InitializerMethodTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,6 +1,6 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import javax.webbeans.DefinitionException;
import javax.webbeans.NonexistentMethodException;
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionTests.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionTests.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionTests.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,8 +1,8 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createProducerMethodBean;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createProducerMethodBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import javax.webbeans.ContextNotActiveException;
import javax.webbeans.DefinitionException;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,6 +1,6 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import javax.webbeans.AmbiguousDependencyException;
import javax.webbeans.manager.Bean;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,6 +1,6 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import javax.webbeans.AmbiguousDependencyException;
import javax.webbeans.AnnotationLiteral;
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,6 +1,6 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import javax.webbeans.DefinitionException;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,7 +1,7 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createProducerMethodBean;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createProducerMethodBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import java.lang.reflect.Method;
@@ -16,7 +16,7 @@
import org.jboss.webbeans.test.beans.SpiderProducer;
import org.jboss.webbeans.test.beans.Tarantula;
import org.jboss.webbeans.test.beans.Tuna;
-import org.jboss.webbeans.test.util.Util;
+import org.jboss.webbeans.util.BeanFactory;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -40,13 +40,13 @@
@Test(groups="contexts") @SpecAssertion(section="8.1")
public void testGetWithCreateFalseReturnsNull() {
- Bean<Tuna> tunaBean = Util.createSimpleBean(Tuna.class, manager);
+ Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class, manager);
assert context.get(tunaBean, false) == null;
}
@Test(groups="contexts") @SpecAssertion(section="8.1")
public void testGetWithCreateTrueReturnsBean() {
- Bean<Tuna> tunaBean = Util.createSimpleBean(Tuna.class, manager);
+ Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class, manager);
assert context.get(tunaBean, true) != null;
}
@@ -59,7 +59,7 @@
@Test(groups="contexts") @SpecAssertion(section="8.1")
public void testReturnsCorrectExistingBean() {
- Bean<Tuna> tunaBean = Util.createSimpleBean(Tuna.class, manager);
+ Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class, manager);
Tuna firstTuna = context.get(tunaBean, true);
Tuna secondTuna = context.get(tunaBean, false);
assert firstTuna == secondTuna;
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,5 +1,5 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanLifecycleTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanLifecycleTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanLifecycleTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,7 +1,7 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createProducerMethodBean;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createProducerMethodBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import java.lang.reflect.Method;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanModelTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanModelTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanModelTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,7 +1,7 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createProducerMethodBean;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createProducerMethodBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import java.lang.reflect.Method;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByNameTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByNameTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByNameTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,6 +1,6 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import javax.webbeans.manager.Bean;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,7 +1,7 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createProducerMethodBean;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createProducerMethodBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import java.lang.reflect.Method;
import java.util.Set;
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,6 +1,6 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import javax.webbeans.DefinitionException;
import javax.webbeans.Dependent;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanLifecycleTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanLifecycleTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanLifecycleTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,6 +1,6 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import javax.webbeans.manager.Bean;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,6 +1,6 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import java.lang.annotation.Annotation;
import java.util.HashMap;
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypesTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypesTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypesTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,6 +1,6 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import java.util.Arrays;
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeTest.java 2008-11-13
10:35:56 UTC (rev 301)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,6 +1,6 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.test.util.Util.createSimpleBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.test.beans.Haddock;
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Cougar.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Cougar.java 2008-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Cougar.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,31 +0,0 @@
-package org.jboss.webbeans.test.beans;
-
-import javax.ejb.Remove;
-import javax.ejb.Stateful;
-import javax.webbeans.Destructor;
-import javax.webbeans.Production;
-
-@Production
-@Stateful
-public class Cougar
-{
-
- @Remove
- public void remove()
- {
-
- }
-
- @Remove @Destructor
- public void remove1()
- {
-
- }
-
- @Remove @Destructor
- public void remove2()
- {
-
- }
-
-}
Added:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/TarantulaProducer.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/TarantulaProducer.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/TarantulaProducer.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -0,0 +1,15 @@
+package org.jboss.webbeans.test.beans;
+
+import javax.webbeans.Produces;
+
+import org.jboss.webbeans.test.annotations.Tame;
+
+public class TarantulaProducer
+{
+
+ @Produces @Tame public Tarantula produceTameTarantula()
+ {
+ return new DefangedTarantula();
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/TarantulaProducer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/broken/Cougar.java (from
rev 296, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Cougar.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/broken/Cougar.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/broken/Cougar.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -0,0 +1,31 @@
+package org.jboss.webbeans.test.beans.broken;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.webbeans.Destructor;
+import javax.webbeans.Production;
+
+@Production
+@Stateful
+public class Cougar
+{
+
+ @Remove
+ public void remove()
+ {
+
+ }
+
+ @Remove @Destructor
+ public void remove1()
+ {
+
+ }
+
+ @Remove @Destructor
+ public void remove2()
+ {
+
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/broken/Cougar.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanDeclarationTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -20,7 +20,7 @@
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.test.util.Util;
+import org.jboss.webbeans.util.BeanFactory;
import org.testng.annotations.Test;
@SpecVersion("PDR")
@@ -32,84 +32,84 @@
@SpecAssertion(section = "3.3")
public void testStatelessWithDependentScopeOK()
{
- EnterpriseBean<Giraffe> giraffe = Util.createEnterpriseBean(Giraffe.class,
manager);
+ EnterpriseBean<Giraffe> giraffe =
BeanFactory.createEnterpriseBean(Giraffe.class, manager);
}
@Test(expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3")
public void testStatelessWithRequestScopeFails()
{
- EnterpriseBean<Beagle> beagle = Util.createEnterpriseBean(Beagle.class,
manager);
+ EnterpriseBean<Beagle> beagle =
BeanFactory.createEnterpriseBean(Beagle.class, manager);
}
@Test(expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3")
public void testStatelessWithConversationScopeFails()
{
- EnterpriseBean<Boxer> boxer = Util.createEnterpriseBean(Boxer.class,
manager);
+ EnterpriseBean<Boxer> boxer = BeanFactory.createEnterpriseBean(Boxer.class,
manager);
}
@Test(expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3")
public void testStatelessWithSessionScopeFails()
{
- EnterpriseBean<Bullmastiff> boxer =
Util.createEnterpriseBean(Bullmastiff.class, manager);
+ EnterpriseBean<Bullmastiff> boxer =
BeanFactory.createEnterpriseBean(Bullmastiff.class, manager);
}
@Test(expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3")
public void testStatelessWithApplicationScopeFails()
{
- EnterpriseBean<Dachshund> dachshund =
Util.createEnterpriseBean(Dachshund.class, manager);
+ EnterpriseBean<Dachshund> dachshund =
BeanFactory.createEnterpriseBean(Dachshund.class, manager);
}
@Test
@SpecAssertion(section = "3.3")
public void testSingletonWithDependentScopeOK()
{
- EnterpriseBean<GreatDane> greatDane =
Util.createEnterpriseBean(GreatDane.class, manager);
+ EnterpriseBean<GreatDane> greatDane =
BeanFactory.createEnterpriseBean(GreatDane.class, manager);
}
@Test(expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3")
public void testSingletonWithRequestScopeFails()
{
- EnterpriseBean<Greyhound> greyhound =
Util.createEnterpriseBean(Greyhound.class, manager);
+ EnterpriseBean<Greyhound> greyhound =
BeanFactory.createEnterpriseBean(Greyhound.class, manager);
}
@Test(expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3")
public void testSingletonWithConversationScopeFails()
{
- EnterpriseBean<Husky> husky = Util.createEnterpriseBean(Husky.class,
manager);
+ EnterpriseBean<Husky> husky = BeanFactory.createEnterpriseBean(Husky.class,
manager);
}
@Test(expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3")
public void testSingletonWithSessionScopeFails()
{
- EnterpriseBean<IrishTerrier> irishTerrier =
Util.createEnterpriseBean(IrishTerrier.class, manager);
+ EnterpriseBean<IrishTerrier> irishTerrier =
BeanFactory.createEnterpriseBean(IrishTerrier.class, manager);
}
@Test
@SpecAssertion(section = "3.3")
public void testSingletonWithApplicationScopeOK()
{
- EnterpriseBean<Laika> laika = Util.createEnterpriseBean(Laika.class,
manager);
+ EnterpriseBean<Laika> laika = BeanFactory.createEnterpriseBean(Laika.class,
manager);
}
@Test(expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3")
public void testEnterpriseBeanInterceptorFails()
{
- EnterpriseBean<Pug> pug = Util.createEnterpriseBean(Pug.class, manager);
+ EnterpriseBean<Pug> pug = BeanFactory.createEnterpriseBean(Pug.class,
manager);
}
@Test(expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.3")
public void testEnterpriseBeanDecoratorFails()
{
- EnterpriseBean<Pekingese> pekingese =
Util.createEnterpriseBean(Pekingese.class, manager);
+ EnterpriseBean<Pekingese> pekingese =
BeanFactory.createEnterpriseBean(Pekingese.class, manager);
}
@Test(expectedExceptions = DefinitionException.class, groups =
{"enterpriseBeans", "stub"})
@@ -172,7 +172,7 @@
@SpecAssertion(section = "3.3.2")
public void testObjectIsInAPITypes()
{
- EnterpriseBean<Laika> laika = Util.createEnterpriseBean(Laika.class,
manager);
+ EnterpriseBean<Laika> laika = BeanFactory.createEnterpriseBean(Laika.class,
manager);
assert laika.getTypes().contains(Object.class);
}
@@ -201,7 +201,7 @@
@SpecAssertion(section = "3.3")
public void testMessageDrivenBeansNotOK()
{
- EnterpriseBean<Leopard> Leopard = Util.createEnterpriseBean(Leopard.class,
manager);
+ EnterpriseBean<Leopard> Leopard =
BeanFactory.createEnterpriseBean(Leopard.class, manager);
}
@@ -209,7 +209,7 @@
@SpecAssertion(section = "3.3.7")
public void testDefaultName()
{
- EnterpriseBean<Pitbull> pitbull = Util.createEnterpriseBean(Pitbull.class,
manager);
+ EnterpriseBean<Pitbull> pitbull =
BeanFactory.createEnterpriseBean(Pitbull.class, manager);
assert pitbull.getName().equals("pitbull");
}
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-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanRemoveMethodTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -21,7 +21,7 @@
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.test.util.Util;
+import org.jboss.webbeans.util.BeanFactory;
import org.testng.annotations.Test;
@SpecVersion("PDR")
@@ -35,7 +35,7 @@
@SpecAssertion(section = "3.3.5")
public void testStatelessEnterpriseBeansWithRemoveMethodsFails()
{
- EnterpriseBean<Armant> bean = Util.createEnterpriseBean(Armant.class,
manager);
+ EnterpriseBean<Armant> bean = BeanFactory.createEnterpriseBean(Armant.class,
manager);
}
@Test(groups={"enterpriseBeans", "removeMethod",
"lifecycle", "stub"})
@@ -43,7 +43,7 @@
public void testStatefulEnterpriseBeanRemoveMethodCalledWhenDestroyedByManager()
{
EnterpriseBeanRemoveMethodTest.tickle = false;
- EnterpriseBean<Toller> bena = Util.createEnterpriseBean(Toller.class,
manager);
+ EnterpriseBean<Toller> bena = BeanFactory.createEnterpriseBean(Toller.class,
manager);
RequestContext context = (RequestContext) manager.getContext(RequestScoped.class);
Toller instance = context.get(bena, true);
context.destroy(manager);
@@ -54,21 +54,21 @@
@SpecAssertion(section = "3.3.5")
public void testStatefulEnterpriseBeanWithoutRemoveMethodMustBeDependentScoped()
{
- EnterpriseBean<Pumi> bean = Util.createEnterpriseBean(Pumi.class, manager);
+ EnterpriseBean<Pumi> bean = BeanFactory.createEnterpriseBean(Pumi.class,
manager);
}
@Test(groups={"enterpriseBeans", "removeMethod"})
@SpecAssertion(section = "3.3.5")
public void testStatefulEnterpriseBeanWithoutRemoveMethodMustBeDependentScoped2()
{
- EnterpriseBean<WelshCorgie> bean =
Util.createEnterpriseBean(WelshCorgie.class, manager);
+ EnterpriseBean<WelshCorgie> bean =
BeanFactory.createEnterpriseBean(WelshCorgie.class, manager);
}
@Test(groups={"enterpriseBeans", "removeMethod",
"stub"}, expectedExceptions = UnremovedException.class)
@SpecAssertion(section = "3.3.5")
public void
testStatefulEnterpriseBeanWithoutRemoveMethodMustBeRemovedByApplicationBeforeManager()
{
- EnterpriseBean<Toller> bean = Util.createEnterpriseBean(Toller.class,
manager);
+ EnterpriseBean<Toller> bean = BeanFactory.createEnterpriseBean(Toller.class,
manager);
Toller instance = manager.getInstance(bean);
RequestContext context = (RequestContext) manager
.getContext(RequestScoped.class);
@@ -79,7 +79,7 @@
@SpecAssertion(section = "3.3.5")
public void testApplicationRemoveMethodCallRemovesInstanceFromContext()
{
- EnterpriseBean<Toller> bean = Util.createEnterpriseBean(Toller.class,
manager);
+ EnterpriseBean<Toller> bean = BeanFactory.createEnterpriseBean(Toller.class,
manager);
RequestContext context = (RequestContext) manager.getContext(RequestScoped.class);
Toller instance = context.get(bean, true);
instance.bye();
@@ -91,7 +91,7 @@
@SpecAssertion(section = {"3.3.5.1", "3.3.5.2"})
public void
testEnterpriseBeanWithoutDestructorUsesNoArgsRemoveAnnotatedMethodAsRemoveMethod()
{
- EnterpriseBean<Toller> bean = Util.createEnterpriseBean(Toller.class,
manager);
+ EnterpriseBean<Toller> bean = BeanFactory.createEnterpriseBean(Toller.class,
manager);
assert "bye".equals(bean.getRemoveMethod().getName());
}
@@ -99,7 +99,7 @@
@SpecAssertion(section = {"3.3.5.1", "3.3.5.2"})
public void
testEnterpriseBeanWithoutDestructorAndNoArgsRemoveAnnotatedMethodHasNoRemoveMethod()
{
- EnterpriseBean<Koirus> bean = Util.createEnterpriseBean(Koirus.class,
manager);
+ EnterpriseBean<Koirus> bean = BeanFactory.createEnterpriseBean(Koirus.class,
manager);
assert bean.getRemoveMethod() == null;
}
@@ -107,49 +107,49 @@
@SpecAssertion(section = {"3.3.5.1", "3.3.5.2"})
public void testMultipleDestructorAnnotatedMethodsFails()
{
- EnterpriseBean<Rottweiler> bean = Util.createEnterpriseBean(Rottweiler.class,
manager);
+ EnterpriseBean<Rottweiler> bean =
BeanFactory.createEnterpriseBean(Rottweiler.class, manager);
}
@Test(groups={"enterpriseBeans", "removeMethod"},
expectedExceptions = DefinitionException.class)
@SpecAssertion(section = {"3.3.5.1", "3.3.5.2"})
public void testDestructorAnnotatedMethodNotRemoveAnnotatedFails()
{
- EnterpriseBean<RussellTerrier> bean =
Util.createEnterpriseBean(RussellTerrier.class, manager);
+ EnterpriseBean<RussellTerrier> bean =
BeanFactory.createEnterpriseBean(RussellTerrier.class, manager);
}
@Test(groups={"enterpriseBeans", "removeMethod"},
expectedExceptions = DefinitionException.class)
@SpecAssertion(section = {"3.3.5.1", "3.3.5.2"})
public void testRemoveMethodIsInitializerFails()
{
- EnterpriseBean<Saluki> bean = Util.createEnterpriseBean(Saluki.class,
manager);
+ EnterpriseBean<Saluki> bean = BeanFactory.createEnterpriseBean(Saluki.class,
manager);
}
@Test(groups={"enterpriseBeans", "removeMethod"},
expectedExceptions = DefinitionException.class)
@SpecAssertion(section = {"3.3.5.1", "3.3.5.2"})
public void testRemoveMethodIsProducerFails()
{
- EnterpriseBean<Spitz> bean = Util.createEnterpriseBean(Spitz.class,
manager);
+ EnterpriseBean<Spitz> bean = BeanFactory.createEnterpriseBean(Spitz.class,
manager);
}
@Test(groups={"enterpriseBeans", "removeMethod"},
expectedExceptions = DefinitionException.class)
@SpecAssertion(section = {"3.3.5.1", "3.3.5.2"})
public void testRemoveMethodWithDisposesParameterFails()
{
- EnterpriseBean<GoldenRetriever> bean =
Util.createEnterpriseBean(GoldenRetriever.class, manager);
+ EnterpriseBean<GoldenRetriever> bean =
BeanFactory.createEnterpriseBean(GoldenRetriever.class, manager);
}
@Test(groups={"enterpriseBeans", "removeMethod"},
expectedExceptions = DefinitionException.class)
@SpecAssertion(section = {"3.3.5.1", "3.3.5.2"})
public void testRemoveMethodWithObservesParameterFails()
{
- EnterpriseBean<JackRussellTerrier> bean =
Util.createEnterpriseBean(JackRussellTerrier.class, manager);
+ EnterpriseBean<JackRussellTerrier> bean =
BeanFactory.createEnterpriseBean(JackRussellTerrier.class, manager);
}
@Test(groups={"enterpriseBeans", "removeMethod"},
expectedExceptions = DefinitionException.class)
@SpecAssertion(section = {"3.3.5.1", "3.3.5.2"})
public void testMultipleRemoveAnnotationsButNoDestructorFails()
{
- EnterpriseBean<Poodle> bean = Util.createEnterpriseBean(Poodle.class,
manager);
+ EnterpriseBean<Poodle> bean = BeanFactory.createEnterpriseBean(Poodle.class,
manager);
}
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-11-13
10:35:56 UTC (rev 301)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/model/EnterpriseBeanSpecializationTest.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -10,7 +10,7 @@
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.test.util.Util;
+import org.jboss.webbeans.util.BeanFactory;
import org.testng.annotations.Test;
@SpecVersion("PDR")
@@ -21,8 +21,8 @@
@SpecAssertion(section = "3.3.6")
public void testSpecializingBeanInheritsBindingTypes()
{
- EnterpriseBean<Hound> hound = Util.createEnterpriseBean(Hound.class,
manager);
- EnterpriseBean<HoundOfBaskerville> houndOfBaskerville =
Util.createEnterpriseBean(HoundOfBaskerville.class, manager);
+ EnterpriseBean<Hound> hound = BeanFactory.createEnterpriseBean(Hound.class,
manager);
+ EnterpriseBean<HoundOfBaskerville> houndOfBaskerville =
BeanFactory.createEnterpriseBean(HoundOfBaskerville.class, manager);
assert compareBindingTypesOK(hound, houndOfBaskerville);
}
@@ -45,7 +45,7 @@
@SpecAssertion(section = "3.3.6")
public void testSpecializingBeanInheritsNameIfAny()
{
- EnterpriseBean<HoundOfBaskerville> houndOfBaskerville =
Util.createEnterpriseBean(HoundOfBaskerville.class, manager);
+ EnterpriseBean<HoundOfBaskerville> houndOfBaskerville =
BeanFactory.createEnterpriseBean(HoundOfBaskerville.class, manager);
assert houndOfBaskerville.getName().equals("Pongo");
}
@@ -82,7 +82,7 @@
@SpecAssertion(section = "3.3.6")
public void
testAnnotationDefinedSpecializingEnterpriseBeanNotDirectlyExtendingAnnotationDefinedEnterpriseBeanFails()
{
- EnterpriseBean<GreaterDane> greaterDane =
Util.createEnterpriseBean(GreaterDane.class, manager);
+ EnterpriseBean<GreaterDane> greaterDane =
BeanFactory.createEnterpriseBean(GreaterDane.class, manager);
}
@Test(expectedExceptions=DefinitionException.class, groups={"stub",
"specialization", "enterpriseBeans"})
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.test.mock;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.bootstrap.Bootstrap;
+
+public class MockBootstrap extends Bootstrap
+{
+
+ public MockBootstrap(ManagerImpl manager)
+ {
+ super(manager);
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/util/Util.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/util/Util.java 2008-11-13
10:35:56 UTC (rev 301)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/util/Util.java 2008-11-13
12:06:36 UTC (rev 302)
@@ -1,40 +0,0 @@
-package org.jboss.webbeans.test.util;
-
-import java.lang.reflect.Method;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.bean.AbstractClassBean;
-import org.jboss.webbeans.bean.EnterpriseBean;
-import org.jboss.webbeans.bean.ProducerMethodBean;
-import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.bean.XmlEnterpriseBean;
-import org.jboss.webbeans.bean.XmlSimpleBean;
-
-public class Util
-{
- public static <T> SimpleBean<T> createSimpleBean(Class<T> clazz,
ManagerImpl manager)
- {
- return new SimpleBean<T>(clazz, manager);
- }
-
- public static <T> XmlSimpleBean<T> createXmlSimpleBean(Class<T>
clazz, ManagerImpl manager)
- {
- return new XmlSimpleBean<T>(clazz, manager);
- }
-
- public static <T> EnterpriseBean<T> createEnterpriseBean(Class<T>
clazz, ManagerImpl manager)
- {
- return new EnterpriseBean<T>(clazz, manager);
- }
-
- public static <T> XmlEnterpriseBean<T>
createXmlEnterpriseBean(Class<T> clazz, ManagerImpl manager)
- {
- return new XmlEnterpriseBean<T>(clazz, manager);
- }
-
- public static <T> ProducerMethodBean<T>
createProducerMethodBean(Class<T> type, Method method, ManagerImpl manager,
AbstractClassBean<?> declaringBean)
- {
- return new ProducerMethodBean<T>(method, declaringBean, manager);
- }
-
-}