Package org.jboss.arquillian.container.weld.ee.embedded_1_1

Examples of org.jboss.arquillian.container.weld.ee.embedded_1_1.WeldEEMockContainer


     
      ShrinkWrapClassLoader classLoader = new ShrinkWrapClassLoader(archive.getClass().getClassLoader(), archive);
      ContextClassLoaderManager classLoaderManager = new ContextClassLoaderManager(classLoader);
      classLoaderManager.enable();
     
      TestContainer container = new TestContainer(findArchiveId(archive), findBeansXml(archive), findBeanClasses(archive, classLoader));
      Bootstrap bootstrap = container.getLifecycle().getBootstrap();

      context.add(ContextClassLoaderManager.class, classLoaderManager);

      container.startContainer();
     
      context.add(TestContainer.class, container);
      context.add(Bootstrap.class, bootstrap);
      // Assume a flat structure
      context.add(WeldManager.class, container.getBeanManager(container.getDeployment().getBeanDeploymentArchives().iterator().next()));

      context.register(AfterDeploy.class, new SessionLifeCycleCreator());
      context.register(BeforeUnDeploy.class, new SessionLifeCycleDestoryer());
     
      context.register(Before.class, new RequestLifeCycleCreator());
View Full Code Here


      return new LocalMethodExecutor();
   }

   public void undeploy(Context context, Archive<?> archive) throws DeploymentException
   {
      TestContainer container = context.get(TestContainer.class);
      if(container != null)
      {
         container.stopContainer();
      }
      ContextClassLoaderManager classLoaderManager = context.get(ContextClassLoaderManager.class);
      classLoaderManager.disable();
   }
View Full Code Here

  
      ShrinkWrapClassLoader classLoader = getClassLoader(archive);
      ContextClassLoaderManager classLoaderManager = new ContextClassLoaderManager(classLoader);
      classLoaderManager.enable();
     
      TestContainer container = new TestContainer(findArchiveId(archive), findBeansXml(archive), findBeanClasses(archive, classLoader), true);
      Bootstrap bootstrap = container.getBootstrap();

      contextClassLoaderManagerProducer.set(classLoaderManager);

      try {
          container.startContainer();
      } finally {
          // always set container - even if an exception occurs, we want the container to be cleaned up properly in undeploy()
          testContainerProducer.set(container);
          bootstrapProducer.set(bootstrap);
      }


      // Assume a flat structure
      WeldManager manager = container.getBeanManager(container.getDeployment().getBeanDeploymentArchives().iterator().next());
      weldManagerProducer.set(manager);
      beanManagerProducer.set(manager);

      return new ProtocolMetaData();
   }
View Full Code Here

      return new ProtocolMetaData();
   }

   public void undeploy(Archive<?> archive) throws DeploymentException
   {
      TestContainer container = testContainerProducer.get();
      if(container != null)
      {
         container.stopContainer();
      }
      ContextClassLoaderManager classLoaderManager = contextClassLoaderManagerProducer.get();
      classLoaderManager.disable();
   }
View Full Code Here

  
      ShrinkWrapClassLoader classLoader = new ShrinkWrapClassLoader(archive.getClass().getClassLoader(), archive);
      ContextClassLoaderManager classLoaderManager = new ContextClassLoaderManager(classLoader);
      classLoaderManager.enable();
     
      TestContainer container = new TestContainer(findArchiveId(archive), findBeansXml(archive), findBeanClasses(archive, classLoader));
      Bootstrap bootstrap = container.getBootstrap();

      contextClassLoaderManagerProducer.set(classLoaderManager);

      container.startContainer();

      testContainerProducer.set(container);
      bootstrapProducer.set(bootstrap);

      // Assume a flat structure
      WeldManager manager = container.getBeanManager(container.getDeployment().getBeanDeploymentArchives().iterator().next());
      weldManagerProducer.set(manager);
      beanManagerProducer.set(manager);

      return new ProtocolMetaData();
   }
View Full Code Here

      return new ProtocolMetaData();
   }

   public void undeploy(Archive<?> archive) throws DeploymentException
   {
      TestContainer container = testContainerProducer.get();
      if(container != null)
      {
         container.stopContainer();
      }
      ContextClassLoaderManager classLoaderManager = contextClassLoaderManagerProducer.get();
      classLoaderManager.disable();
   }
View Full Code Here

        createRunner("multipleInterceptorsBlocks.xml").runAndExpect(XmlLogger.LOG.multipleInterceptors(null));
    }

    @Test
    public void testAlternativesEnabled() throws Exception {
        createRunner("alternative.xml").run(new Runnable() {

            public void run(WeldManager beanManager) {
                ModuleEnablement enabled = ((BeanManagerImpl) beanManager).getEnabled();
                assertEquals(1, enabled.getAlternativeClasses().size());
                assertEquals(Alt.class, enabled.getAlternativeClasses().iterator().next());
View Full Code Here

        });
    }

    @Test
    public void testDecoratorsEnabled() throws Exception {
        createRunner("decorator.xml").run(new Runnable() {

            public void run(WeldManager beanManager) {
                ModuleEnablement enabled = ((BeanManagerImpl) beanManager).getEnabled();
                assertEquals(1, enabled.getDecorators().size());
                assertEquals(Dec.class, enabled.getDecorators().iterator().next());
View Full Code Here

        });
    }

    @Test
    public void testInterceptorsEnabled() throws Exception {
        createRunner("interceptor.xml").run(new Runnable() {

            public void run(WeldManager beanManager) {
                ModuleEnablement enabled = ((BeanManagerImpl) beanManager).getEnabled();
                assertEquals(1, enabled.getInterceptors().size());
                assertEquals(Int.class, enabled.getInterceptors().iterator().next());
View Full Code Here

        });
    }

    @Test
    public void testMergeBeansXmls() throws Exception {
        createRunner("alternative.xml", "decorator.xml", "interceptor.xml").run(new Runnable() {

            public void run(WeldManager beanManager) {
                ModuleEnablement enabled = ((BeanManagerImpl) beanManager).getEnabled();
                Assert.assertEquals(1, enabled.getAlternativeClasses().size());
                Assert.assertEquals(Alt.class, enabled.getAlternativeClasses().iterator().next());
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.container.weld.ee.embedded_1_1.WeldEEMockContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.