[webbeans-commits] Webbeans SVN: r316 - in ri/trunk/webbeans-ri/src: test/java/org/jboss/webbeans/test and 1 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Mon Nov 17 22:00:52 EST 2008
Author: pete.muir at jboss.org
Date: 2008-11-17 22:00:52 -0500 (Mon, 17 Nov 2008)
New Revision: 316
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.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/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/EventBeanModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventTest.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/mock/MockManagerImpl.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockWebBeanDiscovery.java
Log:
Fix broken build, and consistent use of arrays in ManagerImpl
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-11-17 11:43:53 UTC (rev 315)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-11-18 03:00:52 UTC (rev 316)
@@ -41,7 +41,6 @@
import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
-import org.jboss.webbeans.servlet.ServletLifecycle;
import org.jboss.webbeans.util.Reflections;
import com.google.common.collect.ForwardingMap;
@@ -90,8 +89,6 @@
public ManagerImpl()
{
- initEnabledDeploymentTypes(null);
- initContexts(null);
this.modelManager = new ModelManager();
this.beans = new CopyOnWriteArrayList<Bean<?>>();
this.eventBus = new EventBus();
@@ -99,10 +96,17 @@
this.proxyPool = new ProxyPool(this);
this.decorators = new HashSet<Decorator>();
this.interceptors = new HashSet<Interceptor>();
+ initEnabledDeploymentTypes(null);
+ initContexts();
+ addStandardBeans();
+ }
+
+ protected void addStandardBeans()
+ {
addBean( new SimpleBean<DefaultEnterpriseBeanLookup>( DefaultEnterpriseBeanLookup.class, this ) );
}
- protected void initEnabledDeploymentTypes(List<Class<? extends Annotation>> enabledDeploymentTypes)
+ protected void initEnabledDeploymentTypes(Class<? extends Annotation> ... enabledDeploymentTypes)
{
this.enabledDeploymentTypes = new ArrayList<Class<? extends Annotation>>();
if (enabledDeploymentTypes == null)
@@ -112,7 +116,10 @@
}
else
{
- this.enabledDeploymentTypes.addAll(enabledDeploymentTypes);
+ 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");
@@ -123,7 +130,7 @@
protected void initContexts(Context... contexts)
{
this.contextMap = new ContextMap();
- if (contexts == null)
+ if (contexts.length == 0)
{
addContext(new DependentContext());
addContext(new RequestContext());
@@ -220,6 +227,7 @@
public Manager setBeans(Set<AbstractBean<?, ?>> beans) {
this.beans = new CopyOnWriteArrayList<Bean<?>>(beans);
getResolutionManager().clear();
+ addStandardBeans();
return this;
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java 2008-11-17 11:43:53 UTC (rev 315)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java 2008-11-18 03:00:52 UTC (rev 316)
@@ -1,9 +1,5 @@
package org.jboss.webbeans.test;
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.List;
-
import javax.webbeans.Decorator;
import javax.webbeans.Interceptor;
import javax.webbeans.Production;
@@ -46,12 +42,7 @@
protected void addEnabledDeploymentTypes()
{
- List<Class<? extends Annotation>> enabledDeploymentTypes = new ArrayList<Class<? extends Annotation>>();
- enabledDeploymentTypes.add(Standard.class);
- enabledDeploymentTypes.add(Production.class);
- enabledDeploymentTypes.add(AnotherDeploymentType.class);
- enabledDeploymentTypes.add(HornedAnimalDeploymentType.class);
- manager.setEnabledDeploymentTypes(enabledDeploymentTypes);
+ manager.setEnabledDeploymentTypes(Standard.class, Production.class, AnotherDeploymentType.class, HornedAnimalDeploymentType.class);
}
protected void addStereotypes()
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java 2008-11-17 11:43:53 UTC (rev 315)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java 2008-11-18 03:00:52 UTC (rev 316)
@@ -2,10 +2,6 @@
import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.List;
-
import javax.webbeans.Observes;
import javax.webbeans.Standard;
@@ -36,10 +32,7 @@
@Override
protected void addEnabledDeploymentTypes()
{
- List<Class<? extends Annotation>> enabledDeploymentTypes = new ArrayList<Class<? extends Annotation>>();
- enabledDeploymentTypes.add(Standard.class);
- enabledDeploymentTypes.add(AnotherDeploymentType.class);
- manager.setEnabledDeploymentTypes(enabledDeploymentTypes);
+ manager.setEnabledDeploymentTypes(Standard.class, AnotherDeploymentType.class);
}
public class 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-11-17 11:43:53 UTC (rev 315)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java 2008-11-18 03:00:52 UTC (rev 316)
@@ -2,10 +2,6 @@
import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.List;
-
import javax.webbeans.DefinitionException;
import javax.webbeans.DeploymentException;
import javax.webbeans.Production;
@@ -109,11 +105,7 @@
@Test(groups="beanLifecycle", expectedExceptions=UnsatisfiedDependencyException.class) @SpecAssertion(section="2.5.6")
public void testBeanWithDisabledDeploymentTypeNotInstantiated()
{
- List<Class<? extends Annotation>> enabledDeploymentTypes = new ArrayList<Class<? extends Annotation>>();
- enabledDeploymentTypes.add(Standard.class);
- enabledDeploymentTypes.add(AnotherDeploymentType.class);
- enabledDeploymentTypes.add(HornedAnimalDeploymentType.class);
- manager.setEnabledDeploymentTypes(enabledDeploymentTypes);
+ manager.setEnabledDeploymentTypes(Standard.class, AnotherDeploymentType.class, HornedAnimalDeploymentType.class);
Bean<RedSnapper> bean = createSimpleBean(RedSnapper.class, manager);
manager.addBean(bean);
@@ -132,11 +124,7 @@
@Test @SpecAssertion(section={"2.5.6", "2.5.7"})
public void testCustomDeploymentTypes()
{
- List<Class<? extends Annotation>> enabledDeploymentTypes = new ArrayList<Class<? extends Annotation>>();
- enabledDeploymentTypes.add(Standard.class);
- enabledDeploymentTypes.add(AnotherDeploymentType.class);
- enabledDeploymentTypes.add(HornedAnimalDeploymentType.class);
- manager.setEnabledDeploymentTypes(enabledDeploymentTypes);
+ manager.setEnabledDeploymentTypes(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);
@@ -146,10 +134,7 @@
@Test(expectedExceptions=DeploymentException.class) @SpecAssertion(section="2.5.6")
public void testStandardMustBeDeclared()
{
- List<Class<? extends Annotation>> enabledDeploymentTypes = new ArrayList<Class<? extends Annotation>>();
- enabledDeploymentTypes.add(AnotherDeploymentType.class);
- enabledDeploymentTypes.add(HornedAnimalDeploymentType.class);
- manager.setEnabledDeploymentTypes(enabledDeploymentTypes);
+ manager.setEnabledDeploymentTypes(AnotherDeploymentType.class, HornedAnimalDeploymentType.class);
}
@Test(groups={"stub", "webbeansxml"}, expectedExceptions=DeploymentException.class) @SpecAssertion(section="2.5.6")
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventBeanModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventBeanModelTest.java 2008-11-17 11:43:53 UTC (rev 315)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventBeanModelTest.java 2008-11-18 03:00:52 UTC (rev 316)
@@ -1,9 +1,6 @@
package org.jboss.webbeans.test;
-import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.List;
import javax.webbeans.Standard;
@@ -30,11 +27,8 @@
@BeforeMethod
public void before() throws Exception
{
- List<Class<? extends Annotation>> enabledDeploymentTypes = new ArrayList<Class<? extends Annotation>>();
- enabledDeploymentTypes.add(Standard.class);
- enabledDeploymentTypes.add(AnotherDeploymentType.class);
manager = new MockManagerImpl();
- manager.setEnabledDeploymentTypes(enabledDeploymentTypes);
+ manager.setEnabledDeploymentTypes(Standard.class, AnotherDeploymentType.class);
Field eventModelField = this.getClass().getDeclaredField("eventModelField");
/*eventBeanModel = new EventBeanModel<EventImpl<DangerCall>>(
new SimpleAnnotatedField<EventImpl<DangerCall>>(eventModelField),
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventTest.java 2008-11-17 11:43:53 UTC (rev 315)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventTest.java 2008-11-18 03:00:52 UTC (rev 316)
@@ -55,7 +55,7 @@
enabledDeploymentTypes.add(Standard.class);
enabledDeploymentTypes.add(AnotherDeploymentType.class);
manager = new MockManagerImpl();
- manager.setEnabledDeploymentTypes(enabledDeploymentTypes);
+ manager.setEnabledDeploymentTypes(Standard.class, AnotherDeploymentType.class);
}
/**
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java 2008-11-17 11:43:53 UTC (rev 315)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java 2008-11-18 03:00:52 UTC (rev 316)
@@ -55,7 +55,7 @@
enabledDeploymentTypes.add(Standard.class);
enabledDeploymentTypes.add(AnotherDeploymentType.class);
manager = new MockManagerImpl();
- manager.setEnabledDeploymentTypes(enabledDeploymentTypes);
+ manager.setEnabledDeploymentTypes(Standard.class, AnotherDeploymentType.class);
// Create an observer with known binding types
// TODO This should be a real class being mapped
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-11-17 11:43:53 UTC (rev 315)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockManagerImpl.java 2008-11-18 03:00:52 UTC (rev 316)
@@ -3,7 +3,6 @@
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import javax.webbeans.Observer;
@@ -94,7 +93,7 @@
return observer;
}
- public void setEnabledDeploymentTypes(List<Class<? extends Annotation>> enabledDeploymentTypes)
+ public void setEnabledDeploymentTypes(Class<? extends Annotation>... enabledDeploymentTypes)
{
initEnabledDeploymentTypes(enabledDeploymentTypes);
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockWebBeanDiscovery.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockWebBeanDiscovery.java 2008-11-17 11:43:53 UTC (rev 315)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockWebBeanDiscovery.java 2008-11-18 03:00:52 UTC (rev 316)
@@ -1,18 +1,37 @@
package org.jboss.webbeans.test.mock;
+import java.net.URL;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
+import org.jboss.webbeans.bootstrap.spi.EjbDescriptor;
import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
public class MockWebBeanDiscovery implements WebBeanDiscovery
{
public static Set<Class<?>> webBeanClasses = new HashSet<Class<?>>();
+
+ public static Set<URL> webBeansXmlFiles = new HashSet<URL>();
- public Set<Class<?>> discoverWebBeanClasses()
+ public static Map<Class<?>, EjbDescriptor<?>> ejbs = new HashMap<Class<?>, EjbDescriptor<?>>();
+
+ public Iterable<Class<?>> discoverWebBeanClasses()
{
return webBeanClasses;
}
+
+ public Map<Class<?>, EjbDescriptor<?>> discoverEjbs()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Iterable<URL> discoverWebBeansXml()
+ {
+ return webBeansXmlFiles;
+ }
}
More information about the weld-commits
mailing list