Author: pete.muir(a)jboss.org
Date: 2009-01-07 08:18:31 -0500 (Wed, 07 Jan 2009)
New Revision: 806
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanFactory.java
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/EventBean.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/NewSimpleBean.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/bean/SimpleBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.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/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/ManagerTest.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/ProducerFieldBeanLifecycleTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerFieldBeanModelTest.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/beans/AuroraFinch.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/OrangeCheekedWaxbill.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/StarFinch.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/DependentContextTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/PassivatingContextTest.java
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/EnterpriseBeanLifecycleTest.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/newbean/NewBeanTest.java
Log:
Remove BeanFactory and clean up methods
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanFactory.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanFactory.java 2009-01-07
11:49:47 UTC (rev 805)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanFactory.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,165 +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.reflect.Field;
-import java.lang.reflect.Method;
-
-import javax.webbeans.Event;
-import javax.webbeans.Instance;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.event.ObserverImpl;
-import org.jboss.webbeans.introspector.AnnotatedField;
-import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.introspector.AnnotatedMethod;
-
-/**
- * Utility class for creating Web Beans
- *
- * @author Pete Muir
- */
-public class BeanFactory
-{
- /**
- * Creates a simple, annotation defined Web Bean
- *
- * @param <T> The type
- * @param clazz The class
- * @param manager the current manager
- * @return A Web Bean
- */
- public static <T> SimpleBean<T> createSimpleBean(Class<T> clazz,
ManagerImpl manager)
- {
- return new SimpleBean<T>(clazz, manager);
- }
-
- /**
- * Creates a simple, annotation defined Enterprise Web Bean
- *
- * @param <T> The type
- * @param clazz The class
- * @param manager the current manager
- * @return An Enterprise Web Bean
- */
- public static <T> EnterpriseBean<T> createEnterpriseBean(Class<T>
clazz, ManagerImpl manager)
- {
- return new EnterpriseBean<T>(clazz, manager);
- }
-
- /**
- * Creates a producer method Web Bean
- *
- * @param <T> The type
- * @param type The class
- * @param method The underlying method
- * @param declaringBean The declaring bean abstraction
- * @param manager the current manager
- * @return A producer Web Bean
- */
- public static <T> ProducerMethodBean<T>
createProducerMethodBean(Class<T> type, Method method, AbstractClassBean<?>
declaringBean, ManagerImpl manager)
- {
- return new ProducerMethodBean<T>(method, declaringBean, manager);
- }
-
- /**
- * Creates a producer field Web Bean
- *
- * @param <T> The type
- * @param type The class
- * @param field The underlying field
- * @param declaringBean The declaring bean abstraction
- * @param manager the current manager
- * @return A producer Web Bean
- */
- public static <T> ProducerFieldBean<T>
createProducerFieldBean(Class<T> type, Field field, AbstractClassBean<?>
declaringBean, ManagerImpl manager)
- {
- return new ProducerFieldBean<T>(field, declaringBean, manager);
- }
-
- /**
- * Creates a producer field Web Bean
- *
- * @param field The underlying method abstraction
- * @param declaringBean The declaring bean abstraction
- * @param manager the current manager
- * @return A producer Web Bean
- */
- public static <T> ProducerFieldBean<T>
createProducerFieldBean(AnnotatedField<T> field, AbstractClassBean<?>
declaringBean, ManagerImpl manager)
- {
- return new ProducerFieldBean<T>(field, declaringBean, manager);
- }
-
- /**
- * Creates a producer method Web Bean
- *
- * @param method The underlying method abstraction
- * @param declaringBean The declaring bean abstraction
- * @param manager the current manager
- * @return A producer Web Bean
- */
- public static <T> ProducerMethodBean<T>
createProducerMethodBean(AnnotatedMethod<T> method, AbstractClassBean<?>
declaringBean, ManagerImpl manager)
- {
- return new ProducerMethodBean<T>(method, declaringBean, manager);
- }
-
- /**
- * Creates an event Web Bean
- *
- * @param field The event injection point abstraction
- * @param manager the current manager
- * @param declaringBean The declaring bean abstraction
- * @return An event Web Bean
- */
- public static <T, S> EventBean<T, S>
createEventBean(AnnotatedItem<Event<T>, S> field, ManagerImpl manager)
- {
- return new EventBean<T, S>(field, manager);
- }
-
- /**
- * Creates an instance Web Bean
- *
- * @param field The instance injection point abstraction
- * @param manager the current manager
- * @param declaringBean The declaring bean abstraction
- * @return An event Web Bean
- */
- public static <T, S> InstanceBean<T, S>
createInstanceBean(AnnotatedItem<Instance<T>, S> field, ManagerImpl manager)
- {
- return new InstanceBean<T, S>(field, manager);
- }
-
- /**
- * Creates an observer
- *
- * @param method The observer method abstraction
- * @param declaringBean The declaring bean
- * @param manager The Web Beans manager
- * @return An observer implementation built from the method abstraction
- */
- public static <T> ObserverImpl<T>
createObserver(AnnotatedMethod<Object> method, AbstractClassBean<?>
declaringBean, ManagerImpl manager)
- {
- return new ObserverImpl<T>(method, declaringBean, manager);
- }
-
- public static <T> NewSimpleBean<T> createNewSimpleBean(Class<T>
type, ManagerImpl manager)
- {
- return new NewSimpleBean<T>(type, manager);
- }
-
-}
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -62,12 +62,25 @@
private AnnotatedMethod<?> removeMethod;
/**
+ * Creates a simple, annotation defined Enterprise Web Bean
+ *
+ * @param <T> The type
+ * @param clazz The class
+ * @param manager the current manager
+ * @return An Enterprise Web Bean
+ */
+ public static <T> EnterpriseBean<T> of(Class<T> clazz, ManagerImpl
manager)
+ {
+ return new EnterpriseBean<T>(clazz, manager);
+ }
+
+ /**
* Constructor
*
* @param type The type of the bean
* @param manager The Web Beans manager
*/
- public EnterpriseBean(Class<T> type, ManagerImpl manager)
+ protected EnterpriseBean(Class<T> type, ManagerImpl manager)
{
super(type, manager);
init();
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 2009-01-07
11:49:47 UTC (rev 805)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -42,12 +42,25 @@
{
/**
+ * Creates an event Web Bean
+ *
+ * @param field The event injection point abstraction
+ * @param manager the current manager
+ * @param declaringBean The declaring bean abstraction
+ * @return An event Web Bean
+ */
+ public static <T, S> EventBean<T, S> of(AnnotatedItem<Event<T>,
S> field, ManagerImpl manager)
+ {
+ return new EventBean<T, S>(field, manager);
+ }
+
+ /**
* Constructor
*
* @param field The underlying field abstraction
* @param manager The Web Beans manager
*/
- public EventBean(AnnotatedItem<Event<T>, S> field, ManagerImpl manager)
+ protected EventBean(AnnotatedItem<Event<T>, S> field, ManagerImpl
manager)
{
super(field, manager);
}
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InstanceBean.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -35,6 +35,19 @@
*/
public class InstanceBean<T, S> extends AbstractFacadeBean<Instance<T>, S,
T>
{
+
+ /**
+ * Creates an instance Web Bean
+ *
+ * @param field The instance injection point abstraction
+ * @param manager the current manager
+ * @param declaringBean The declaring bean abstraction
+ * @return An event Web Bean
+ */
+ public static <T, S> InstanceBean<T, S>
of(AnnotatedItem<Instance<T>, S> field, ManagerImpl manager)
+ {
+ return new InstanceBean<T, S>(field, manager);
+ }
/**
* Constructor
@@ -42,7 +55,7 @@
* @param field The underlying fields
* @param manager The Web Beans manager
*/
- public InstanceBean(AnnotatedItem<Instance<T>, S> field, ManagerImpl
manager)
+ protected InstanceBean(AnnotatedItem<Instance<T>, S> field, ManagerImpl
manager)
{
super(field, manager);
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -20,8 +20,13 @@
{
private static Set<Annotation> NEW_BINDING_SET = new
HashSet<Annotation>(Arrays.asList(new NewBinding()));
- public NewSimpleBean(Class<T> type, ManagerImpl manager)
+ public static <T> NewSimpleBean<T> of(Class<T> clazz, ManagerImpl
manager)
{
+ return new NewSimpleBean<T>(clazz, manager);
+ }
+
+ protected NewSimpleBean(Class<T> type, ManagerImpl manager)
+ {
super(type, manager);
}
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -36,18 +36,32 @@
{
// The underlying field
private AnnotatedField<T> field;
-
+
/**
- * Constructor
+ * Creates a producer field Web Bean
*
- * @param method The producer field
- * @param declaringBean The declaring bean instance
- * @param manager The Web Beans manager
+ * @param field The underlying method abstraction
+ * @param declaringBean The declaring bean abstraction
+ * @param manager the current manager
+ * @return A producer Web Bean
*/
- public ProducerFieldBean(Field field, AbstractClassBean<?> declaringBean,
ManagerImpl manager)
+ public static <T> ProducerFieldBean<T> of(AnnotatedField<T> field,
AbstractClassBean<?> declaringBean, ManagerImpl manager)
{
- this(new AnnotatedFieldImpl<T>(field, declaringBean.getAnnotatedItem()),
declaringBean, manager);
+ return new ProducerFieldBean<T>(field, declaringBean, manager);
}
+
+ /**
+ * Creates a producer field Web Bean
+ *
+ * @param field The underlying method abstraction
+ * @param declaringBean The declaring bean abstraction
+ * @param manager the current manager
+ * @return A producer Web Bean
+ */
+ public static <T> ProducerFieldBean<T> of(Field field,
AbstractClassBean<?> declaringBean, ManagerImpl manager)
+ {
+ return new ProducerFieldBean<T>(new AnnotatedFieldImpl<T>(field,
declaringBean.getAnnotatedItem()), declaringBean, manager);
+ }
/**
* Constructor
@@ -56,7 +70,7 @@
* @param declaringBean The declaring bean
* @param manager The Web Beans manager
*/
- public ProducerFieldBean(AnnotatedField<T> field, AbstractClassBean<?>
declaringBean, ManagerImpl manager)
+ protected ProducerFieldBean(AnnotatedField<T> field, AbstractClassBean<?>
declaringBean, ManagerImpl manager)
{
super(declaringBean, manager);
this.field = field;
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -47,17 +47,24 @@
private AnnotatedMethod<?> disposalMethod;
+
/**
- * Constructor
+ * Creates a producer method Web Bean
*
- * @param method The producer method
- * @param declaringBean The declaring bean instance
- * @param manager The Web Beans manager
+ * @param method The underlying method abstraction
+ * @param declaringBean The declaring bean abstraction
+ * @param manager the current manager
+ * @return A producer Web Bean
*/
- public ProducerMethodBean(Method method, AbstractClassBean<?> declaringBean,
ManagerImpl manager)
+ public static <T> ProducerMethodBean<T> of(AnnotatedMethod<T>
method, AbstractClassBean<?> declaringBean, ManagerImpl manager)
{
- this(new AnnotatedMethodImpl<T>(method, declaringBean.getAnnotatedItem()),
declaringBean, manager);
+ return new ProducerMethodBean<T>(method, declaringBean, manager);
}
+
+ public static <T> ProducerMethodBean<T> of(Method method,
SimpleBean<?> declaringBean, ManagerImpl manager)
+ {
+ return of(new AnnotatedMethodImpl<T>(method,
declaringBean.getAnnotatedItem()), declaringBean, manager);
+ }
/**
* Constructor
@@ -66,7 +73,7 @@
* @param declaringBean The declaring bean
* @param manager The Web Beans manager
*/
- public ProducerMethodBean(AnnotatedMethod<T> method, AbstractClassBean<?>
declaringBean, ManagerImpl manager)
+ protected ProducerMethodBean(AnnotatedMethod<T> method,
AbstractClassBean<?> declaringBean, ManagerImpl manager)
{
super(declaringBean, manager);
this.method = method;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-01-07
11:49:47 UTC (rev 805)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -60,6 +60,19 @@
private AnnotatedMethod<Object> postConstruct;
// The pre-destroy method
private AnnotatedMethod<Object> preDestroy;
+
+ /**
+ * Creates a simple, annotation defined Web Bean
+ *
+ * @param <T> The type
+ * @param clazz The class
+ * @param manager the current manager
+ * @return A Web Bean
+ */
+ public static <T> SimpleBean<T> of(Class<T> clazz, ManagerImpl
manager)
+ {
+ return new SimpleBean<T>(clazz, manager);
+ }
/**
* Constructor
@@ -67,7 +80,7 @@
* @param type The type of the bean
* @param manager The Web Beans manager
*/
- public SimpleBean(Class<T> type, ManagerImpl manager)
+ protected SimpleBean(Class<T> type, ManagerImpl manager)
{
super(type, manager);
init();
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -17,8 +17,6 @@
package org.jboss.webbeans.bootstrap;
-import static org.jboss.webbeans.bean.BeanFactory.*;
-
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
@@ -41,7 +39,7 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.bean.AbstractBean;
import org.jboss.webbeans.bean.AbstractClassBean;
-import org.jboss.webbeans.bean.BeanFactory;
+import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.bean.EventBean;
import org.jboss.webbeans.bean.InstanceBean;
import org.jboss.webbeans.bean.NewSimpleBean;
@@ -73,6 +71,40 @@
*/
public abstract class WebBeansBootstrap
{
+
+ private static class ManagerBean extends SimpleBean<ManagerImpl>
+ {
+
+ public static final SimpleBean<ManagerImpl> of(ManagerImpl manager)
+ {
+ return new ManagerBean(ManagerImpl.class, manager);
+ }
+
+ protected ManagerBean(Class<ManagerImpl> type, ManagerImpl manager)
+ {
+ super(type, manager);
+ }
+
+ @Override
+ protected void initConstructor()
+ {
+ // No - op, no constructor needed
+ }
+
+ @Override
+ protected void initInjectionPoints()
+ {
+ injectionPoints = Collections.emptySet();
+ }
+
+ @Override
+ public ManagerImpl create()
+ {
+ return manager;
+ }
+
+ }
+
// The log provider
private static LogProvider log = Logging.getLogProvider(WebBeansBootstrap.class);
@@ -160,7 +192,7 @@
}
else
{
- NewSimpleBean<?> newSimpleBean =
createNewSimpleBean(injectionPoint.getType(), manager);
+ NewSimpleBean<?> newSimpleBean =
NewSimpleBean.of(injectionPoint.getType(), manager);
newBeans.add(newSimpleBean);
log.info("Web Bean: " + newSimpleBean);
}
@@ -177,30 +209,8 @@
protected Set<AbstractBean<?, ?>> createStandardBeans()
{
Set<AbstractBean<?, ?>> beans = new HashSet<AbstractBean<?,
?>>();
- createBean(BeanFactory.createSimpleBean(Transaction.class, getManager()), beans);
- final ManagerImpl managerImpl = getManager();
- createBean(new SimpleBean<ManagerImpl>(ManagerImpl.class, getManager())
- {
-
- @Override
- protected void initConstructor()
- {
- // No - op, no constructor needed
- }
-
- @Override
- protected void initInjectionPoints()
- {
- injectionPoints = Collections.emptySet();
- }
-
- @Override
- public ManagerImpl create()
- {
- return managerImpl;
- }
-
- }, beans);
+ createBean(SimpleBean.of(Transaction.class, manager), beans);
+ createBean(ManagerBean.of(getManager()), beans);
return beans;
}
@@ -222,11 +232,11 @@
{
if (getManager().getEjbDescriptorCache().containsKey(clazz))
{
- createBean(createEnterpriseBean(clazz, getManager()), beans);
+ createBean(EnterpriseBean.of(clazz, getManager()), beans);
}
else if (isTypeSimpleWebBean(clazz))
{
- createBean(createSimpleBean(clazz, getManager()), beans);
+ createBean(SimpleBean.of(clazz, manager), beans);
}
}
return beans;
@@ -248,7 +258,7 @@
getManager().getResolver().addInjectionPoints(bean.getInjectionPoints());
for (AnnotatedMethod<Object> producerMethod : bean.getProducerMethods())
{
- ProducerMethodBean<?> producerMethodBean =
createProducerMethodBean(producerMethod, bean, getManager());
+ ProducerMethodBean<?> producerMethodBean =
ProducerMethodBean.of(producerMethod, bean, getManager());
beans.add(producerMethodBean);
getManager().getResolver().addInjectionPoints(producerMethodBean.getInjectionPoints());
registerEvents(producerMethodBean.getInjectionPoints(), beans);
@@ -256,7 +266,7 @@
}
for (AnnotatedField<Object> producerField : bean.getProducerFields())
{
- ProducerFieldBean<?> producerFieldBean =
createProducerFieldBean(producerField, bean, getManager());
+ ProducerFieldBean<?> producerFieldBean =
ProducerFieldBean.of(producerField, bean, getManager());
beans.add(producerFieldBean);
log.info("Web Bean: " + producerFieldBean);
}
@@ -268,14 +278,14 @@
}
if (injectionPoint.isAnnotationPresent(Obtains.class))
{
- InstanceBean<Object, Field> instanceBean =
createInstanceBean(injectionPoint, getManager());
+ InstanceBean<Object, Field> instanceBean =
InstanceBean.of(injectionPoint, getManager());
beans.add(instanceBean);
log.info("Web Bean: " + instanceBean);
}
}
for (AnnotatedMethod<Object> observerMethod : bean.getObserverMethods())
{
- ObserverImpl<?> observer = createObserver(observerMethod, bean,
getManager());
+ ObserverImpl<?> observer = ObserverImpl.of(observerMethod, bean,
getManager());
if (observerMethod.getAnnotatedParameters(Observes.class).size() == 1)
{
registerObserver(observer,
observerMethod.getAnnotatedParameters(Observes.class).get(0).getType(),
observerMethod.getAnnotatedParameters(Observes.class).get(0).getBindingTypesAsArray());
@@ -359,7 +369,7 @@
{
if (injectionPoint.isAnnotationPresent(Fires.class))
{
- EventBean<Object, Method> eventBean = createEventBean(injectionPoint,
getManager());
+ EventBean<Object, Method> eventBean = EventBean.of(injectionPoint,
getManager());
beans.add(eventBean);
log.info("Web Bean: " + eventBean);
}
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -40,6 +40,7 @@
import javax.webbeans.manager.Bean;
import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.bean.AbstractClassBean;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.transaction.UserTransaction;
@@ -73,8 +74,20 @@
private boolean conditional;
private ManagerImpl manager;
-
/**
+ * Creates an observer
+ *
+ * @param method The observer method abstraction
+ * @param declaringBean The declaring bean
+ * @param manager The Web Beans manager
+ * @return An observer implementation built from the method abstraction
+ */
+ public static <T> ObserverImpl<T> of(AnnotatedMethod<Object> method,
AbstractClassBean<?> declaringBean, ManagerImpl manager)
+ {
+ return new ObserverImpl<T>(method, declaringBean, manager);
+ }
+
+ /**
* Creates an Observer which describes and encapsulates an observer method
* (8.5).
*
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 2009-01-07
11:49:47 UTC (rev 805)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Tests.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -6,7 +6,6 @@
import javax.webbeans.Production;
import javax.webbeans.Standard;
-import org.jboss.webbeans.bean.BeanFactory;
import org.jboss.webbeans.bean.ProducerMethodBean;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.context.DependentContext;
@@ -39,11 +38,11 @@
private void setupGameGenerator() throws NoSuchMethodException
{
- SimpleBean<Game> gameBean = BeanFactory.createSimpleBean(Game.class,
manager);
- SimpleBean<Generator> generatorBean =
BeanFactory.createSimpleBean(Generator.class, manager);
+ SimpleBean<Game> gameBean = SimpleBean.of(Game.class, manager);
+ SimpleBean<Generator> generatorBean = SimpleBean.of(Generator.class,
manager);
Method method = Generator.class.getDeclaredMethod("next");
method.setAccessible(true);
- ProducerMethodBean<Integer> nextBean =
BeanFactory.createProducerMethodBean(int.class, method, generatorBean, manager);
+ ProducerMethodBean<Integer> nextBean = ProducerMethodBean.of(method,
generatorBean, manager);
manager.addBean(gameBean);
manager.addBean(generatorBean);
@@ -94,10 +93,10 @@
private void setupTextTranslator()
{
- 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);
+ SimpleBean<SentenceParser> spBean = SimpleBean.of(SentenceParser.class,
manager);
+ SimpleBean<SentenceTranslator> stBean =
SimpleBean.of(SentenceTranslator.class, manager);
+ SimpleBean<MockSentenceTranslator> mstBean =
SimpleBean.of(MockSentenceTranslator.class, manager);
+ SimpleBean<TextTranslator> ttBean = SimpleBean.of(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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -13,7 +13,8 @@
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.bean.AbstractClassBean;
-import org.jboss.webbeans.bean.BeanFactory;
+import org.jboss.webbeans.bean.EnterpriseBean;
+import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
import org.jboss.webbeans.test.annotations.HornedAnimalDeploymentType;
import org.jboss.webbeans.test.mock.MockBootstrap;
@@ -42,11 +43,11 @@
AbstractClassBean<T> bean = null;
if (CurrentManager.rootManager().getEjbDescriptorCache().containsKey(clazz))
{
- bean = BeanFactory.createEnterpriseBean(clazz, manager);
+ bean = EnterpriseBean.of(clazz, manager);
}
else
{
- bean = BeanFactory.createSimpleBean(clazz, manager);
+ bean = SimpleBean.of(clazz, manager);
}
CurrentManager.rootManager().addBean(bean);
return bean;
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,8 +1,5 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createProducerMethodBean;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import java.lang.reflect.Method;
import javax.webbeans.Current;
@@ -31,7 +28,7 @@
@Test @SpecAssertion(section={"2.3.3", "2.3.1"})
public void testDefaultBindingTypeDeclaredInJava()
{
- SimpleBean<Order> order = createSimpleBean(Order.class, manager);
+ SimpleBean<Order> order = SimpleBean.of(Order.class, manager);
assert order.getBindingTypes().size() == 1;
order.getBindingTypes().iterator().next().annotationType().equals(Current.class);
}
@@ -58,7 +55,7 @@
@Test @SpecAssertion(section="2.3.3")
public void testBindingTypesDeclaredInJava()
{
- SimpleBean<Cat> cat = createSimpleBean(Cat.class, manager);
+ SimpleBean<Cat> cat = SimpleBean.of(Cat.class, manager);
assert cat.getBindingTypes().size() == 1;
assert Reflections.annotationSetMatches(cat.getBindingTypes(), Synchronous.class);
}
@@ -66,7 +63,7 @@
@Test @SpecAssertion(section="2.3.3")
public void testMultipleBindingTypes()
{
- SimpleBean<?> model = createSimpleBean(Cod.class, manager);
+ SimpleBean<?> model = SimpleBean.of(Cod.class, manager);
assert model.getBindingTypes().size() == 2;
}
@@ -111,7 +108,7 @@
@Test(groups={"stub", "webbeansxml"})
@SpecAssertion(section={"2.3.4", "2.3.1"})
public void testDefaultBindingTypeDeclaredInXml()
{
- SimpleBean<?> model = createSimpleBean(Tuna.class, manager);
+ SimpleBean<?> model = SimpleBean.of(Tuna.class, manager);
assert model.getBindingTypes().size() == 1;
assert model.getBindingTypes().contains(new CurrentBinding());
assert false;
@@ -122,11 +119,11 @@
@Test(groups={"injection", "producerMethod"})
@SpecAssertion(section="2.3.5")
public void testFieldInjectedFromProducerMethod() throws Exception
{
- SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class, manager);
+ SimpleBean<SpiderProducer> spiderProducer = SimpleBean.of(SpiderProducer.class,
manager);
manager.addBean(spiderProducer);
Method method = SpiderProducer.class.getMethod("produceTameTarantula");
- manager.addBean(createProducerMethodBean(Tarantula.class, method, spiderProducer,
manager));
- Barn barn = createSimpleBean(Barn.class, manager).create();
+ manager.addBean(ProducerMethodBean.of(method, spiderProducer, manager));
+ Barn barn = SimpleBean.of(Barn.class, manager).create();
assert barn.petSpider != null;
assert barn.petSpider instanceof DefangedTarantula;
}
@@ -146,12 +143,12 @@
@Test(groups={"injection", "producerMethod"})
public void testMethodWithBindingAnnotationsOnParametersAreInjected() throws
Exception
{
- SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class, manager);
+ SimpleBean<SpiderProducer> spiderProducer =
SimpleBean.of(SpiderProducer.class, manager);
manager.addBean(spiderProducer);
Method method = SpiderProducer.class.getMethod("produceTameTarantula");
- manager.addBean(createProducerMethodBean(Tarantula.class, method, spiderProducer,
manager));
+ manager.addBean(ProducerMethodBean.of(method, spiderProducer, manager));
method = SpiderProducer.class.getMethod("produceSpiderFromInjection",
Tarantula.class);
- ProducerMethodBean<Spider> spiderBean =
createProducerMethodBean(Spider.class, method, spiderProducer, manager);
+ ProducerMethodBean<Spider> spiderBean = ProducerMethodBean.of(method,
spiderProducer, manager);
Spider spider = spiderBean.create();
assert spider != null;
assert spider instanceof DefangedTarantula;
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClientProxyTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -6,7 +6,7 @@
import javax.webbeans.UnproxyableDependencyException;
import javax.webbeans.manager.Bean;
-import org.jboss.webbeans.bean.BeanFactory;
+import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.test.beans.Fox;
import org.jboss.webbeans.test.beans.Tuna;
@@ -23,7 +23,7 @@
@SpecAssertion(section = { "5.4" })
public void testClientProxyUsedForNormalScope()
{
- Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class, manager);
+ Bean<Tuna> tunaBean = SimpleBean.of(Tuna.class, manager);
manager.addBean(tunaBean);
Tuna tuna = manager.getInstance(tunaBean);
assert Reflections.isProxy(tuna);
@@ -33,7 +33,7 @@
@SpecAssertion(section = { "5.4" })
public void testClientProxyNotUsedForPseudoScope()
{
- Bean<Fox> foxBean = BeanFactory.createSimpleBean(Fox.class, manager);
+ Bean<Fox> foxBean = SimpleBean.of(Fox.class, manager);
try
{
DependentContext.INSTANCE.setActive(true);
@@ -50,7 +50,7 @@
@SpecAssertion(section = "5.4")
public void testSimpleWebBeanClientProxyIsSerializable() throws IOException,
ClassNotFoundException
{
- Bean<TunedTuna> tunaBean = BeanFactory.createSimpleBean(TunedTuna.class,
manager);
+ Bean<TunedTuna> tunaBean = SimpleBean.of(TunedTuna.class, manager);
manager.addBean(tunaBean);
TunedTuna tuna = manager.getInstance(tunaBean);
assert Reflections.isProxy(tuna);
@@ -64,7 +64,7 @@
@SpecAssertion(section = "5.4.1")
public void testInjectionPointWithUnproxyableTypeWhichResolvesToNormalScopedWebBean()
{
- Bean<FinalTuna> tunaBean = BeanFactory.createSimpleBean(FinalTuna.class,
manager);
+ Bean<FinalTuna> tunaBean = SimpleBean.of(FinalTuna.class, manager);
manager.addBean(tunaBean);
@SuppressWarnings("unused")
FinalTuna tuna = manager.getInstanceByType(FinalTuna.class);
@@ -75,7 +75,7 @@
@SpecAssertion(section = "5.4.2")
public void testClientProxyInvocation()
{
- Bean<TunedTuna> tunaBean = BeanFactory.createSimpleBean(TunedTuna.class,
manager);
+ Bean<TunedTuna> tunaBean = SimpleBean.of(TunedTuna.class, manager);
manager.addBean(tunaBean);
TunedTuna tuna = manager.getInstance(tunaBean);
assert Reflections.isProxy(tuna);
@@ -84,7 +84,7 @@
@Test(groups = "Reflections", expectedExceptions=DefinitionException.class)
public void testGettingUnknownBeanFails() {
- Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class, manager);
+ Bean<Tuna> tunaBean = SimpleBean.of(Tuna.class, manager);
@SuppressWarnings("unused")
Tuna tuna = manager.getInstance(tunaBean);
assert false;
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/CommonWebBeanTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,14 +1,12 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createProducerMethodBean;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import java.lang.reflect.Method;
import javax.webbeans.Production;
import javax.webbeans.RequestScoped;
import javax.webbeans.manager.Bean;
+import org.jboss.webbeans.bean.ProducerMethodBean;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.test.beans.Animal;
import org.jboss.webbeans.test.beans.DeadlyAnimal;
@@ -35,41 +33,41 @@
@Test @SpecAssertion(section="2")
public void testApiTypesNonEmpty()
{
- Bean<?> model = createSimpleBean(RedSnapper.class, manager);
+ Bean<?> model = SimpleBean.of(RedSnapper.class, manager);
assert model.getTypes().size() > 0;
}
@Test @SpecAssertion(section="2")
public void testBindingTypesNonEmpty()
{
- Bean<?> model = createSimpleBean(RedSnapper.class, manager);
+ Bean<?> model = SimpleBean.of(RedSnapper.class, manager);
assert model.getBindingTypes().size() > 0;
}
@Test @SpecAssertion(section="2")
public void testHasScopeType()
{
- Bean<?> model = createSimpleBean(RedSnapper.class, manager);
+ Bean<?> model = SimpleBean.of(RedSnapper.class, manager);
assert model.getScopeType().equals(RequestScoped.class);
}
@Test @SpecAssertion(section="2")
public void testHasDeploymentType()
{
- Bean<?> model = createSimpleBean(RedSnapper.class, manager);
+ Bean<?> model = SimpleBean.of(RedSnapper.class, manager);
assert model.getDeploymentType().equals(Production.class);
}
@Test(groups="producerMethod") @SpecAssertion(section="5.2")
public void testIsNullable() throws Exception
{
- SimpleBean<SpiderProducer> spiderProducerBean =
createSimpleBean(SpiderProducer.class, manager);
+ SimpleBean<SpiderProducer> spiderProducerBean =
SimpleBean.of(SpiderProducer.class, manager);
manager.addBean(spiderProducerBean);
Method method = SpiderProducer.class.getMethod("getWolfSpiderSize");
- Bean<Integer> bean = createProducerMethodBean(int.class, method,
spiderProducerBean, manager);
+ Bean<Integer> bean = ProducerMethodBean.of(method, spiderProducerBean,
manager);
assert !bean.isNullable();
method = SpiderProducer.class.getMethod("makeASpider");
- Bean<Spider> spiderBean = createProducerMethodBean(Spider.class, method,
spiderProducerBean, manager);
+ Bean<Spider> spiderBean = ProducerMethodBean.of(method, spiderProducerBean,
manager);
assert spiderBean.isNullable();
}
@@ -77,7 +75,7 @@
@Test @SpecAssertion(section={"3.2.2", "2.2"})
public void testApiTypes()
{
- Bean<Tarantula> bean = createSimpleBean(Tarantula.class, manager);
+ Bean<Tarantula> bean = SimpleBean.of(Tarantula.class, manager);
assert bean.getTypes().size() == 6;
assert bean.getTypes().contains(Tarantula.class);
assert bean.getTypes().contains(Spider.class);
@@ -90,7 +88,7 @@
@Test @SpecAssertion(section="2.2")
public void testFinalApiType()
{
- createSimpleBean(DependentFinalTuna.class, manager);
+ SimpleBean.of(DependentFinalTuna.class, manager);
}
}
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,7 +1,5 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import java.util.Arrays;
import javax.webbeans.Observes;
@@ -68,7 +66,7 @@
//annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
//AnnotatedClass<Tuna> annotatedItem = new
SimpleAnnotatedClass<Tuna>(Tuna.class, annotations);
// TODO This should test a real class
- tuna = createSimpleBean(Tuna.class, manager);
+ tuna = SimpleBean.of(Tuna.class, manager);
om = new
AnnotatedMethodImpl<Object>(AnObserver.class.getMethod("observe", new
Class[] { Event.class }), new AnnotatedClassImpl<AnObserver>(AnObserver.class));
AnObserver observerInstance = new AnObserver();
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,8 +1,5 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createProducerMethodBean;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import java.lang.reflect.Method;
import java.util.Arrays;
@@ -33,7 +30,7 @@
@Test(expectedExceptions=DefinitionException.class)
@SpecAssertion(section="2.5.1")
public void testNonBuiltInComponentUsesStandard()
{
- createSimpleBean(Gazelle.class, manager);
+ SimpleBean.of(Gazelle.class, manager);
}
@Test(groups={"stub", "annotationDefinition"})
@SpecAssertion(section="2.5.2")
@@ -57,16 +54,16 @@
@Test(expectedExceptions=DefinitionException.class)
@SpecAssertion(section="2.5.3")
public void testTooManyDeploymentTypes()
{
- createSimpleBean(BeanWithTooManyDeploymentTypes.class, manager);
+ SimpleBean.of(BeanWithTooManyDeploymentTypes.class, manager);
}
@Test @SpecAssertion(section="2.5.3")
public void testDeploymentTypeInhertitedFromDeclaringBean() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
+ SimpleBean<SpiderProducer> bean = SimpleBean.of(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("produceBlackWidow");
- ProducerMethodBean<BlackWidow> blackWidowSpiderModel =
createProducerMethodBean(BlackWidow.class, method, bean, manager);
+ ProducerMethodBean<BlackWidow> blackWidowSpiderModel =
ProducerMethodBean.of(method, bean, manager);
assert
blackWidowSpiderModel.getDeploymentType().equals(AnotherDeploymentType.class);
}
@@ -105,7 +102,7 @@
@Test @SpecAssertion(section="2.5.5")
public void testHighestPrecedenceDeploymentTypeFromStereotype()
{
- Bean<?> bean = createSimpleBean(Rhinoceros.class, manager);
+ Bean<?> bean = SimpleBean.of(Rhinoceros.class, manager);
assert bean.getDeploymentType().equals(HornedAnimalDeploymentType.class);
}
@@ -114,7 +111,7 @@
{
manager.setEnabledDeploymentTypes(Arrays.asList(Standard.class,
AnotherDeploymentType.class, HornedAnimalDeploymentType.class));
- Bean<RedSnapper> bean = createSimpleBean(RedSnapper.class, manager);
+ Bean<RedSnapper> bean = SimpleBean.of(RedSnapper.class, manager);
manager.addBean(bean);
manager.getInstanceByType(RedSnapper.class);
}
@@ -144,7 +141,7 @@
@Test @SpecAssertion(section={"2.5.5", "2.7.2"})
public void testWebBeanDeploymentTypeOverridesStereotype()
{
- Bean<Reindeer> bean = createSimpleBean(Reindeer.class, manager);
+ Bean<Reindeer> bean = SimpleBean.of(Reindeer.class, manager);
assert bean.getDeploymentType().equals(Production.class);
}
}
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InitializerMethodTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,11 +1,10 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import javax.webbeans.DefinitionException;
import javax.webbeans.NonexistentMethodException;
import javax.webbeans.manager.Bean;
+import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.test.beans.Chicken;
import org.jboss.webbeans.test.beans.ChickenHutch;
import org.jboss.webbeans.test.beans.Fox;
@@ -23,7 +22,7 @@
@Test(expectedExceptions=DefinitionException.class,
groups="initializerMethod") @SpecAssertion(section="3.8")
public void testStaticInitializerMethodNotAllowed()
{
- createSimpleBean(Dottrel.class, manager);
+ SimpleBean.of(Dottrel.class, manager);
}
@Test(groups={"stub", "initializerMethod", "servlet"})
@SpecAssertion(section="3.8")
@@ -65,10 +64,10 @@
@Test(groups={"initializerMethod"}) @SpecAssertion(section={"3.8",
"5.3", "3.8.2", "3.8.3"})
public void testMultipleInitializerMethodsAreCalled()
{
- manager.addBean(createSimpleBean(Fox.class, manager));
- manager.addBean(createSimpleBean(Chicken.class, manager));
+ manager.addBean(SimpleBean.of(Fox.class, manager));
+ manager.addBean(SimpleBean.of(Chicken.class, manager));
- Bean<ChickenHutch> chickenHutchBean = createSimpleBean(ChickenHutch.class,
manager);
+ Bean<ChickenHutch> chickenHutchBean = SimpleBean.of(ChickenHutch.class,
manager);
ChickenHutch chickenHutch = chickenHutchBean.create();
assert chickenHutch.fox != null;
assert chickenHutch.chicken != null;
@@ -77,25 +76,25 @@
@Test(groups="initializerMethod",
expectedExceptions=DefinitionException.class) @SpecAssertion(section={"3.8.1",
"3.4.2"})
public void testInitializerMethodAnnotatedProduces()
{
- createSimpleBean(Pheasant.class, manager);
+ SimpleBean.of(Pheasant.class, manager);
}
@Test(groups="initializerMethod",
expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.8.1")
public void testInitializerMethodAnnotatedDestructor()
{
- createSimpleBean(Shrike.class, manager);
+ SimpleBean.of(Shrike.class, manager);
}
@Test(groups="initializerMethod",
expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.8.1")
public void testInitializerMethodHasParameterAnnotatedDisposes()
{
- createSimpleBean(Capercaillie.class, manager);
+ SimpleBean.of(Capercaillie.class, manager);
}
@Test(groups="initializerMethod",
expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.8.1")
public void testInitializerMethodHasParameterAnnotatedObserves()
{
- createSimpleBean(Grouse.class, manager);
+ SimpleBean.of(Grouse.class, manager);
}
@Test(groups={"stub", "initializerMethod",
"webbeansxml"}) @SpecAssertion(section="3.8.2")
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionTests.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,9 +1,6 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createProducerMethodBean;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import javax.webbeans.ContextNotActiveException;
import javax.webbeans.DefinitionException;
import javax.webbeans.NonexistentFieldException;
@@ -11,6 +8,7 @@
import javax.webbeans.RequestScoped;
import javax.webbeans.manager.Bean;
+import org.jboss.webbeans.bean.ProducerMethodBean;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.context.RequestContext;
import org.jboss.webbeans.test.beans.Fox;
@@ -32,10 +30,10 @@
@Test(groups={"injection", "producerMethod"})
@SpecAssertion(section="5.2")
public void testInjectionPerformsBoxingIfNecessary() throws Exception
{
- SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class, manager);
+ SimpleBean<SpiderProducer> spiderProducer =
SimpleBean.of(SpiderProducer.class, manager);
manager.addBean(spiderProducer);
- Bean<SpiderNest> spiderNestBean = createSimpleBean(SpiderNest.class,
manager);
- manager.addBean(createProducerMethodBean(Integer.class,
SpiderProducer.class.getMethod("getWolfSpiderSize"), spiderProducer, manager));
+ Bean<SpiderNest> spiderNestBean = SimpleBean.of(SpiderNest.class, manager);
+
manager.addBean(ProducerMethodBean.of(SpiderProducer.class.getMethod("getWolfSpiderSize"),
spiderProducer, manager));
SpiderNest spiderNest = spiderNestBean.create();
assert spiderNest.numberOfSpiders != null;
assert spiderNest.numberOfSpiders.equals(4);
@@ -44,17 +42,17 @@
@Test(groups={"injection", "producerMethod"},
expectedExceptions=NullableDependencyException.class)
@SpecAssertion(section="5.2")
public void testPrimitiveInjectionPointResolvesToNullableWebBean() throws Exception
{
- Bean<FarmHouse> farmHouseBean = createSimpleBean(FarmHouse.class, manager);
- SimpleBean<FarmHouseProducer> farmHouseProducerBean =
createSimpleBean(FarmHouseProducer.class, manager);
- manager.addBean(createProducerMethodBean(Integer.class,
FarmHouseProducer.class.getMethod("getNumberOfBedrooms"), farmHouseProducerBean,
manager));
+ Bean<FarmHouse> farmHouseBean = SimpleBean.of(FarmHouse.class, manager);
+ SimpleBean<FarmHouseProducer> farmHouseProducerBean =
SimpleBean.of(FarmHouseProducer.class, manager);
+
manager.addBean(ProducerMethodBean.of(FarmHouseProducer.class.getMethod("getNumberOfBedrooms"),
farmHouseProducerBean, manager));
farmHouseBean.create();
}
@Test(groups={"injection", "clientProxy"},
expectedExceptions=ContextNotActiveException.class)
@SpecAssertion(section="5.3")
public void testInvokeNormalInjectedWebBeanWhenContextNotActive()
{
- SimpleBean<TunaFarm> tunaFarmBean = createSimpleBean(TunaFarm.class,
manager);
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class, manager);
+ SimpleBean<TunaFarm> tunaFarmBean = SimpleBean.of(TunaFarm.class, manager);
+ Bean<Tuna> tunaBean = SimpleBean.of(Tuna.class, manager);
manager.addBean(tunaBean);
TunaFarm tunaFarm = tunaFarmBean.create();
assert tunaFarm.tuna != null;
@@ -66,8 +64,8 @@
@Test(groups="injection") @SpecAssertion(section="5.3")
public void testInvokeDependentScopeWhenContextNotActive()
{
- Bean<FoxRun> foxRunBean = createSimpleBean(FoxRun.class, manager);
- Bean<Fox> foxBean = createSimpleBean(Fox.class, manager);
+ Bean<FoxRun> foxRunBean = SimpleBean.of(FoxRun.class, manager);
+ Bean<Fox> foxBean = SimpleBean.of(Fox.class, manager);
manager.addBean(foxBean);
FoxRun foxRun = foxRunBean.create();
assert foxRun.fox.getName().equals("gavin");
@@ -76,8 +74,8 @@
@Test(groups="injection", expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.7")
public void testInjectingStaticField()
{
- SimpleBean<BeanWithStaticBoundField> bean =
createSimpleBean(BeanWithStaticBoundField.class, manager);
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class, manager);
+ SimpleBean<BeanWithStaticBoundField> bean =
SimpleBean.of(BeanWithStaticBoundField.class, manager);
+ Bean<Tuna> tunaBean = SimpleBean.of(Tuna.class, manager);
manager.addBean(tunaBean);
BeanWithStaticBoundField instance = bean.create();
}
@@ -85,8 +83,8 @@
@Test(groups="injection",expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.7")
public void testInjectingFinalField()
{
- SimpleBean<BeanWithFinalBoundField> bean =
createSimpleBean(BeanWithFinalBoundField.class, manager);
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class, manager);
+ SimpleBean<BeanWithFinalBoundField> bean =
SimpleBean.of(BeanWithFinalBoundField.class, manager);
+ Bean<Tuna> tunaBean = SimpleBean.of(Tuna.class, manager);
manager.addBean(tunaBean);
BeanWithFinalBoundField instance = bean.create();
}
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,10 +1,9 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import javax.webbeans.AmbiguousDependencyException;
import javax.webbeans.manager.Bean;
+import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
@@ -31,8 +30,8 @@
public void testNoWebBeansFound() throws Exception
{
AnnotatedField<ScottishFish> whiteScottishFishField = new
AnnotatedFieldImpl<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"),
fishFarmClass);
- Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
+ Bean<Cod> codBean = SimpleBean.of(Cod.class, manager);
+ Bean<Salmon> salmonBean = SimpleBean.of(Salmon.class, manager);
manager.addBean(codBean);
manager.addBean(salmonBean);
@@ -43,9 +42,9 @@
public void testAmbiguousDependencies() throws Exception
{
AnnotatedField<ScottishFish> whiteScottishFishField = new
AnnotatedFieldImpl<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"),
fishFarmClass);
- Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
- Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
+ Bean<Cod> codBean = SimpleBean.of(Cod.class, manager);
+ Bean<Salmon> salmonBean = SimpleBean.of(Salmon.class, manager);
+ Bean<Sole> soleBean = SimpleBean.of(Sole.class, manager);
manager.addBean(codBean);
manager.addBean(salmonBean);
manager.addBean(soleBean);
@@ -56,13 +55,13 @@
@Test(groups={"resolution", "beanLifecycle"})
@SpecAssertion(section="4.10.1")
public void testGetInstanceByName()
{
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class, manager);
- Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
- Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
- Bean<SeaBass> seaBassBean = createSimpleBean(SeaBass.class, manager);
- Bean<Haddock> haddockBean = createSimpleBean(Haddock.class, manager);
- Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class, manager);
+ Bean<Tuna> tunaBean = SimpleBean.of(Tuna.class, manager);
+ Bean<Cod> codBean = SimpleBean.of(Cod.class, manager);
+ Bean<Salmon> salmonBean = SimpleBean.of(Salmon.class, manager);
+ Bean<Sole> soleBean = SimpleBean.of(Sole.class, manager);
+ Bean<SeaBass> seaBassBean = SimpleBean.of(SeaBass.class, manager);
+ Bean<Haddock> haddockBean = SimpleBean.of(Haddock.class, manager);
+ Bean<Plaice> plaiceBean = SimpleBean.of(Plaice.class, manager);
manager.addBean(tunaBean);
manager.addBean(codBean);
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,7 +1,5 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import javax.webbeans.AmbiguousDependencyException;
import javax.webbeans.AnnotationLiteral;
import javax.webbeans.DuplicateBindingTypeException;
@@ -10,6 +8,7 @@
import javax.webbeans.UnsatisfiedDependencyException;
import javax.webbeans.manager.Bean;
+import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.binding.CurrentBinding;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
@@ -36,7 +35,7 @@
@Test(groups={"resolution", "beanLifecycle"})
@SpecAssertion(section="5.9")
public void testCurrentBindingTypeAssumed()
{
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class, manager);
+ Bean<Tuna> tunaBean = SimpleBean.of(Tuna.class, manager);
manager.addBean(tunaBean);
assert manager.getInstanceByType(Tuna.class) != null;
}
@@ -70,9 +69,9 @@
public void testAmbiguousDependencies() throws Exception
{
AnnotatedField<ScottishFish> whiteScottishFishField = new
AnnotatedFieldImpl<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"),
fishFarmClass);
- Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
- Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
+ Bean<Cod> codBean = SimpleBean.of(Cod.class, manager);
+ Bean<Salmon> salmonBean = SimpleBean.of(Salmon.class, manager);
+ Bean<Sole> soleBean = SimpleBean.of(Sole.class, manager);
manager.addBean(codBean);
manager.addBean(salmonBean);
manager.addBean(soleBean);
@@ -84,9 +83,9 @@
public void testUnsatisfiedDependencies() throws Exception
{
AnnotatedField<ScottishFish> whiteScottishFishField = new
AnnotatedFieldImpl<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"),
fishFarmClass);
- Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
- Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
+ Bean<Cod> codBean = SimpleBean.of(Cod.class, manager);
+ Bean<Salmon> salmonBean = SimpleBean.of(Salmon.class, manager);
+ Bean<Sole> soleBean = SimpleBean.of(Sole.class, manager);
manager.addBean(codBean);
manager.addBean(salmonBean);
manager.addBean(soleBean);
@@ -97,7 +96,7 @@
@Test(expectedExceptions=UnproxyableDependencyException.class)
@SpecAssertion(section="5.9")
public void testUnproxyableDependencies() throws Exception
{
- Bean<FinalTuna> FinalTunaBean = createSimpleBean(FinalTuna.class, manager);
+ Bean<FinalTuna> FinalTunaBean = SimpleBean.of(FinalTuna.class, manager);
manager.addBean(FinalTunaBean);
manager.getInstanceByType(FinalTuna.class, new
AnnotationLiteral<Whitefish>(){});
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ManagerTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ManagerTest.java 2009-01-07
11:49:47 UTC (rev 805)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ManagerTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,11 +1,10 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import javax.webbeans.ContextNotActiveException;
import javax.webbeans.RequestScoped;
import javax.webbeans.manager.Context;
+import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.context.AbstractBeanMapContext;
import org.jboss.webbeans.context.RequestContext;
import org.jboss.webbeans.test.beans.FishFarmOffice;
@@ -18,7 +17,7 @@
@Test(groups={"manager", "injection", "deployment"})
@SpecAssertion(section="5.8")
public void testInjectingManager()
{
- FishFarmOffice fishFarmOffice = createSimpleBean(FishFarmOffice.class,
manager).create();
+ FishFarmOffice fishFarmOffice = SimpleBean.of(FishFarmOffice.class,
manager).create();
assert fishFarmOffice.manager != null;
}
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 2009-01-07
11:49:47 UTC (rev 805)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,7 +1,5 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import javax.webbeans.DefinitionException;
import org.jboss.webbeans.bean.SimpleBean;
@@ -25,7 +23,7 @@
@Test @SpecAssertion(section="2.6.1")
public void testNonDefaultNamed()
{
- SimpleBean<Moose> moose = createSimpleBean(Moose.class, manager);
+ SimpleBean<Moose> moose = SimpleBean.of(Moose.class, manager);
assert moose.getName().equals("aMoose");
}
@@ -81,7 +79,7 @@
@Test @SpecAssertion(section={"2.6.3", "3.2.7"})
public void testDefaultNamed()
{
- SimpleBean<Haddock> haddock = createSimpleBean(Haddock.class, manager);
+ SimpleBean<Haddock> haddock = SimpleBean.of(Haddock.class, manager);
assert haddock.getName() != null;
assert haddock.getName().equals("haddock");
}
@@ -109,7 +107,7 @@
@Test @SpecAssertion(section={"2.6.3", "2.7"})
public void testSterotypeDefaultsName()
{
- SimpleBean<RedSnapper> model = createSimpleBean(RedSnapper.class, manager);
+ SimpleBean<RedSnapper> model = SimpleBean.of(RedSnapper.class, manager);
assert model.getMergedStereotypes().isBeanNameDefaulted();
assert model.getName().equals("redSnapper");
}
@@ -117,21 +115,21 @@
@Test @SpecAssertion(section="2.6.4")
public void testNotNamedInJava()
{
- SimpleBean<SeaBass> model = createSimpleBean(SeaBass.class, manager);
+ SimpleBean<SeaBass> model = SimpleBean.of(SeaBass.class, manager);
assert model.getName() == null;
}
@Test @SpecAssertion(section="2.6.4")
public void testNotNamedInXml()
{
- SimpleBean<SeaBass> model = createSimpleBean(SeaBass.class, manager);
+ SimpleBean<SeaBass> model = SimpleBean.of(SeaBass.class, manager);
assert model.getName() == null;
}
@Test @SpecAssertion(section="2.6.4")
public void testNotNamedInStereotype()
{
- SimpleBean<Minnow> model = createSimpleBean(Minnow.class, manager);
+ SimpleBean<Minnow> model = SimpleBean.of(Minnow.class, manager);
assert model.getName() == null;
}
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerFieldBeanLifecycleTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerFieldBeanLifecycleTest.java 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerFieldBeanLifecycleTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,8 +1,5 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createProducerFieldBean;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import java.lang.reflect.Field;
import javax.webbeans.IllegalProductException;
@@ -22,10 +19,10 @@
@Test(groups="producerField") @SpecAssertion(section="5.6")
public void testProducerFieldBeanCreate() throws Exception
{
- SimpleBean<OtherSpiderProducer> spiderProducer =
createSimpleBean(OtherSpiderProducer.class, manager);
+ SimpleBean<OtherSpiderProducer> spiderProducer =
SimpleBean.of(OtherSpiderProducer.class, manager);
manager.addBean(spiderProducer);
Field method = OtherSpiderProducer.class.getField("produceTarantula");
- ProducerFieldBean<Tarantula> tarantulaBean =
createProducerFieldBean(Tarantula.class, method, spiderProducer, manager);
+ ProducerFieldBean<Tarantula> tarantulaBean = ProducerFieldBean.of(method,
spiderProducer, manager);
Tarantula tarantula = tarantulaBean.create();
assert tarantula != null;
}
@@ -41,10 +38,10 @@
@Test(groups="producerField") @SpecAssertion(section={"3.5",
"5.6", "8.3"})
public void testProducerFieldReturnsNullIsDependent() throws Exception
{
- SimpleBean<OtherSpiderProducer> spiderProducer =
createSimpleBean(OtherSpiderProducer.class, manager);
+ SimpleBean<OtherSpiderProducer> spiderProducer =
SimpleBean.of(OtherSpiderProducer.class, manager);
manager.addBean(spiderProducer);
Field method = OtherSpiderProducer.class.getField("getNullSpider");
- ProducerFieldBean<Spider> spiderBean = createProducerFieldBean(Spider.class,
method, spiderProducer, manager);
+ ProducerFieldBean<Spider> spiderBean = ProducerFieldBean.of(method,
spiderProducer, manager);
Spider spider = spiderBean.create();
assert spider == null;
}
@@ -52,10 +49,10 @@
@Test(groups="producerField",
expectedExceptions=IllegalProductException.class) @SpecAssertion(section={"3.5",
"5.6"})
public void testProducerFieldReturnsNullIsNotDependent() throws Exception
{
- SimpleBean<OtherBrokenSpiderProducer> spiderProducer =
createSimpleBean(OtherBrokenSpiderProducer.class, manager);
+ SimpleBean<OtherBrokenSpiderProducer> spiderProducer =
SimpleBean.of(OtherBrokenSpiderProducer.class, manager);
manager.addBean(spiderProducer);
Field method =
OtherBrokenSpiderProducer.class.getField("getRequestScopedSpider");
- createProducerFieldBean(Spider.class, method, spiderProducer, manager).create();
+ ProducerFieldBean.of(method, spiderProducer, manager).create();
}
}
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerFieldBeanModelTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerFieldBeanModelTest.java 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerFieldBeanModelTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,8 +1,5 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createProducerFieldBean;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import java.lang.reflect.Field;
import javax.webbeans.Current;
@@ -19,7 +16,6 @@
import org.jboss.webbeans.test.beans.DaddyLongLegs;
import org.jboss.webbeans.test.beans.DeadlyAnimal;
import org.jboss.webbeans.test.beans.DeadlySpider;
-import org.jboss.webbeans.test.beans.FunnelWeaver;
import org.jboss.webbeans.test.beans.LadybirdSpider;
import org.jboss.webbeans.test.beans.OtherSpiderProducer;
import org.jboss.webbeans.test.beans.Spider;
@@ -34,10 +30,10 @@
@Test(groups="producerField") @SpecAssertion(section="2.5.3")
public void testProducerFieldInheritsDeploymentTypeOfDeclaringWebBean() throws
Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
+ SimpleBean<OtherSpiderProducer> bean =
SimpleBean.of(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field =
OtherSpiderProducer.class.getField("produceTameTarantula");
- ProducerFieldBean<Tarantula> tarantulaModel =
createProducerFieldBean(Tarantula.class, field, bean, manager);
+ ProducerFieldBean<Tarantula> tarantulaModel = ProducerFieldBean.of(field,
bean, manager);
tarantulaModel.getDeploymentType().equals(AnotherDeploymentType.class);
}
@@ -59,19 +55,19 @@
@Test(groups="producerField") @SpecAssertion(section="3.5")
public void testParameterizedReturnType() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
+ SimpleBean<OtherSpiderProducer> bean =
SimpleBean.of(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field =
OtherSpiderProducer.class.getField("getFunnelWeaverSpider");
- createProducerFieldBean(FunnelWeaver.class, field, bean, manager);
+ ProducerFieldBean.of(field, bean, manager);
}
@Test(groups="producerField", expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.5")
public void testParameterizedReturnTypeWithWildcard() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
+ SimpleBean<OtherSpiderProducer> bean =
SimpleBean.of(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field =
OtherSpiderProducer.class.getField("getAnotherFunnelWeaver");
- createProducerFieldBean(FunnelWeaver.class, field, bean, manager);
+ ProducerFieldBean.of(field, bean, manager);
}
@Test(groups={"stub", "producerField", "deployment"})
@SpecAssertion(section="3.5")
@@ -83,10 +79,10 @@
@Test(groups="producerField") @SpecAssertion(section={"3.5",
"2.3.1"})
public void testDefaultBindingType() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
+ SimpleBean<OtherSpiderProducer> bean =
SimpleBean.of(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field = OtherSpiderProducer.class.getField("produceTarantula");
- ProducerFieldBean<Tarantula> tarantulaModel =
createProducerFieldBean(Tarantula.class, field, bean, manager);
+ ProducerFieldBean<Tarantula> tarantulaModel = ProducerFieldBean.of(field,
bean, manager);
assert tarantulaModel.getBindingTypes().size() == 1;
assert
tarantulaModel.getBindingTypes().iterator().next().annotationType().equals(Current.class);
}
@@ -94,10 +90,10 @@
@Test(groups="producerField") @SpecAssertion(section="3.5.1")
public void testApiTypeForClassReturn() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
+ SimpleBean<OtherSpiderProducer> bean =
SimpleBean.of(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field = OtherSpiderProducer.class.getField("produceTarantula");
- ProducerFieldBean<Tarantula> tarantulaModel =
createProducerFieldBean(Tarantula.class, field, bean, manager);
+ ProducerFieldBean<Tarantula> tarantulaModel = ProducerFieldBean.of(field,
bean, manager);
assert tarantulaModel.getTypes().size() == 6;
assert tarantulaModel.getTypes().contains(Tarantula.class);
assert tarantulaModel.getTypes().contains(DeadlySpider.class);
@@ -110,10 +106,10 @@
@Test(groups="producerField") @SpecAssertion(section="3.5.1")
public void testApiTypeForInterfaceReturn() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
+ SimpleBean<OtherSpiderProducer> bean =
SimpleBean.of(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field = OtherSpiderProducer.class.getField("makeASpider");
- ProducerFieldBean<Animal> animalModel = createProducerFieldBean(Animal.class,
field, bean, manager);
+ ProducerFieldBean<Animal> animalModel = ProducerFieldBean.of(field, bean,
manager);
assert animalModel.getTypes().size() == 2;
assert animalModel.getTypes().contains(Animal.class);
assert animalModel.getTypes().contains(Object.class);
@@ -122,10 +118,10 @@
@Test(groups="producerField") @SpecAssertion(section="3.5.1")
public void testApiTypeForPrimitiveReturn() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
+ SimpleBean<OtherSpiderProducer> bean =
SimpleBean.of(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field = OtherSpiderProducer.class.getField("getWolfSpiderSize");
- ProducerFieldBean<Integer> intModel = createProducerFieldBean(int.class,
field, bean, manager);
+ ProducerFieldBean<Integer> intModel = ProducerFieldBean.of(field, bean,
manager);
assert intModel.getTypes().size() == 2;
assert intModel.getTypes().contains(int.class);
assert intModel.getTypes().contains(Object.class);
@@ -134,10 +130,10 @@
@Test(groups="producerField") @SpecAssertion(section={"3.5.1",
"2.2"})
public void testApiTypeForArrayTypeReturn() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
+ SimpleBean<OtherSpiderProducer> bean =
SimpleBean.of(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field = OtherSpiderProducer.class.getField("getSpiders");
- ProducerFieldBean<Spider[]> spidersModel =
createProducerFieldBean(Spider[].class, field, bean, manager);
+ ProducerFieldBean<Spider[]> spidersModel = ProducerFieldBean.of(field, bean,
manager);
assert spidersModel.getTypes().size() == 2;
assert spidersModel.getTypes().contains(Spider[].class);
assert spidersModel.getTypes().contains(Object.class);
@@ -146,10 +142,10 @@
@Test(groups="producerField") @SpecAssertion(section="3.5.2")
public void testBindingType() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
+ SimpleBean<OtherSpiderProducer> bean =
SimpleBean.of(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field =
OtherSpiderProducer.class.getField("produceTameTarantula");
- ProducerFieldBean<Tarantula> tarantulaModel =
createProducerFieldBean(Tarantula.class, field, bean, manager);
+ ProducerFieldBean<Tarantula> tarantulaModel = ProducerFieldBean.of(field,
bean, manager);
assert tarantulaModel.getBindingTypes().size() == 1;
assert
tarantulaModel.getBindingTypes().iterator().next().annotationType().equals(Tame.class);
}
@@ -157,10 +153,10 @@
@Test(groups="producerField") @SpecAssertion(section="3.5.2")
public void testScopeType() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
+ SimpleBean<OtherSpiderProducer> bean =
SimpleBean.of(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field =
OtherSpiderProducer.class.getField("produceDaddyLongLegs");
- ProducerFieldBean<DaddyLongLegs> daddyLongLegsModel =
createProducerFieldBean(DaddyLongLegs.class, field, bean, manager);
+ ProducerFieldBean<DaddyLongLegs> daddyLongLegsModel =
ProducerFieldBean.of(field, bean, manager);
assert daddyLongLegsModel.getScopeType().equals(RequestScoped.class);
// TODO Inherit scope from returned web bean?
@@ -169,30 +165,30 @@
@Test(groups="producerField") @SpecAssertion(section="3.5.2")
public void testDeploymentType() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
+ SimpleBean<OtherSpiderProducer> bean =
SimpleBean.of(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field = OtherSpiderProducer.class.getField("getLadybirdSpider");
- ProducerFieldBean<LadybirdSpider> ladybirdSpiderModel =
createProducerFieldBean(LadybirdSpider.class, field, bean, manager);
+ ProducerFieldBean<LadybirdSpider> ladybirdSpiderModel =
ProducerFieldBean.of(field, bean, manager);
assert ladybirdSpiderModel.getDeploymentType().equals(Production.class);
}
@Test(groups="producerField") @SpecAssertion(section="3.5.2")
public void testNamedField() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
+ SimpleBean<OtherSpiderProducer> bean =
SimpleBean.of(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field = OtherSpiderProducer.class.getField("produceBlackWidow");
- ProducerFieldBean<BlackWidow> blackWidowSpiderModel =
createProducerFieldBean(BlackWidow.class, field, bean, manager);
+ ProducerFieldBean<BlackWidow> blackWidowSpiderModel =
ProducerFieldBean.of(field, bean, manager);
assert blackWidowSpiderModel.getName().equals("blackWidow");
}
@Test(groups="producerField") @SpecAssertion(section="3.5.2")
public void testDefaultNamedField() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
+ SimpleBean<OtherSpiderProducer> bean =
SimpleBean.of(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field =
OtherSpiderProducer.class.getField("produceDaddyLongLegs");
- ProducerFieldBean<DaddyLongLegs> daddyLongLegsSpiderModel =
createProducerFieldBean(DaddyLongLegs.class, field, bean, manager);
+ ProducerFieldBean<DaddyLongLegs> daddyLongLegsSpiderModel =
ProducerFieldBean.of(field, bean, manager);
assert
daddyLongLegsSpiderModel.getName().equals("produceDaddyLongLegs");
}
@@ -259,10 +255,10 @@
@Test(groups="producerField") @SpecAssertion(section={"2.7.2",
"3.5.2", "2.2"})
public void testStereotype() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
+ SimpleBean<OtherSpiderProducer> bean =
SimpleBean.of(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field = OtherSpiderProducer.class.getField("produceWolfSpider");
- ProducerFieldBean<WolfSpider> wolfSpiderModel =
createProducerFieldBean(WolfSpider.class, field, bean, manager);
+ ProducerFieldBean<WolfSpider> wolfSpiderModel = ProducerFieldBean.of(field,
bean, manager);
assert wolfSpiderModel.getMergedStereotypes().getRequiredTypes().size() == 1;
assert
wolfSpiderModel.getMergedStereotypes().getRequiredTypes().contains(Animal.class);
assert wolfSpiderModel.getScopeType().equals(RequestScoped.class);
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanLifecycleTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,8 +1,5 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createProducerMethodBean;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import java.lang.reflect.Method;
import javax.webbeans.IllegalProductException;
@@ -22,10 +19,10 @@
@Test(groups="producerMethod") @SpecAssertion(section="5.6")
public void testProducerMethodBeanCreate() throws Exception
{
- SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class, manager);
+ SimpleBean<SpiderProducer> spiderProducer =
SimpleBean.of(SpiderProducer.class, manager);
manager.addBean(spiderProducer);
Method method = SpiderProducer.class.getMethod("produceTarantula");
- ProducerMethodBean<Tarantula> tarantulaBean =
createProducerMethodBean(Tarantula.class, method, spiderProducer, manager);
+ ProducerMethodBean<Tarantula> tarantulaBean = ProducerMethodBean.of(method,
spiderProducer, manager);
Tarantula tarantula = tarantulaBean.create();
assert tarantula != null;
}
@@ -55,10 +52,10 @@
@Test(groups="producerMethod") @SpecAssertion(section={"3.4",
"5.6", "8.3"})
public void testProducerMethodReturnsNullIsDependent() throws Exception
{
- SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class, manager);
+ SimpleBean<SpiderProducer> spiderProducer =
SimpleBean.of(SpiderProducer.class, manager);
manager.addBean(spiderProducer);
Method method = SpiderProducer.class.getMethod("getNullSpider");
- ProducerMethodBean<Spider> spiderBean =
createProducerMethodBean(Spider.class, method, spiderProducer, manager);
+ ProducerMethodBean<Spider> spiderBean = ProducerMethodBean.of(method,
spiderProducer, manager);
Spider spider = spiderBean.create();
assert spider == null;
}
@@ -66,10 +63,10 @@
@Test(groups="producerMethod",
expectedExceptions=IllegalProductException.class) @SpecAssertion(section={"3.4",
"5.6"})
public void testProducerMethodReturnsNullIsNotDependent() throws Exception
{
- SimpleBean<BrokenSpiderProducer> spiderProducer =
createSimpleBean(BrokenSpiderProducer.class, manager);
+ SimpleBean<BrokenSpiderProducer> spiderProducer =
SimpleBean.of(BrokenSpiderProducer.class, manager);
manager.addBean(spiderProducer);
Method method =
BrokenSpiderProducer.class.getMethod("getRequestScopedSpider");
- createProducerMethodBean(Spider.class, method, spiderProducer, manager).create();
+ ProducerMethodBean.of(method, spiderProducer, manager).create();
}
}
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanModelTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,8 +1,5 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createProducerMethodBean;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import java.lang.reflect.Method;
import javax.webbeans.Current;
@@ -19,7 +16,6 @@
import org.jboss.webbeans.test.beans.DaddyLongLegs;
import org.jboss.webbeans.test.beans.DeadlyAnimal;
import org.jboss.webbeans.test.beans.DeadlySpider;
-import org.jboss.webbeans.test.beans.FunnelWeaver;
import org.jboss.webbeans.test.beans.LadybirdSpider;
import org.jboss.webbeans.test.beans.Spider;
import org.jboss.webbeans.test.beans.SpiderProducer;
@@ -36,20 +32,20 @@
@Test(groups="producerMethod") @SpecAssertion(section="2.5.3")
public void testProducerMethodInheritsDeploymentTypeOfDeclaringWebBean() throws
Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
+ SimpleBean<SpiderProducer> bean = SimpleBean.of(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("produceTameTarantula");
- ProducerMethodBean<Tarantula> tarantulaModel =
createProducerMethodBean(Tarantula.class, method, bean, manager);
+ ProducerMethodBean<Tarantula> tarantulaModel = ProducerMethodBean.of(method,
bean, manager);
tarantulaModel.getDeploymentType().equals(AnotherDeploymentType.class);
}
@Test(groups="producerMethod") @SpecAssertion(section="3.4")
public void testStaticMethod() throws Exception
{
- SimpleBean<BeanWithStaticProducerMethod> bean =
createSimpleBean(BeanWithStaticProducerMethod.class, manager);
+ SimpleBean<BeanWithStaticProducerMethod> bean =
SimpleBean.of(BeanWithStaticProducerMethod.class, manager);
manager.addBean(bean);
Method method =
BeanWithStaticProducerMethod.class.getMethod("getString");
- createProducerMethodBean(String.class, method, bean, manager);
+ ProducerMethodBean.of(method, bean, manager);
}
@Test(groups={"stub", "producerMethod",
"enterpriseBeans", "stub"},
expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
@@ -61,37 +57,37 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.4")
public void testParameterizedReturnType() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
+ SimpleBean<SpiderProducer> bean = SimpleBean.of(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("getFunnelWeaverSpider");
- createProducerMethodBean(FunnelWeaver.class, method, bean, manager);
+ ProducerMethodBean.of(method, bean, manager);
}
@Test(groups="producerMethod", expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.4")
public void testParameterizedReturnTypeWithWildcard() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
+ SimpleBean<SpiderProducer> bean = SimpleBean.of(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method =
SpiderProducer.class.getMethod("getAnotherFunnelWeaver");
- createProducerMethodBean(FunnelWeaver.class, method, bean, manager);
+ ProducerMethodBean.of(method, bean, manager);
}
@Test(groups="producerMethod", expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.4")
public void testParameterizedReturnTypeWithTypeParameter() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
+ SimpleBean<SpiderProducer> bean = SimpleBean.of(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("getFunnelWeaver");
- createProducerMethodBean(FunnelWeaver.class, method, bean, manager);
+ ProducerMethodBean.of(method, bean, manager);
}
@Test(groups="producerMethod") @SpecAssertion(section={"3.4",
"2.3.1"})
public void testDefaultBindingType() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
+ SimpleBean<SpiderProducer> bean = SimpleBean.of(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("produceTarantula");
- ProducerMethodBean<Tarantula> tarantulaModel =
createProducerMethodBean(Tarantula.class, method, bean, manager);
+ ProducerMethodBean<Tarantula> tarantulaModel = ProducerMethodBean.of(method,
bean, manager);
assert tarantulaModel.getBindingTypes().size() == 1;
assert
tarantulaModel.getBindingTypes().iterator().next().annotationType().equals(Current.class);
}
@@ -99,10 +95,10 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.4.1")
public void testApiTypeForClassReturn() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
+ SimpleBean<SpiderProducer> bean = SimpleBean.of(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("produceTarantula");
- ProducerMethodBean<Tarantula> tarantulaModel =
createProducerMethodBean(Tarantula.class, method, bean, manager);
+ ProducerMethodBean<Tarantula> tarantulaModel = ProducerMethodBean.of(method,
bean, manager);
assert tarantulaModel.getTypes().size() == 6;
assert tarantulaModel.getTypes().contains(Tarantula.class);
assert tarantulaModel.getTypes().contains(DeadlySpider.class);
@@ -115,10 +111,10 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.4.1")
public void testApiTypeForInterfaceReturn() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
+ SimpleBean<SpiderProducer> bean = SimpleBean.of(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("makeASpider");
- ProducerMethodBean<Animal> animalModel =
createProducerMethodBean(Animal.class, method, bean, manager);
+ ProducerMethodBean<Animal> animalModel = ProducerMethodBean.of(method, bean,
manager);
assert animalModel.getTypes().size() == 2;
assert animalModel.getTypes().contains(Animal.class);
assert animalModel.getTypes().contains(Object.class);
@@ -127,10 +123,10 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.4.1")
public void testApiTypeForPrimitiveReturn() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
+ SimpleBean<SpiderProducer> bean = SimpleBean.of(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("getWolfSpiderSize");
- ProducerMethodBean<Integer> intModel = createProducerMethodBean(int.class,
method, bean, manager);
+ ProducerMethodBean<Integer> intModel = ProducerMethodBean.of(method, bean,
manager);
assert intModel.getTypes().size() == 2;
assert intModel.getTypes().contains(int.class);
assert intModel.getTypes().contains(Object.class);
@@ -139,10 +135,10 @@
@Test(groups="producerMethod") @SpecAssertion(section={"3.4.1",
"2.2"})
public void testApiTypeForArrayTypeReturn() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
+ SimpleBean<SpiderProducer> bean = SimpleBean.of(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("getSpiders");
- ProducerMethodBean<Spider[]> spidersModel =
createProducerMethodBean(Spider[].class, method, bean, manager);
+ ProducerMethodBean<Spider[]> spidersModel = ProducerMethodBean.of(method,
bean, manager);
assert spidersModel.getTypes().size() == 2;
assert spidersModel.getTypes().contains(Spider[].class);
assert spidersModel.getTypes().contains(Object.class);
@@ -151,10 +147,10 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
public void testBindingType() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
+ SimpleBean<SpiderProducer> bean = SimpleBean.of(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("produceTameTarantula");
- ProducerMethodBean<Tarantula> tarantulaModel =
createProducerMethodBean(Tarantula.class, method, bean, manager);
+ ProducerMethodBean<Tarantula> tarantulaModel = ProducerMethodBean.of(method,
bean, manager);
assert tarantulaModel.getBindingTypes().size() == 1;
assert
tarantulaModel.getBindingTypes().iterator().next().annotationType().equals(Tame.class);
}
@@ -162,10 +158,10 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
public void testScopeType() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
+ SimpleBean<SpiderProducer> bean = SimpleBean.of(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("produceDaddyLongLegs");
- ProducerMethodBean<DaddyLongLegs> daddyLongLegsModel =
createProducerMethodBean(DaddyLongLegs.class, method, bean, manager);
+ ProducerMethodBean<DaddyLongLegs> daddyLongLegsModel =
ProducerMethodBean.of(method, bean, manager);
assert daddyLongLegsModel.getScopeType().equals(RequestScoped.class);
// TODO Inherit scope from returned web bean?
@@ -174,58 +170,58 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
public void testDeploymentType() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
+ SimpleBean<SpiderProducer> bean = SimpleBean.of(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("getLadybirdSpider");
- ProducerMethodBean<LadybirdSpider> ladybirdSpiderModel =
createProducerMethodBean(LadybirdSpider.class, method, bean, manager);
+ ProducerMethodBean<LadybirdSpider> ladybirdSpiderModel =
ProducerMethodBean.of(method, bean, manager);
assert ladybirdSpiderModel.getDeploymentType().equals(Production.class);
}
@Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
public void testNamedMethod() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
+ SimpleBean<SpiderProducer> bean = SimpleBean.of(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("produceBlackWidow");
- ProducerMethodBean<BlackWidow> blackWidowSpiderModel =
createProducerMethodBean(BlackWidow.class, method, bean, manager);
+ ProducerMethodBean<BlackWidow> blackWidowSpiderModel =
ProducerMethodBean.of(method, bean, manager);
assert blackWidowSpiderModel.getName().equals("blackWidow");
}
@Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
public void testDefaultNamedMethod() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
+ SimpleBean<SpiderProducer> bean = SimpleBean.of(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("produceDaddyLongLegs");
- ProducerMethodBean<DaddyLongLegs> daddyLongLegsSpiderModel =
createProducerMethodBean(DaddyLongLegs.class, method, bean, manager);
+ ProducerMethodBean<DaddyLongLegs> daddyLongLegsSpiderModel =
ProducerMethodBean.of(method, bean, manager);
assert
daddyLongLegsSpiderModel.getName().equals("produceDaddyLongLegs");
}
@Test(groups="producerMethod", expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.4")
public void testProducerMethodAnnotatedDestructor() throws Exception
{
- SimpleBean<BrokenSpiderProducer> bean =
createSimpleBean(BrokenSpiderProducer.class, manager);
+ SimpleBean<BrokenSpiderProducer> bean =
SimpleBean.of(BrokenSpiderProducer.class, manager);
manager.addBean(bean);
Method method = BrokenSpiderProducer.class.getMethod("destroy");
- createProducerMethodBean(String.class, method, bean, manager);
+ ProducerMethodBean.of(method, bean, manager);
}
@Test(groups="producerMethod", expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.4")
public void testProducerMethodWithParameterAnnotatedDisposes() throws Exception
{
- SimpleBean<BrokenSpiderProducer> bean =
createSimpleBean(BrokenSpiderProducer.class, manager);
+ SimpleBean<BrokenSpiderProducer> bean =
SimpleBean.of(BrokenSpiderProducer.class, manager);
manager.addBean(bean);
Method method = BrokenSpiderProducer.class.getMethod("dispose",
String.class);
- createProducerMethodBean(String.class, method, bean, manager);
+ ProducerMethodBean.of(method, bean, manager);
}
@Test(groups="producerMethod", expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.4")
public void testProducerMethodWithParameterAnnotatedObserves() throws Exception
{
- SimpleBean<BrokenSpiderProducer> bean =
createSimpleBean(BrokenSpiderProducer.class, manager);
+ SimpleBean<BrokenSpiderProducer> bean =
SimpleBean.of(BrokenSpiderProducer.class, manager);
manager.addBean(bean);
Method method = BrokenSpiderProducer.class.getMethod("observe",
String.class);
- createProducerMethodBean(String.class, method, bean, manager);
+ ProducerMethodBean.of(method, bean, manager);
}
@Test(groups={"stub", "disposalMethod"})
@SpecAssertion(section="3.3.4")
@@ -291,10 +287,10 @@
@Test(groups="producerMethod") @SpecAssertion(section={"2.7.2",
"3.4.2", "2.2"})
public void testStereotype() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
+ SimpleBean<SpiderProducer> bean = SimpleBean.of(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("produceWolfSpider");
- ProducerMethodBean<WolfSpider> wolfSpiderModel =
createProducerMethodBean(WolfSpider.class, method, bean, manager);
+ ProducerMethodBean<WolfSpider> wolfSpiderModel =
ProducerMethodBean.of(method, bean, manager);
assert wolfSpiderModel.getMergedStereotypes().getRequiredTypes().size() == 1;
assert
wolfSpiderModel.getMergedStereotypes().getRequiredTypes().contains(Animal.class);
assert wolfSpiderModel.getScopeType().equals(RequestScoped.class);
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByNameTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,9 +1,8 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import javax.webbeans.manager.Bean;
+import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.test.beans.Cod;
import org.jboss.webbeans.test.beans.Haddock;
import org.jboss.webbeans.test.beans.Plaice;
@@ -39,13 +38,13 @@
public void testNamedBasedResolution()
{
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class, manager);
- Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
- Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
- Bean<SeaBass> seaBassBean = createSimpleBean(SeaBass.class, manager);
- Bean<Haddock> haddockBean = createSimpleBean(Haddock.class, manager);
- Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class, manager);
+ Bean<Tuna> tunaBean = SimpleBean.of(Tuna.class, manager);
+ Bean<Cod> codBean = SimpleBean.of(Cod.class, manager);
+ Bean<Salmon> salmonBean = SimpleBean.of(Salmon.class, manager);
+ Bean<Sole> soleBean = SimpleBean.of(Sole.class, manager);
+ Bean<SeaBass> seaBassBean = SimpleBean.of(SeaBass.class, manager);
+ Bean<Haddock> haddockBean = SimpleBean.of(Haddock.class, manager);
+ Bean<Plaice> plaiceBean = SimpleBean.of(Plaice.class, manager);
manager.addBean(tunaBean);
manager.addBean(codBean);
@@ -70,8 +69,8 @@
@Test(groups="resolution") @SpecAssertion(section="5.11.1")
public void testNoWebBeansFound() throws Exception
{
- Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
+ Bean<Cod> codBean = SimpleBean.of(Cod.class, manager);
+ Bean<Salmon> salmonBean = SimpleBean.of(Salmon.class, manager);
manager.addBean(codBean);
manager.addBean(salmonBean);
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,8 +1,5 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createProducerMethodBean;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import java.lang.reflect.Method;
import java.util.Set;
@@ -12,6 +9,7 @@
import javax.webbeans.TypeLiteral;
import javax.webbeans.manager.Bean;
+import org.jboss.webbeans.bean.ProducerMethodBean;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.binding.CurrentBinding;
import org.jboss.webbeans.introspector.AnnotatedClass;
@@ -65,7 +63,7 @@
public void testDefaultBindingTypeAssumed() throws Exception
{
AnnotatedField<Tuna> tunaField = new
AnnotatedFieldImpl<Tuna>(FishFarm.class.getDeclaredField("tuna"),
fishFarmClass);
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class, manager);
+ Bean<Tuna> tunaBean = SimpleBean.of(Tuna.class, manager);
manager.addBean(tunaBean);
Set<Bean<Tuna>> possibleTargets = manager.resolveByType(tunaField);
assert possibleTargets.size() == 1;
@@ -100,9 +98,9 @@
public void testOneBindingType() throws Exception
{
AnnotatedField<ScottishFish> whiteScottishFishField = new
AnnotatedFieldImpl<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"),
fishFarmClass);
- Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
- Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
+ Bean<Cod> codBean = SimpleBean.of(Cod.class, manager);
+ Bean<Salmon> salmonBean = SimpleBean.of(Salmon.class, manager);
+ Bean<Sole> soleBean = SimpleBean.of(Sole.class, manager);
manager.addBean(codBean);
manager.addBean(salmonBean);
manager.addBean(soleBean);
@@ -117,9 +115,9 @@
{
AnnotatedField<Animal> whiteChunkyFishField = new
AnnotatedFieldImpl<Animal>(FishFarm.class.getDeclaredField("realChunkyWhiteFish"),
fishFarmClass);
- Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
- Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
+ Bean<Cod> codBean = SimpleBean.of(Cod.class, manager);
+ Bean<Salmon> salmonBean = SimpleBean.of(Salmon.class, manager);
+ Bean<Sole> soleBean = SimpleBean.of(Sole.class, manager);
manager.addBean(codBean);
manager.addBean(salmonBean);
@@ -133,8 +131,8 @@
public void testMultipleApiTypeWithCurrent() throws Exception
{
AnnotatedField<Animal> animalField = new
AnnotatedFieldImpl<Animal>(FishFarm.class.getDeclaredField("animal"),
fishFarmClass);
- Bean<SeaBass> seaBassBean = createSimpleBean(SeaBass.class, manager);
- Bean<Haddock> haddockBean = createSimpleBean(Haddock.class, manager);
+ Bean<SeaBass> seaBassBean = SimpleBean.of(SeaBass.class, manager);
+ Bean<Haddock> haddockBean = SimpleBean.of(Haddock.class, manager);
manager.addBean(seaBassBean);
manager.addBean(haddockBean);
Set<Bean<Animal>> possibleTargets =
manager.resolveByType(animalField);
@@ -146,10 +144,10 @@
@Test(groups="resolution") @SpecAssertion(section={"5.9.2"})
public void testResolveByType() throws Exception
{
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class, manager);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
- Bean<SeaBass> seaBassBean = createSimpleBean(SeaBass.class, manager);
- Bean<Haddock> haddockBean = createSimpleBean(Haddock.class, manager);
+ Bean<Tuna> tunaBean = SimpleBean.of(Tuna.class, manager);
+ Bean<Salmon> salmonBean = SimpleBean.of(Salmon.class, manager);
+ Bean<SeaBass> seaBassBean = SimpleBean.of(SeaBass.class, manager);
+ Bean<Haddock> haddockBean = SimpleBean.of(Haddock.class, manager);
manager.addBean(tunaBean);
manager.addBean(salmonBean);
@@ -171,9 +169,9 @@
@Test(groups="injection")
@SpecAssertion(section={"2.3.5","5.9.2.2"})
public void testAllBindingTypesSpecifiedForResolutionMustAppearOnWebBean()
{
- Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
- Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
+ Bean<Cod> codBean = SimpleBean.of(Cod.class, manager);
+ Bean<Salmon> salmonBean = SimpleBean.of(Salmon.class, manager);
+ Bean<Sole> soleBean = SimpleBean.of(Sole.class, manager);
manager.addBean(codBean);
manager.addBean(salmonBean);
@@ -206,8 +204,8 @@
{
AnnotatedField<Farmer<ScottishFish>> scottishFishFarmerField = new
AnnotatedFieldImpl<Farmer<ScottishFish>>(FishFarm.class.getDeclaredField("scottishFishFarmer"),
fishFarmClass);
- Bean<ScottishFishFarmer> scottishFishFarmerBean =
createSimpleBean(ScottishFishFarmer.class, manager);
- Bean<AnimalFarmer> farmerBean = createSimpleBean(AnimalFarmer.class,
manager);
+ Bean<ScottishFishFarmer> scottishFishFarmerBean =
SimpleBean.of(ScottishFishFarmer.class, manager);
+ Bean<AnimalFarmer> farmerBean = SimpleBean.of(AnimalFarmer.class, manager);
manager.addBean(scottishFishFarmerBean);
manager.addBean(farmerBean);
@@ -219,13 +217,13 @@
@Test(groups={"resolution", "producerMethod"})
@SpecAssertion(section="5.9.2")
public void testResolveByTypeWithArray() throws Exception
{
- SimpleBean<SpiderProducer> spiderProducerBean =
createSimpleBean(SpiderProducer.class, manager);
+ SimpleBean<SpiderProducer> spiderProducerBean =
SimpleBean.of(SpiderProducer.class, manager);
manager.addBean(spiderProducerBean);
Method method = SpiderProducer.class.getMethod("getSpiders");
- Bean<Spider[]> spidersModel = createProducerMethodBean(Spider[].class,
method, spiderProducerBean, manager);
+ Bean<Spider[]> spidersModel = ProducerMethodBean.of(method,
spiderProducerBean, manager);
manager.addBean(spidersModel);
method = SpiderProducer.class.getMethod("getStrings");
- Bean<String[]> stringModel = createProducerMethodBean(String[].class, method,
spiderProducerBean, manager);
+ Bean<String[]> stringModel = ProducerMethodBean.of(method,
spiderProducerBean, manager);
manager.addBean(stringModel);
assert manager.resolveByType(Spider[].class).size() == 1;
@@ -235,9 +233,9 @@
public void testOnlyHighestEnabledPreecedenceWebBeansResolved() throws Exception
{
AnnotatedField<Animal> whiteFishField = new
AnnotatedFieldImpl<Animal>(FishFarm.class.getDeclaredField("whiteFish"),
fishFarmClass);
- Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
- Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
- Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class, manager);
+ Bean<Cod> codBean = SimpleBean.of(Cod.class, manager);
+ Bean<Sole> soleBean = SimpleBean.of(Sole.class, manager);
+ Bean<Plaice> plaiceBean = SimpleBean.of(Plaice.class, manager);
manager.addBean(plaiceBean);
@@ -254,9 +252,9 @@
public void testNoWebBeansFound() throws Exception
{
AnnotatedField<ScottishFish> whiteScottishFishField = new
AnnotatedFieldImpl<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"),
fishFarmClass);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
- Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
- Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class, manager);
+ Bean<Salmon> salmonBean = SimpleBean.of(Salmon.class, manager);
+ Bean<Sole> soleBean = SimpleBean.of(Sole.class, manager);
+ Bean<Plaice> plaiceBean = SimpleBean.of(Plaice.class, manager);
manager.addBean(plaiceBean);
manager.addBean(salmonBean);
manager.addBean(soleBean);
@@ -267,9 +265,9 @@
@Test(groups="resolution") @SpecAssertion(section={"5.9.2",
"2.2"})
public void testResolveObject() throws Exception
{
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
- Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
- Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class, manager);
+ Bean<Salmon> salmonBean = SimpleBean.of(Salmon.class, manager);
+ Bean<Sole> soleBean = SimpleBean.of(Sole.class, manager);
+ Bean<Plaice> plaiceBean = SimpleBean.of(Plaice.class, manager);
manager.addBean(plaiceBean);
manager.addBean(salmonBean);
manager.addBean(soleBean);
@@ -287,9 +285,9 @@
public void testResolveByTypeWithNonBindingMembers() throws Exception
{
AnnotatedField<Animal> veryExpensiveWhitefishField = new
AnnotatedFieldImpl<Animal>(FishFarm.class.getDeclaredField("veryExpensiveWhitefish"),
fishFarmClass);
- Bean<Halibut> halibutBean = createSimpleBean(Halibut.class, manager);
- Bean<RoundWhitefish> roundWhiteFishBean =
createSimpleBean(RoundWhitefish.class, manager);
- Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
+ Bean<Halibut> halibutBean = SimpleBean.of(Halibut.class, manager);
+ Bean<RoundWhitefish> roundWhiteFishBean = SimpleBean.of(RoundWhitefish.class,
manager);
+ Bean<Sole> soleBean = SimpleBean.of(Sole.class, manager);
manager.addBean(halibutBean);
manager.addBean(roundWhiteFishBean);
manager.addBean(soleBean);
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,7 +1,5 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import javax.webbeans.ApplicationScoped;
import javax.webbeans.DefinitionException;
import javax.webbeans.Dependent;
@@ -28,7 +26,7 @@
@Test @SpecAssertion(section="2.4")
public void testScopeTypesAreExtensible()
{
- Bean<Mullet> mullet = createSimpleBean(Mullet.class, manager);
+ Bean<Mullet> mullet = SimpleBean.of(Mullet.class, manager);
assert mullet.getScopeType().equals(AnotherScopeType.class);
}
@@ -53,14 +51,14 @@
@Test @SpecAssertion(section="2.4.3")
public void testScopeDeclaredInJava()
{
- SimpleBean<SeaBass> trout = createSimpleBean(SeaBass.class, manager);
+ SimpleBean<SeaBass> trout = SimpleBean.of(SeaBass.class, manager);
assert trout.getScopeType().equals(RequestScoped.class);
}
@Test(expectedExceptions=DefinitionException.class)
@SpecAssertion(section="2.4.3")
public void testTooManyScopesSpecifiedInJava()
{
- createSimpleBean(BeanWithTooManyScopeTypes.class, manager);
+ SimpleBean.of(BeanWithTooManyScopeTypes.class, manager);
}
@Test(expectedExceptions=DefinitionException.class, groups={"stub",
"webbeansxml"})
@@ -110,41 +108,41 @@
@Test @SpecAssertion(section="2.4.5")
public void testDefaultScope()
{
- SimpleBean<Order> order = createSimpleBean(Order.class, manager);
+ SimpleBean<Order> order = SimpleBean.of(Order.class, manager);
assert order.getScopeType().equals(Dependent.class);
}
@Test @SpecAssertion(section={"2.4.5", "2.7.2"})
public void testScopeSpecifiedAndStereotyped()
{
- Bean<Minnow> minnow = createSimpleBean(Minnow.class, manager);
+ Bean<Minnow> minnow = SimpleBean.of(Minnow.class, manager);
assert minnow.getScopeType().equals(RequestScoped.class);
}
@Test(expectedExceptions=DefinitionException.class)
@SpecAssertion(section="2.4.5")
public void testMutipleIncompatibleScopeStereotypes()
{
- createSimpleBean(Scallop.class, manager);
+ SimpleBean.of(Scallop.class, manager);
}
@Test @SpecAssertion(section="2.4.5")
public void testMutipleIncompatibleScopeStereotypesWithScopeSpecified()
{
- Bean<Pollock> pollock = createSimpleBean(Pollock.class, manager);
+ Bean<Pollock> pollock = SimpleBean.of(Pollock.class, manager);
assert pollock.getScopeType().equals(Dependent.class);
}
@Test @SpecAssertion(section="2.4.5")
public void testMutipleCompatibleScopeStereotypes()
{
- Bean<Grayling> grayling = createSimpleBean(Grayling.class, manager);
+ Bean<Grayling> grayling = SimpleBean.of(Grayling.class, manager);
assert grayling.getScopeType().equals(ApplicationScoped.class);
}
@Test @SpecAssertion(section="2.7.2")
public void testWebBeanScopeTypeOverridesStereotype()
{
- Bean<RedSnapper> bean = createSimpleBean(RedSnapper.class, manager);
+ Bean<RedSnapper> bean = SimpleBean.of(RedSnapper.class, manager);
assert bean.getScopeType().equals(RequestScoped.class);
}
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanLifecycleTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,7 +1,5 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import javax.webbeans.manager.Bean;
import org.jboss.webbeans.bean.SimpleBean;
@@ -21,8 +19,8 @@
@Test(groups="beanConstruction") @SpecAssertion(section="3.1.3")
public void testInjectionOfParametersIntoBeanConstructor()
{
- Bean<FishPond> goldfishPondBean = createSimpleBean(FishPond.class, manager);
- Bean<Goldfish> goldfishBean = createSimpleBean(Goldfish.class, manager);
+ Bean<FishPond> goldfishPondBean = SimpleBean.of(FishPond.class, manager);
+ Bean<Goldfish> goldfishBean = SimpleBean.of(Goldfish.class, manager);
manager.addBean(goldfishBean);
manager.addBean(goldfishPondBean);
FishPond fishPond = goldfishPondBean.create();
@@ -39,7 +37,7 @@
@Test(groups="beanLifecycle") @SpecAssertion(section="5.3")
public void testCreateReturnsInstanceOfBean()
{
- Bean<RedSnapper> bean = createSimpleBean(RedSnapper.class, manager);
+ Bean<RedSnapper> bean = SimpleBean.of(RedSnapper.class, manager);
assert bean.create() instanceof RedSnapper;
}
@@ -76,8 +74,8 @@
@Test(groups={"beanLifecycle", "lifecycleCallbacks"})
@SpecAssertion(section="5.3")
public void testPostConstructPreDestroy() throws Exception
{
- Bean<FarmOffice> farmOfficeBean = createSimpleBean(FarmOffice.class,
manager);
- Bean<Farm> farmBean = createSimpleBean(Farm.class, manager);
+ Bean<FarmOffice> farmOfficeBean = SimpleBean.of(FarmOffice.class, manager);
+ Bean<Farm> farmBean = SimpleBean.of(Farm.class, manager);
manager.addBean(farmOfficeBean);
manager.addBean(farmBean);
Farm farm = farmBean.create();
@@ -91,8 +89,8 @@
@Test(groups="injection") @SpecAssertion(section="5.3")
public void testCreateInjectsFieldsDeclaredInJava()
{
- SimpleBean<TunaFarm> tunaFarmBean = createSimpleBean(TunaFarm.class,
manager);
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class, manager);
+ SimpleBean<TunaFarm> tunaFarmBean = SimpleBean.of(TunaFarm.class, manager);
+ Bean<Tuna> tunaBean = SimpleBean.of(Tuna.class, manager);
manager.addBean(tunaBean);
TunaFarm tunaFarm = tunaFarmBean.create();
assert tunaFarm.tuna != null;
@@ -101,8 +99,8 @@
@Test(groups="injection")
public void testFieldMissingBindingAnnotationsAreNotInjected()
{
- SimpleBean<TunaFarm> tunaFarmBean = createSimpleBean(TunaFarm.class,
manager);
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class, manager);
+ SimpleBean<TunaFarm> tunaFarmBean = SimpleBean.of(TunaFarm.class, manager);
+ Bean<Tuna> tunaBean = SimpleBean.of(Tuna.class, manager);
manager.addBean(tunaBean);
TunaFarm tunaFarm = tunaFarmBean.create();
assert tunaFarm.notInjectedTuna != manager.getInstance(tunaBean);
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,7 +1,5 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.HashMap;
@@ -50,26 +48,26 @@
@Test(expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.2")
public void testAbstractClassDeclaredInJavaIsNotAllowed()
{
- createSimpleBean(Cow.class, manager);
+ SimpleBean.of(Cow.class, manager);
}
@Test(groups="innerClass") @SpecAssertion(section="3.2")
public void testStaticInnerClassDeclaredInJavaAllowed()
{
- createSimpleBean(StaticInnerBean.class, manager);
+ SimpleBean.of(StaticInnerBean.class, manager);
}
@Test(expectedExceptions=DefinitionException.class, groups="innerClass")
@SpecAssertion(section="3.2")
public void testNonStaticInnerClassDeclaredInJavaNotAllowed()
{
- createSimpleBean(InnerBean.class, manager);
+ SimpleBean.of(InnerBean.class, manager);
}
@SuppressWarnings("unchecked")
@Test(expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.2")
public void testParameterizedClassDeclaredInJavaIsNotAllowed()
{
- createSimpleBean(ParameterizedBean.class, manager);
+ SimpleBean.of(ParameterizedBean.class, manager);
}
@Test(expectedExceptions=DefinitionException.class, groups={"stub",
"interceptors", "decorators"})
@SpecAssertion(section="3.2")
@@ -171,7 +169,7 @@
@Test @SpecAssertion(section="3.2.5.1")
public void testInitializerAnnotatedConstructor()
{
- AnnotatedConstructor<Sheep> constructor = createSimpleBean(Sheep.class,
manager).getConstructor();
+ AnnotatedConstructor<Sheep> constructor = SimpleBean.of(Sheep.class,
manager).getConstructor();
assert constructor.getDeclaringClass().getType().equals(Sheep.class);
assert constructor.getParameters().size() == 2;
@@ -191,7 +189,7 @@
@Test @SpecAssertion(section="3.2.5.1")
public void testImplicitConstructorUsed()
{
- AnnotatedConstructor<Order> constructor = createSimpleBean(Order.class,
manager).getConstructor();
+ AnnotatedConstructor<Order> constructor = SimpleBean.of(Order.class,
manager).getConstructor();
assert constructor.getDeclaringClass().getType().equals(Order.class);
assert constructor.getParameters().size() == 0;
}
@@ -199,7 +197,7 @@
@Test @SpecAssertion(section="3.2.5.1")
public void testEmptyConstructorUsed()
{
- AnnotatedConstructor<Donkey> constructor = createSimpleBean(Donkey.class,
manager).getConstructor();
+ AnnotatedConstructor<Donkey> constructor = SimpleBean.of(Donkey.class,
manager).getConstructor();
assert constructor.getDeclaringClass().getType().equals(Donkey.class);
assert constructor.getParameters().size() == 0;
}
@@ -207,7 +205,7 @@
@Test @SpecAssertion(section="3.2.5.1")
public void testInitializerAnnotatedConstructorUsedOverEmptyConstuctor()
{
- AnnotatedConstructor<Turkey> constructor = createSimpleBean(Turkey.class,
manager).getConstructor();
+ AnnotatedConstructor<Turkey> constructor = SimpleBean.of(Turkey.class,
manager).getConstructor();
assert constructor.getParameters().size() == 2;
Map<Class<?>, Set<? extends Annotation>> map = new
HashMap<Class<?>, Set<? extends Annotation>>();
for (AnnotatedParameter<Object> parameter : constructor.getParameters())
@@ -221,7 +219,7 @@
@Test(expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.2.5.1")
public void testTooManyInitializerAnnotatedConstructor()
{
- createSimpleBean(Goose.class, manager);
+ SimpleBean.of(Goose.class, manager);
}
@Test(expectedExceptions=DefinitionException.class, groups={"stub",
"disposalMethod"}) @SpecAssertion(section="3.2.5.1")
@@ -245,7 +243,7 @@
@Test(groups={"stub", "webbeansxml"})
@SpecAssertion(section="3.2.5.2")
public void testEmptyConstructorDeclaredInXmlUsed()
{
- AnnotatedConstructor<Donkey> constructor = createSimpleBean(Donkey.class,
manager).getConstructor();
+ AnnotatedConstructor<Donkey> constructor = SimpleBean.of(Donkey.class,
manager).getConstructor();
assert constructor.getParameters().size() == 0;
assert false;
}
@@ -265,7 +263,7 @@
@Test @SpecAssertion(section="3.2.5.3")
public void testBindingTypeAnnotatedConstructor()
{
- AnnotatedConstructor<Duck> constructor = createSimpleBean(Duck.class,
manager).getConstructor();
+ AnnotatedConstructor<Duck> constructor = SimpleBean.of(Duck.class,
manager).getConstructor();
assert constructor.getDeclaringClass().getType().equals(Duck.class);
assert constructor.getParameters().size() == 2;
Map<Class<?>, Set<? extends Annotation>> map = new
HashMap<Class<?>, Set<? extends Annotation>>();
@@ -284,7 +282,7 @@
@Test(groups="specializationInherit")
@SpecAssertion(section="3.2.6")
public void testSpecializedClassInheritsBindingTypes()
{
- SimpleBean<Tractor> bean = createSimpleBean(Tractor.class, manager);
+ SimpleBean<Tractor> bean = SimpleBean.of(Tractor.class, manager);
assert bean.getBindingTypes().size()==2;
assert bean.getBindingTypes().contains( new AnnotationLiteral<Motorized>() {}
);
assert bean.getBindingTypes().contains( new AnnotationLiteral<HeavyDuty>() {}
);
@@ -293,7 +291,7 @@
@Test(groups="specializationInherit")
@SpecAssertion(section="3.2.6")
public void testSpecializedClassInheritsName()
{
- SimpleBean<Tractor> bean = createSimpleBean(Tractor.class, manager);
+ SimpleBean<Tractor> bean = SimpleBean.of(Tractor.class, manager);
assert bean.getName()!=null;
assert bean.getName().equals("plough");
}
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 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypesTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,7 +1,5 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import java.util.Arrays;
import javax.webbeans.DefinitionException;
@@ -144,7 +142,7 @@
@Test @SpecAssertion(section={"2.7.2", "2.7.4"})
public void testMultipleStereotypes()
{
- SimpleBean<HighlandCow> highlandCow = createSimpleBean(HighlandCow.class,
manager);
+ SimpleBean<HighlandCow> highlandCow = SimpleBean.of(HighlandCow.class,
manager);
assert highlandCow.getName() == null;
assert
highlandCow.getBindingTypes().iterator().next().annotationType().equals(Tame.class);
assert highlandCow.getScopeType().equals(RequestScoped.class);
@@ -189,25 +187,25 @@
@Test(a)SpecAssertion(section={"2.7.1.4", "2.7.4"})
public void testRequiredTypeIsImplemented()
{
- createSimpleBean(HighlandCow.class, manager);
+ SimpleBean.of(HighlandCow.class, manager);
}
@Test(expectedExceptions=DefinitionException.class)
@SpecAssertion(section={"2.7.1.4", "2.7.4"})
public void testRequiredTypeIsNotImplemented()
{
- createSimpleBean(Chair.class, manager);
+ SimpleBean.of(Chair.class, manager);
}
@Test @SpecAssertion(section={"2.7.1.4", "2.7.4"})
public void testScopeIsSupported()
{
- createSimpleBean(Goldfish.class, manager);
+ SimpleBean.of(Goldfish.class, manager);
}
@Test(expectedExceptions=DefinitionException.class)
@SpecAssertion(section={"2.7.1.4", "2.7.4"})
public void testScopeIsNotSupported()
{
- createSimpleBean(Carp.class, manager);
+ SimpleBean.of(Carp.class, manager);
}
// TODO Stereotype inheritance tests
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 2009-01-07
11:49:47 UTC (rev 805)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,7 +1,5 @@
package org.jboss.webbeans.test;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.test.beans.Haddock;
import org.testng.annotations.Test;
@@ -12,7 +10,7 @@
@Test @SpecAssertion(section="2.6.3")
public void testDefaultNamed()
{
- SimpleBean<Haddock> haddock = createSimpleBean(Haddock.class, manager);
+ SimpleBean<Haddock> haddock = SimpleBean.of(Haddock.class, manager);
assert haddock.getName() != null;
assert haddock.getName().equals("haddock");
}
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/AuroraFinch.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/AuroraFinch.java 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/AuroraFinch.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,8 +1,8 @@
package org.jboss.webbeans.test.beans;
import javax.webbeans.Event;
+import javax.webbeans.Fires;
import javax.webbeans.Initializer;
-import javax.webbeans.Fires;
import org.jboss.webbeans.test.beans.StarFinch.Mess;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/OrangeCheekedWaxbill.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/OrangeCheekedWaxbill.java 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/OrangeCheekedWaxbill.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,8 +1,9 @@
package org.jboss.webbeans.test.beans;
import javax.webbeans.Event;
+import javax.webbeans.Fires;
import javax.webbeans.Initializer;
-import javax.webbeans.Fires;
+
import org.jboss.webbeans.test.beans.StarFinch.Mess;
public class OrangeCheekedWaxbill
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/StarFinch.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/StarFinch.java 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/StarFinch.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,8 +1,8 @@
package org.jboss.webbeans.test.beans;
import javax.webbeans.Event;
+import javax.webbeans.Fires;
import javax.webbeans.Named;
-import javax.webbeans.Fires;
import javax.webbeans.Produces;
import javax.webbeans.RequestScoped;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/DependentContextTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/DependentContextTest.java 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/DependentContextTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -1,8 +1,5 @@
package org.jboss.webbeans.test.contexts;
-import static org.jboss.webbeans.bean.BeanFactory.createProducerMethodBean;
-import static org.jboss.webbeans.bean.BeanFactory.createSimpleBean;
-
import java.lang.reflect.Method;
import javax.webbeans.ContextNotActiveException;
@@ -33,8 +30,8 @@
@SpecAssertion(section = "9.4")
public void testInstanceNotSharedBetweenInjectionPoints()
{
- Bean<FoxRun> foxRunBean = createSimpleBean(FoxRun.class, manager);
- Bean<Fox> foxBean = createSimpleBean(Fox.class, manager);
+ Bean<FoxRun> foxRunBean = SimpleBean.of(FoxRun.class, manager);
+ Bean<Fox> foxBean = SimpleBean.of(Fox.class, manager);
manager.addBean(foxBean);
FoxRun foxRun = foxRunBean.create();
assert !foxRun.fox.equals(foxRun.anotherFox);
@@ -60,10 +57,10 @@
@SpecAssertion(section = "9.4")
public void testInstanceUsedForProducerMethodNotShared() throws Exception
{
- SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class, manager);
+ SimpleBean<SpiderProducer> spiderProducer =
SimpleBean.of(SpiderProducer.class, manager);
manager.addBean(spiderProducer);
Method method = SpiderProducer.class.getMethod("produceTarantula");
- ProducerMethodBean<Tarantula> tarantulaBean =
createProducerMethodBean(Tarantula.class, method, spiderProducer, manager);
+ ProducerMethodBean<Tarantula> tarantulaBean = ProducerMethodBean.of(method,
spiderProducer, manager);
Tarantula tarantula = tarantulaBean.create();
Tarantula tarantula2 = tarantulaBean.create();
assert tarantula != null;
@@ -116,7 +113,7 @@
@SpecAssertion(section = "9.4")
public void testContextGetWithCreateTrueReturnsNewInstance()
{
- Bean<Fox> foxBean = createSimpleBean(Fox.class, manager);
+ Bean<Fox> foxBean = SimpleBean.of(Fox.class, manager);
manager.addBean(foxBean);
DependentContext context = new DependentContext();
context.setActive(true);
@@ -132,7 +129,7 @@
@SpecAssertion(section = "9.4")
public void testContextGetWithCreateFalseReturnsNull()
{
- Bean<Fox> foxBean = createSimpleBean(Fox.class, manager);
+ Bean<Fox> foxBean = SimpleBean.of(Fox.class, manager);
manager.addBean(foxBean);
DependentContext context = new DependentContext();
context.setActive(true);
@@ -216,8 +213,8 @@
public void testContextIsActiveDuringBeanCreation()
{
// Slightly roundabout, but I can't see a better way to test atm
- Bean<FoxRun> foxRunBean = createSimpleBean(FoxRun.class, manager);
- Bean<Fox> foxBean = createSimpleBean(Fox.class, manager);
+ Bean<FoxRun> foxRunBean = SimpleBean.of(FoxRun.class, manager);
+ Bean<Fox> foxBean = SimpleBean.of(Fox.class, manager);
manager.addBean(foxBean);
FoxRun foxRun = foxRunBean.create();
assert foxRun.fox != null;
@@ -242,8 +239,8 @@
@SpecAssertion(section = "9.4")
public void testContextIsActiveDuringInjection()
{
- Bean<FoxRun> foxRunBean = createSimpleBean(FoxRun.class, manager);
- Bean<Fox> foxBean = createSimpleBean(Fox.class, manager);
+ Bean<FoxRun> foxRunBean = SimpleBean.of(FoxRun.class, manager);
+ Bean<Fox> foxBean = SimpleBean.of(Fox.class, manager);
manager.addBean(foxBean);
FoxRun foxRun = foxRunBean.create();
assert foxRun.fox != null;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/PassivatingContextTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/PassivatingContextTest.java 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/PassivatingContextTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -16,8 +16,9 @@
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.MetaDataCache;
import org.jboss.webbeans.bean.AbstractProducerBean;
-import org.jboss.webbeans.bean.BeanFactory;
import org.jboss.webbeans.bean.EnterpriseBean;
+import org.jboss.webbeans.bean.ProducerFieldBean;
+import org.jboss.webbeans.bean.ProducerMethodBean;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.test.AbstractTest;
import org.jboss.webbeans.test.SpecAssertion;
@@ -82,7 +83,7 @@
@SpecAssertion(section = "9.5")
public void testEJBWebBeanCanDeclarePassivatingScope()
{
- EnterpriseBean<Turku> bean = BeanFactory.createEnterpriseBean(Turku.class,
manager);
+ EnterpriseBean<Turku> bean = EnterpriseBean.of(Turku.class, manager);
assert true;
}
@@ -110,7 +111,7 @@
@SpecAssertion(section = "9.5")
public void testSimpleWebBeanWithSerializableImplementationClassOK()
{
- SimpleBean<Jyvaskyla> bean = BeanFactory.createSimpleBean(Jyvaskyla.class,
manager);
+ SimpleBean<Jyvaskyla> bean = SimpleBean.of(Jyvaskyla.class, manager);
assert true;
}
@@ -169,7 +170,7 @@
@SpecAssertion(section = "9.5")
public void
testSimpleWebBeanDeclaringPassivatingScopeIsSerializedWhenContextIsPassivated() throws
IOException, ClassNotFoundException
{
- SimpleBean<Jyvaskyla> bean = BeanFactory.createSimpleBean(Jyvaskyla.class,
manager);
+ SimpleBean<Jyvaskyla> bean = SimpleBean.of(Jyvaskyla.class, manager);
//assert testSerialize(bean);
}
@@ -195,7 +196,7 @@
@SpecAssertion(section = "9.5")
public void testStatefulEJBIsSerializedWhenPassivatedByEJBContainer() throws
IOException, ClassNotFoundException
{
- EnterpriseBean<Turku> bean = BeanFactory.createEnterpriseBean(Turku.class,
manager);
+ EnterpriseBean<Turku> bean = EnterpriseBean.of(Turku.class, manager);
assert testSerialize(bean);
}
@@ -209,7 +210,7 @@
@SpecAssertion(section = "9.5")
public void testDependentInterceptorsOfStatefulEnterpriseBeanMustBeSerializable()
{
- EnterpriseBean<Kaarina> bean =
BeanFactory.createEnterpriseBean(Kaarina.class, manager);
+ EnterpriseBean<Kaarina> bean = EnterpriseBean.of(Kaarina.class, manager);
}
/**
@@ -222,7 +223,7 @@
@SpecAssertion(section = "9.5")
public void testDependentDecoratorsOfStatefulEnterpriseBeanMustBeSerializable()
{
- EnterpriseBean<Porvoo> bean = BeanFactory.createEnterpriseBean(Porvoo.class,
manager);
+ EnterpriseBean<Porvoo> bean = EnterpriseBean.of(Porvoo.class, manager);
}
/**
@@ -235,7 +236,7 @@
@SpecAssertion(section = "9.5")
public void
testDependentInterceptorsOfWebBeanWithPassivatingScopeMustBeSerializable()
{
- SimpleBean<Kotka> bean = BeanFactory.createSimpleBean(Kotka.class, manager);
+ SimpleBean<Kotka> bean = SimpleBean.of(Kotka.class, manager);
}
/**
@@ -248,7 +249,7 @@
@SpecAssertion(section = "9.5")
public void testDependentDecoratorsOfWebBeansWithPassivatingScopeMustBeSerializable()
{
- SimpleBean<Raisio> bean = BeanFactory.createSimpleBean(Raisio.class,
manager);
+ SimpleBean<Raisio> bean = SimpleBean.of(Raisio.class, manager);
}
/**
@@ -262,8 +263,8 @@
@SpecAssertion(section = "9.5")
public void testDependentEJBsAreSerializable() throws IOException,
ClassNotFoundException
{
- SimpleBean<Vaasa> bean = BeanFactory.createSimpleBean(Vaasa.class, manager);
- manager.addBean(BeanFactory.createSimpleBean(Helsinki.class, manager));
+ SimpleBean<Vaasa> bean = SimpleBean.of(Vaasa.class, manager);
+ manager.addBean(SimpleBean.of(Helsinki.class, manager));
assert testSerialize(bean);
}
@@ -280,8 +281,8 @@
@SpecAssertion(section = "9.5")
public void
testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoStatefulSessionBeanFails()
{
- manager.addBean(BeanFactory.createSimpleBean(Violation.class, manager));
- EnterpriseBean<Espoo> bean = BeanFactory.createEnterpriseBean(Espoo.class,
manager);
+ manager.addBean(SimpleBean.of(Violation.class, manager));
+ EnterpriseBean<Espoo> bean = EnterpriseBean.of(Espoo.class, manager);
bean.postConstruct(null);
}
@@ -317,7 +318,7 @@
@SpecAssertion(section = "9.5")
public void
testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoTransientFieldOK()
{
- SimpleBean<Joensuu> bean = BeanFactory.createSimpleBean(Joensuu.class,
manager);
+ SimpleBean<Joensuu> bean = SimpleBean.of(Joensuu.class, manager);
}
/**
@@ -367,7 +368,7 @@
@SpecAssertion(section = "9.5")
public void
testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoProducerMethodParameterWithPassivatingScopeFails()
{
- manager.addBean(BeanFactory.createSimpleBean(Violation.class, manager));
+ manager.addBean(SimpleBean.of(Violation.class, manager));
Bean<?> producerBean = registerProducerBean(Peraseinajoki.class,
"create", Violation2.class);
manager.validate();
}
@@ -388,7 +389,7 @@
public void
testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoStatefulEnterpriseBeanFails()
throws SecurityException, NoSuchMethodException
{
registerProducerBean(CityProducer2.class, "create", Violation.class);
- EnterpriseBean<Maarianhamina> ejb =
BeanFactory.createEnterpriseBean(Maarianhamina.class, manager);
+ EnterpriseBean<Maarianhamina> ejb = EnterpriseBean.of(Maarianhamina.class,
manager);
ejb.postConstruct(null);
}
@@ -420,8 +421,8 @@
@SpecAssertion(section = "9.5")
public void
testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoTransientFieldOfWebBeanWithPassivatingScopeOK()
{
- SimpleBean<CityProducer2> bean =
BeanFactory.createSimpleBean(CityProducer2.class, manager);
- SimpleBean<Hyvinkaa> ejb = BeanFactory.createSimpleBean(Hyvinkaa.class,
manager);
+ SimpleBean<CityProducer2> bean = SimpleBean.of(CityProducer2.class,
manager);
+ SimpleBean<Hyvinkaa> ejb = SimpleBean.of(Hyvinkaa.class, manager);
}
/**
@@ -490,7 +491,7 @@
public void
testDependentScopedProducerFieldReturnsNonSerializableObjectForInjectionIntoStatefulSessionBeanFails()
throws SecurityException, NoSuchFieldException
{
registerProducerBean(CityProducer.class, "reference", Violation.class);
- EnterpriseBean<Pietarsaari> bean =
BeanFactory.createEnterpriseBean(Pietarsaari.class, manager);
+ EnterpriseBean<Pietarsaari> bean = EnterpriseBean.of(Pietarsaari.class,
manager);
// TODO: hack
bean.postConstruct(null);
assert true;
@@ -566,11 +567,11 @@
Bean<T> bean = null;
if (CurrentManager.rootManager().getEjbDescriptorCache().containsKey(clazz))
{
- bean = BeanFactory.createEnterpriseBean(clazz, manager);
+ bean = EnterpriseBean.of(clazz, manager);
}
else
{
- bean = BeanFactory.createSimpleBean(clazz, manager);
+ bean = SimpleBean.of(clazz, manager);
}
manager.addBean(bean);
return manager.getInstance(bean);
@@ -603,7 +604,7 @@
private AbstractProducerBean<?, ?> registerProducerBean(Class<?>
producerBeanClass, String fieldOrMethodName, Class<?> productClass)
{
- SimpleBean<?> producerContainerBean =
BeanFactory.createSimpleBean(producerBeanClass, manager);
+ SimpleBean<?> producerContainerBean = SimpleBean.of(producerBeanClass,
manager);
manager.addBean(producerContainerBean);
AbstractProducerBean<?, ?> producerBean = null;
try
@@ -611,12 +612,12 @@
if (hasField(producerBeanClass, fieldOrMethodName))
{
Field producerField = producerBeanClass.getDeclaredField(fieldOrMethodName);
- producerBean = BeanFactory.createProducerFieldBean(productClass,
producerField, producerContainerBean, manager);
+ producerBean = ProducerFieldBean.of(producerField, producerContainerBean,
manager);
}
else
{
Method producerMethod = getMethod(producerBeanClass, fieldOrMethodName);
- producerBean = BeanFactory.createProducerMethodBean(productClass,
producerMethod, producerContainerBean, manager);
+ producerBean = ProducerMethodBean.of(producerMethod, producerContainerBean,
manager);
}
}
catch (Exception e)
Modified:
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/EnterpriseBeanDeclarationTest.java 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanDeclarationTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -3,7 +3,6 @@
import javax.webbeans.DefinitionException;
import javax.webbeans.DeploymentException;
-import org.jboss.webbeans.bean.BeanFactory;
import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.test.AbstractTest;
import org.jboss.webbeans.test.SpecAssertion;
@@ -72,7 +71,7 @@
@SpecAssertion(section = "3.3")
public void testStatelessWithDependentScopeOK()
{
- EnterpriseBean<Giraffe> giraffe =
BeanFactory.createEnterpriseBean(Giraffe.class, manager);
+ EnterpriseBean<Giraffe> giraffe = EnterpriseBean.of(Giraffe.class, manager);
}
/**
@@ -85,7 +84,7 @@
@SpecAssertion(section = "3.3")
public void testStatelessWithRequestScopeFails()
{
- EnterpriseBean<Beagle> beagle =
BeanFactory.createEnterpriseBean(Beagle.class, manager);
+ EnterpriseBean<Beagle> beagle = EnterpriseBean.of(Beagle.class, manager);
}
/**
@@ -99,7 +98,7 @@
@SpecAssertion(section = "3.3")
public void testStatelessWithConversationScopeFails()
{
- EnterpriseBean<Boxer> boxer = BeanFactory.createEnterpriseBean(Boxer.class,
manager);
+ EnterpriseBean<Boxer> boxer = EnterpriseBean.of(Boxer.class, manager);
}
/**
@@ -112,7 +111,7 @@
@SpecAssertion(section = "3.3")
public void testStatelessWithSessionScopeFails()
{
- EnterpriseBean<Bullmastiff> boxer =
BeanFactory.createEnterpriseBean(Bullmastiff.class, manager);
+ EnterpriseBean<Bullmastiff> boxer = EnterpriseBean.of(Bullmastiff.class,
manager);
}
/**
@@ -125,7 +124,7 @@
@SpecAssertion(section = "3.3")
public void testStatelessWithApplicationScopeFails()
{
- EnterpriseBean<Dachshund> dachshund =
BeanFactory.createEnterpriseBean(Dachshund.class, manager);
+ EnterpriseBean<Dachshund> dachshund = EnterpriseBean.of(Dachshund.class,
manager);
}
/**
@@ -138,7 +137,7 @@
@SpecAssertion(section = "3.3")
public void testSingletonWithDependentScopeOK()
{
- BeanFactory.createEnterpriseBean(Labrador.class, manager);
+ EnterpriseBean.of(Labrador.class, manager);
}
/**
@@ -151,7 +150,7 @@
@SpecAssertion(section = "3.3")
public void testSingletonWithRequestScopeFails()
{
- EnterpriseBean<Greyhound> greyhound =
BeanFactory.createEnterpriseBean(Greyhound.class, manager);
+ EnterpriseBean<Greyhound> greyhound = EnterpriseBean.of(Greyhound.class,
manager);
}
/**
@@ -164,7 +163,7 @@
@SpecAssertion(section = "3.3")
public void testSingletonWithConversationScopeFails()
{
- EnterpriseBean<Husky> husky = BeanFactory.createEnterpriseBean(Husky.class,
manager);
+ EnterpriseBean<Husky> husky = EnterpriseBean.of(Husky.class, manager);
}
/**
@@ -177,7 +176,7 @@
@SpecAssertion(section = "3.3")
public void testSingletonWithSessionScopeFails()
{
- EnterpriseBean<IrishTerrier> irishTerrier =
BeanFactory.createEnterpriseBean(IrishTerrier.class, manager);
+ EnterpriseBean<IrishTerrier> irishTerrier =
EnterpriseBean.of(IrishTerrier.class, manager);
}
/**
@@ -190,7 +189,7 @@
@SpecAssertion(section = "3.3")
public void testSingletonWithApplicationScopeOK()
{
- EnterpriseBean<Laika> laika = BeanFactory.createEnterpriseBean(Laika.class,
manager);
+ EnterpriseBean<Laika> laika = EnterpriseBean.of(Laika.class, manager);
}
/**
@@ -218,7 +217,7 @@
@SpecAssertion(section = "3.3")
public void testEnterpriseBeanInterceptorFails()
{
- EnterpriseBean<Pug> pug = BeanFactory.createEnterpriseBean(Pug.class,
manager);
+ EnterpriseBean<Pug> pug = EnterpriseBean.of(Pug.class, manager);
}
/**
@@ -230,7 +229,7 @@
@SpecAssertion(section = "3.3")
public void testEnterpriseBeanDecoratorFails()
{
- EnterpriseBean<Pekingese> pekingese =
BeanFactory.createEnterpriseBean(Pekingese.class, manager);
+ EnterpriseBean<Pekingese> pekingese = EnterpriseBean.of(Pekingese.class,
manager);
}
/**
@@ -336,7 +335,7 @@
@SpecAssertion(section = "3.3.2")
public void testObjectIsInAPITypes()
{
- EnterpriseBean<Laika> laika = BeanFactory.createEnterpriseBean(Laika.class,
manager);
+ EnterpriseBean<Laika> laika = EnterpriseBean.of(Laika.class, manager);
assert laika.getTypes().contains(Object.class);
}
@@ -372,7 +371,7 @@
@SpecAssertion(section = "3.3")
public void testMessageDrivenBeansNotOK()
{
- EnterpriseBean<Leopard> Leopard =
BeanFactory.createEnterpriseBean(Leopard.class, manager);
+ EnterpriseBean<Leopard> Leopard = EnterpriseBean.of(Leopard.class, manager);
}
/**
@@ -384,7 +383,7 @@
@SpecAssertion(section = "3.3.7")
public void testDefaultName()
{
- EnterpriseBean<Pitbull> pitbull =
BeanFactory.createEnterpriseBean(Pitbull.class, manager);
+ EnterpriseBean<Pitbull> pitbull = EnterpriseBean.of(Pitbull.class, manager);
assert pitbull.getName().equals("pitbull");
}
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanLifecycleTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanLifecycleTest.java 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanLifecycleTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -2,7 +2,6 @@
import javax.webbeans.UnremovedException;
-import org.jboss.webbeans.bean.BeanFactory;
import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.test.AbstractTest;
@@ -59,7 +58,7 @@
{
visited = false;
DependentContext.INSTANCE.setActive(true);
- EnterpriseBean<GoodDoggie> bean =
BeanFactory.createEnterpriseBean(GoodDoggie.class, manager);
+ EnterpriseBean<GoodDoggie> bean = EnterpriseBean.of(GoodDoggie.class,
manager);
manager.addBean(bean);
GoodDoggie doggie = manager.getInstance(bean);
bean.destroy(doggie);
Modified:
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/EnterpriseBeanRemoveMethodTest.java 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanRemoveMethodTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -4,7 +4,6 @@
import javax.webbeans.RequestScoped;
import javax.webbeans.UnremovedException;
-import org.jboss.webbeans.bean.BeanFactory;
import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.context.RequestContext;
import org.jboss.webbeans.test.AbstractTest;
@@ -65,7 +64,7 @@
@SpecAssertion(section = "3.3.5")
public void testStatelessEnterpriseBeansWithRemoveMethodsFails()
{
- EnterpriseBean<Armant> bean = BeanFactory.createEnterpriseBean(Armant.class,
manager);
+ EnterpriseBean<Armant> bean = EnterpriseBean.of(Armant.class, manager);
}
/**
@@ -77,7 +76,7 @@
public void testStatefulEnterpriseBeanRemoveMethodCalledWhenDestroyedByManager()
{
EnterpriseBeanRemoveMethodTest.visited = false;
- EnterpriseBean<Toller> bena = BeanFactory.createEnterpriseBean(Toller.class,
manager);
+ EnterpriseBean<Toller> bena = EnterpriseBean.of(Toller.class, manager);
RequestContext context = (RequestContext) manager.getContext(RequestScoped.class);
Toller instance = context.get(bena, true);
context.destroy();
@@ -105,7 +104,7 @@
@SpecAssertion(section = "3.3.5")
public void testStatefulEnterpriseBeanWithoutRemoveMethodMustBeDependentScoped()
{
- EnterpriseBean<Pumi> bean = BeanFactory.createEnterpriseBean(Pumi.class,
manager);
+ EnterpriseBean<Pumi> bean = EnterpriseBean.of(Pumi.class, manager);
}
/**
@@ -118,7 +117,7 @@
@SpecAssertion(section = "3.3.5")
public void testStatefulEnterpriseBeanWithoutRemoveMethodMustBeDependentScoped2()
{
- EnterpriseBean<WelshCorgie> bean =
BeanFactory.createEnterpriseBean(WelshCorgie.class, manager);
+ EnterpriseBean<WelshCorgie> bean = EnterpriseBean.of(WelshCorgie.class,
manager);
}
/**
@@ -131,7 +130,7 @@
@SpecAssertion(section = "3.3.5")
public void
testStatefulEnterpriseBeanWithoutRemoveMethodMustBeRemovedByApplicationBeforeManager()
{
- EnterpriseBean<Toller> bean = BeanFactory.createEnterpriseBean(Toller.class,
manager);
+ EnterpriseBean<Toller> bean = EnterpriseBean.of(Toller.class, manager);
Toller instance = manager.getInstance(bean);
RequestContext context = (RequestContext) manager.getContext(RequestScoped.class);
context.destroy();
@@ -178,7 +177,7 @@
@SpecAssertion(section = "3.3.5")
public void testApplicationRemoveMethodCallRemovesInstanceFromContext()
{
- EnterpriseBean<Toller> bean = BeanFactory.createEnterpriseBean(Toller.class,
manager);
+ EnterpriseBean<Toller> bean = EnterpriseBean.of(Toller.class, manager);
RequestContext context = (RequestContext) manager.getContext(RequestScoped.class);
Toller instance = context.get(bean, true);
instance.bye();
@@ -196,7 +195,7 @@
@SpecAssertion(section = { "3.3.5.1" })
public void
testEnterpriseBeanWithoutDestructorUsesNoArgsRemoveAnnotatedMethodAsWebBeansRemoveMethod()
{
- EnterpriseBean<Toller> bean = BeanFactory.createEnterpriseBean(Toller.class,
manager);
+ EnterpriseBean<Toller> bean = EnterpriseBean.of(Toller.class, manager);
assert "bye".equals(bean.getRemoveMethod().getName());
}
@@ -209,7 +208,7 @@
@SpecAssertion(section = { "3.3.5.1" })
public void
testEnterpriseBeanWithoutDestructorAndNoOrMultipleNoArgsRemoveMethodsHasNoWebBeansRemoveMethod()
{
- EnterpriseBean<Koirus> bean = BeanFactory.createEnterpriseBean(Koirus.class,
manager);
+ EnterpriseBean<Koirus> bean = EnterpriseBean.of(Koirus.class, manager);
assert bean.getRemoveMethod() == null;
}
@@ -222,7 +221,7 @@
@SpecAssertion(section = { "3.3.5.1" })
public void testMultipleDestructorAnnotatedMethodsFails()
{
- EnterpriseBean<Rottweiler> bean =
BeanFactory.createEnterpriseBean(Rottweiler.class, manager);
+ EnterpriseBean<Rottweiler> bean = EnterpriseBean.of(Rottweiler.class,
manager);
}
/**
@@ -236,14 +235,14 @@
@SpecAssertion(section = { "3.3.5.1" })
public void testDestructorAnnotatedMethodNotRemoveAnnotatedFails()
{
- EnterpriseBean<RussellTerrier> bean =
BeanFactory.createEnterpriseBean(RussellTerrier.class, manager);
+ EnterpriseBean<RussellTerrier> bean = EnterpriseBean.of(RussellTerrier.class,
manager);
}
@Test(groups = { "enterpriseBeans", "removeMethod" })
@SpecAssertion(section = { "3.3.5.1" })
public void testDestructorAnnotatedSingleRemoveMethod()
{
- EnterpriseBean<GoodDoggie> bean =
BeanFactory.createEnterpriseBean(GoodDoggie.class, manager);
+ EnterpriseBean<GoodDoggie> bean = EnterpriseBean.of(GoodDoggie.class,
manager);
}
/**
@@ -256,7 +255,7 @@
@SpecAssertion(section = { "3.3.5.1" })
public void testRemoveMethodIsInitializerFails()
{
- EnterpriseBean<Saluki> bean = BeanFactory.createEnterpriseBean(Saluki.class,
manager);
+ EnterpriseBean<Saluki> bean = EnterpriseBean.of(Saluki.class, manager);
}
/**
@@ -269,7 +268,7 @@
@SpecAssertion(section = { "3.3.5.1" })
public void testRemoveMethodIsProducerFails()
{
- EnterpriseBean<Spitz> bean = BeanFactory.createEnterpriseBean(Spitz.class,
manager);
+ EnterpriseBean<Spitz> bean = EnterpriseBean.of(Spitz.class, manager);
}
/**
@@ -282,7 +281,7 @@
@SpecAssertion(section = { "3.3.5.1" })
public void testRemoveMethodWithDisposesParameterFails()
{
- EnterpriseBean<GoldenRetriever> bean =
BeanFactory.createEnterpriseBean(GoldenRetriever.class, manager);
+ EnterpriseBean<GoldenRetriever> bean =
EnterpriseBean.of(GoldenRetriever.class, manager);
}
/**
@@ -295,7 +294,7 @@
@SpecAssertion(section = { "3.3.5.1" })
public void testRemoveMethodWithObservesParameterFails()
{
- EnterpriseBean<JackRussellTerrier> bean =
BeanFactory.createEnterpriseBean(JackRussellTerrier.class, manager);
+ EnterpriseBean<JackRussellTerrier> bean =
EnterpriseBean.of(JackRussellTerrier.class, manager);
}
/**
Modified:
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/EnterpriseBeanSpecializationTest.java 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanSpecializationTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -3,7 +3,6 @@
import javax.webbeans.DefinitionException;
import javax.webbeans.DeploymentException;
-import org.jboss.webbeans.bean.BeanFactory;
import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.test.AbstractTest;
import org.jboss.webbeans.test.SpecAssertion;
@@ -56,8 +55,8 @@
@SpecAssertion(section = "3.3.6")
public void testSpecializingBeanInheritsBindingTypes()
{
- EnterpriseBean<Hound> hound = BeanFactory.createEnterpriseBean(Hound.class,
manager);
- EnterpriseBean<HoundOfBaskerville> houndOfBaskerville =
BeanFactory.createEnterpriseBean(HoundOfBaskerville.class, manager);
+ EnterpriseBean<Hound> hound = EnterpriseBean.of(Hound.class, manager);
+ EnterpriseBean<HoundOfBaskerville> houndOfBaskerville =
EnterpriseBean.of(HoundOfBaskerville.class, manager);
assert compareBindingTypesOK(hound, houndOfBaskerville);
}
@@ -85,7 +84,7 @@
@SpecAssertion(section = "3.3.6")
public void testSpecializingBeanInheritsNameIfAny()
{
- EnterpriseBean<HoundOfBaskerville> houndOfBaskerville =
BeanFactory.createEnterpriseBean(HoundOfBaskerville.class, manager);
+ EnterpriseBean<HoundOfBaskerville> houndOfBaskerville =
EnterpriseBean.of(HoundOfBaskerville.class, manager);
assert houndOfBaskerville.getName().equals("Pongo");
}
@@ -142,7 +141,7 @@
@SpecAssertion(section = "3.3.6")
public void
testAnnotationDefinedSpecializingEnterpriseBeanNotDirectlyExtendingAnnotationDefinedEnterpriseBeanFails()
{
- BeanFactory.createEnterpriseBean(GreaterDane.class, manager);
+ EnterpriseBean.of(GreaterDane.class, manager);
}
@Test(expectedExceptions = DefinitionException.class, groups = { "stub",
"specialization", "enterpriseBeans" })
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/NewBeanTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/NewBeanTest.java 2009-01-07
11:49:47 UTC (rev 805)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/NewBeanTest.java 2009-01-07
13:18:31 UTC (rev 806)
@@ -7,7 +7,6 @@
import javax.webbeans.Dependent;
import javax.webbeans.Standard;
-import org.jboss.webbeans.bean.BeanFactory;
import org.jboss.webbeans.bean.NewSimpleBean;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.binding.NewBinding;
@@ -34,9 +33,9 @@
@BeforeMethod
public void initNewBean() {
- wrappedBean = BeanFactory.createSimpleBean(WrappedBean.class, manager);
+ wrappedBean = SimpleBean.of(WrappedBean.class, manager);
manager.addBean(wrappedBean);
- newBean = BeanFactory.createNewSimpleBean(WrappedBean.class, manager);
+ newBean = NewSimpleBean.of(WrappedBean.class, manager);
manager.addBean(newBean);
}