Author: pete.muir(a)jboss.org
Date: 2008-12-14 08:04:04 -0500 (Sun, 14 Dec 2008)
New Revision: 516
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractFacadeBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/CurrentBinding.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DefaultDeploymentTypeTest.java
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/FacadeBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/ApplicationScopedAnnotationLiteral.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/ConversationScopedAnnotationLiteral.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/CurrentAnnotationLiteral.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/DependentAnnotationLiteral.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/NamedAnnotationLiteral.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/ProductionAnnotationLiteral.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/RequestScopedAnnotationLiteral.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/StandardAnnotationLiteral.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ApplicationContextTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/RequestContextTest.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/CurrentManager.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/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/ManagerBean.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/bootstrap/WebBeansBootstrap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/DependentContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/BeanFactory.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/NewEventTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/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/contexts/DependentContextTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/NormalContextTest.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/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/mock/MockBootstrap.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockManagerImpl.java
ri/trunk/webbeans-ri/testng.xml
Log:
Refactor - move context creation logic to bootstrap/servlet lifecycle, mock it out for
tests, clean up literals
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/CurrentManager.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/CurrentManager.java 2008-12-13
23:42:34 UTC (rev 515)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/CurrentManager.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -17,9 +17,6 @@
package org.jboss.webbeans;
-import org.jboss.webbeans.contexts.ApplicationContext;
-import org.jboss.webbeans.contexts.RequestContext;
-import org.jboss.webbeans.contexts.SessionContext;
/**
* Access point for getting/setting current Managager
@@ -50,17 +47,5 @@
{
CurrentManager.rootManager = rootManager;
}
-
- /**
- * Set up the root manager.
- * TODO: move this to Bootstrap
- */
- static
- {
- rootManager = new ManagerImpl();
- rootManager.addContext(RequestContext.INSTANCE);
- rootManager.addContext(SessionContext.INSTANCE);
- rootManager.addContext(ApplicationContext.INSTANCE);
- }
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-12-13
23:42:34 UTC (rev 515)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -32,7 +32,6 @@
import javax.webbeans.AmbiguousDependencyException;
import javax.webbeans.BindingType;
import javax.webbeans.ContextNotActiveException;
-import javax.webbeans.Dependent;
import javax.webbeans.DeploymentException;
import javax.webbeans.DuplicateBindingTypeException;
import javax.webbeans.Observer;
@@ -47,13 +46,9 @@
import javax.webbeans.manager.Interceptor;
import javax.webbeans.manager.Manager;
-import org.jboss.webbeans.bean.AbstractBean;
-import org.jboss.webbeans.bean.ManagerBean;
-import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.bean.proxy.ProxyPool;
import org.jboss.webbeans.contexts.ContextMap;
import org.jboss.webbeans.contexts.DependentContext;
-import org.jboss.webbeans.ejb.DefaultEnterpriseBeanLookup;
import org.jboss.webbeans.event.EventManager;
import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedMethod;
@@ -94,6 +89,9 @@
/**
* Constructor
+ *
+ * @param enabledDeploymentTypes any enabled deployment types, an empty set
+ * if none are specified
*/
@SuppressWarnings("unchecked")
public ManagerImpl()
@@ -105,46 +103,26 @@
this.decorators = new HashSet<Decorator>();
this.interceptors = new HashSet<Interceptor>();
this.contextMap = new ContextMap();
- initEnabledDeploymentTypes();
- initStandardBeans();
- addContext(new DependentContext());
+
+ List<Class<? extends Annotation>> defaultEnabledDeploymentTypes = new
ArrayList<Class<? extends Annotation>>();
+ defaultEnabledDeploymentTypes.add(0, Standard.class);
+ defaultEnabledDeploymentTypes.add(1, Production.class);
+ setEnabledDeploymentTypes(defaultEnabledDeploymentTypes);
}
/**
- * Add any beans provided by the Web Beans RI to the registry
- */
- protected void initStandardBeans()
- {
- addBean(new
SimpleBean<DefaultEnterpriseBeanLookup>(DefaultEnterpriseBeanLookup.class, this));
- addBean(new ManagerBean(this));
- }
-
- /**
* Set up the enabled deployment types, if none are specified by the user,
* the default @Production and @Standard are used. For internal use.
*
* @param enabledDeploymentTypes The enabled deployment types from
* web-beans.xml
*/
- protected void initEnabledDeploymentTypes(Class<? extends Annotation>...
enabledDeploymentTypes)
+ protected void checkEnabledDeploymentTypes()
{
- this.enabledDeploymentTypes = new ArrayList<Class<? extends
Annotation>>();
- if (enabledDeploymentTypes.length == 0)
+ if (!this.enabledDeploymentTypes.get(0).equals(Standard.class))
{
- this.enabledDeploymentTypes.add(0, Standard.class);
- this.enabledDeploymentTypes.add(1, Production.class);
+ throw new DeploymentException("@Standard must be the lowest precedence
deployment type");
}
- else
- {
- for (Class<? extends Annotation> enabledDeploymentType :
enabledDeploymentTypes)
- {
- this.enabledDeploymentTypes.add(enabledDeploymentType);
- }
- if (!this.enabledDeploymentTypes.get(0).equals(Standard.class))
- {
- throw new DeploymentException("@Standard must be the lowest precedence
deployment type");
- }
- }
}
/**
@@ -194,7 +172,7 @@
}
/**
- * A strongly ordered, unmodifyable list of enabled deployment types
+ * A strongly ordered, unmodifiable list of enabled deployment types
*
* @return The ordered enabled deployment types known to the manager
*/
@@ -202,6 +180,16 @@
{
return Collections.unmodifiableList(enabledDeploymentTypes);
}
+
+ /**
+ * Set the enabled deployment types
+ * @param enabledDeploymentTypes
+ */
+ public void setEnabledDeploymentTypes(List<Class<? extends Annotation>>
enabledDeploymentTypes)
+ {
+ this.enabledDeploymentTypes = enabledDeploymentTypes;
+ checkEnabledDeploymentTypes();
+ }
/**
* Resolves beans by API type and binding types
@@ -276,14 +264,12 @@
* @param beans The set of beans to add
* @return A reference to the manager
*/
- public Manager setBeans(Set<AbstractBean<?, ?>> beans)
+ public void setBeans(Set<Bean<?>> beans)
{
synchronized (beans)
{
this.beans = new CopyOnWriteArrayList<Bean<?>>(beans);
resolver.clear();
- initStandardBeans();
- return this;
}
}
@@ -465,7 +451,7 @@
{
try
{
- contextMap.getBuiltInContext(Dependent.class).setActive(true);
+ DependentContext.INSTANCE.setActive(true);
if (MetaDataCache.instance().getScopeModel(bean.getScopeType()).isNormal())
{
return (T) proxyPool.getClientProxy(bean);
@@ -477,7 +463,7 @@
}
finally
{
- contextMap.getBuiltInContext(Dependent.class).setActive(false);
+ DependentContext.INSTANCE.setActive(false);
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -38,7 +38,7 @@
import javax.webbeans.manager.Bean;
import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
+import org.jboss.webbeans.bindings.CurrentBinding;
import org.jboss.webbeans.ejb.DefaultEnterpriseBeanLookup;
import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedMethod;
@@ -166,7 +166,7 @@
else if (bindingTypes.size() == 0)
{
log.trace("Adding default @Current binding type");
- this.bindingTypes.add(new CurrentAnnotationLiteral());
+ this.bindingTypes.add(new CurrentBinding());
}
else
{
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractFacadeBean.java
(from rev 511,
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/FacadeBean.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractFacadeBean.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractFacadeBean.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -0,0 +1,186 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.bean;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.webbeans.DefinitionException;
+import javax.webbeans.Dependent;
+import javax.webbeans.Production;
+import javax.webbeans.Standard;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+
+/**
+ * Facade bean for implicit beans
+ *
+ * @author Gavin King
+ *
+ * @param <T>
+ * @param <S>
+ * @param <P>
+ */
+public abstract class AbstractFacadeBean<T, S, P> extends AbstractBean<T, S>
+{
+ // The underlying item
+ protected AnnotatedItem<T, S> annotatedItem;
+
+ /**
+ * Constructor
+ *
+ * @param field The facaded field
+ * @param manager The Web Beans manager
+ */
+ public AbstractFacadeBean(AnnotatedItem<T, S> field, ManagerImpl manager)
+ {
+ super(manager);
+ this.annotatedItem = field;
+ init();
+ }
+
+ /**
+ * Initializes the bean
+ *
+ * Calls super method and validates the annotated item
+ */
+ protected void init()
+ {
+ super.init();
+ checkAnnotatedItem();
+ }
+
+ /**
+ * Validates the annotated item
+ */
+ private void checkAnnotatedItem()
+ {
+ Type[] actualTypeArguments = annotatedItem.getActualTypeArguments();
+ if (actualTypeArguments.length != 1)
+ {
+ throw new DefinitionException("Event must have type arguments");
+ }
+ if (!(actualTypeArguments[0] instanceof Class))
+ {
+ throw new DefinitionException("Event must have concrete type
argument");
+ }
+ }
+
+ /*
+ * Gets the binding type as an array
+ *
+ * @return The binding types
+ */
+ protected Annotation[] getBindingTypesArray()
+ {
+ return annotatedItem.getBindingTypesAsArray();
+ }
+
+ /**
+ * Gets the type paramater of the facade
+ *
+ * @return The type parameter
+ */
+ @SuppressWarnings("unchecked")
+ protected Class<P> getTypeParameter()
+ {
+ return (Class<P>) annotatedItem.getType().getTypeParameters()[0].getClass();
+ }
+
+ /**
+ * Initializes the scope type to dependent
+ */
+ @Override
+ protected void initScopeType()
+ {
+ this.scopeType = Dependent.class;
+ }
+
+ /**
+ * Initializes the deployment type to Standard
+ */
+ @Override
+ protected void initDeploymentType()
+ {
+ this.deploymentType = Standard.class;
+ }
+
+ /**
+ * Gets the underlying item
+ *
+ * @return The underlying item
+ */
+ @Override
+ protected AnnotatedItem<T, S> getAnnotatedItem()
+ {
+ return annotatedItem;
+ }
+
+ /**
+ * Gets the default name
+ *
+ * @return The default name
+ */
+ @Override
+ protected String getDefaultName()
+ {
+ return null;
+ }
+
+ /**
+ * Initializes the type
+ */
+ @Override
+ protected void initType()
+ {
+ try
+ {
+ if (getAnnotatedItem() != null)
+ {
+ this.type = getAnnotatedItem().getType();
+ }
+ }
+ catch (ClassCastException e)
+ {
+ // TODO: Expand error
+ throw new IllegalArgumentException("Type mismatch");
+ }
+ }
+
+ /**
+ * Gets the default deployment type, Production
+ */
+ @Override
+ protected Class<? extends Annotation> getDefaultDeploymentType()
+ {
+ return Production.class;
+ }
+
+ /**
+ * Returns a string representation
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ return "FacadeBean " + getName() + " for " + annotatedItem;
+ }
+
+}
\ No newline at end of file
Copied:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java (from
rev 511, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerBean.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -0,0 +1,189 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.bean;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+
+import javax.webbeans.DefinitionException;
+import javax.webbeans.Dependent;
+import javax.webbeans.IllegalProductException;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.util.Names;
+
+/**
+ * The implicit producer bean
+ *
+ * @author Gavin King
+ *
+ * @param <T>
+ * @param <S>
+ */
+public abstract class AbstractProducerBean<T, S> extends AbstractBean<T, S>
+{
+ // The declaring bean
+ protected AbstractClassBean<?> declaringBean;
+
+ /**
+ * Constructor
+ *
+ * @param declaringBean The declaring bean
+ * @param manager The Web Beans manager
+ */
+ public AbstractProducerBean(AbstractClassBean<?> declaringBean, ManagerImpl
manager)
+ {
+ super(manager);
+ this.declaringBean = declaringBean;
+ }
+
+ /**
+ * Gets the deployment types
+ *
+ * @return The deployment types of the declaring bean
+ */
+ @Override
+ protected Class<? extends Annotation> getDefaultDeploymentType()
+ {
+ return deploymentType = declaringBean.getDeploymentType();
+ }
+
+ /**
+ * Initializes the API types
+ */
+ @Override
+ protected void initApiTypes()
+ {
+ if (getType().isArray() || getType().isPrimitive())
+ {
+ apiTypes = new HashSet<Class<?>>();
+ apiTypes.add(getType());
+ apiTypes.add(Object.class);
+ }
+ else if (getType().isInterface())
+ {
+ super.initApiTypes();
+ apiTypes.add(Object.class);
+ }
+ else
+ {
+ super.initApiTypes();
+ }
+ }
+
+ /**
+ * Initializes the type
+ */
+ @Override
+ protected void initType()
+ {
+ try
+ {
+ if (getAnnotatedItem() != null)
+ {
+ this.type = getAnnotatedItem().getType();
+ }
+ }
+ catch (ClassCastException e)
+ {
+ throw new RuntimeException(" Cannot cast producer type " +
getAnnotatedItem().getType() + " to bean type " + (getDeclaredBeanType() == null
? " unknown " : getDeclaredBeanType()), e);
+ }
+ }
+
+ /**
+ * Returns the declaring bean
+ *
+ * @return The bean representation
+ */
+ public AbstractClassBean<?> getDeclaringBean()
+ {
+ return declaringBean;
+ }
+
+ /**
+ * Validates the producer method
+ */
+ protected void checkProducerReturnType()
+ {
+ for (Type type : getAnnotatedItem().getActualTypeArguments())
+ {
+ if (!(type instanceof Class))
+ {
+ throw new DefinitionException("Producer type cannot be parameterized
with type parameter or wildcard");
+ }
+ }
+ }
+
+ /**
+ * Initializes the bean and its metadata
+ */
+ @Override
+ protected void init()
+ {
+ super.init();
+ checkProducerReturnType();
+ }
+
+ /**
+ * Validates the return value
+ *
+ * @param instance The instance to validate
+ */
+ protected void checkReturnValue(T instance)
+ {
+ if (instance == null && !getScopeType().equals(Dependent.class))
+ {
+ throw new IllegalProductException("Cannot return null from a non-dependent
producer method");
+ }
+ }
+
+ /**
+ * Gets the receiver of the product
+ *
+ * @return The receiver
+ */
+ protected Object getReceiver()
+ {
+ return getAnnotatedItem().isStatic() ? null :
manager.getInstance(getDeclaringBean());
+ }
+
+ /**
+ * Gets a string representation
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("Annotated " + Names.scopeTypeToString(getScopeType()));
+ if (getName() == null)
+ {
+ buffer.append("unnamed producer bean");
+ }
+ else
+ {
+ buffer.append("simple producer bean '" + getName() +
"'");
+ }
+ buffer.append(" [" + getType().getName() + "]\n");
+ buffer.append(" API types " + getTypes() + ", binding types "
+ getBindingTypes() + "\n");
+ return buffer.toString();
+ }
+
+}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java 2008-12-13
23:42:34 UTC (rev 515)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -33,7 +33,7 @@
* @param <T>
* @param <S>
*/
-public class EventBean<T, S> extends FacadeBean<Event<T>, S, T>
+public class EventBean<T, S> extends AbstractFacadeBean<Event<T>, S,
T>
{
/**
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/FacadeBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/FacadeBean.java 2008-12-13
23:42:34 UTC (rev 515)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/FacadeBean.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -1,186 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.webbeans.bean;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-
-import javax.webbeans.DefinitionException;
-import javax.webbeans.Dependent;
-import javax.webbeans.Production;
-import javax.webbeans.Standard;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.introspector.AnnotatedItem;
-
-/**
- * Facade bean for implicit beans
- *
- * @author Gavin King
- *
- * @param <T>
- * @param <S>
- * @param <P>
- */
-public abstract class FacadeBean<T, S, P> extends AbstractBean<T, S>
-{
- // The underlying item
- protected AnnotatedItem<T, S> annotatedItem;
-
- /**
- * Constructor
- *
- * @param field The facaded field
- * @param manager The Web Beans manager
- */
- public FacadeBean(AnnotatedItem<T, S> field, ManagerImpl manager)
- {
- super(manager);
- this.annotatedItem = field;
- init();
- }
-
- /**
- * Initializes the bean
- *
- * Calls super method and validates the annotated item
- */
- protected void init()
- {
- super.init();
- checkAnnotatedItem();
- }
-
- /**
- * Validates the annotated item
- */
- private void checkAnnotatedItem()
- {
- Type[] actualTypeArguments = annotatedItem.getActualTypeArguments();
- if (actualTypeArguments.length != 1)
- {
- throw new DefinitionException("Event must have type arguments");
- }
- if (!(actualTypeArguments[0] instanceof Class))
- {
- throw new DefinitionException("Event must have concrete type
argument");
- }
- }
-
- /*
- * Gets the binding type as an array
- *
- * @return The binding types
- */
- protected Annotation[] getBindingTypesArray()
- {
- return annotatedItem.getBindingTypesAsArray();
- }
-
- /**
- * Gets the type paramater of the facade
- *
- * @return The type parameter
- */
- @SuppressWarnings("unchecked")
- protected Class<P> getTypeParameter()
- {
- return (Class<P>) annotatedItem.getType().getTypeParameters()[0].getClass();
- }
-
- /**
- * Initializes the scope type to dependent
- */
- @Override
- protected void initScopeType()
- {
- this.scopeType = Dependent.class;
- }
-
- /**
- * Initializes the deployment type to Standard
- */
- @Override
- protected void initDeploymentType()
- {
- this.deploymentType = Standard.class;
- }
-
- /**
- * Gets the underlying item
- *
- * @return The underlying item
- */
- @Override
- protected AnnotatedItem<T, S> getAnnotatedItem()
- {
- return annotatedItem;
- }
-
- /**
- * Gets the default name
- *
- * @return The default name
- */
- @Override
- protected String getDefaultName()
- {
- return null;
- }
-
- /**
- * Initializes the type
- */
- @Override
- protected void initType()
- {
- try
- {
- if (getAnnotatedItem() != null)
- {
- this.type = getAnnotatedItem().getType();
- }
- }
- catch (ClassCastException e)
- {
- // TODO: Expand error
- throw new IllegalArgumentException("Type mismatch");
- }
- }
-
- /**
- * Gets the default deployment type, Production
- */
- @Override
- protected Class<? extends Annotation> getDefaultDeploymentType()
- {
- return Production.class;
- }
-
- /**
- * Returns a string representation
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- return "FacadeBean " + getName() + " for " + annotatedItem;
- }
-
-}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InstanceBean.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InstanceBean.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InstanceBean.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -32,7 +32,7 @@
* @param <T>
* @param <S>
*/
-public class InstanceBean<T, S> extends FacadeBean<Instance<T>, S, T>
+public class InstanceBean<T, S> extends AbstractFacadeBean<Instance<T>, S,
T>
{
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ManagerBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ManagerBean.java 2008-12-13
23:42:34 UTC (rev 515)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ManagerBean.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -27,13 +27,13 @@
import javax.webbeans.manager.Bean;
import javax.webbeans.manager.Manager;
-import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
+import org.jboss.webbeans.bindings.CurrentBinding;
import org.jboss.webbeans.util.Reflections;
/**
* Helper bean for accessing the Manager
*
- * @author Gavin King
+ * @author Pete Muir
*
*/
public class ManagerBean extends Bean<Manager>
@@ -41,7 +41,7 @@
// The API types of the manager
private static Set<Class<?>> types =
Reflections.getTypeHierachy(Manager.class);
// The binding types of the manager
- private static final Set<Annotation> BINDING = new
HashSet<Annotation>(Arrays.asList(new CurrentAnnotationLiteral()));
+ private static final Set<Annotation> BINDING = new
HashSet<Annotation>(Arrays.asList(new CurrentBinding()));
/**
* Constructor
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerBean.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerBean.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerBean.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -1,189 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.webbeans.bean;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.HashSet;
-
-import javax.webbeans.DefinitionException;
-import javax.webbeans.Dependent;
-import javax.webbeans.IllegalProductException;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.util.Names;
-
-/**
- * The implicit producer bean
- *
- * @author Gavin King
- *
- * @param <T>
- * @param <S>
- */
-public abstract class ProducerBean<T, S> extends AbstractBean<T, S>
-{
- // The declaring bean
- protected AbstractClassBean<?> declaringBean;
-
- /**
- * Constructor
- *
- * @param declaringBean The declaring bean
- * @param manager The Web Beans manager
- */
- public ProducerBean(AbstractClassBean<?> declaringBean, ManagerImpl manager)
- {
- super(manager);
- this.declaringBean = declaringBean;
- }
-
- /**
- * Gets the deployment types
- *
- * @return The deployment types of the declaring bean
- */
- @Override
- protected Class<? extends Annotation> getDefaultDeploymentType()
- {
- return deploymentType = declaringBean.getDeploymentType();
- }
-
- /**
- * Initializes the API types
- */
- @Override
- protected void initApiTypes()
- {
- if (getType().isArray() || getType().isPrimitive())
- {
- apiTypes = new HashSet<Class<?>>();
- apiTypes.add(getType());
- apiTypes.add(Object.class);
- }
- else if (getType().isInterface())
- {
- super.initApiTypes();
- apiTypes.add(Object.class);
- }
- else
- {
- super.initApiTypes();
- }
- }
-
- /**
- * Initializes the type
- */
- @Override
- protected void initType()
- {
- try
- {
- if (getAnnotatedItem() != null)
- {
- this.type = getAnnotatedItem().getType();
- }
- }
- catch (ClassCastException e)
- {
- throw new RuntimeException(" Cannot cast producer type " +
getAnnotatedItem().getType() + " to bean type " + (getDeclaredBeanType() == null
? " unknown " : getDeclaredBeanType()), e);
- }
- }
-
- /**
- * Returns the declaring bean
- *
- * @return The bean representation
- */
- public AbstractClassBean<?> getDeclaringBean()
- {
- return declaringBean;
- }
-
- /**
- * Validates the producer method
- */
- protected void checkProducerReturnType()
- {
- for (Type type : getAnnotatedItem().getActualTypeArguments())
- {
- if (!(type instanceof Class))
- {
- throw new DefinitionException("Producer type cannot be parameterized
with type parameter or wildcard");
- }
- }
- }
-
- /**
- * Initializes the bean and its metadata
- */
- @Override
- protected void init()
- {
- super.init();
- checkProducerReturnType();
- }
-
- /**
- * Validates the return value
- *
- * @param instance The instance to validate
- */
- protected void checkReturnValue(T instance)
- {
- if (instance == null && !getScopeType().equals(Dependent.class))
- {
- throw new IllegalProductException("Cannot return null from a non-dependent
producer method");
- }
- }
-
- /**
- * Gets the receiver of the product
- *
- * @return The receiver
- */
- protected Object getReceiver()
- {
- return getAnnotatedItem().isStatic() ? null :
manager.getInstance(getDeclaringBean());
- }
-
- /**
- * Gets a string representation
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("Annotated " + Names.scopeTypeToString(getScopeType()));
- if (getName() == null)
- {
- buffer.append("unnamed producer bean");
- }
- else
- {
- buffer.append("simple producer bean '" + getName() +
"'");
- }
- buffer.append(" [" + getType().getName() + "]\n");
- buffer.append(" API types " + getTypes() + ", binding types "
+ getBindingTypes() + "\n");
- return buffer.toString();
- }
-
-}
\ No newline at end of file
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -31,7 +31,7 @@
*
* @param <T>
*/
-public class ProducerFieldBean<T> extends ProducerBean<T, Field>
+public class ProducerFieldBean<T> extends AbstractProducerBean<T, Field>
{
// The underlying field
private AnnotatedField<T> 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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -39,7 +39,7 @@
*
* @param <T>
*/
-public class ProducerMethodBean<T> extends ProducerBean<T, Method>
+public class ProducerMethodBean<T> extends AbstractProducerBean<T, Method>
{
// The underlying method
private AnnotatedMethod<T> method;
Deleted:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/ApplicationScopedAnnotationLiteral.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/ApplicationScopedAnnotationLiteral.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/ApplicationScopedAnnotationLiteral.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -1,31 +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.bindings;
-
-import javax.webbeans.AnnotationLiteral;
-import javax.webbeans.ApplicationScoped;
-
-/**
- * Annotation literal for @ApplicationScoped
- *
- * @author Pete Muir
- */
-public class ApplicationScopedAnnotationLiteral extends
AnnotationLiteral<ApplicationScoped> implements ApplicationScoped
-{
-
-}
Deleted:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/ConversationScopedAnnotationLiteral.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/ConversationScopedAnnotationLiteral.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/ConversationScopedAnnotationLiteral.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -1,31 +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.bindings;
-
-import javax.webbeans.AnnotationLiteral;
-import javax.webbeans.ConversationScoped;
-
-/**
- * Annotation literal for @ConversationScoped
- *
- * @author Pete Muir
- */
-public class ConversationScopedAnnotationLiteral extends
AnnotationLiteral<ConversationScoped> implements ConversationScoped
-{
-
-}
Deleted:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/CurrentAnnotationLiteral.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/CurrentAnnotationLiteral.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/CurrentAnnotationLiteral.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -1,28 +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.bindings;
-
-import javax.webbeans.AnnotationLiteral;
-import javax.webbeans.Current;
-
-/**
- * Annotation literal for @Current
- *
- * @author Pete Muir
- */
-public class CurrentAnnotationLiteral extends AnnotationLiteral<Current> implements
Current {}
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/CurrentBinding.java
(from rev 511,
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/CurrentAnnotationLiteral.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/CurrentBinding.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/CurrentBinding.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -0,0 +1,28 @@
+/*
+ * 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.bindings;
+
+import javax.webbeans.AnnotationLiteral;
+import javax.webbeans.Current;
+
+/**
+ * Annotation literal for @Current
+ *
+ * @author Pete Muir
+ */
+public class CurrentBinding extends AnnotationLiteral<Current> implements Current
{}
Property changes on:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/CurrentBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/DependentAnnotationLiteral.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/DependentAnnotationLiteral.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/DependentAnnotationLiteral.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -1,31 +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.bindings;
-
-import javax.webbeans.AnnotationLiteral;
-import javax.webbeans.Dependent;
-
-/**
- * Annotation literal for @Dependent
- *
- * @author Pete Muir
- */
-public class DependentAnnotationLiteral extends AnnotationLiteral<Dependent>
implements Dependent
-{
-
-}
Deleted:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/NamedAnnotationLiteral.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/NamedAnnotationLiteral.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/NamedAnnotationLiteral.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -1,30 +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.bindings;
-
-import javax.webbeans.AnnotationLiteral;
-import javax.webbeans.Named;
-
-/**
- * Annotation literal for @Named
- *
- * @author Pete Muir
- */
-public abstract class NamedAnnotationLiteral extends AnnotationLiteral<Named>
implements Named
-{
-}
\ No newline at end of file
Deleted:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/ProductionAnnotationLiteral.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/ProductionAnnotationLiteral.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/ProductionAnnotationLiteral.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -1,31 +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.bindings;
-
-import javax.webbeans.AnnotationLiteral;
-import javax.webbeans.Production;
-
-/**
- * Annotation literal for @Production
- *
- * @author Pete Muir
- */
-public class ProductionAnnotationLiteral extends AnnotationLiteral<Production>
implements Production
-{
-
-}
Deleted:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/RequestScopedAnnotationLiteral.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/RequestScopedAnnotationLiteral.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/RequestScopedAnnotationLiteral.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -1,31 +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.bindings;
-
-import javax.webbeans.AnnotationLiteral;
-import javax.webbeans.RequestScoped;
-
-/**
- * Annotation literal for @RequestScoped
- *
- * @author Pete Muir
- */
-public class RequestScopedAnnotationLiteral extends
AnnotationLiteral<RequestScoped> implements RequestScoped
-{
-
-}
Deleted:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/StandardAnnotationLiteral.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/StandardAnnotationLiteral.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bindings/StandardAnnotationLiteral.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -1,31 +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.bindings;
-
-import javax.webbeans.AnnotationLiteral;
-import javax.webbeans.Standard;
-
-/**
- * Annotation literal for @Standard
- *
- * @author Pete Muir
- */
-public class StandardAnnotationLiteral extends AnnotationLiteral<Standard>
implements Standard
-{
-
-}
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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -43,6 +43,7 @@
import javax.webbeans.Observer;
import javax.webbeans.Observes;
import javax.webbeans.Obtainable;
+import javax.webbeans.manager.Bean;
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.ManagerImpl;
@@ -51,10 +52,14 @@
import org.jboss.webbeans.bean.AbstractClassBean;
import org.jboss.webbeans.bean.EventBean;
import org.jboss.webbeans.bean.InstanceBean;
+import org.jboss.webbeans.bean.ManagerBean;
import org.jboss.webbeans.bean.ProducerFieldBean;
import org.jboss.webbeans.bean.ProducerMethodBean;
+import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.bindings.InitializedBinding;
import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
+import org.jboss.webbeans.contexts.DependentContext;
+import org.jboss.webbeans.ejb.DefaultEnterpriseBeanLookup;
import org.jboss.webbeans.event.ObserverImpl;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedItem;
@@ -76,15 +81,25 @@
public static String WEB_BEAN_DISCOVERY_PROPERTY_NAME =
"org.jboss.webbeans.bootstrap.webBeanDiscovery";
private static LogProvider log = Logging.getLogProvider(WebBeansBootstrap.class);
+
+ private ManagerImpl manager;
/**
* Constructor
*
* Starts up with the singleton Manager
*/
+ public WebBeansBootstrap(ManagerImpl manager)
+ {
+ this.manager = manager;
+ CurrentManager.setRootManager(manager);
+ manager.addContext(DependentContext.INSTANCE);
+ JNDI.set(ManagerImpl.JNDI_KEY, manager);
+ }
+
public WebBeansBootstrap()
{
- JNDI.set(ManagerImpl.JNDI_KEY, CurrentManager.rootManager());
+ this(new ManagerImpl());
}
/**
@@ -98,15 +113,15 @@
}
/**
- * Register the bean with the manager
+ * Register the bean with the manager, including any standard (built in) beans
*
- * Creates the beans first and then sets them in the manager
- *
* @param classes The classes to register as Web Beans
*/
public void registerBeans(Iterable<Class<?>> classes)
{
- Set<AbstractBean<?, ?>> beans = createBeans(classes);
+ Set<Bean<?>> beans = (Set) createBeans(classes);
+ beans.add(new
SimpleBean<DefaultEnterpriseBeanLookup>(DefaultEnterpriseBeanLookup.class,
manager));
+ beans.add(new ManagerBean(manager));
CurrentManager.rootManager().setBeans(beans);
}
@@ -141,11 +156,11 @@
{
if (MetaDataCache.instance().getEjbMetaData(clazz).isEjb())
{
- createBean(createEnterpriseBean(clazz), beans);
+ createBean(createEnterpriseBean(clazz, manager), beans);
}
else if (isTypeSimpleWebBean(clazz))
{
- createBean(createSimpleBean(clazz), beans);
+ createBean(createSimpleBean(clazz, manager), beans);
}
}
return beans;
@@ -154,17 +169,17 @@
public void createBean(AbstractClassBean<?> bean, Set<AbstractBean<?,
?>> beans)
{
beans.add(bean);
-
CurrentManager.rootManager().getResolver().addInjectionPoints(bean.getInjectionPoints());
+ manager.getResolver().addInjectionPoints(bean.getInjectionPoints());
for (AnnotatedMethod<Object> producerMethod : bean.getProducerMethods())
{
- ProducerMethodBean<?> producerMethodBean =
createProducerMethodBean(producerMethod, bean);
+ ProducerMethodBean<?> producerMethodBean =
createProducerMethodBean(producerMethod, bean, manager);
beans.add(producerMethodBean);
-
CurrentManager.rootManager().getResolver().addInjectionPoints(producerMethodBean.getInjectionPoints());
+
manager.getResolver().addInjectionPoints(producerMethodBean.getInjectionPoints());
log.info("Web Bean: " + producerMethodBean);
}
for (AnnotatedField<Object> producerField : bean.getProducerFields())
{
- ProducerFieldBean<?> producerFieldBean =
createProducerFieldBean(producerField, bean);
+ ProducerFieldBean<?> producerFieldBean =
createProducerFieldBean(producerField, bean, manager);
beans.add(producerFieldBean);
log.info("Web Bean: " + producerFieldBean);
}
@@ -172,22 +187,20 @@
{
if ( injectionPoint.isAnnotationPresent(Observable.class) )
{
- EventBean<Object, Field> eventBean = createEventBean(injectionPoint);
+ EventBean<Object, Field> eventBean = createEventBean(injectionPoint,
manager);
beans.add(eventBean);
-
//CurrentManager.rootManager().getResolver().addInjectionPoints(eventBean.getInjectionPoints());
log.info("Web Bean: " + eventBean);
}
if ( injectionPoint.isAnnotationPresent(Obtainable.class) )
{
- InstanceBean<Object, Field> instanceBean =
createInstanceBean(injectionPoint);
+ InstanceBean<Object, Field> instanceBean =
createInstanceBean(injectionPoint, manager);
beans.add(instanceBean);
-
//CurrentManager.rootManager().getResolver().addInjectionPoints(eventBean.getInjectionPoints());
log.info("Web Bean: " + instanceBean);
}
}
for (AnnotatedMethod<Object> observerMethod : bean.getObserverMethods())
{
- ObserverImpl<?> observer = createObserver(observerMethod, bean);
+ ObserverImpl<?> observer = createObserver(observerMethod, bean, manager);
if (observerMethod.getAnnotatedParameters(Observes.class).size() == 1)
{
registerObserver(observer,
observerMethod.getAnnotatedParameters(Observes.class).get(0).getType(),
observerMethod.getAnnotatedParameters(Observes.class).get(0).getBindingTypesAsArray());
@@ -219,8 +232,8 @@
}
registerBeans(webBeanDiscovery.discoverWebBeanClasses());
log.info("Validing Web Bean injection points");
- CurrentManager.rootManager().getResolver().resolveInjectionPoints();
- CurrentManager.rootManager().fireEvent(CurrentManager.rootManager(), new
InitializedBinding());
+ manager.getResolver().resolveInjectionPoints();
+ manager.fireEvent(manager, new InitializedBinding());
log.info("Web Beans RI initialized");
}
@@ -267,9 +280,9 @@
}
@SuppressWarnings("unchecked")
- private static <T> void registerObserver(Observer<T> observer,
Class<?> eventType, Annotation[] bindings)
+ private <T> void registerObserver(Observer<T> observer, Class<?>
eventType, Annotation[] bindings)
{
- CurrentManager.rootManager().addObserver(observer, (Class<T>) eventType,
bindings);
+ manager.addObserver(observer, (Class<T>) eventType, bindings);
}
protected static boolean isTypeSimpleWebBean(Class<?> type)
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/DependentContext.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/DependentContext.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/DependentContext.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -31,6 +31,8 @@
public class DependentContext extends BasicContext
{
+ public static final DependentContext INSTANCE = new DependentContext();
+
/**
* Constructor
*/
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -32,7 +32,7 @@
import javax.webbeans.BindingType;
import javax.webbeans.manager.Manager;
-import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
+import org.jboss.webbeans.bindings.CurrentBinding;
import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.util.Reflections;
@@ -155,7 +155,7 @@
}
// The array of default binding types
- private static final Annotation[] DEFAULT_BINDING_ARRAY = { new
CurrentAnnotationLiteral() };
+ private static final Annotation[] DEFAULT_BINDING_ARRAY = { new CurrentBinding() };
// The set of default binding types
private static final Set<Annotation> DEFAULT_BINDING = new
HashSet<Annotation>(Arrays.asList(DEFAULT_BINDING_ARRAY));
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -24,6 +24,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
+import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.bootstrap.WebBeansBootstrap;
import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
import org.jboss.webbeans.contexts.ApplicationContext;
@@ -57,6 +58,9 @@
servletContext = context;
ApplicationContext.INSTANCE.setBeanMap(new ApplicationBeanMap(servletContext));
WebBeansBootstrap webBeansBootstrap = new WebBeansBootstrap();
+ CurrentManager.rootManager().addContext(RequestContext.INSTANCE);
+ CurrentManager.rootManager().addContext(SessionContext.INSTANCE);
+ CurrentManager.rootManager().addContext(ApplicationContext.INSTANCE);
webBeansBootstrap.boot(getWebBeanDiscovery());
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/BeanFactory.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/BeanFactory.java 2008-12-13
23:42:34 UTC (rev 515)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/BeanFactory.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -23,7 +23,7 @@
import javax.webbeans.Event;
import javax.webbeans.Instance;
-import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.bean.AbstractClassBean;
import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.bean.EventBean;
@@ -48,11 +48,12 @@
*
* @param <T> The type
* @param clazz The class
+ * @param manager TODO
* @return A Web Bean
*/
- public static <T> SimpleBean<T> createSimpleBean(Class<T> clazz)
+ public static <T> SimpleBean<T> createSimpleBean(Class<T> clazz,
ManagerImpl manager)
{
- return new SimpleBean<T>(clazz, CurrentManager.rootManager());
+ return new SimpleBean<T>(clazz, manager);
}
/**
@@ -60,11 +61,12 @@
*
* @param <T> The type
* @param clazz The class
+ * @param manager TODO
* @return An Enterprise Web Bean
*/
- public static <T> EnterpriseBean<T> createEnterpriseBean(Class<T>
clazz)
+ public static <T> EnterpriseBean<T> createEnterpriseBean(Class<T>
clazz, ManagerImpl manager)
{
- return new EnterpriseBean<T>(clazz, CurrentManager.rootManager());
+ return new EnterpriseBean<T>(clazz, manager);
}
/**
@@ -74,11 +76,12 @@
* @param type The class
* @param method The underlying method
* @param declaringBean The declaring bean abstraction
+ * @param manager TODO
* @return A producer Web Bean
*/
- public static <T> ProducerMethodBean<T>
createProducerMethodBean(Class<T> type, Method method, AbstractClassBean<?>
declaringBean)
+ public static <T> ProducerMethodBean<T>
createProducerMethodBean(Class<T> type, Method method, AbstractClassBean<?>
declaringBean, ManagerImpl manager)
{
- return new ProducerMethodBean<T>(method, declaringBean,
CurrentManager.rootManager());
+ return new ProducerMethodBean<T>(method, declaringBean, manager);
}
/**
@@ -88,11 +91,12 @@
* @param type The class
* @param field The underlying field
* @param declaringBean The declaring bean abstraction
+ * @param manager TODO
* @return A producer Web Bean
*/
- public static <T> ProducerFieldBean<T>
createProducerFieldBean(Class<T> type, Field field, AbstractClassBean<?>
declaringBean)
+ public static <T> ProducerFieldBean<T>
createProducerFieldBean(Class<T> type, Field field, AbstractClassBean<?>
declaringBean, ManagerImpl manager)
{
- return new ProducerFieldBean<T>(field, declaringBean,
CurrentManager.rootManager());
+ return new ProducerFieldBean<T>(field, declaringBean, manager);
}
/**
@@ -100,11 +104,12 @@
*
* @param field The underlying method abstraction
* @param declaringBean The declaring bean abstraction
+ * @param manager TODO
* @return A producer Web Bean
*/
- public static <T> ProducerFieldBean<T>
createProducerFieldBean(AnnotatedField<T> field, AbstractClassBean<?>
declaringBean)
+ public static <T> ProducerFieldBean<T>
createProducerFieldBean(AnnotatedField<T> field, AbstractClassBean<?>
declaringBean, ManagerImpl manager)
{
- return new ProducerFieldBean<T>(field, declaringBean,
CurrentManager.rootManager());
+ return new ProducerFieldBean<T>(field, declaringBean, manager);
}
/**
@@ -112,40 +117,43 @@
*
* @param method The underlying method abstraction
* @param declaringBean The declaring bean abstraction
+ * @param manager TODO
* @return A producer Web Bean
*/
- public static <T> ProducerMethodBean<T>
createProducerMethodBean(AnnotatedMethod<T> method, AbstractClassBean<?>
declaringBean)
+ public static <T> ProducerMethodBean<T>
createProducerMethodBean(AnnotatedMethod<T> method, AbstractClassBean<?>
declaringBean, ManagerImpl manager)
{
- return new ProducerMethodBean<T>(method, declaringBean,
CurrentManager.rootManager());
+ return new ProducerMethodBean<T>(method, declaringBean, manager);
}
/**
* Creates an event Web Bean
*
* @param field The event injection point abstraction
+ * @param manager TODO
* @param declaringBean The declaring bean abstraction
* @return An event Web Bean
*/
- public static <T, S> EventBean<T, S>
createEventBean(AnnotatedItem<Event<T>, S> field)
+ public static <T, S> EventBean<T, S>
createEventBean(AnnotatedItem<Event<T>, S> field, ManagerImpl manager)
{
- return new EventBean<T, S>(field, CurrentManager.rootManager());
+ return new EventBean<T, S>(field, manager);
}
/**
* Creates an instance Web Bean
*
* @param field The instance injection point abstraction
+ * @param manager TODO
* @param declaringBean The declaring bean abstraction
* @return An event Web Bean
*/
- public static <T, S> InstanceBean<T, S>
createInstanceBean(AnnotatedItem<Instance<T>, S> field)
+ public static <T, S> InstanceBean<T, S>
createInstanceBean(AnnotatedItem<Instance<T>, S> field, ManagerImpl manager)
{
- return new InstanceBean<T, S>(field, CurrentManager.rootManager());
+ return new InstanceBean<T, S>(field, manager);
}
- public static <T> ObserverImpl<T>
createObserver(AnnotatedMethod<Object> method, AbstractClassBean<?>
declaringBean)
+ public static <T> ObserverImpl<T>
createObserver(AnnotatedMethod<Object> method, AbstractClassBean<?>
declaringBean, ManagerImpl manager)
{
- return new ObserverImpl<T>(method, declaringBean,
CurrentManager.rootManager());
+ return new ObserverImpl<T>(method, declaringBean, manager);
}
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Tests.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Tests.java 2008-12-13
23:42:34 UTC (rev 515)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Tests.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -1,6 +1,7 @@
package org.jboss.webbeans.examples;
import java.lang.reflect.Method;
+import java.util.Arrays;
import javax.webbeans.Production;
import javax.webbeans.Standard;
@@ -29,11 +30,11 @@
private void setupGameGenerator() throws NoSuchMethodException
{
- SimpleBean<Game> gameBean = BeanFactory.createSimpleBean(Game.class);
- SimpleBean<Generator> generatorBean =
BeanFactory.createSimpleBean(Generator.class);
+ SimpleBean<Game> gameBean = BeanFactory.createSimpleBean(Game.class,
manager);
+ SimpleBean<Generator> generatorBean =
BeanFactory.createSimpleBean(Generator.class, manager);
Method method = Generator.class.getDeclaredMethod("next");
method.setAccessible(true);
- ProducerMethodBean<Integer> nextBean =
BeanFactory.createProducerMethodBean(int.class, method, generatorBean);
+ ProducerMethodBean<Integer> nextBean =
BeanFactory.createProducerMethodBean(int.class, method, generatorBean, manager);
manager.addBean(gameBean);
manager.addBean(generatorBean);
@@ -44,7 +45,7 @@
public void testMockSentenceTranslator() throws Exception {
setupTextTranslator();
- manager.setEnabledDeploymentTypes(Standard.class, Production.class, Mock.class);
+ manager.setEnabledDeploymentTypes(Arrays.asList(Standard.class, Production.class,
Mock.class));
TextTranslator tt2 = manager.getInstanceByType(TextTranslator.class);
assert "Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.".equals(
tt2.translate("Hello world. How's tricks?") );
@@ -68,10 +69,10 @@
private void setupTextTranslator()
{
- SimpleBean<SentenceParser> spBean =
BeanFactory.createSimpleBean(SentenceParser.class);
- SimpleBean<SentenceTranslator> stBean =
BeanFactory.createSimpleBean(SentenceTranslator.class);
- SimpleBean<MockSentenceTranslator> mstBean =
BeanFactory.createSimpleBean(MockSentenceTranslator.class);
- SimpleBean<TextTranslator> ttBean =
BeanFactory.createSimpleBean(TextTranslator.class);
+ SimpleBean<SentenceParser> spBean =
BeanFactory.createSimpleBean(SentenceParser.class, manager);
+ SimpleBean<SentenceTranslator> stBean =
BeanFactory.createSimpleBean(SentenceTranslator.class, manager);
+ SimpleBean<MockSentenceTranslator> mstBean =
BeanFactory.createSimpleBean(MockSentenceTranslator.class, manager);
+ SimpleBean<TextTranslator> ttBean =
BeanFactory.createSimpleBean(TextTranslator.class, manager);
manager.addBean(spBean);
manager.addBean(stBean);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -1,9 +1,10 @@
package org.jboss.webbeans.test;
+import java.util.Arrays;
+
import javax.webbeans.Production;
import javax.webbeans.Standard;
-import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.bootstrap.WebBeansBootstrap;
import org.jboss.webbeans.contexts.ApplicationContext;
import org.jboss.webbeans.contexts.RequestContext;
@@ -25,24 +26,25 @@
public final void before()
{
manager = new MockManagerImpl();
+ webBeansBootstrap = new MockBootstrap(manager);
manager.addContext(RequestContext.INSTANCE);
+ SessionContext.INSTANCE.setBeanMap(new SimpleBeanMap());
manager.addContext(SessionContext.INSTANCE);
+ ApplicationContext.INSTANCE.setBeanMap(new SimpleBeanMap());
manager.addContext(ApplicationContext.INSTANCE);
- CurrentManager.setRootManager(manager);
- // Mock the ApplicationContext as a simple map
- ApplicationContext.INSTANCE.setBeanMap(new SimpleBeanMap());
- webBeansBootstrap = new MockBootstrap();
+ // Load the build in beans
+ webBeansBootstrap.registerBeans();
init();
}
protected void init()
{
- addEnabledDeploymentTypes();
+ addStandardDeploymentTypesForTests();
}
- protected void addEnabledDeploymentTypes()
+ protected void addStandardDeploymentTypesForTests()
{
- manager.setEnabledDeploymentTypes(Standard.class, Production.class,
AnotherDeploymentType.class, HornedAnimalDeploymentType.class);
+ manager.setEnabledDeploymentTypes(Arrays.asList(Standard.class, Production.class,
AnotherDeploymentType.class, HornedAnimalDeploymentType.class));
}
}
Deleted:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ApplicationContextTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ApplicationContextTest.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ApplicationContextTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -1,79 +0,0 @@
-package org.jboss.webbeans.test;
-
-import org.testng.annotations.Test;
-
-@SpecVersion("2001206")
-public class ApplicationContextTest extends AbstractTest
-{
-
- @Test(groups={"stub", "servlet", "contexts"})
@SpecAssertion(section="9.5.3")
- public void testScopeActiveDuringServiceMethod()
- {
- assert false;
- }
-
- @Test(groups={"stub", "webservice", "contexts"})
@SpecAssertion(section="9.5.3")
- public void testScopeActiveDuringWebServiceInvocation()
- {
- assert false;
- }
-
- @Test(groups={"stub", "contexts", "ejb3"})
@SpecAssertion(section="9.5.3")
- public void testScopeActiveDuringRemoteInvocationOfEjbs()
- {
- assert false;
- }
-
- @Test(groups={"stub", "contexts", "ejb3"})
@SpecAssertion(section="9.5.3")
- public void testScopeActiveDuringEjbTimeouts()
- {
- assert false;
- }
-
- @Test(groups={"stub", "contexts", "ejb3"})
@SpecAssertion(section="9.5.3")
- public void testScopeActiveDuringMessageDelivery()
- {
- assert false;
- }
-
- @Test(groups={"stub", "servlet", "contexts"})
@SpecAssertion(section="9.5.3")
- public void testScopeSharedAcrossRequests()
- {
- assert false;
- }
-
- @Test(groups={"stub", "webservice", "contexts"})
@SpecAssertion(section="9.5.3")
- public void testScopeSharedAcrossWebServiceInvocations()
- {
- assert false;
- }
-
- @Test(groups={"stub", "contexts", "ejb3"})
@SpecAssertion(section="9.5.3")
- public void testScopeSharedAcrossRemoteInvocationsOfEjbs()
- {
- assert false;
- }
-
- @Test(groups={"stub", "contexts", "ejb3"})
@SpecAssertion(section="9.5.3")
- public void testScopeSharedAcrossEjbTimeouts()
- {
- assert false;
- }
-
- @Test(groups={"stub", "contexts", "ejb3"})
@SpecAssertion(section="9.5.3")
- public void testScopeSharedAcrossMessageDelivery()
- {
- assert false;
- }
-
- /*
-
- @Test @SpecAssertion(section="9.5.3")
- public void test
- {
- assert false;
- }
-
- */
-
-}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -9,7 +9,7 @@
import org.jboss.webbeans.bean.ProducerMethodBean;
import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
+import org.jboss.webbeans.bindings.CurrentBinding;
import org.jboss.webbeans.test.annotations.Synchronous;
import org.jboss.webbeans.test.beans.Barn;
import org.jboss.webbeans.test.beans.Cat;
@@ -31,7 +31,7 @@
@Test @SpecAssertion(section={"2.3.3", "2.3.1"})
public void testDefaultBindingTypeDeclaredInJava()
{
- SimpleBean<Order> order = createSimpleBean(Order.class);
+ SimpleBean<Order> order = createSimpleBean(Order.class, manager);
assert order.getBindingTypes().size() == 1;
order.getBindingTypes().iterator().next().annotationType().equals(Current.class);
}
@@ -58,7 +58,7 @@
@Test @SpecAssertion(section="2.3.3")
public void testBindingTypesDeclaredInJava()
{
- SimpleBean<Cat> cat = createSimpleBean(Cat.class);
+ SimpleBean<Cat> cat = createSimpleBean(Cat.class, manager);
assert cat.getBindingTypes().size() == 1;
assert Reflections.annotationSetMatches(cat.getBindingTypes(), Synchronous.class);
}
@@ -66,7 +66,7 @@
@Test @SpecAssertion(section="2.3.3")
public void testMultipleBindingTypes()
{
- SimpleBean<?> model = createSimpleBean(Cod.class);
+ SimpleBean<?> model = createSimpleBean(Cod.class, manager);
assert model.getBindingTypes().size() == 2;
}
@@ -111,9 +111,9 @@
@Test(groups={"stub", "webbeansxml"})
@SpecAssertion(section={"2.3.4", "2.3.1"})
public void testDefaultBindingTypeDeclaredInXml()
{
- SimpleBean<?> model = createSimpleBean(Tuna.class);
+ SimpleBean<?> model = createSimpleBean(Tuna.class, manager);
assert model.getBindingTypes().size() == 1;
- assert model.getBindingTypes().contains(new CurrentAnnotationLiteral());
+ assert model.getBindingTypes().contains(new CurrentBinding());
assert false;
}
@@ -122,11 +122,11 @@
@Test(groups={"injection", "producerMethod"})
@SpecAssertion(section="2.3.5")
public void testFieldInjectedFromProducerMethod() throws Exception
{
- SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class, manager);
manager.addBean(spiderProducer);
Method method = SpiderProducer.class.getMethod("produceTameTarantula");
- manager.addBean(createProducerMethodBean(Tarantula.class, method, spiderProducer));
- Barn barn = createSimpleBean(Barn.class).create();
+ manager.addBean(createProducerMethodBean(Tarantula.class, method, spiderProducer,
manager));
+ Barn barn = createSimpleBean(Barn.class, manager).create();
assert barn.petSpider != null;
assert barn.petSpider instanceof DefangedTarantula;
}
@@ -146,12 +146,12 @@
@Test(groups={"injection", "producerMethod"})
public void testMethodWithBindingAnnotationsOnParametersAreInjected() throws
Exception
{
- SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class, manager);
manager.addBean(spiderProducer);
Method method = SpiderProducer.class.getMethod("produceTameTarantula");
- manager.addBean(createProducerMethodBean(Tarantula.class, method,
spiderProducer));
+ manager.addBean(createProducerMethodBean(Tarantula.class, method, spiderProducer,
manager));
method = SpiderProducer.class.getMethod("produceSpiderFromInjection",
Tarantula.class);
- ProducerMethodBean<Spider> spiderBean =
createProducerMethodBean(Spider.class, method, spiderProducer);
+ ProducerMethodBean<Spider> spiderBean =
createProducerMethodBean(Spider.class, 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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClientProxyTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -26,7 +26,7 @@
@SpecAssertion(section = { "5.4" })
public void testClientProxyUsedForNormalScope()
{
- Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class);
+ Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class, manager);
manager.addBean(tunaBean);
Tuna tuna = manager.getInstance(tunaBean);
assert Reflections.isProxy(tuna);
@@ -36,7 +36,7 @@
@SpecAssertion(section = { "5.4" })
public void testClientProxyNotUsedForPseudoScope()
{
- Bean<Fox> foxBean = BeanFactory.createSimpleBean(Fox.class);
+ Bean<Fox> foxBean = BeanFactory.createSimpleBean(Fox.class, manager);
Fox fox = manager.getInstance(foxBean);
assert !Reflections.isProxy(fox);
}
@@ -57,7 +57,7 @@
@SpecAssertion(section = "5.4")
public void testSimpleWebBeanClientProxyIsSerializable() throws IOException,
ClassNotFoundException
{
- Bean<TunedTuna> tunaBean = BeanFactory.createSimpleBean(TunedTuna.class);
+ Bean<TunedTuna> tunaBean = BeanFactory.createSimpleBean(TunedTuna.class,
manager);
manager.addBean(tunaBean);
TunedTuna tuna = manager.getInstance(tunaBean);
assert Reflections.isProxy(tuna);
@@ -71,7 +71,7 @@
@SpecAssertion(section = "5.4.1")
public void testInjectionPointWithUnproxyableTypeWhichResolvesToNormalScopedWebBean()
{
- Bean<FinalTuna> tunaBean = BeanFactory.createSimpleBean(FinalTuna.class);
+ Bean<FinalTuna> tunaBean = BeanFactory.createSimpleBean(FinalTuna.class,
manager);
manager.addBean(tunaBean);
FinalTuna tuna = manager.getInstanceByType(FinalTuna.class);
assert false;
@@ -81,7 +81,7 @@
@SpecAssertion(section = "5.4.2")
public void testClientProxyInvocation()
{
- Bean<TunedTuna> tunaBean = BeanFactory.createSimpleBean(TunedTuna.class);
+ Bean<TunedTuna> tunaBean = BeanFactory.createSimpleBean(TunedTuna.class,
manager);
manager.addBean(tunaBean);
TunedTuna tuna = manager.getInstance(tunaBean);
assert Reflections.isProxy(tuna);
@@ -90,7 +90,7 @@
@Test(groups = "Reflections", expectedExceptions=DefinitionException.class)
public void testGettingUnknownBeanFails() {
- Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class);
+ Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class, manager);
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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/CommonWebBeanTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -35,41 +35,41 @@
@Test @SpecAssertion(section="2")
public void testApiTypesNonEmpty()
{
- Bean<?> model = createSimpleBean(RedSnapper.class);
+ Bean<?> model = createSimpleBean(RedSnapper.class, manager);
assert model.getTypes().size() > 0;
}
@Test @SpecAssertion(section="2")
public void testBindingTypesNonEmpty()
{
- Bean<?> model = createSimpleBean(RedSnapper.class);
+ Bean<?> model = createSimpleBean(RedSnapper.class, manager);
assert model.getBindingTypes().size() > 0;
}
@Test @SpecAssertion(section="2")
public void testHasScopeType()
{
- Bean<?> model = createSimpleBean(RedSnapper.class);
+ Bean<?> model = createSimpleBean(RedSnapper.class, manager);
assert model.getScopeType().equals(RequestScoped.class);
}
@Test @SpecAssertion(section="2")
public void testHasDeploymentType()
{
- Bean<?> model = createSimpleBean(RedSnapper.class);
+ Bean<?> model = createSimpleBean(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);
+ SimpleBean<SpiderProducer> spiderProducerBean =
createSimpleBean(SpiderProducer.class, manager);
manager.addBean(spiderProducerBean);
Method method = SpiderProducer.class.getMethod("getWolfSpiderSize");
- Bean<Integer> bean = createProducerMethodBean(int.class, method,
spiderProducerBean);
+ Bean<Integer> bean = createProducerMethodBean(int.class, method,
spiderProducerBean, manager);
assert !bean.isNullable();
method = SpiderProducer.class.getMethod("makeASpider");
- Bean<Spider> spiderBean = createProducerMethodBean(Spider.class, method,
spiderProducerBean);
+ Bean<Spider> spiderBean = createProducerMethodBean(Spider.class, method,
spiderProducerBean, manager);
assert spiderBean.isNullable();
}
@@ -77,7 +77,7 @@
@Test @SpecAssertion(section={"3.2.2", "2.2"})
public void testApiTypes()
{
- Bean<Tarantula> bean = createSimpleBean(Tarantula.class);
+ Bean<Tarantula> bean = createSimpleBean(Tarantula.class, manager);
assert bean.getTypes().size() == 6;
assert bean.getTypes().contains(Tarantula.class);
assert bean.getTypes().contains(Spider.class);
@@ -90,7 +90,7 @@
@Test @SpecAssertion(section="2.2")
public void testFinalApiType()
{
- createSimpleBean(DependentFinalTuna.class);
+ createSimpleBean(DependentFinalTuna.class, manager);
}
}
Added:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DefaultDeploymentTypeTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DefaultDeploymentTypeTest.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DefaultDeploymentTypeTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -0,0 +1,26 @@
+package org.jboss.webbeans.test;
+
+import javax.webbeans.Production;
+import javax.webbeans.Standard;
+
+import org.testng.annotations.Test;
+
+
+public class DefaultDeploymentTypeTest extends AbstractTest
+{
+
+ @Override
+ protected void addStandardDeploymentTypesForTests()
+ {
+ // No-op
+ }
+
+ @Test @SpecAssertion(section={"2.5.6", "2.5.7"})
+ public void testDefaultEnabledDeploymentTypes()
+ {
+ assert manager.getEnabledDeploymentTypes().size() == 2;
+ assert manager.getEnabledDeploymentTypes().get(0).equals(Standard.class);
+ assert manager.getEnabledDeploymentTypes().get(1).equals(Production.class);
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DefaultDeploymentTypeTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -2,6 +2,8 @@
import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
+import java.util.Arrays;
+
import javax.webbeans.Observes;
import javax.webbeans.Standard;
@@ -30,9 +32,9 @@
}
@Override
- protected void addEnabledDeploymentTypes()
+ protected void addStandardDeploymentTypesForTests()
{
- manager.setEnabledDeploymentTypes(Standard.class, AnotherDeploymentType.class);
+ manager.setEnabledDeploymentTypes(Arrays.asList(Standard.class,
AnotherDeploymentType.class));
}
public class AnObserver
@@ -66,7 +68,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);
+ tuna = createSimpleBean(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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -4,6 +4,7 @@
import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
import java.lang.reflect.Method;
+import java.util.Arrays;
import javax.webbeans.DefinitionException;
import javax.webbeans.DeploymentException;
@@ -32,7 +33,7 @@
@Test(expectedExceptions=DefinitionException.class)
@SpecAssertion(section="2.5.1")
public void testNonBuiltInComponentUsesStandard()
{
- createSimpleBean(Gazelle.class);
+ createSimpleBean(Gazelle.class, manager);
}
@Test(groups={"stub", "annotationDefinition"})
@SpecAssertion(section="2.5.2")
@@ -56,16 +57,16 @@
@Test(expectedExceptions=DefinitionException.class)
@SpecAssertion(section="2.5.3")
public void testTooManyDeploymentTypes()
{
- createSimpleBean(BeanWithTooManyDeploymentTypes.class);
+ createSimpleBean(BeanWithTooManyDeploymentTypes.class, manager);
}
@Test @SpecAssertion(section="2.5.3")
public void testDeploymentTypeInhertitedFromDeclaringBean() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("produceBlackWidow");
- ProducerMethodBean<BlackWidow> blackWidowSpiderModel =
createProducerMethodBean(BlackWidow.class, method, bean);
+ ProducerMethodBean<BlackWidow> blackWidowSpiderModel =
createProducerMethodBean(BlackWidow.class, method, bean, manager);
assert
blackWidowSpiderModel.getDeploymentType().equals(AnotherDeploymentType.class);
}
@@ -104,33 +105,24 @@
@Test @SpecAssertion(section="2.5.5")
public void testHighestPrecedenceDeploymentTypeFromStereotype()
{
- Bean<?> bean = createSimpleBean(Rhinoceros.class);
+ Bean<?> bean = createSimpleBean(Rhinoceros.class, manager);
assert bean.getDeploymentType().equals(HornedAnimalDeploymentType.class);
}
@Test(groups="beanLifecycle",
expectedExceptions=UnsatisfiedDependencyException.class)
@SpecAssertion(section="2.5.6")
public void testBeanWithDisabledDeploymentTypeNotInstantiated()
{
- manager.setEnabledDeploymentTypes(Standard.class, AnotherDeploymentType.class,
HornedAnimalDeploymentType.class);
+ manager.setEnabledDeploymentTypes(Arrays.asList(Standard.class,
AnotherDeploymentType.class, HornedAnimalDeploymentType.class));
- Bean<RedSnapper> bean = createSimpleBean(RedSnapper.class);
+ Bean<RedSnapper> bean = createSimpleBean(RedSnapper.class, manager);
manager.addBean(bean);
manager.getInstanceByType(RedSnapper.class);
}
-
- @Test @SpecAssertion(section={"2.5.6", "2.5.7"})
- public void testDefaultEnabledDeploymentTypes()
- {
- manager.setEnabledDeploymentTypes();
- assert manager.getEnabledDeploymentTypes().size() == 2;
- assert manager.getEnabledDeploymentTypes().get(0).equals(Standard.class);
- assert manager.getEnabledDeploymentTypes().get(1).equals(Production.class);
- }
@Test @SpecAssertion(section={"2.5.6", "2.5.7"})
public void testCustomDeploymentTypes()
{
- manager.setEnabledDeploymentTypes(Standard.class, AnotherDeploymentType.class,
HornedAnimalDeploymentType.class);
+ manager.setEnabledDeploymentTypes(Arrays.asList(Standard.class,
AnotherDeploymentType.class, HornedAnimalDeploymentType.class));
assert manager.getEnabledDeploymentTypes().size() == 3;
assert manager.getEnabledDeploymentTypes().get(0).equals(Standard.class);
assert
manager.getEnabledDeploymentTypes().get(1).equals(AnotherDeploymentType.class);
@@ -140,7 +132,7 @@
@Test(expectedExceptions=DeploymentException.class)
@SpecAssertion(section="2.5.6")
public void testStandardMustBeDeclared()
{
- manager.setEnabledDeploymentTypes(AnotherDeploymentType.class,
HornedAnimalDeploymentType.class);
+ manager.setEnabledDeploymentTypes(Arrays.asList(AnotherDeploymentType.class,
HornedAnimalDeploymentType.class));
}
@Test(groups={"stub", "webbeansxml"},
expectedExceptions=DeploymentException.class) @SpecAssertion(section="2.5.6")
@@ -152,7 +144,7 @@
@Test @SpecAssertion(section={"2.5.5", "2.7.2"})
public void testWebBeanDeploymentTypeOverridesStereotype()
{
- Bean<Reindeer> bean = createSimpleBean(Reindeer.class);
+ Bean<Reindeer> bean = createSimpleBean(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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InitializerMethodTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -23,7 +23,7 @@
@Test(expectedExceptions=DefinitionException.class,
groups="initializerMethod") @SpecAssertion(section="3.8")
public void testStaticInitializerMethodNotAllowed()
{
- createSimpleBean(Dottrel.class);
+ createSimpleBean(Dottrel.class, manager);
}
@Test(groups={"stub", "initializerMethod", "servlet"})
@SpecAssertion(section="3.8")
@@ -65,10 +65,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.addBean(createSimpleBean(Chicken.class));
+ manager.addBean(createSimpleBean(Fox.class, manager));
+ manager.addBean(createSimpleBean(Chicken.class, manager));
- Bean<ChickenHutch> chickenHutchBean = createSimpleBean(ChickenHutch.class);
+ Bean<ChickenHutch> chickenHutchBean = createSimpleBean(ChickenHutch.class,
manager);
ChickenHutch chickenHutch = chickenHutchBean.create();
assert chickenHutch.fox != null;
assert chickenHutch.chicken != null;
@@ -77,25 +77,25 @@
@Test(groups="initializerMethod",
expectedExceptions=DefinitionException.class) @SpecAssertion(section={"3.8.1",
"3.4.2"})
public void testInitializerMethodAnnotatedProduces()
{
- createSimpleBean(Pheasant.class);
+ createSimpleBean(Pheasant.class, manager);
}
@Test(groups="initializerMethod",
expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.8.1")
public void testInitializerMethodAnnotatedDestructor()
{
- createSimpleBean(Shrike.class);
+ createSimpleBean(Shrike.class, manager);
}
@Test(groups="initializerMethod",
expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.8.1")
public void testInitializerMethodHasParameterAnnotatedDisposes()
{
- createSimpleBean(Capercaillie.class);
+ createSimpleBean(Capercaillie.class, manager);
}
@Test(groups="initializerMethod",
expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.8.1")
public void testInitializerMethodHasParameterAnnotatedObserves()
{
- createSimpleBean(Grouse.class);
+ createSimpleBean(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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionTests.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -32,10 +32,10 @@
@Test(groups={"injection", "producerMethod"})
@SpecAssertion(section="5.2")
public void testInjectionPerformsBoxingIfNecessary() throws Exception
{
- SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class, manager);
manager.addBean(spiderProducer);
- Bean<SpiderNest> spiderNestBean = createSimpleBean(SpiderNest.class);
- manager.addBean(createProducerMethodBean(Integer.class,
SpiderProducer.class.getMethod("getWolfSpiderSize"), spiderProducer));
+ Bean<SpiderNest> spiderNestBean = createSimpleBean(SpiderNest.class,
manager);
+ manager.addBean(createProducerMethodBean(Integer.class,
SpiderProducer.class.getMethod("getWolfSpiderSize"), spiderProducer, manager));
SpiderNest spiderNest = spiderNestBean.create();
assert spiderNest.numberOfSpiders != null;
assert spiderNest.numberOfSpiders.equals(4);
@@ -44,17 +44,17 @@
@Test(groups={"injection", "producerMethod"},
expectedExceptions=NullableDependencyException.class)
@SpecAssertion(section="5.2")
public void testPrimitiveInjectionPointResolvesToNullableWebBean() throws Exception
{
- Bean<FarmHouse> farmHouseBean = createSimpleBean(FarmHouse.class);
- SimpleBean<FarmHouseProducer> farmHouseProducerBean =
createSimpleBean(FarmHouseProducer.class);
- manager.addBean(createProducerMethodBean(Integer.class,
FarmHouseProducer.class.getMethod("getNumberOfBedrooms"),
farmHouseProducerBean));
+ 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));
farmHouseBean.create();
}
@Test(groups={"injection", "clientProxy"},
expectedExceptions=ContextNotActiveException.class)
@SpecAssertion(section="5.3")
public void testInvokeNormalInjectedWebBeanWhenContextNotActive()
{
- SimpleBean<TunaFarm> tunaFarmBean = createSimpleBean(TunaFarm.class);
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class);
+ SimpleBean<TunaFarm> tunaFarmBean = createSimpleBean(TunaFarm.class,
manager);
+ Bean<Tuna> tunaBean = createSimpleBean(Tuna.class, manager);
manager.addBean(tunaBean);
TunaFarm tunaFarm = tunaFarmBean.create();
assert tunaFarm.tuna != null;
@@ -66,8 +66,8 @@
@Test(groups="injection") @SpecAssertion(section="5.3")
public void testInvokeDependentScopeWhenContextNotActive()
{
- Bean<FoxRun> foxRunBean = createSimpleBean(FoxRun.class);
- Bean<Fox> foxBean = createSimpleBean(Fox.class);
+ Bean<FoxRun> foxRunBean = createSimpleBean(FoxRun.class, manager);
+ Bean<Fox> foxBean = createSimpleBean(Fox.class, manager);
manager.addBean(foxBean);
FoxRun foxRun = foxRunBean.create();
assert foxRun.fox.getName().equals("gavin");
@@ -76,8 +76,8 @@
@Test(groups="injection", expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.7")
public void testInjectingStaticField()
{
- SimpleBean<BeanWithStaticBoundField> bean =
createSimpleBean(BeanWithStaticBoundField.class);
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class);
+ SimpleBean<BeanWithStaticBoundField> bean =
createSimpleBean(BeanWithStaticBoundField.class, manager);
+ Bean<Tuna> tunaBean = createSimpleBean(Tuna.class, manager);
manager.addBean(tunaBean);
BeanWithStaticBoundField instance = bean.create();
}
@@ -85,8 +85,8 @@
@Test(groups="injection",expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.7")
public void testInjectingFinalField()
{
- SimpleBean<BeanWithFinalBoundField> bean =
createSimpleBean(BeanWithFinalBoundField.class);
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class);
+ SimpleBean<BeanWithFinalBoundField> bean =
createSimpleBean(BeanWithFinalBoundField.class, manager);
+ Bean<Tuna> tunaBean = createSimpleBean(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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -30,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);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
+ Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
+ Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
manager.addBean(codBean);
manager.addBean(salmonBean);
@@ -42,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);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
- Bean<Sole> soleBean = createSimpleBean(Sole.class);
+ Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
+ Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
+ Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
manager.addBean(codBean);
manager.addBean(salmonBean);
manager.addBean(soleBean);
@@ -55,13 +55,13 @@
@Test(groups={"resolution", "beanLifecycle"})
@SpecAssertion(section="4.10.1")
public void testGetInstanceByName()
{
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class);
- Bean<Cod> codBean = createSimpleBean(Cod.class);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
- Bean<Sole> soleBean = createSimpleBean(Sole.class);
- Bean<SeaBass> seaBassBean = createSimpleBean(SeaBass.class);
- Bean<Haddock> haddockBean = createSimpleBean(Haddock.class);
- Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class);
+ 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);
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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -10,7 +10,7 @@
import javax.webbeans.UnsatisfiedDependencyException;
import javax.webbeans.manager.Bean;
-import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
+import org.jboss.webbeans.bindings.CurrentBinding;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
@@ -36,7 +36,7 @@
@Test(groups={"resolution", "beanLifecycle"})
@SpecAssertion(section="5.9")
public void testCurrentBindingTypeAssumed()
{
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class);
+ Bean<Tuna> tunaBean = createSimpleBean(Tuna.class, manager);
manager.addBean(tunaBean);
assert manager.getInstanceByType(Tuna.class) != null;
}
@@ -57,7 +57,7 @@
@Test(groups="resolution",
expectedExceptions=DuplicateBindingTypeException.class)
@SpecAssertion(section="5.9")
public void testDuplicateBindingTypesUsed()
{
- manager.getInstanceByType(Tuna.class, new CurrentAnnotationLiteral(), new
CurrentAnnotationLiteral());
+ manager.getInstanceByType(Tuna.class, new CurrentBinding(), new CurrentBinding());
}
@Test(groups="resolution",
expectedExceptions=IllegalArgumentException.class)
@SpecAssertion(section="5.9")
@@ -70,9 +70,9 @@
public void testAmbiguousDependencies() throws Exception
{
AnnotatedField<ScottishFish> whiteScottishFishField = new
AnnotatedFieldImpl<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"),
fishFarmClass);
- Bean<Cod> codBean = createSimpleBean(Cod.class);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
- Bean<Sole> soleBean = createSimpleBean(Sole.class);
+ Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
+ Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
+ Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
manager.addBean(codBean);
manager.addBean(salmonBean);
manager.addBean(soleBean);
@@ -84,20 +84,20 @@
public void testUnsatisfiedDependencies() throws Exception
{
AnnotatedField<ScottishFish> whiteScottishFishField = new
AnnotatedFieldImpl<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"),
fishFarmClass);
- Bean<Cod> codBean = createSimpleBean(Cod.class);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
- Bean<Sole> soleBean = createSimpleBean(Sole.class);
+ Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
+ Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
+ Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
manager.addBean(codBean);
manager.addBean(salmonBean);
manager.addBean(soleBean);
- manager.getInstanceByType(Tuna.class, new CurrentAnnotationLiteral());
+ manager.getInstanceByType(Tuna.class, new CurrentBinding());
}
@Test(expectedExceptions=UnproxyableDependencyException.class)
@SpecAssertion(section="5.9")
public void testUnproxyableDependencies() throws Exception
{
- Bean<FinalTuna> FinalTunaBean = createSimpleBean(FinalTuna.class);
+ Bean<FinalTuna> FinalTunaBean = createSimpleBean(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 2008-12-13
23:42:34 UTC (rev 515)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ManagerTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -18,7 +18,7 @@
@Test(groups={"manager", "injection", "deployment"})
@SpecAssertion(section="5.8")
public void testInjectingManager()
{
- FishFarmOffice fishFarmOffice = createSimpleBean(FishFarmOffice.class).create();
+ FishFarmOffice fishFarmOffice = createSimpleBean(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 2008-12-13
23:42:34 UTC (rev 515)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -25,7 +25,7 @@
@Test @SpecAssertion(section="2.6.1")
public void testNonDefaultNamed()
{
- SimpleBean<Moose> moose = createSimpleBean(Moose.class);
+ SimpleBean<Moose> moose = createSimpleBean(Moose.class, manager);
assert moose.getName().equals("aMoose");
}
@@ -81,7 +81,7 @@
@Test @SpecAssertion(section={"2.6.3", "3.2.7"})
public void testDefaultNamed()
{
- SimpleBean<Haddock> haddock = createSimpleBean(Haddock.class);
+ SimpleBean<Haddock> haddock = createSimpleBean(Haddock.class, manager);
assert haddock.getName() != null;
assert haddock.getName().equals("haddock");
}
@@ -109,7 +109,7 @@
@Test @SpecAssertion(section={"2.6.3", "2.7"})
public void testSterotypeDefaultsName()
{
- SimpleBean<RedSnapper> model = createSimpleBean(RedSnapper.class);
+ SimpleBean<RedSnapper> model = createSimpleBean(RedSnapper.class, manager);
assert model.getMergedStereotypes().isBeanNameDefaulted();
assert model.getName().equals("redSnapper");
}
@@ -117,21 +117,21 @@
@Test @SpecAssertion(section="2.6.4")
public void testNotNamedInJava()
{
- SimpleBean<SeaBass> model = createSimpleBean(SeaBass.class);
+ SimpleBean<SeaBass> model = createSimpleBean(SeaBass.class, manager);
assert model.getName() == null;
}
@Test @SpecAssertion(section="2.6.4")
public void testNotNamedInXml()
{
- SimpleBean<SeaBass> model = createSimpleBean(SeaBass.class);
+ SimpleBean<SeaBass> model = createSimpleBean(SeaBass.class, manager);
assert model.getName() == null;
}
@Test @SpecAssertion(section="2.6.4")
public void testNotNamedInStereotype()
{
- SimpleBean<Minnow> model = createSimpleBean(Minnow.class);
+ SimpleBean<Minnow> model = createSimpleBean(Minnow.class, manager);
assert model.getName() == null;
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewEventTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewEventTest.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewEventTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -80,13 +80,13 @@
@Test(groups = "events")
public void testEventBeanCreation()
{
- SimpleBean<MyTest> myTestBean = BeanFactory.createSimpleBean(MyTest.class);
+ SimpleBean<MyTest> myTestBean = BeanFactory.createSimpleBean(MyTest.class,
manager);
boolean found = false;
for (AnnotatedField field : myTestBean.getInjectableFields())
{
if (field.isAnnotationPresent(Observable.class))
{
- EventBean eventBean = BeanFactory.createEventBean(field);
+ EventBean eventBean = BeanFactory.createEventBean(field, manager);
Event<Param> event = eventBean.create();
assert event != null;
found = true;
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -5,14 +5,12 @@
import javax.webbeans.Observer;
import javax.webbeans.Observes;
-import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
import org.jboss.webbeans.introspector.jlr.AnnotatedMethodImpl;
import org.jboss.webbeans.test.annotations.Role;
import org.jboss.webbeans.test.bindings.RoleBinding;
-import org.jboss.webbeans.test.mock.MockManagerImpl;
import org.jboss.webbeans.util.BeanFactory;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -24,9 +22,9 @@
*
*/
@SpecVersion("20081024-PDR")
-public class ObserverTest
+public class ObserverTest extends AbstractTest
{
- private MockManagerImpl manager;
+
// private SimpleBean<Tuna> tuna;
private SimpleBean<SampleObserver> ob;
private AnnotatedMethod<Object> om;
@@ -55,15 +53,14 @@
}
@BeforeMethod
- public void before() throws Exception
+ public void beforeObserverTest() throws Exception
{
- manager = new MockManagerImpl();
- CurrentManager.setRootManager(manager);
- ob = BeanFactory.createSimpleBean(SampleObserver.class);
+ super.before();
+ ob = BeanFactory.createSimpleBean(SampleObserver.class, manager);
manager.addBean(ob);
Method method = SampleObserver.class.getMethod("observe",
SampleEvent.class);
om = new AnnotatedMethodImpl<Object>(method, new
AnnotatedClassImpl<SampleObserver>(SampleObserver.class));
- observer = BeanFactory.createObserver(om, ob);
+ observer = BeanFactory.createObserver(om, ob, manager);
manager.addObserver(observer, SampleEvent.class, new
RoleBinding("Admin"));
notified = false;
}
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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerFieldBeanLifecycleTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -22,10 +22,10 @@
@Test(groups="producerField") @SpecAssertion(section="5.6")
public void testProducerFieldBeanCreate() throws Exception
{
- SimpleBean<OtherSpiderProducer> spiderProducer =
createSimpleBean(OtherSpiderProducer.class);
+ SimpleBean<OtherSpiderProducer> spiderProducer =
createSimpleBean(OtherSpiderProducer.class, manager);
manager.addBean(spiderProducer);
Field method = OtherSpiderProducer.class.getField("produceTarantula");
- ProducerFieldBean<Tarantula> tarantulaBean =
createProducerFieldBean(Tarantula.class, method, spiderProducer);
+ ProducerFieldBean<Tarantula> tarantulaBean =
createProducerFieldBean(Tarantula.class, method, spiderProducer, manager);
Tarantula tarantula = tarantulaBean.create();
assert tarantula != null;
}
@@ -41,10 +41,10 @@
@Test(groups="producerField") @SpecAssertion(section={"3.5",
"5.6", "8.3"})
public void testProducerFieldReturnsNullIsDependent() throws Exception
{
- SimpleBean<OtherSpiderProducer> spiderProducer =
createSimpleBean(OtherSpiderProducer.class);
+ SimpleBean<OtherSpiderProducer> spiderProducer =
createSimpleBean(OtherSpiderProducer.class, manager);
manager.addBean(spiderProducer);
Field method = OtherSpiderProducer.class.getField("getNullSpider");
- ProducerFieldBean<Spider> spiderBean = createProducerFieldBean(Spider.class,
method, spiderProducer);
+ ProducerFieldBean<Spider> spiderBean = createProducerFieldBean(Spider.class,
method, spiderProducer, manager);
Spider spider = spiderBean.create();
assert spider == null;
}
@@ -52,10 +52,10 @@
@Test(groups="producerField",
expectedExceptions=IllegalProductException.class) @SpecAssertion(section={"3.5",
"5.6"})
public void testProducerFieldReturnsNullIsNotDependent() throws Exception
{
- SimpleBean<OtherBrokenSpiderProducer> spiderProducer =
createSimpleBean(OtherBrokenSpiderProducer.class);
+ SimpleBean<OtherBrokenSpiderProducer> spiderProducer =
createSimpleBean(OtherBrokenSpiderProducer.class, manager);
manager.addBean(spiderProducer);
Field method =
OtherBrokenSpiderProducer.class.getField("getRequestScopedSpider");
- createProducerFieldBean(Spider.class, method, spiderProducer).create();
+ createProducerFieldBean(Spider.class, 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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerFieldBeanModelTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -34,10 +34,10 @@
@Test(groups="producerField") @SpecAssertion(section="2.5.3")
public void testProducerFieldInheritsDeploymentTypeOfDeclaringWebBean() throws
Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class);
+ SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field =
OtherSpiderProducer.class.getField("produceTameTarantula");
- ProducerFieldBean<Tarantula> tarantulaModel =
createProducerFieldBean(Tarantula.class, field, bean);
+ ProducerFieldBean<Tarantula> tarantulaModel =
createProducerFieldBean(Tarantula.class, field, bean, manager);
tarantulaModel.getDeploymentType().equals(AnotherDeploymentType.class);
}
@@ -59,19 +59,19 @@
@Test(groups="producerField") @SpecAssertion(section="3.5")
public void testParameterizedReturnType() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class);
+ SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field =
OtherSpiderProducer.class.getField("getFunnelWeaverSpider");
- createProducerFieldBean(FunnelWeaver.class, field, bean);
+ createProducerFieldBean(FunnelWeaver.class, field, bean, manager);
}
@Test(groups="producerField", expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.5")
public void testParameterizedReturnTypeWithWildcard() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class);
+ SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field =
OtherSpiderProducer.class.getField("getAnotherFunnelWeaver");
- createProducerFieldBean(FunnelWeaver.class, field, bean);
+ createProducerFieldBean(FunnelWeaver.class, field, bean, manager);
}
@Test(groups={"stub", "producerField", "deployment"})
@SpecAssertion(section="3.5")
@@ -83,10 +83,10 @@
@Test(groups="producerField") @SpecAssertion(section={"3.5",
"2.3.1"})
public void testDefaultBindingType() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class);
+ SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field = OtherSpiderProducer.class.getField("produceTarantula");
- ProducerFieldBean<Tarantula> tarantulaModel =
createProducerFieldBean(Tarantula.class, field, bean);
+ ProducerFieldBean<Tarantula> tarantulaModel =
createProducerFieldBean(Tarantula.class, field, bean, manager);
assert tarantulaModel.getBindingTypes().size() == 1;
assert
tarantulaModel.getBindingTypes().iterator().next().annotationType().equals(Current.class);
}
@@ -94,10 +94,10 @@
@Test(groups="producerField") @SpecAssertion(section="3.5.1")
public void testApiTypeForClassReturn() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class);
+ SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field = OtherSpiderProducer.class.getField("produceTarantula");
- ProducerFieldBean<Tarantula> tarantulaModel =
createProducerFieldBean(Tarantula.class, field, bean);
+ ProducerFieldBean<Tarantula> tarantulaModel =
createProducerFieldBean(Tarantula.class, field, bean, manager);
assert tarantulaModel.getTypes().size() == 6;
assert tarantulaModel.getTypes().contains(Tarantula.class);
assert tarantulaModel.getTypes().contains(DeadlySpider.class);
@@ -110,10 +110,10 @@
@Test(groups="producerField") @SpecAssertion(section="3.5.1")
public void testApiTypeForInterfaceReturn() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class);
+ SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field = OtherSpiderProducer.class.getField("makeASpider");
- ProducerFieldBean<Animal> animalModel = createProducerFieldBean(Animal.class,
field, bean);
+ ProducerFieldBean<Animal> animalModel = createProducerFieldBean(Animal.class,
field, bean, manager);
assert animalModel.getTypes().size() == 2;
assert animalModel.getTypes().contains(Animal.class);
assert animalModel.getTypes().contains(Object.class);
@@ -122,10 +122,10 @@
@Test(groups="producerField") @SpecAssertion(section="3.5.1")
public void testApiTypeForPrimitiveReturn() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class);
+ SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field = OtherSpiderProducer.class.getField("getWolfSpiderSize");
- ProducerFieldBean<Integer> intModel = createProducerFieldBean(int.class,
field, bean);
+ ProducerFieldBean<Integer> intModel = createProducerFieldBean(int.class,
field, bean, manager);
assert intModel.getTypes().size() == 2;
assert intModel.getTypes().contains(int.class);
assert intModel.getTypes().contains(Object.class);
@@ -134,10 +134,10 @@
@Test(groups="producerField") @SpecAssertion(section={"3.5.1",
"2.2"})
public void testApiTypeForArrayTypeReturn() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class);
+ SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field = OtherSpiderProducer.class.getField("getSpiders");
- ProducerFieldBean<Spider[]> spidersModel =
createProducerFieldBean(Spider[].class, field, bean);
+ ProducerFieldBean<Spider[]> spidersModel =
createProducerFieldBean(Spider[].class, field, bean, manager);
assert spidersModel.getTypes().size() == 2;
assert spidersModel.getTypes().contains(Spider[].class);
assert spidersModel.getTypes().contains(Object.class);
@@ -146,10 +146,10 @@
@Test(groups="producerField") @SpecAssertion(section="3.5.2")
public void testBindingType() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class);
+ SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field =
OtherSpiderProducer.class.getField("produceTameTarantula");
- ProducerFieldBean<Tarantula> tarantulaModel =
createProducerFieldBean(Tarantula.class, field, bean);
+ ProducerFieldBean<Tarantula> tarantulaModel =
createProducerFieldBean(Tarantula.class, field, bean, manager);
assert tarantulaModel.getBindingTypes().size() == 1;
assert
tarantulaModel.getBindingTypes().iterator().next().annotationType().equals(Tame.class);
}
@@ -157,10 +157,10 @@
@Test(groups="producerField") @SpecAssertion(section="3.5.2")
public void testScopeType() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class);
+ SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field =
OtherSpiderProducer.class.getField("produceDaddyLongLegs");
- ProducerFieldBean<DaddyLongLegs> daddyLongLegsModel =
createProducerFieldBean(DaddyLongLegs.class, field, bean);
+ ProducerFieldBean<DaddyLongLegs> daddyLongLegsModel =
createProducerFieldBean(DaddyLongLegs.class, field, bean, manager);
assert daddyLongLegsModel.getScopeType().equals(RequestScoped.class);
// TODO Inherit scope from returned web bean?
@@ -169,30 +169,30 @@
@Test(groups="producerField") @SpecAssertion(section="3.5.2")
public void testDeploymentType() throws Exception
{
- SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class);
+ SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field = OtherSpiderProducer.class.getField("getLadybirdSpider");
- ProducerFieldBean<LadybirdSpider> ladybirdSpiderModel =
createProducerFieldBean(LadybirdSpider.class, field, bean);
+ ProducerFieldBean<LadybirdSpider> ladybirdSpiderModel =
createProducerFieldBean(LadybirdSpider.class, 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);
+ SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field = OtherSpiderProducer.class.getField("produceBlackWidow");
- ProducerFieldBean<BlackWidow> blackWidowSpiderModel =
createProducerFieldBean(BlackWidow.class, field, bean);
+ ProducerFieldBean<BlackWidow> blackWidowSpiderModel =
createProducerFieldBean(BlackWidow.class, 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);
+ SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field =
OtherSpiderProducer.class.getField("produceDaddyLongLegs");
- ProducerFieldBean<DaddyLongLegs> daddyLongLegsSpiderModel =
createProducerFieldBean(DaddyLongLegs.class, field, bean);
+ ProducerFieldBean<DaddyLongLegs> daddyLongLegsSpiderModel =
createProducerFieldBean(DaddyLongLegs.class, field, bean, manager);
assert
daddyLongLegsSpiderModel.getName().equals("produceDaddyLongLegs");
}
@@ -259,10 +259,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);
+ SimpleBean<OtherSpiderProducer> bean =
createSimpleBean(OtherSpiderProducer.class, manager);
manager.addBean(bean);
Field field = OtherSpiderProducer.class.getField("produceWolfSpider");
- ProducerFieldBean<WolfSpider> wolfSpiderModel =
createProducerFieldBean(WolfSpider.class, field, bean);
+ ProducerFieldBean<WolfSpider> wolfSpiderModel =
createProducerFieldBean(WolfSpider.class, 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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanLifecycleTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -22,10 +22,10 @@
@Test(groups="producerMethod") @SpecAssertion(section="5.6")
public void testProducerMethodBeanCreate() throws Exception
{
- SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class, manager);
manager.addBean(spiderProducer);
Method method = SpiderProducer.class.getMethod("produceTarantula");
- ProducerMethodBean<Tarantula> tarantulaBean =
createProducerMethodBean(Tarantula.class, method, spiderProducer);
+ ProducerMethodBean<Tarantula> tarantulaBean =
createProducerMethodBean(Tarantula.class, method, spiderProducer, manager);
Tarantula tarantula = tarantulaBean.create();
assert tarantula != null;
}
@@ -55,10 +55,10 @@
@Test(groups="producerMethod") @SpecAssertion(section={"3.4",
"5.6", "8.3"})
public void testProducerMethodReturnsNullIsDependent() throws Exception
{
- SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class, manager);
manager.addBean(spiderProducer);
Method method = SpiderProducer.class.getMethod("getNullSpider");
- ProducerMethodBean<Spider> spiderBean =
createProducerMethodBean(Spider.class, method, spiderProducer);
+ ProducerMethodBean<Spider> spiderBean =
createProducerMethodBean(Spider.class, method, spiderProducer, manager);
Spider spider = spiderBean.create();
assert spider == null;
}
@@ -66,10 +66,10 @@
@Test(groups="producerMethod",
expectedExceptions=IllegalProductException.class) @SpecAssertion(section={"3.4",
"5.6"})
public void testProducerMethodReturnsNullIsNotDependent() throws Exception
{
- SimpleBean<BrokenSpiderProducer> spiderProducer =
createSimpleBean(BrokenSpiderProducer.class);
+ SimpleBean<BrokenSpiderProducer> spiderProducer =
createSimpleBean(BrokenSpiderProducer.class, manager);
manager.addBean(spiderProducer);
Method method =
BrokenSpiderProducer.class.getMethod("getRequestScopedSpider");
- createProducerMethodBean(Spider.class, method, spiderProducer).create();
+ createProducerMethodBean(Spider.class, 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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanModelTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -36,20 +36,20 @@
@Test(groups="producerMethod") @SpecAssertion(section="2.5.3")
public void testProducerMethodInheritsDeploymentTypeOfDeclaringWebBean() throws
Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("produceTameTarantula");
- ProducerMethodBean<Tarantula> tarantulaModel =
createProducerMethodBean(Tarantula.class, method, bean);
+ ProducerMethodBean<Tarantula> tarantulaModel =
createProducerMethodBean(Tarantula.class, 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);
+ SimpleBean<BeanWithStaticProducerMethod> bean =
createSimpleBean(BeanWithStaticProducerMethod.class, manager);
manager.addBean(bean);
Method method =
BeanWithStaticProducerMethod.class.getMethod("getString");
- createProducerMethodBean(String.class, method, bean);
+ createProducerMethodBean(String.class, method, bean, manager);
}
@Test(groups={"stub", "producerMethod",
"enterpriseBeans", "stub"},
expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
@@ -61,37 +61,37 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.4")
public void testParameterizedReturnType() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("getFunnelWeaverSpider");
- createProducerMethodBean(FunnelWeaver.class, method, bean);
+ createProducerMethodBean(FunnelWeaver.class, method, bean, manager);
}
@Test(groups="producerMethod", expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.4")
public void testParameterizedReturnTypeWithWildcard() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method =
SpiderProducer.class.getMethod("getAnotherFunnelWeaver");
- createProducerMethodBean(FunnelWeaver.class, method, bean);
+ createProducerMethodBean(FunnelWeaver.class, method, bean, manager);
}
@Test(groups="producerMethod", expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.4")
public void testParameterizedReturnTypeWithTypeParameter() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("getFunnelWeaver");
- createProducerMethodBean(FunnelWeaver.class, method, bean);
+ createProducerMethodBean(FunnelWeaver.class, method, bean, manager);
}
@Test(groups="producerMethod") @SpecAssertion(section={"3.4",
"2.3.1"})
public void testDefaultBindingType() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("produceTarantula");
- ProducerMethodBean<Tarantula> tarantulaModel =
createProducerMethodBean(Tarantula.class, method, bean);
+ ProducerMethodBean<Tarantula> tarantulaModel =
createProducerMethodBean(Tarantula.class, method, bean, manager);
assert tarantulaModel.getBindingTypes().size() == 1;
assert
tarantulaModel.getBindingTypes().iterator().next().annotationType().equals(Current.class);
}
@@ -99,10 +99,10 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.4.1")
public void testApiTypeForClassReturn() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("produceTarantula");
- ProducerMethodBean<Tarantula> tarantulaModel =
createProducerMethodBean(Tarantula.class, method, bean);
+ ProducerMethodBean<Tarantula> tarantulaModel =
createProducerMethodBean(Tarantula.class, method, bean, manager);
assert tarantulaModel.getTypes().size() == 6;
assert tarantulaModel.getTypes().contains(Tarantula.class);
assert tarantulaModel.getTypes().contains(DeadlySpider.class);
@@ -115,10 +115,10 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.4.1")
public void testApiTypeForInterfaceReturn() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("makeASpider");
- ProducerMethodBean<Animal> animalModel =
createProducerMethodBean(Animal.class, method, bean);
+ ProducerMethodBean<Animal> animalModel =
createProducerMethodBean(Animal.class, method, bean, manager);
assert animalModel.getTypes().size() == 2;
assert animalModel.getTypes().contains(Animal.class);
assert animalModel.getTypes().contains(Object.class);
@@ -127,10 +127,10 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.4.1")
public void testApiTypeForPrimitiveReturn() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("getWolfSpiderSize");
- ProducerMethodBean<Integer> intModel = createProducerMethodBean(int.class,
method, bean);
+ ProducerMethodBean<Integer> intModel = createProducerMethodBean(int.class,
method, bean, manager);
assert intModel.getTypes().size() == 2;
assert intModel.getTypes().contains(int.class);
assert intModel.getTypes().contains(Object.class);
@@ -139,10 +139,10 @@
@Test(groups="producerMethod") @SpecAssertion(section={"3.4.1",
"2.2"})
public void testApiTypeForArrayTypeReturn() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("getSpiders");
- ProducerMethodBean<Spider[]> spidersModel =
createProducerMethodBean(Spider[].class, method, bean);
+ ProducerMethodBean<Spider[]> spidersModel =
createProducerMethodBean(Spider[].class, method, bean, manager);
assert spidersModel.getTypes().size() == 2;
assert spidersModel.getTypes().contains(Spider[].class);
assert spidersModel.getTypes().contains(Object.class);
@@ -151,10 +151,10 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
public void testBindingType() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("produceTameTarantula");
- ProducerMethodBean<Tarantula> tarantulaModel =
createProducerMethodBean(Tarantula.class, method, bean);
+ ProducerMethodBean<Tarantula> tarantulaModel =
createProducerMethodBean(Tarantula.class, method, bean, manager);
assert tarantulaModel.getBindingTypes().size() == 1;
assert
tarantulaModel.getBindingTypes().iterator().next().annotationType().equals(Tame.class);
}
@@ -162,10 +162,10 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
public void testScopeType() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("produceDaddyLongLegs");
- ProducerMethodBean<DaddyLongLegs> daddyLongLegsModel =
createProducerMethodBean(DaddyLongLegs.class, method, bean);
+ ProducerMethodBean<DaddyLongLegs> daddyLongLegsModel =
createProducerMethodBean(DaddyLongLegs.class, method, bean, manager);
assert daddyLongLegsModel.getScopeType().equals(RequestScoped.class);
// TODO Inherit scope from returned web bean?
@@ -174,58 +174,58 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
public void testDeploymentType() throws Exception
{
- SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("getLadybirdSpider");
- ProducerMethodBean<LadybirdSpider> ladybirdSpiderModel =
createProducerMethodBean(LadybirdSpider.class, method, bean);
+ ProducerMethodBean<LadybirdSpider> ladybirdSpiderModel =
createProducerMethodBean(LadybirdSpider.class, 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);
+ SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("produceBlackWidow");
- ProducerMethodBean<BlackWidow> blackWidowSpiderModel =
createProducerMethodBean(BlackWidow.class, method, bean);
+ ProducerMethodBean<BlackWidow> blackWidowSpiderModel =
createProducerMethodBean(BlackWidow.class, 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);
+ SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("produceDaddyLongLegs");
- ProducerMethodBean<DaddyLongLegs> daddyLongLegsSpiderModel =
createProducerMethodBean(DaddyLongLegs.class, method, bean);
+ ProducerMethodBean<DaddyLongLegs> daddyLongLegsSpiderModel =
createProducerMethodBean(DaddyLongLegs.class, 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);
+ SimpleBean<BrokenSpiderProducer> bean =
createSimpleBean(BrokenSpiderProducer.class, manager);
manager.addBean(bean);
Method method = BrokenSpiderProducer.class.getMethod("destroy");
- createProducerMethodBean(String.class, method, bean);
+ createProducerMethodBean(String.class, method, bean, manager);
}
@Test(groups="producerMethod", expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.4")
public void testProducerMethodWithParameterAnnotatedDisposes() throws Exception
{
- SimpleBean<BrokenSpiderProducer> bean =
createSimpleBean(BrokenSpiderProducer.class);
+ SimpleBean<BrokenSpiderProducer> bean =
createSimpleBean(BrokenSpiderProducer.class, manager);
manager.addBean(bean);
Method method = BrokenSpiderProducer.class.getMethod("dispose",
String.class);
- createProducerMethodBean(String.class, method, bean);
+ createProducerMethodBean(String.class, method, bean, manager);
}
@Test(groups="producerMethod", expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.4")
public void testProducerMethodWithParameterAnnotatedObserves() throws Exception
{
- SimpleBean<BrokenSpiderProducer> bean =
createSimpleBean(BrokenSpiderProducer.class);
+ SimpleBean<BrokenSpiderProducer> bean =
createSimpleBean(BrokenSpiderProducer.class, manager);
manager.addBean(bean);
Method method = BrokenSpiderProducer.class.getMethod("observe",
String.class);
- createProducerMethodBean(String.class, method, bean);
+ createProducerMethodBean(String.class, method, bean, manager);
}
@Test(groups={"stub", "disposalMethod"})
@SpecAssertion(section="3.3.4")
@@ -291,10 +291,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);
+ SimpleBean<SpiderProducer> bean = createSimpleBean(SpiderProducer.class,
manager);
manager.addBean(bean);
Method method = SpiderProducer.class.getMethod("produceWolfSpider");
- ProducerMethodBean<WolfSpider> wolfSpiderModel =
createProducerMethodBean(WolfSpider.class, method, bean);
+ ProducerMethodBean<WolfSpider> wolfSpiderModel =
createProducerMethodBean(WolfSpider.class, method, bean, manager);
assert wolfSpiderModel.getMergedStereotypes().getRequiredTypes().size() == 1;
assert
wolfSpiderModel.getMergedStereotypes().getRequiredTypes().contains(Animal.class);
assert wolfSpiderModel.getScopeType().equals(RequestScoped.class);
Deleted:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/RequestContextTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/RequestContextTest.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/RequestContextTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -1,79 +0,0 @@
-package org.jboss.webbeans.test;
-
-import org.testng.annotations.Test;
-
-@SpecVersion("PDR")
-public class RequestContextTest extends AbstractTest
-{
-
- @Test(groups={"stub", "servlet", "contexts"})
@SpecAssertion(section="8.5.1")
- public void testScopeActiveDuringServiceMethod()
- {
- assert false;
- }
-
- @Test(groups={"stub", "webservice", "contexts"})
@SpecAssertion(section="8.5.1")
- public void testScopeActiveDuringWebServiceInvocation()
- {
- assert false;
- }
-
- @Test(groups={"stub", "contexts", "ejb3"})
@SpecAssertion(section="8.5.1")
- public void testScopeActiveDuringRemoteInvocationOfEjbs()
- {
- assert false;
- }
-
- @Test(groups={"stub", "contexts", "ejb3"})
@SpecAssertion(section="8.5.1")
- public void testScopeActiveDuringEjbTimeoutsInEE6()
- {
- assert false;
- }
-
- @Test(groups={"stub", "contexts", "ejb3"})
@SpecAssertion(section="8.5.1")
- public void testScopeActiveDuringMessageDelivery()
- {
- assert false;
- }
-
- @Test(groups={"stub", "servlet", "contexts"})
@SpecAssertion(section="8.5.1")
- public void testScopeNotSharedAcrossRequests()
- {
- assert false;
- }
-
- @Test(groups={"stub", "webservice", "contexts"})
@SpecAssertion(section="8.5.1")
- public void testScopeNotSharedAcrossWebServiceInvocations()
- {
- assert false;
- }
-
- @Test(groups={"stub", "contexts", "ejb3"})
@SpecAssertion(section="8.5.1")
- public void testScopeNotSharedAcrossRemoteInvocationsOfEjbs()
- {
- assert false;
- }
-
- @Test(groups={"stub", "contexts", "ejb3"})
@SpecAssertion(section="8.5.1")
- public void testScopeNotSharedAcrossEjbTimeouts()
- {
- assert false;
- }
-
- @Test(groups={"stub", "contexts", "ejb3"})
@SpecAssertion(section="8.5.1")
- public void testScopeNotSharedAcrossMessageDelivery()
- {
- assert false;
- }
-
- /*
-
- @Test @SpecAssertion(section="8.5.3")
- public void test
- {
- assert false;
- }
-
- */
-
-}
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByNameTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByNameTest.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByNameTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -39,13 +39,13 @@
public void testNamedBasedResolution()
{
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class);
- Bean<Cod> codBean = createSimpleBean(Cod.class);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
- Bean<Sole> soleBean = createSimpleBean(Sole.class);
- Bean<SeaBass> seaBassBean = createSimpleBean(SeaBass.class);
- Bean<Haddock> haddockBean = createSimpleBean(Haddock.class);
- Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class);
+ 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);
manager.addBean(tunaBean);
manager.addBean(codBean);
@@ -70,8 +70,8 @@
@Test(groups="resolution") @SpecAssertion(section="5.11.1")
public void testNoWebBeansFound() throws Exception
{
- Bean<Cod> codBean = createSimpleBean(Cod.class);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
+ Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
+ Bean<Salmon> salmonBean = createSimpleBean(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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -13,7 +13,7 @@
import javax.webbeans.manager.Bean;
import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
+import org.jboss.webbeans.bindings.CurrentBinding;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
@@ -58,7 +58,7 @@
AnnotatedField<Tuna> tuna = new
AnnotatedFieldImpl<Tuna>(FishFarm.class.getDeclaredField("tuna"),
fishFarmClass);
assert tuna.getType().isAssignableFrom(Tuna.class);
assert tuna.getBindingTypes().size() == 1;
- assert tuna.getBindingTypes().contains(new CurrentAnnotationLiteral());
+ assert tuna.getBindingTypes().contains(new CurrentBinding());
assert tuna.getType().isAssignableFrom(Tuna.class);
}
@@ -66,7 +66,7 @@
public void testDefaultBindingTypeAssumed() throws Exception
{
AnnotatedField<Tuna> tunaField = new
AnnotatedFieldImpl<Tuna>(FishFarm.class.getDeclaredField("tuna"),
fishFarmClass);
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class);
+ Bean<Tuna> tunaBean = createSimpleBean(Tuna.class, manager);
manager.addBean(tunaBean);
Set<Bean<Tuna>> possibleTargets = manager.resolveByType(tunaField);
assert possibleTargets.size() == 1;
@@ -88,7 +88,7 @@
@Test(groups="resolution",
expectedExceptions=DuplicateBindingTypeException.class)
@SpecAssertion(section="5.9.2")
public void testDuplicateBindingTypesUsed()
{
- manager.resolveByType(Tuna.class, new CurrentAnnotationLiteral(), new
CurrentAnnotationLiteral());
+ manager.resolveByType(Tuna.class, new CurrentBinding(), new CurrentBinding());
}
@Test(groups="resolution",
expectedExceptions=IllegalArgumentException.class)
@SpecAssertion(section="5.9.2")
@@ -101,9 +101,9 @@
public void testOneBindingType() throws Exception
{
AnnotatedField<ScottishFish> whiteScottishFishField = new
AnnotatedFieldImpl<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"),
fishFarmClass);
- Bean<Cod> codBean = createSimpleBean(Cod.class);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
- Bean<Sole> soleBean = createSimpleBean(Sole.class);
+ Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
+ Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
+ Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
manager.addBean(codBean);
manager.addBean(salmonBean);
manager.addBean(soleBean);
@@ -118,9 +118,9 @@
{
AnnotatedField<Animal> whiteChunkyFishField = new
AnnotatedFieldImpl<Animal>(FishFarm.class.getDeclaredField("realChunkyWhiteFish"),
fishFarmClass);
- Bean<Cod> codBean = createSimpleBean(Cod.class);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
- Bean<Sole> soleBean = createSimpleBean(Sole.class);
+ Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
+ Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
+ Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
manager.addBean(codBean);
manager.addBean(salmonBean);
@@ -134,8 +134,8 @@
public void testMultipleApiTypeWithCurrent() throws Exception
{
AnnotatedField<Animal> animalField = new
AnnotatedFieldImpl<Animal>(FishFarm.class.getDeclaredField("animal"),
fishFarmClass);
- Bean<SeaBass> seaBassBean = createSimpleBean(SeaBass.class);
- Bean<Haddock> haddockBean = createSimpleBean(Haddock.class);
+ Bean<SeaBass> seaBassBean = createSimpleBean(SeaBass.class, manager);
+ Bean<Haddock> haddockBean = createSimpleBean(Haddock.class, manager);
manager.addBean(seaBassBean);
manager.addBean(haddockBean);
Set<Bean<Animal>> possibleTargets =
manager.resolveByType(animalField);
@@ -147,34 +147,34 @@
@Test(groups="resolution") @SpecAssertion(section={"5.9.2"})
public void testResolveByType() throws Exception
{
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
- Bean<SeaBass> seaBassBean = createSimpleBean(SeaBass.class);
- Bean<Haddock> haddockBean = createSimpleBean(Haddock.class);
+ 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);
manager.addBean(tunaBean);
manager.addBean(salmonBean);
manager.addBean(haddockBean);
manager.addBean(seaBassBean);
- assert manager.resolveByType(Tuna.class, new CurrentAnnotationLiteral()).size() ==
1;
- assert manager.resolveByType(Tuna.class, new
CurrentAnnotationLiteral()).contains(tunaBean);
+ assert manager.resolveByType(Tuna.class, new CurrentBinding()).size() == 1;
+ assert manager.resolveByType(Tuna.class, new CurrentBinding()).contains(tunaBean);
assert manager.resolveByType(Tuna.class).size() == 1;
assert manager.resolveByType(Tuna.class).contains(tunaBean);
- assert manager.resolveByType(Animal.class, new CurrentAnnotationLiteral()).size()
== 3;
- assert manager.resolveByType(Animal.class, new
CurrentAnnotationLiteral()).contains(salmonBean);
- assert manager.resolveByType(Animal.class, new
CurrentAnnotationLiteral()).contains(seaBassBean);
- assert manager.resolveByType(Animal.class, new
CurrentAnnotationLiteral()).contains(haddockBean);
+ assert manager.resolveByType(Animal.class, new CurrentBinding()).size() == 3;
+ assert manager.resolveByType(Animal.class, new
CurrentBinding()).contains(salmonBean);
+ assert manager.resolveByType(Animal.class, new
CurrentBinding()).contains(seaBassBean);
+ assert manager.resolveByType(Animal.class, new
CurrentBinding()).contains(haddockBean);
}
@Test(groups="injection")
@SpecAssertion(section={"2.3.5","5.9.2.2"})
public void testAllBindingTypesSpecifiedForResolutionMustAppearOnWebBean()
{
- Bean<Cod> codBean = createSimpleBean(Cod.class);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
- Bean<Sole> soleBean = createSimpleBean(Sole.class);
+ Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
+ Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
+ Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
manager.addBean(codBean);
manager.addBean(salmonBean);
@@ -207,8 +207,8 @@
{
AnnotatedField<Farmer<ScottishFish>> scottishFishFarmerField = new
AnnotatedFieldImpl<Farmer<ScottishFish>>(FishFarm.class.getDeclaredField("scottishFishFarmer"),
fishFarmClass);
- Bean<ScottishFishFarmer> scottishFishFarmerBean =
createSimpleBean(ScottishFishFarmer.class);
- Bean<AnimalFarmer> farmerBean = createSimpleBean(AnimalFarmer.class);
+ Bean<ScottishFishFarmer> scottishFishFarmerBean =
createSimpleBean(ScottishFishFarmer.class, manager);
+ Bean<AnimalFarmer> farmerBean = createSimpleBean(AnimalFarmer.class,
manager);
manager.addBean(scottishFishFarmerBean);
manager.addBean(farmerBean);
@@ -220,13 +220,13 @@
@Test(groups={"resolution", "producerMethod"})
@SpecAssertion(section="5.9.2")
public void testResolveByTypeWithArray() throws Exception
{
- SimpleBean<SpiderProducer> spiderProducerBean =
createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> spiderProducerBean =
createSimpleBean(SpiderProducer.class, manager);
manager.addBean(spiderProducerBean);
Method method = SpiderProducer.class.getMethod("getSpiders");
- Bean<Spider[]> spidersModel = createProducerMethodBean(Spider[].class,
method, spiderProducerBean);
+ Bean<Spider[]> spidersModel = createProducerMethodBean(Spider[].class,
method, spiderProducerBean, manager);
manager.addBean(spidersModel);
method = SpiderProducer.class.getMethod("getStrings");
- Bean<String[]> stringModel = createProducerMethodBean(String[].class, method,
spiderProducerBean);
+ Bean<String[]> stringModel = createProducerMethodBean(String[].class, method,
spiderProducerBean, manager);
manager.addBean(stringModel);
assert manager.resolveByType(Spider[].class).size() == 1;
@@ -236,9 +236,9 @@
public void testOnlyHighestEnabledPreecedenceWebBeansResolved() throws Exception
{
AnnotatedField<Animal> whiteFishField = new
AnnotatedFieldImpl<Animal>(FishFarm.class.getDeclaredField("whiteFish"),
fishFarmClass);
- Bean<Cod> codBean = createSimpleBean(Cod.class);
- Bean<Sole> soleBean = createSimpleBean(Sole.class);
- Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class);
+ Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
+ Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
+ Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class, manager);
manager.addBean(plaiceBean);
@@ -255,22 +255,22 @@
public void testNoWebBeansFound() throws Exception
{
AnnotatedField<ScottishFish> whiteScottishFishField = new
AnnotatedFieldImpl<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"),
fishFarmClass);
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
- Bean<Sole> soleBean = createSimpleBean(Sole.class);
- Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class);
+ Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
+ Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
+ Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class, manager);
manager.addBean(plaiceBean);
manager.addBean(salmonBean);
manager.addBean(soleBean);
- assert manager.resolveByType(Tuna.class, new CurrentAnnotationLiteral()).size() ==
0;
+ assert manager.resolveByType(Tuna.class, new CurrentBinding()).size() == 0;
}
@Test(groups="resolution") @SpecAssertion(section={"5.9.2",
"2.2"})
public void testResolveObject() throws Exception
{
- Bean<Salmon> salmonBean = createSimpleBean(Salmon.class);
- Bean<Sole> soleBean = createSimpleBean(Sole.class);
- Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class);
+ Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
+ Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
+ Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class, manager);
manager.addBean(plaiceBean);
manager.addBean(salmonBean);
manager.addBean(soleBean);
@@ -286,9 +286,9 @@
public void testResolveByTypeWithNonBindingMembers() throws Exception
{
AnnotatedField<Animal> veryExpensiveWhitefishField = new
AnnotatedFieldImpl<Animal>(FishFarm.class.getDeclaredField("veryExpensiveWhitefish"),
fishFarmClass);
- Bean<Halibut> halibutBean = createSimpleBean(Halibut.class);
- Bean<RoundWhitefish> roundWhiteFishBean =
createSimpleBean(RoundWhitefish.class);
- Bean<Sole> soleBean = createSimpleBean(Sole.class);
+ Bean<Halibut> halibutBean = createSimpleBean(Halibut.class, manager);
+ Bean<RoundWhitefish> roundWhiteFishBean =
createSimpleBean(RoundWhitefish.class, manager);
+ Bean<Sole> soleBean = createSimpleBean(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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -28,7 +28,7 @@
@Test @SpecAssertion(section="2.4")
public void testScopeTypesAreExtensible()
{
- Bean<Mullet> mullet = createSimpleBean(Mullet.class);
+ Bean<Mullet> mullet = createSimpleBean(Mullet.class, manager);
assert mullet.getScopeType().equals(AnotherScopeType.class);
}
@@ -53,14 +53,14 @@
@Test @SpecAssertion(section="2.4.3")
public void testScopeDeclaredInJava()
{
- SimpleBean<SeaBass> trout = createSimpleBean(SeaBass.class);
+ SimpleBean<SeaBass> trout = createSimpleBean(SeaBass.class, manager);
assert trout.getScopeType().equals(RequestScoped.class);
}
@Test(expectedExceptions=DefinitionException.class)
@SpecAssertion(section="2.4.3")
public void testTooManyScopesSpecifiedInJava()
{
- createSimpleBean(BeanWithTooManyScopeTypes.class);
+ createSimpleBean(BeanWithTooManyScopeTypes.class, manager);
}
@Test(expectedExceptions=DefinitionException.class, groups={"stub",
"webbeansxml"})
@@ -110,41 +110,41 @@
@Test @SpecAssertion(section="2.4.5")
public void testDefaultScope()
{
- SimpleBean<Order> order = createSimpleBean(Order.class);
+ SimpleBean<Order> order = createSimpleBean(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);
+ Bean<Minnow> minnow = createSimpleBean(Minnow.class, manager);
assert minnow.getScopeType().equals(RequestScoped.class);
}
@Test(expectedExceptions=DefinitionException.class)
@SpecAssertion(section="2.4.5")
public void testMutipleIncompatibleScopeStereotypes()
{
- createSimpleBean(Scallop.class);
+ createSimpleBean(Scallop.class, manager);
}
@Test @SpecAssertion(section="2.4.5")
public void testMutipleIncompatibleScopeStereotypesWithScopeSpecified()
{
- Bean<Pollock> pollock = createSimpleBean(Pollock.class);
+ Bean<Pollock> pollock = createSimpleBean(Pollock.class, manager);
assert pollock.getScopeType().equals(Dependent.class);
}
@Test @SpecAssertion(section="2.4.5")
public void testMutipleCompatibleScopeStereotypes()
{
- Bean<Grayling> grayling = createSimpleBean(Grayling.class);
+ Bean<Grayling> grayling = createSimpleBean(Grayling.class, manager);
assert grayling.getScopeType().equals(ApplicationScoped.class);
}
@Test @SpecAssertion(section="2.7.2")
public void testWebBeanScopeTypeOverridesStereotype()
{
- Bean<RedSnapper> bean = createSimpleBean(RedSnapper.class);
+ Bean<RedSnapper> bean = createSimpleBean(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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanLifecycleTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -21,8 +21,8 @@
@Test(groups="beanConstruction") @SpecAssertion(section="3.1.3")
public void testInjectionOfParametersIntoBeanConstructor()
{
- Bean<FishPond> goldfishPondBean = createSimpleBean(FishPond.class);
- Bean<Goldfish> goldfishBean = createSimpleBean(Goldfish.class);
+ Bean<FishPond> goldfishPondBean = createSimpleBean(FishPond.class, manager);
+ Bean<Goldfish> goldfishBean = createSimpleBean(Goldfish.class, manager);
manager.addBean(goldfishBean);
manager.addBean(goldfishPondBean);
FishPond fishPond = goldfishPondBean.create();
@@ -39,7 +39,7 @@
@Test(groups="beanLifecycle") @SpecAssertion(section="5.3")
public void testCreateReturnsInstanceOfBean()
{
- Bean<RedSnapper> bean = createSimpleBean(RedSnapper.class);
+ Bean<RedSnapper> bean = createSimpleBean(RedSnapper.class, manager);
assert bean.create() instanceof RedSnapper;
}
@@ -76,8 +76,8 @@
@Test(groups={"beanLifecycle", "lifecycleCallbacks"})
@SpecAssertion(section="5.3")
public void testPostConstructPreDestroy() throws Exception
{
- Bean<FarmOffice> farmOfficeBean = createSimpleBean(FarmOffice.class);
- Bean<Farm> farmBean = createSimpleBean(Farm.class);
+ Bean<FarmOffice> farmOfficeBean = createSimpleBean(FarmOffice.class,
manager);
+ Bean<Farm> farmBean = createSimpleBean(Farm.class, manager);
manager.addBean(farmOfficeBean);
manager.addBean(farmBean);
Farm farm = farmBean.create();
@@ -91,8 +91,8 @@
@Test(groups="injection") @SpecAssertion(section="5.3")
public void testCreateInjectsFieldsDeclaredInJava()
{
- SimpleBean<TunaFarm> tunaFarmBean = createSimpleBean(TunaFarm.class);
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class);
+ SimpleBean<TunaFarm> tunaFarmBean = createSimpleBean(TunaFarm.class,
manager);
+ Bean<Tuna> tunaBean = createSimpleBean(Tuna.class, manager);
manager.addBean(tunaBean);
TunaFarm tunaFarm = tunaFarmBean.create();
assert tunaFarm.tuna != null;
@@ -101,8 +101,8 @@
@Test(groups="injection")
public void testFieldMissingBindingAnnotationsAreNotInjected()
{
- SimpleBean<TunaFarm> tunaFarmBean = createSimpleBean(TunaFarm.class);
- Bean<Tuna> tunaBean = createSimpleBean(Tuna.class);
+ SimpleBean<TunaFarm> tunaFarmBean = createSimpleBean(TunaFarm.class,
manager);
+ Bean<Tuna> tunaBean = createSimpleBean(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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -14,7 +14,7 @@
import javax.webbeans.NonexistentConstructorException;
import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
+import org.jboss.webbeans.bindings.CurrentBinding;
import org.jboss.webbeans.introspector.AnnotatedConstructor;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.test.annotations.HeavyDuty;
@@ -51,26 +51,26 @@
@Test(expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.2")
public void testAbstractClassDeclaredInJavaIsNotAllowed()
{
- createSimpleBean(Cow.class);
+ createSimpleBean(Cow.class, manager);
}
@Test(groups="innerClass") @SpecAssertion(section="3.2")
public void testStaticInnerClassDeclaredInJavaAllowed()
{
- createSimpleBean(StaticInnerBean.class);
+ createSimpleBean(StaticInnerBean.class, manager);
}
@Test(expectedExceptions=DefinitionException.class, groups="innerClass")
@SpecAssertion(section="3.2")
public void testNonStaticInnerClassDeclaredInJavaNotAllowed()
{
- createSimpleBean(InnerBean.class);
+ createSimpleBean(InnerBean.class, manager);
}
@SuppressWarnings("unchecked")
@Test(expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.2")
public void testParameterizedClassDeclaredInJavaIsNotAllowed()
{
- createSimpleBean(ParameterizedBean.class);
+ createSimpleBean(ParameterizedBean.class, manager);
}
@Test(expectedExceptions=DefinitionException.class, groups={"stub",
"interceptors", "decorators"})
@SpecAssertion(section="3.2")
@@ -169,7 +169,7 @@
@Test @SpecAssertion(section="3.2.5.1")
public void testInitializerAnnotatedConstructor()
{
- AnnotatedConstructor<Sheep> constructor =
createSimpleBean(Sheep.class).getConstructor();
+ AnnotatedConstructor<Sheep> constructor = createSimpleBean(Sheep.class,
manager).getConstructor();
assert constructor.getDeclaringClass().getType().equals(Sheep.class);
assert constructor.getParameters().size() == 2;
@@ -181,15 +181,15 @@
assert map.containsKey(String.class);
assert map.containsKey(Double.class);
assert map.get(String.class).size() == 1;
- assert map.get(String.class).contains(new CurrentAnnotationLiteral());
+ assert map.get(String.class).contains(new CurrentBinding());
assert map.get(Double.class).size() == 1;
- assert map.get(Double.class).contains(new CurrentAnnotationLiteral());
+ assert map.get(Double.class).contains(new CurrentBinding());
}
@Test @SpecAssertion(section="3.2.5.1")
public void testImplicitConstructorUsed()
{
- AnnotatedConstructor<Order> constructor =
createSimpleBean(Order.class).getConstructor();
+ AnnotatedConstructor<Order> constructor = createSimpleBean(Order.class,
manager).getConstructor();
assert constructor.getDeclaringClass().getType().equals(Order.class);
assert constructor.getParameters().size() == 0;
}
@@ -197,7 +197,7 @@
@Test @SpecAssertion(section="3.2.5.1")
public void testEmptyConstructorUsed()
{
- AnnotatedConstructor<Donkey> constructor =
createSimpleBean(Donkey.class).getConstructor();
+ AnnotatedConstructor<Donkey> constructor = createSimpleBean(Donkey.class,
manager).getConstructor();
assert constructor.getDeclaringClass().getType().equals(Donkey.class);
assert constructor.getParameters().size() == 0;
}
@@ -205,7 +205,7 @@
@Test @SpecAssertion(section="3.2.5.1")
public void testInitializerAnnotatedConstructorUsedOverEmptyConstuctor()
{
- AnnotatedConstructor<Turkey> constructor =
createSimpleBean(Turkey.class).getConstructor();
+ AnnotatedConstructor<Turkey> constructor = createSimpleBean(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())
@@ -219,7 +219,7 @@
@Test(expectedExceptions=DefinitionException.class)
@SpecAssertion(section="3.2.5.1")
public void testTooManyInitializerAnnotatedConstructor()
{
- createSimpleBean(Goose.class);
+ createSimpleBean(Goose.class, manager);
}
@Test(expectedExceptions=DefinitionException.class, groups={"stub",
"disposalMethod"}) @SpecAssertion(section="3.2.5.1")
@@ -243,7 +243,7 @@
@Test(groups={"stub", "webbeansxml"})
@SpecAssertion(section="3.2.5.2")
public void testEmptyConstructorDeclaredInXmlUsed()
{
- AnnotatedConstructor<Donkey> constructor =
createSimpleBean(Donkey.class).getConstructor();
+ AnnotatedConstructor<Donkey> constructor = createSimpleBean(Donkey.class,
manager).getConstructor();
assert constructor.getParameters().size() == 0;
assert false;
}
@@ -263,7 +263,7 @@
@Test @SpecAssertion(section="3.2.5.3")
public void testBindingTypeAnnotatedConstructor()
{
- AnnotatedConstructor<Duck> constructor =
createSimpleBean(Duck.class).getConstructor();
+ AnnotatedConstructor<Duck> constructor = createSimpleBean(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>>();
@@ -274,7 +274,7 @@
assert map.containsKey(String.class);
assert map.containsKey(Integer.class);
assert map.get(String.class).size() == 1;
- assert map.get(String.class).contains(new CurrentAnnotationLiteral());
+ assert map.get(String.class).contains(new CurrentBinding());
assert map.get(Integer.class).size() == 1;
assert map.get(Integer.class).contains(new SynchronousAnnotationLiteral());
}
@@ -282,7 +282,7 @@
@Test(groups="specializationInherit")
@SpecAssertion(section="3.2.6")
public void testSpecializedClassInheritsBindingTypes()
{
- SimpleBean<Tractor> bean = createSimpleBean(Tractor.class);
+ SimpleBean<Tractor> bean = createSimpleBean(Tractor.class, manager);
assert bean.getBindingTypes().size()==2;
assert bean.getBindingTypes().contains( new AnnotationLiteral<Motorized>() {}
);
assert bean.getBindingTypes().contains( new AnnotationLiteral<HeavyDuty>() {}
);
@@ -291,7 +291,7 @@
@Test(groups="specializationInherit")
@SpecAssertion(section="3.2.6")
public void testSpecializedClassInheritsName()
{
- SimpleBean<Tractor> bean = createSimpleBean(Tractor.class);
+ SimpleBean<Tractor> bean = createSimpleBean(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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypesTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -144,7 +144,7 @@
@Test @SpecAssertion(section={"2.7.2", "2.7.4"})
public void testMultipleStereotypes()
{
- SimpleBean<HighlandCow> highlandCow = createSimpleBean(HighlandCow.class);
+ SimpleBean<HighlandCow> highlandCow = createSimpleBean(HighlandCow.class,
manager);
assert highlandCow.getName() == null;
assert
highlandCow.getBindingTypes().iterator().next().annotationType().equals(Tame.class);
assert highlandCow.getScopeType().equals(RequestScoped.class);
@@ -189,25 +189,25 @@
@Test(a)SpecAssertion(section={"2.7.1.4", "2.7.4"})
public void testRequiredTypeIsImplemented()
{
- createSimpleBean(HighlandCow.class);
+ createSimpleBean(HighlandCow.class, manager);
}
@Test(expectedExceptions=DefinitionException.class)
@SpecAssertion(section={"2.7.1.4", "2.7.4"})
public void testRequiredTypeIsNotImplemented()
{
- createSimpleBean(Chair.class);
+ createSimpleBean(Chair.class, manager);
}
@Test @SpecAssertion(section={"2.7.1.4", "2.7.4"})
public void testScopeIsSupported()
{
- createSimpleBean(Goldfish.class);
+ createSimpleBean(Goldfish.class, manager);
}
@Test(expectedExceptions=DefinitionException.class)
@SpecAssertion(section={"2.7.1.4", "2.7.4"})
public void testScopeIsNotSupported()
{
- createSimpleBean(Carp.class);
+ createSimpleBean(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 2008-12-13
23:42:34 UTC (rev 515)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -12,7 +12,7 @@
@Test @SpecAssertion(section="2.6.3")
public void testDefaultNamed()
{
- SimpleBean<Haddock> haddock = createSimpleBean(Haddock.class);
+ SimpleBean<Haddock> haddock = createSimpleBean(Haddock.class, manager);
assert haddock.getName() != null;
assert haddock.getName().equals("haddock");
}
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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/DependentContextTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -33,8 +33,8 @@
@SpecAssertion(section = "9.4")
public void testInstanceNotSharedBetweenInjectionPoints()
{
- Bean<FoxRun> foxRunBean = createSimpleBean(FoxRun.class);
- Bean<Fox> foxBean = createSimpleBean(Fox.class);
+ Bean<FoxRun> foxRunBean = createSimpleBean(FoxRun.class, manager);
+ Bean<Fox> foxBean = createSimpleBean(Fox.class, manager);
manager.addBean(foxBean);
FoxRun foxRun = foxRunBean.create();
assert !foxRun.fox.equals(foxRun.anotherFox);
@@ -60,10 +60,10 @@
@SpecAssertion(section = "9.4")
public void testInstanceUsedForProducerMethodNotShared() throws Exception
{
- SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class, manager);
manager.addBean(spiderProducer);
Method method = SpiderProducer.class.getMethod("produceTarantula");
- ProducerMethodBean<Tarantula> tarantulaBean =
createProducerMethodBean(Tarantula.class, method, spiderProducer);
+ ProducerMethodBean<Tarantula> tarantulaBean =
createProducerMethodBean(Tarantula.class, method, spiderProducer, manager);
Tarantula tarantula = tarantulaBean.create();
Tarantula tarantula2 = tarantulaBean.create();
assert tarantula != null;
@@ -116,7 +116,7 @@
@SpecAssertion(section = "9.4")
public void testContextGetWithCreateTrueReturnsNewInstance()
{
- Bean<Fox> foxBean = createSimpleBean(Fox.class);
+ Bean<Fox> foxBean = createSimpleBean(Fox.class, manager);
manager.addBean(foxBean);
DependentContext context = new DependentContext();
context.setActive(true);
@@ -132,7 +132,7 @@
@SpecAssertion(section = "9.4")
public void testContextGetWithCreateFalseReturnsNull()
{
- Bean<Fox> foxBean = createSimpleBean(Fox.class);
+ Bean<Fox> foxBean = createSimpleBean(Fox.class, manager);
manager.addBean(foxBean);
DependentContext context = new DependentContext();
context.setActive(true);
@@ -216,8 +216,8 @@
public void testContextIsActiveDuringBeanCreation()
{
// Slightly roundabout, but I can't see a better way to test atm
- Bean<FoxRun> foxRunBean = createSimpleBean(FoxRun.class);
- Bean<Fox> foxBean = createSimpleBean(Fox.class);
+ Bean<FoxRun> foxRunBean = createSimpleBean(FoxRun.class, manager);
+ Bean<Fox> foxBean = createSimpleBean(Fox.class, manager);
manager.addBean(foxBean);
FoxRun foxRun = foxRunBean.create();
assert foxRun.fox != null;
@@ -242,8 +242,8 @@
@SpecAssertion(section = "9.4")
public void testContextIsActiveDuringInjection()
{
- Bean<FoxRun> foxRunBean = createSimpleBean(FoxRun.class);
- Bean<Fox> foxBean = createSimpleBean(Fox.class);
+ Bean<FoxRun> foxRunBean = createSimpleBean(FoxRun.class, manager);
+ Bean<Fox> foxBean = createSimpleBean(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/NormalContextTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/NormalContextTest.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/NormalContextTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -43,13 +43,13 @@
@Test(groups="contexts") @SpecAssertion(section="8.1")
public void testGetWithCreateFalseReturnsNull() {
- Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class);
+ Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class, manager);
assert context.get(tunaBean, false) == null;
}
@Test(groups="contexts") @SpecAssertion(section="8.1")
public void testGetWithCreateTrueReturnsBean() {
- Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class);
+ Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class, manager);
assert context.get(tunaBean, true) != null;
}
@@ -62,7 +62,7 @@
@Test(groups="contexts") @SpecAssertion(section="8.1")
public void testReturnsCorrectExistingBean() {
- Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class);
+ Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class, manager);
Tuna firstTuna = context.get(tunaBean, true);
Tuna secondTuna = context.get(tunaBean, false);
assert firstTuna == secondTuna;
@@ -70,10 +70,10 @@
@Test(groups={"contexts", "producerMethod"})
@SpecAssertion(section="8.1")
public void testProducerMethodReturningNullOK() throws SecurityException,
NoSuchMethodException {
- SimpleBean<SpiderProducer> producer =
createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> producer = createSimpleBean(SpiderProducer.class,
manager);
manager.addBean(producer);
Method nullProducer = SpiderProducer.class.getMethod("produceShelob");
- ProducerMethodBean<Tarantula> shelobBean =
createProducerMethodBean(Tarantula.class, nullProducer, producer);
+ ProducerMethodBean<Tarantula> shelobBean =
createProducerMethodBean(Tarantula.class, nullProducer, producer, manager);
assert shelobBean.create() == null;
}
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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanDeclarationTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -50,7 +50,7 @@
@SpecAssertion(section = "3.3")
public void testStatelessWithDependentScopeOK()
{
- EnterpriseBean<Giraffe> giraffe =
BeanFactory.createEnterpriseBean(Giraffe.class);
+ EnterpriseBean<Giraffe> giraffe =
BeanFactory.createEnterpriseBean(Giraffe.class, manager);
}
/**
@@ -63,7 +63,7 @@
@SpecAssertion(section = "3.3")
public void testStatelessWithRequestScopeFails()
{
- EnterpriseBean<Beagle> beagle =
BeanFactory.createEnterpriseBean(Beagle.class);
+ EnterpriseBean<Beagle> beagle =
BeanFactory.createEnterpriseBean(Beagle.class, manager);
}
/**
@@ -77,7 +77,7 @@
@SpecAssertion(section = "3.3")
public void testStatelessWithConversationScopeFails()
{
- EnterpriseBean<Boxer> boxer = BeanFactory.createEnterpriseBean(Boxer.class);
+ EnterpriseBean<Boxer> boxer = BeanFactory.createEnterpriseBean(Boxer.class,
manager);
}
/**
@@ -90,7 +90,7 @@
@SpecAssertion(section = "3.3")
public void testStatelessWithSessionScopeFails()
{
- EnterpriseBean<Bullmastiff> boxer =
BeanFactory.createEnterpriseBean(Bullmastiff.class);
+ EnterpriseBean<Bullmastiff> boxer =
BeanFactory.createEnterpriseBean(Bullmastiff.class, manager);
}
/**
@@ -103,7 +103,7 @@
@SpecAssertion(section = "3.3")
public void testStatelessWithApplicationScopeFails()
{
- EnterpriseBean<Dachshund> dachshund =
BeanFactory.createEnterpriseBean(Dachshund.class);
+ EnterpriseBean<Dachshund> dachshund =
BeanFactory.createEnterpriseBean(Dachshund.class, manager);
}
/**
@@ -116,7 +116,7 @@
@SpecAssertion(section = "3.3")
public void testSingletonWithDependentScopeOK()
{
- EnterpriseBean<GreatDane> greatDane =
BeanFactory.createEnterpriseBean(GreatDane.class);
+ EnterpriseBean<GreatDane> greatDane =
BeanFactory.createEnterpriseBean(GreatDane.class, manager);
}
/**
@@ -129,7 +129,7 @@
@SpecAssertion(section = "3.3")
public void testSingletonWithRequestScopeFails()
{
- EnterpriseBean<Greyhound> greyhound =
BeanFactory.createEnterpriseBean(Greyhound.class);
+ EnterpriseBean<Greyhound> greyhound =
BeanFactory.createEnterpriseBean(Greyhound.class, manager);
}
/**
@@ -142,7 +142,7 @@
@SpecAssertion(section = "3.3")
public void testSingletonWithConversationScopeFails()
{
- EnterpriseBean<Husky> husky = BeanFactory.createEnterpriseBean(Husky.class);
+ EnterpriseBean<Husky> husky = BeanFactory.createEnterpriseBean(Husky.class,
manager);
}
/**
@@ -155,7 +155,7 @@
@SpecAssertion(section = "3.3")
public void testSingletonWithSessionScopeFails()
{
- EnterpriseBean<IrishTerrier> irishTerrier =
BeanFactory.createEnterpriseBean(IrishTerrier.class);
+ EnterpriseBean<IrishTerrier> irishTerrier =
BeanFactory.createEnterpriseBean(IrishTerrier.class, manager);
}
/**
@@ -168,7 +168,7 @@
@SpecAssertion(section = "3.3")
public void testSingletonWithApplicationScopeOK()
{
- EnterpriseBean<Laika> laika = BeanFactory.createEnterpriseBean(Laika.class);
+ EnterpriseBean<Laika> laika = BeanFactory.createEnterpriseBean(Laika.class,
manager);
}
/**
@@ -196,7 +196,7 @@
@SpecAssertion(section = "3.3")
public void testEnterpriseBeanInterceptorFails()
{
- EnterpriseBean<Pug> pug = BeanFactory.createEnterpriseBean(Pug.class);
+ EnterpriseBean<Pug> pug = BeanFactory.createEnterpriseBean(Pug.class,
manager);
}
/**
@@ -208,7 +208,7 @@
@SpecAssertion(section = "3.3")
public void testEnterpriseBeanDecoratorFails()
{
- EnterpriseBean<Pekingese> pekingese =
BeanFactory.createEnterpriseBean(Pekingese.class);
+ EnterpriseBean<Pekingese> pekingese =
BeanFactory.createEnterpriseBean(Pekingese.class, manager);
}
/**
@@ -314,7 +314,7 @@
@SpecAssertion(section = "3.3.2")
public void testObjectIsInAPITypes()
{
- EnterpriseBean<Laika> laika = BeanFactory.createEnterpriseBean(Laika.class);
+ EnterpriseBean<Laika> laika = BeanFactory.createEnterpriseBean(Laika.class,
manager);
assert laika.getTypes().contains(Object.class);
}
@@ -350,7 +350,7 @@
@SpecAssertion(section = "3.3")
public void testMessageDrivenBeansNotOK()
{
- EnterpriseBean<Leopard> Leopard =
BeanFactory.createEnterpriseBean(Leopard.class);
+ EnterpriseBean<Leopard> Leopard =
BeanFactory.createEnterpriseBean(Leopard.class, manager);
}
/**
@@ -362,7 +362,7 @@
@SpecAssertion(section = "3.3.7")
public void testDefaultName()
{
- EnterpriseBean<Pitbull> pitbull =
BeanFactory.createEnterpriseBean(Pitbull.class);
+ EnterpriseBean<Pitbull> pitbull =
BeanFactory.createEnterpriseBean(Pitbull.class, manager);
assert pitbull.getName().equals("pitbull");
}
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanRemoveMethodTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanRemoveMethodTest.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanRemoveMethodTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -47,7 +47,7 @@
@SpecAssertion(section = "3.3.5")
public void testStatelessEnterpriseBeansWithRemoveMethodsFails()
{
- EnterpriseBean<Armant> bean =
BeanFactory.createEnterpriseBean(Armant.class);
+ EnterpriseBean<Armant> bean = BeanFactory.createEnterpriseBean(Armant.class,
manager);
}
/**
@@ -59,7 +59,7 @@
public void testStatefulEnterpriseBeanRemoveMethodCalledWhenDestroyedByManager()
{
EnterpriseBeanRemoveMethodTest.visited = false;
- EnterpriseBean<Toller> bena =
BeanFactory.createEnterpriseBean(Toller.class);
+ EnterpriseBean<Toller> bena = BeanFactory.createEnterpriseBean(Toller.class,
manager);
RequestContext context = (RequestContext) manager.getContext(RequestScoped.class);
Toller instance = context.get(bena, true);
context.destroy();
@@ -88,7 +88,7 @@
@SpecAssertion(section = "3.3.5")
public void testStatefulEnterpriseBeanWithoutRemoveMethodMustBeDependentScoped()
{
- EnterpriseBean<Pumi> bean = BeanFactory.createEnterpriseBean(Pumi.class);
+ EnterpriseBean<Pumi> bean = BeanFactory.createEnterpriseBean(Pumi.class,
manager);
}
/**
@@ -102,7 +102,7 @@
@SpecAssertion(section = "3.3.5")
public void testStatefulEnterpriseBeanWithoutRemoveMethodMustBeDependentScoped2()
{
- EnterpriseBean<WelshCorgie> bean =
BeanFactory.createEnterpriseBean(WelshCorgie.class);
+ EnterpriseBean<WelshCorgie> bean =
BeanFactory.createEnterpriseBean(WelshCorgie.class, manager);
}
/**
@@ -116,7 +116,7 @@
@SpecAssertion(section = "3.3.5")
public void
testStatefulEnterpriseBeanWithoutRemoveMethodMustBeRemovedByApplicationBeforeManager()
{
- EnterpriseBean<Toller> bean =
BeanFactory.createEnterpriseBean(Toller.class);
+ EnterpriseBean<Toller> bean = BeanFactory.createEnterpriseBean(Toller.class,
manager);
Toller instance = manager.getInstance(bean);
RequestContext context = (RequestContext) manager.getContext(RequestScoped.class);
context.destroy();
@@ -164,7 +164,7 @@
@SpecAssertion(section = "3.3.5")
public void testApplicationRemoveMethodCallRemovesInstanceFromContext()
{
- EnterpriseBean<Toller> bean =
BeanFactory.createEnterpriseBean(Toller.class);
+ EnterpriseBean<Toller> bean = BeanFactory.createEnterpriseBean(Toller.class,
manager);
RequestContext context = (RequestContext) manager.getContext(RequestScoped.class);
Toller instance = context.get(bean, true);
instance.bye();
@@ -182,7 +182,7 @@
@SpecAssertion(section = { "3.3.5.1" })
public void
testEnterpriseBeanWithoutDestructorUsesNoArgsRemoveAnnotatedMethodAsWebBeansRemoveMethod()
{
- EnterpriseBean<Toller> bean =
BeanFactory.createEnterpriseBean(Toller.class);
+ EnterpriseBean<Toller> bean = BeanFactory.createEnterpriseBean(Toller.class,
manager);
assert "bye".equals(bean.getRemoveMethod().getName());
}
@@ -195,7 +195,7 @@
@SpecAssertion(section = { "3.3.5.1" })
public void
testEnterpriseBeanWithoutDestructorAndNoOrMultipleNoArgsRemoveMethodsHasNoWebBeansRemoveMethod()
{
- EnterpriseBean<Koirus> bean =
BeanFactory.createEnterpriseBean(Koirus.class);
+ EnterpriseBean<Koirus> bean = BeanFactory.createEnterpriseBean(Koirus.class,
manager);
assert bean.getRemoveMethod() == null;
}
@@ -208,7 +208,7 @@
@SpecAssertion(section = { "3.3.5.1" })
public void testMultipleDestructorAnnotatedMethodsFails()
{
- EnterpriseBean<Rottweiler> bean =
BeanFactory.createEnterpriseBean(Rottweiler.class);
+ EnterpriseBean<Rottweiler> bean =
BeanFactory.createEnterpriseBean(Rottweiler.class, manager);
}
/**
@@ -222,7 +222,7 @@
@SpecAssertion(section = { "3.3.5.1" })
public void testDestructorAnnotatedMethodNotRemoveAnnotatedFails()
{
- EnterpriseBean<RussellTerrier> bean =
BeanFactory.createEnterpriseBean(RussellTerrier.class);
+ EnterpriseBean<RussellTerrier> bean =
BeanFactory.createEnterpriseBean(RussellTerrier.class, manager);
}
/**
@@ -235,7 +235,7 @@
@SpecAssertion(section = { "3.3.5.1" })
public void testRemoveMethodIsInitializerFails()
{
- EnterpriseBean<Saluki> bean =
BeanFactory.createEnterpriseBean(Saluki.class);
+ EnterpriseBean<Saluki> bean = BeanFactory.createEnterpriseBean(Saluki.class,
manager);
}
/**
@@ -248,7 +248,7 @@
@SpecAssertion(section = { "3.3.5.1" })
public void testRemoveMethodIsProducerFails()
{
- EnterpriseBean<Spitz> bean = BeanFactory.createEnterpriseBean(Spitz.class);
+ EnterpriseBean<Spitz> bean = BeanFactory.createEnterpriseBean(Spitz.class,
manager);
}
/**
@@ -261,7 +261,7 @@
@SpecAssertion(section = { "3.3.5.1" })
public void testRemoveMethodWithDisposesParameterFails()
{
- EnterpriseBean<GoldenRetriever> bean =
BeanFactory.createEnterpriseBean(GoldenRetriever.class);
+ EnterpriseBean<GoldenRetriever> bean =
BeanFactory.createEnterpriseBean(GoldenRetriever.class, manager);
}
/**
@@ -274,7 +274,7 @@
@SpecAssertion(section = { "3.3.5.1" })
public void testRemoveMethodWithObservesParameterFails()
{
- EnterpriseBean<JackRussellTerrier> bean =
BeanFactory.createEnterpriseBean(JackRussellTerrier.class);
+ EnterpriseBean<JackRussellTerrier> bean =
BeanFactory.createEnterpriseBean(JackRussellTerrier.class, manager);
}
// TODO: where did this come from?
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 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanSpecializationTest.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -46,8 +46,8 @@
@SpecAssertion(section = "3.3.6")
public void testSpecializingBeanInheritsBindingTypes()
{
- EnterpriseBean<Hound> hound = BeanFactory.createEnterpriseBean(Hound.class);
- EnterpriseBean<HoundOfBaskerville> houndOfBaskerville =
BeanFactory.createEnterpriseBean(HoundOfBaskerville.class);
+ EnterpriseBean<Hound> hound = BeanFactory.createEnterpriseBean(Hound.class,
manager);
+ EnterpriseBean<HoundOfBaskerville> houndOfBaskerville =
BeanFactory.createEnterpriseBean(HoundOfBaskerville.class, manager);
assert compareBindingTypesOK(hound, houndOfBaskerville);
}
@@ -75,7 +75,7 @@
@SpecAssertion(section = "3.3.6")
public void testSpecializingBeanInheritsNameIfAny()
{
- EnterpriseBean<HoundOfBaskerville> houndOfBaskerville =
BeanFactory.createEnterpriseBean(HoundOfBaskerville.class);
+ EnterpriseBean<HoundOfBaskerville> houndOfBaskerville =
BeanFactory.createEnterpriseBean(HoundOfBaskerville.class, manager);
assert houndOfBaskerville.getName().equals("Pongo");
}
@@ -132,7 +132,7 @@
@SpecAssertion(section = "3.3.6")
public void
testAnnotationDefinedSpecializingEnterpriseBeanNotDirectlyExtendingAnnotationDefinedEnterpriseBeanFails()
{
- EnterpriseBean<GreaterDane> greaterDane =
BeanFactory.createEnterpriseBean(GreaterDane.class);
+ EnterpriseBean<GreaterDane> greaterDane =
BeanFactory.createEnterpriseBean(GreaterDane.class, manager);
}
@Test(expectedExceptions = DefinitionException.class, groups = { "stub",
"specialization", "enterpriseBeans" })
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -1,13 +1,14 @@
package org.jboss.webbeans.test.mock;
+import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.bootstrap.WebBeansBootstrap;
public class MockBootstrap extends WebBeansBootstrap
{
- public MockBootstrap()
+ public MockBootstrap(ManagerImpl manager)
{
- super();
+ super(manager);
}
}
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockManagerImpl.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockManagerImpl.java 2008-12-13
23:42:34 UTC (rev 515)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockManagerImpl.java 2008-12-14
13:04:04 UTC (rev 516)
@@ -62,10 +62,5 @@
{
return observedEventType;
}
-
- public void setEnabledDeploymentTypes(Class<? extends Annotation>...
enabledDeploymentTypes)
- {
- initEnabledDeploymentTypes(enabledDeploymentTypes);
- }
}
Modified: ri/trunk/webbeans-ri/testng.xml
===================================================================
--- ri/trunk/webbeans-ri/testng.xml 2008-12-13 23:42:34 UTC (rev 515)
+++ ri/trunk/webbeans-ri/testng.xml 2008-12-14 13:04:04 UTC (rev 516)
@@ -34,6 +34,7 @@
</groups>
<packages>
<package name="org.jboss.webbeans.test"></package>
+ <package
name="org.jboss.webbeans.test.contexts"></package>
<package name="org.jboss.webbeans.examples"></package>
<package
name="org.jboss.webbeans.test.ejb.lifecycle"></package>
<package
name="org.jboss.webbeans.test.ejb.model"></package>