[weld-commits] Weld SVN: r4532 - in core/trunk/tests: src/main/java/org/jboss/weld/mock and 5 other directories.
weld-commits at lists.jboss.org
weld-commits at lists.jboss.org
Sun Nov 1 18:17:22 EST 2009
Author: pete.muir at jboss.org
Date: 2009-11-01 18:17:22 -0500 (Sun, 01 Nov 2009)
New Revision: 4532
Added:
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/nonTransitiveResolution/
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/nonTransitiveResolution/Bar.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/nonTransitiveResolution/Foo.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/nonTransitiveResolution/NonTransitiveResolutionTest.java
Modified:
core/trunk/tests/src/main/java/org/jboss/weld/mock/AbstractMockDeployment.java
core/trunk/tests/src/main/java/org/jboss/weld/mock/MockDeployment.java
core/trunk/tests/src/main/java/org/jboss/weld/mock/MockEELifecycle.java
core/trunk/tests/src/main/java/org/jboss/weld/mock/MockServletLifecycle.java
core/trunk/tests/src/main/java/org/jboss/weld/mock/TestContainer.java
core/trunk/tests/src/main/java/org/jboss/weld/test/harness/AbstractStandaloneContainersImpl.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/bootstrap/InjectionServicesTest.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/extensions/NonBDAExtensionTest.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/extensions/NonBdaExtensionTest.java
core/trunk/tests/unit-tests.xml
Log:
improve test infra
Modified: core/trunk/tests/src/main/java/org/jboss/weld/mock/AbstractMockDeployment.java
===================================================================
--- core/trunk/tests/src/main/java/org/jboss/weld/mock/AbstractMockDeployment.java 2009-11-01 22:36:39 UTC (rev 4531)
+++ core/trunk/tests/src/main/java/org/jboss/weld/mock/AbstractMockDeployment.java 2009-11-01 23:17:22 UTC (rev 4532)
@@ -1,5 +1,6 @@
package org.jboss.weld.mock;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -17,7 +18,7 @@
public AbstractMockDeployment(BeanDeploymentArchive... beanDeploymentArchives)
{
this.services = new SimpleServiceRegistry();
- this.beanDeploymentArchives = Arrays.asList(beanDeploymentArchives);
+ this.beanDeploymentArchives = new ArrayList<BeanDeploymentArchive>(Arrays.asList(beanDeploymentArchives));
}
public List<BeanDeploymentArchive> getBeanDeploymentArchives()
Modified: core/trunk/tests/src/main/java/org/jboss/weld/mock/MockDeployment.java
===================================================================
--- core/trunk/tests/src/main/java/org/jboss/weld/mock/MockDeployment.java 2009-11-01 22:36:39 UTC (rev 4531)
+++ core/trunk/tests/src/main/java/org/jboss/weld/mock/MockDeployment.java 2009-11-01 23:17:22 UTC (rev 4532)
@@ -20,23 +20,18 @@
public class MockDeployment extends AbstractMockDeployment
{
-
- private final MockBeanDeploymentArchive archive;
-
- public MockDeployment()
+
+ private final BeanDeploymentArchive archive;
+
+ public MockDeployment(BeanDeploymentArchive beanDeploymentArchive)
{
- this.archive = new MockBeanDeploymentArchive();
+ this.archive = beanDeploymentArchive;
getBeanDeploymentArchives().add(archive);
}
-
+
public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass)
{
return archive;
}
-
- public MockBeanDeploymentArchive getArchive()
- {
- return archive;
- }
}
Modified: core/trunk/tests/src/main/java/org/jboss/weld/mock/MockEELifecycle.java
===================================================================
--- core/trunk/tests/src/main/java/org/jboss/weld/mock/MockEELifecycle.java 2009-11-01 22:36:39 UTC (rev 4531)
+++ core/trunk/tests/src/main/java/org/jboss/weld/mock/MockEELifecycle.java 2009-11-01 23:17:22 UTC (rev 4532)
@@ -38,11 +38,12 @@
getDeployment().getServices().add(SecurityServices.class, new MockSecurityServices());
getDeployment().getServices().add(ValidationServices.class, new MockValidationServices());
getDeployment().getServices().add(EjbServices.class, new MockEjBServices());
- getDeployment().getArchive().getServices().add(EjbInjectionServices.class, new MockEjbInjectionServices());
- getDeployment().getArchive().getServices().add(JpaInjectionServices.class, new MockJpaServices(getDeployment()));
- getDeployment().getArchive().getServices().add(ResourceInjectionServices.class, new MockResourceServices());
+ getWar().getServices().add(EjbInjectionServices.class, new MockEjbInjectionServices());
+ getWar().getServices().add(JpaInjectionServices.class, new MockJpaServices(getDeployment()));
+ getWar().getServices().add(ResourceInjectionServices.class, new MockResourceServices());
}
+ @Override
public Environment getEnvironment()
{
return Environments.EE_INJECT;
Modified: core/trunk/tests/src/main/java/org/jboss/weld/mock/MockServletLifecycle.java
===================================================================
--- core/trunk/tests/src/main/java/org/jboss/weld/mock/MockServletLifecycle.java 2009-11-01 22:36:39 UTC (rev 4531)
+++ core/trunk/tests/src/main/java/org/jboss/weld/mock/MockServletLifecycle.java 2009-11-01 23:17:22 UTC (rev 4532)
@@ -5,6 +5,7 @@
import org.jboss.weld.bootstrap.api.Environments;
import org.jboss.weld.bootstrap.api.Lifecycle;
import org.jboss.weld.bootstrap.api.helpers.ForwardingLifecycle;
+import org.jboss.weld.bootstrap.spi.Deployment;
import org.jboss.weld.context.ContextLifecycle;
import org.jboss.weld.context.api.BeanStore;
import org.jboss.weld.context.api.helpers.ConcurrentHashMapBeanStore;
@@ -16,7 +17,8 @@
private static final ResourceLoader MOCK_RESOURCE_LOADER = new MockResourceLoader();
private final WeldBootstrap bootstrap;
- private final MockDeployment deployment;
+ private final Deployment deployment;
+ private final MockBeanDeploymentArchive war;
private final BeanStore applicationBeanStore;
private final BeanStore sessionBeanStore;
private final BeanStore requestBeanStore;
@@ -25,14 +27,25 @@
public MockServletLifecycle()
{
- this.deployment = new MockDeployment();
+ this(new MockBeanDeploymentArchive());
+ }
+
+ private MockServletLifecycle(MockBeanDeploymentArchive war)
+ {
+ this(new MockDeployment(war), war);
+ }
+
+ public MockServletLifecycle(Deployment deployment, MockBeanDeploymentArchive war)
+ {
+ this.deployment = deployment;
+ this.war = war;
if (deployment == null)
{
throw new IllegalStateException("No WebBeanDiscovery is available");
}
this.bootstrap = new WeldBootstrap();
this.deployment.getServices().add(ResourceLoader.class, MOCK_RESOURCE_LOADER);
- this.deployment.getServices().add(ServletServices.class, new MockServletServices(deployment.getArchive()));
+ this.deployment.getServices().add(ServletServices.class, new MockServletServices(war));
this.applicationBeanStore = new ConcurrentHashMapBeanStore();
this.sessionBeanStore = new ConcurrentHashMapBeanStore();
this.requestBeanStore = new ConcurrentHashMapBeanStore();
@@ -74,7 +87,7 @@
return lifecycle;
}
- protected MockDeployment getDeployment()
+ protected Deployment getDeployment()
{
return deployment;
}
@@ -146,4 +159,9 @@
{
return Environments.SERVLET;
}
+
+ public MockBeanDeploymentArchive getWar()
+ {
+ return war;
+ }
}
Modified: core/trunk/tests/src/main/java/org/jboss/weld/mock/TestContainer.java
===================================================================
--- core/trunk/tests/src/main/java/org/jboss/weld/mock/TestContainer.java 2009-11-01 22:36:39 UTC (rev 4531)
+++ core/trunk/tests/src/main/java/org/jboss/weld/mock/TestContainer.java 2009-11-01 23:17:22 UTC (rev 4532)
@@ -5,6 +5,7 @@
import java.util.Collection;
import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bootstrap.spi.Deployment;
/**
* Control of the container, used for tests. Wraps up common operations.
@@ -28,31 +29,7 @@
public class TestContainer
{
- public static class Status
- {
-
- private final Exception deploymentException;
-
- public Status(Exception deploymentException)
- {
- this.deploymentException = deploymentException;
- }
-
- public Exception getDeploymentException()
- {
- return deploymentException;
- }
-
- public boolean isSuccess()
- {
- return deploymentException == null;
- }
-
- }
-
private final MockServletLifecycle lifecycle;
- private final Collection<Class<?>> classes;
- private final Collection<URL> beansXml;
/**
* Create a container, specifying the classes and beans.xml to deploy
@@ -63,10 +40,13 @@
*/
public TestContainer(MockServletLifecycle lifecycle, Collection<Class<?>> classes, Collection<URL> beansXml)
{
+ this(lifecycle);
+ configureArchive(classes, beansXml);
+ }
+
+ public TestContainer(MockServletLifecycle lifecycle)
+ {
this.lifecycle = lifecycle;
- this.classes = classes;
- this.beansXml = beansXml;
- configureArchive();
}
public TestContainer(MockServletLifecycle lifecycle, Class<?>[] classes, URL[] beansXml)
@@ -80,43 +60,27 @@
}
/**
- * Start the container, returning the container state
- *
- * @return
- */
- public Status startContainerAndReturnStatus()
- {
- try
- {
- startContainer();
- }
- catch (Exception e)
- {
- return new Status(e);
- }
- return new Status(null);
- }
-
- /**
* Starts the container and begins the application
*/
- public void startContainer()
+ public TestContainer startContainer()
{
getLifecycle().initialize();
getLifecycle().beginApplication();
+ return this;
}
/**
* Configure's the archive with the classes and beans.xml
*/
- protected void configureArchive()
+ protected TestContainer configureArchive(Collection<Class<?>> classes, Collection<URL> beansXml)
{
- MockBeanDeploymentArchive archive = lifecycle.getDeployment().getArchive();
+ MockBeanDeploymentArchive archive = lifecycle.getWar();
archive.setBeanClasses(classes);
if (beansXml != null)
{
archive.setBeansXmlFiles(beansXml);
}
+ return this;
}
/**
@@ -131,10 +95,10 @@
public BeanManagerImpl getBeanManager()
{
- return getLifecycle().getBootstrap().getManager(getDeployment().getArchive());
+ return getLifecycle().getBootstrap().getManager(getLifecycle().getWar());
}
- public MockDeployment getDeployment()
+ public Deployment getDeployment()
{
return getLifecycle().getDeployment();
}
@@ -143,7 +107,7 @@
* Utility method which ensures a request is active and available for use
*
*/
- public void ensureRequestActive()
+ public TestContainer ensureRequestActive()
{
if (!getLifecycle().isSessionActive())
{
@@ -153,13 +117,14 @@
{
getLifecycle().beginRequest();
}
+ return this;
}
/**
* Clean up the container, ending any active contexts
*
*/
- public void stopContainer()
+ public TestContainer stopContainer()
{
if (getLifecycle().isRequestActive())
{
@@ -173,6 +138,7 @@
{
getLifecycle().endApplication();
}
+ return this;
}
}
\ No newline at end of file
Modified: core/trunk/tests/src/main/java/org/jboss/weld/test/harness/AbstractStandaloneContainersImpl.java
===================================================================
--- core/trunk/tests/src/main/java/org/jboss/weld/test/harness/AbstractStandaloneContainersImpl.java 2009-11-01 22:36:39 UTC (rev 4531)
+++ core/trunk/tests/src/main/java/org/jboss/weld/test/harness/AbstractStandaloneContainersImpl.java 2009-11-01 23:17:22 UTC (rev 4532)
@@ -7,7 +7,6 @@
import org.jboss.testharness.spi.StandaloneContainers;
import org.jboss.weld.mock.MockServletLifecycle;
import org.jboss.weld.mock.TestContainer;
-import org.jboss.weld.mock.TestContainer.Status;
public abstract class AbstractStandaloneContainersImpl implements StandaloneContainers
{
@@ -20,18 +19,18 @@
{
this.testContainer = new TestContainer(newLifecycle(), classes, beansXml);
- Status status = testContainer.startContainerAndReturnStatus();
- if (!status.isSuccess())
+ try
{
- this.deploymentException = new DeploymentException("Error deploying beans", status.getDeploymentException());
- return false;
+ testContainer.startContainer();
}
- else
+ catch (Exception e)
{
- testContainer.getLifecycle().beginSession();
- testContainer.getLifecycle().beginRequest();
- return true;
+ this.deploymentException = new DeploymentException("Error deploying beans", e);
+ return false;
}
+ testContainer.getLifecycle().beginSession();
+ testContainer.getLifecycle().beginRequest();
+ return true;
}
protected abstract MockServletLifecycle newLifecycle();
Modified: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/bootstrap/InjectionServicesTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/bootstrap/InjectionServicesTest.java 2009-11-01 22:36:39 UTC (rev 4531)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/bootstrap/InjectionServicesTest.java 2009-11-01 23:17:22 UTC (rev 4532)
@@ -18,7 +18,7 @@
{
TestContainer container = new TestContainer(new MockEELifecycle(), Arrays.asList(Foo.class, Bar.class), null);
CheckableInjectionServices ijs = new CheckableInjectionServices();
- container.getDeployment().getArchive().getServices().add(InjectionServices.class, ijs);
+ container.getLifecycle().getWar().getServices().add(InjectionServices.class, ijs);
container.startContainer();
container.ensureRequestActive();
Modified: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/extensions/NonBDAExtensionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/extensions/NonBDAExtensionTest.java 2009-11-01 22:36:39 UTC (rev 4531)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/extensions/NonBDAExtensionTest.java 2009-11-01 23:17:22 UTC (rev 4532)
@@ -3,13 +3,12 @@
import javax.enterprise.inject.spi.Extension;
import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.bootstrap.WeldBootstrap;
-import org.jboss.weld.bootstrap.api.Environments;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.weld.bootstrap.spi.Deployment;
-import org.jboss.weld.context.beanstore.HashMapBeanStore;
import org.jboss.weld.mock.AbstractMockDeployment;
import org.jboss.weld.mock.MockBeanDeploymentArchive;
+import org.jboss.weld.mock.MockServletLifecycle;
+import org.jboss.weld.mock.TestContainer;
import org.jboss.weld.util.serviceProvider.PackageServiceLoaderFactory;
import org.jboss.weld.util.serviceProvider.ServiceLoaderFactory;
import org.testng.annotations.Test;
@@ -20,10 +19,8 @@
@Test(description="WELD-233")
public void test()
{
- WeldBootstrap bootstrap = new WeldBootstrap();
-
// Create the BDA in which we will deploy Observer1 and Foo. This is equivalent to a war or ejb jar
- final BeanDeploymentArchive bda1 = new MockBeanDeploymentArchive("1", Observer1.class, Foo.class);
+ final MockBeanDeploymentArchive bda1 = new MockBeanDeploymentArchive("1", Observer1.class, Foo.class);
// Create the BDA to return from loadBeanDeploymentArchive for Observer2, this is probably a library, though could be another war or ejb jar
// bda2 is accessible from bda1, but isn't added to it's accessibility graph by default. This similar to an archive which doesn't contain a beans.xml but does contain an extension
@@ -50,20 +47,19 @@
};
+ TestContainer container = new TestContainer(new MockServletLifecycle(deployment, bda1));
+ container.getLifecycle().initialize();
- // Initialize the container, we use the SE env as we aren't going to interact with the servlet lifecycle really
- bootstrap.startContainer(Environments.SE, deployment, new HashMapBeanStore());
-
// Add custom ServiceLoader so that we can load Extension services from current package, not META-INF/services
// We do this after startContainer() so we replace the default impl
deployment.getServices().add(ServiceLoaderFactory.class, new PackageServiceLoaderFactory(NonBDAExtensionTest.class.getPackage(), Extension.class));
// Cause the container to deploy the beans etc.
- bootstrap.startInitialization().deployBeans().validateBeans().endInitialization();
+ container.getLifecycle().beginApplication();
// Get the bean manager for bda1 and bda2
- BeanManagerImpl beanManager1 = bootstrap.getManager(bda1);
- BeanManagerImpl beanManager2 = bootstrap.getManager(bda2);
+ BeanManagerImpl beanManager1 = container.getBeanManager();
+ BeanManagerImpl beanManager2 = container.getLifecycle().getBootstrap().getManager(bda2);
Observer1 observer1 = beanManager1.getInstanceByType(Observer1.class);
assert observer1.isBeforeBeanDiscoveryCalled();
Modified: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/extensions/NonBdaExtensionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/extensions/NonBdaExtensionTest.java 2009-11-01 22:36:39 UTC (rev 4531)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/extensions/NonBdaExtensionTest.java 2009-11-01 23:17:22 UTC (rev 4532)
@@ -3,13 +3,12 @@
import javax.enterprise.inject.spi.Extension;
import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.bootstrap.WeldBootstrap;
-import org.jboss.weld.bootstrap.api.Environments;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.weld.bootstrap.spi.Deployment;
-import org.jboss.weld.context.beanstore.HashMapBeanStore;
import org.jboss.weld.mock.AbstractMockDeployment;
import org.jboss.weld.mock.MockBeanDeploymentArchive;
+import org.jboss.weld.mock.MockServletLifecycle;
+import org.jboss.weld.mock.TestContainer;
import org.jboss.weld.util.serviceProvider.PackageServiceLoaderFactory;
import org.jboss.weld.util.serviceProvider.ServiceLoaderFactory;
import org.testng.annotations.Test;
@@ -20,10 +19,8 @@
@Test(description="WELD-233")
public void test()
{
- WeldBootstrap bootstrap = new WeldBootstrap();
-
// Create the BDA in which we will deploy Observer1 and Foo. This is equivalent to a war or ejb jar
- final BeanDeploymentArchive bda1 = new MockBeanDeploymentArchive("1", Observer1.class, Foo.class);
+ final MockBeanDeploymentArchive bda1 = new MockBeanDeploymentArchive("1", Observer1.class, Foo.class);
// Create the BDA to return from loadBeanDeploymentArchive for Observer2, this is probably a library, though could be another war or ejb jar
// bda2 is accessible from bda1, but isn't added to it's accessibility graph by default. This similar to an archive which doesn't contain a beans.xml but does contain an extension
@@ -50,20 +47,19 @@
};
+ TestContainer container = new TestContainer(new MockServletLifecycle(deployment, bda1));
+ container.getLifecycle().initialize();
- // Initialize the container, we use the SE env as we aren't going to interact with the servlet lifecycle really
- bootstrap.startContainer(Environments.SE, deployment, new HashMapBeanStore());
-
// Add custom ServiceLoader so that we can load Extension services from current package, not META-INF/services
// We do this after startContainer() so we replace the default impl
deployment.getServices().add(ServiceLoaderFactory.class, new PackageServiceLoaderFactory(NonBDAExtensionTest.class.getPackage(), Extension.class));
// Cause the container to deploy the beans etc.
- bootstrap.startInitialization().deployBeans().validateBeans().endInitialization();
+ container.getLifecycle().beginApplication();
// Get the bean manager for bda1 and bda2
- BeanManagerImpl beanManager1 = bootstrap.getManager(bda1);
- BeanManagerImpl beanManager2 = bootstrap.getManager(bda2);
+ BeanManagerImpl beanManager1 = container.getBeanManager();
+ BeanManagerImpl beanManager2 = container.getLifecycle().getBootstrap().getManager(bda2);
Observer1 observer1 = beanManager1.getInstanceByType(Observer1.class);
assert observer1.isBeforeBeanDiscoveryCalled();
Added: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/nonTransitiveResolution/Bar.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/nonTransitiveResolution/Bar.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/nonTransitiveResolution/Bar.java 2009-11-01 23:17:22 UTC (rev 4532)
@@ -0,0 +1,15 @@
+package org.jboss.weld.test.unit.deployment.structure.nonTransitiveResolution;
+
+import javax.inject.Inject;
+
+public class Bar
+{
+
+ @Inject Foo foo;
+
+ public Foo getFoo()
+ {
+ return foo;
+ }
+
+}
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/nonTransitiveResolution/Bar.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/nonTransitiveResolution/Foo.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/nonTransitiveResolution/Foo.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/nonTransitiveResolution/Foo.java 2009-11-01 23:17:22 UTC (rev 4532)
@@ -0,0 +1,6 @@
+package org.jboss.weld.test.unit.deployment.structure.nonTransitiveResolution;
+
+public class Foo
+{
+
+}
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/nonTransitiveResolution/Foo.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/nonTransitiveResolution/NonTransitiveResolutionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/nonTransitiveResolution/NonTransitiveResolutionTest.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/nonTransitiveResolution/NonTransitiveResolutionTest.java 2009-11-01 23:17:22 UTC (rev 4532)
@@ -0,0 +1,48 @@
+package org.jboss.weld.test.unit.deployment.structure.nonTransitiveResolution;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.mock.AbstractMockDeployment;
+import org.jboss.weld.mock.MockBeanDeploymentArchive;
+import org.jboss.weld.mock.MockServletLifecycle;
+import org.jboss.weld.mock.TestContainer;
+import org.testng.annotations.Test;
+
+public class NonTransitiveResolutionTest
+{
+
+ @Test(description="WELD-236")
+ public void test()
+ {
+
+ // Create the BDA in which we will deploy Foo. This is equivalent to a ejb jar
+ final MockBeanDeploymentArchive ejbJar = new MockBeanDeploymentArchive("ejb-jar", Foo.class);
+
+ // Create the BDA in which we will deploy Bar. This is equivalent to a war
+ MockBeanDeploymentArchive war = new MockBeanDeploymentArchive("war", Bar.class);
+
+ // The war can access the ejb jar
+ war.getBeanDeploymentArchives().add(ejbJar);
+
+ // Create a deployment, any other classes are put into the ejb-jar (not relevant to test)
+ Deployment deployment = new AbstractMockDeployment(war, ejbJar)
+ {
+
+ public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass)
+ {
+ return ejbJar;
+ }
+
+ };
+
+
+ TestContainer container = new TestContainer(new MockServletLifecycle(deployment, war));
+ container.startContainer();
+ container.ensureRequestActive();
+
+ // Get the bean manager for bda1 and bda2
+ BeanManagerImpl beanManager1 = container.getBeanManager();
+ }
+
+}
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/deployment/structure/nonTransitiveResolution/NonTransitiveResolutionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: core/trunk/tests/unit-tests.xml
===================================================================
--- core/trunk/tests/unit-tests.xml 2009-11-01 22:36:39 UTC (rev 4531)
+++ core/trunk/tests/unit-tests.xml 2009-11-01 23:17:22 UTC (rev 4532)
@@ -36,6 +36,7 @@
<package name="org.jboss.weld.test.unit.context" />
<package name="org.jboss.weld.test.unit.decorator.simple" />
<package name="org.jboss.weld.test.unit.definition" />
+ <package name="org.jboss.weld.test.unit.deployment.structure.extensions" />
<package name="org.jboss.weld.test.unit.deployment.structure.resolution" />
<package name="org.jboss.weld.test.unit.environments.servlet" />
<package name="org.jboss.weld.test.unit.extensions" />
More information about the weld-commits
mailing list