public boolean deploy(Collection<Class<?>> classes, Collection<URL> beansXml) { this.testContainer = new TestContainer(beansXml, classes); try { testContainer.startContainer(); } catch (Exception e) { this.deploymentException = new DeploymentException("Error deploying beans", e); return false; } testContainer.ensureRequestActive(); return true; }
public boolean deploy(Collection<Class<?>> classes, Collection<URL> beansXml) { this.testContainer = new TestContainer(beansXml, classes); try { testContainer.startContainer(); } catch (Exception e) { this.deploymentException = new DeploymentException("Error deploying beans", e); return false; } testContainer.ensureRequestActive(); return true; }
/** * Bootstrap and shutdown the container. * * @param runnable a {@link Runnable} to be called whilst the container is * active * */ public void run(Runnable runnable) throws Exception { TestContainer container = null; try { container = new TestContainer(beansXml, classes); container.startContainer().ensureRequestActive(); runnable.run(container.getBeanManager(container.getDeployment().getBeanDeploymentArchives().iterator().next())); } finally { if (container != null) { container.stopContainer(); } } }
/** * Bootstrap and shutdown the container. * * @param runnable a {@link Runnable} to be called whilst the container is * active * */ public void run(Runnable runnable) throws Exception { TestContainer container = null; try { container = new TestContainer(beansXml, classes); container.startContainer().ensureRequestActive(); runnable.run(container.getBeanManager(container.getDeployment().getBeanDeploymentArchives().iterator().next())); } finally { if (container != null) { container.stopContainer(); } } }