Package org.jboss.shrinkwrap.api.spec

Examples of org.jboss.shrinkwrap.api.spec.JavaArchive


  
  
   public void testMixedEjbJarsInEar() throws Exception
   {
      EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, EAR_NAME);
      JavaArchive ejbJar1 = createEjbJar("ejbJar1.jar", true, PlainJavaBean.class);
      ear.addModule(ejbJar1);
      JavaArchive ejbJar2 = createEjbJar("ejbJar2.jar", false, MySLSBean.class, BusinessInterface.class);
      ear.addModule(ejbJar2);
      MockArchiveManifest.addManifest(ear);
      DeploymentUnit unit = assertDeploy(ear);
      Class<?> plainJavaBeanClass = getClass(PlainJavaBean.class, unit);
      Class<?> mySLSBeanClass = getClass(MySLSBean.class, unit);
View Full Code Here


  
   public void testEjbJarsInEars() throws Exception
   {
      // simple1.ear
      EnterpriseArchive ear1 = ShrinkWrap.create(EnterpriseArchive.class, "simple1.ear");
      JavaArchive ejbJar1 = createEjbJar("ejbJar1.jar", true, PlainJavaBean.class);
      ear1.addModule(ejbJar1);
      MockArchiveManifest.addManifest(ear1);
      DeploymentUnit unit = assertDeploy(ear1);
      Class<?> plainJavaBeanClass = getClass(PlainJavaBean.class, unit);
      Deployment deployment1 = initializeDeploymentBean(unit);
      // simple2.ear
      EnterpriseArchive ear2 = ShrinkWrap.create(EnterpriseArchive.class, "simple2.ear");
      JavaArchive ejbJar2 = createEjbJar("ejbJar2.jar", true, MySLSBean.class, BusinessInterface.class);
      ear2.addModule(ejbJar2);
      MockArchiveManifest.addManifest(ear2);
      unit = assertDeploy(ear2);
      Class<?> mySLSBeanClass = getClass(MySLSBean.class, unit);
      Class<?> businessInterface = getClass(BusinessInterface.class, unit);
View Full Code Here

  
   public void testMixedEjbJarsInEars() throws Exception
   {
      // simple1.ear
      EnterpriseArchive ear1 = ShrinkWrap.create(EnterpriseArchive.class, "simple1.ear");
      JavaArchive ejbJar1 = createEjbJar("ejbJar1.jar", false, PlainJavaBean.class);
      ear1.addModule(ejbJar1);
      MockArchiveManifest.addManifest(ear1);
      DeploymentUnit unit = assertDeploy(ear1);
      Class<?> plainJavaBeanClass = getClass(PlainJavaBean.class, unit);

      // simple2.ear
      EnterpriseArchive ear2 = ShrinkWrap.create(EnterpriseArchive.class, "simple2.ear");
      JavaArchive ejbJar2 = createEjbJar("ejbJar2.jar", true, MySLSBean.class, BusinessInterface.class);
      ear2.addModule(ejbJar2);
      MockArchiveManifest.addManifest(ear2);
      unit = assertDeploy(ear2);
      Class<?> mySLSBeanClass = getClass(MySLSBean.class, unit);
      Class<?> businessInterface = getClass(BusinessInterface.class, unit);
View Full Code Here

   }
  
   public void testEjbJar_War() throws Exception
   {
      // ejb.jar
      JavaArchive ejbJar = createEjbJar(true);
      DeploymentUnit unit = assertDeploy(ejbJar);
      Class<?> plainJavaBeanClass = getClass(PlainJavaBean.class, unit);
      Deployment deployment1 = initializeDeploymentBean(unit);
      // simple.war
      WebArchive war = createWar(true);
View Full Code Here

  
   public void testEjbJarAndWarInEar() throws Exception
   {
      // ejb.jar
      EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, EAR_NAME);
      JavaArchive ejbJar = createEjbJar(true);
      ear.addModule(ejbJar);
      // simple.war
      WebArchive war = createWar(true);
      ear.addModule(war);
      MockArchiveManifest.addManifest(ear);
View Full Code Here

  
   public void testEjbJarInEar_War() throws Exception
   {
      // ejb.jar
      EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, EAR_NAME);
      JavaArchive ejbJar = createEjbJar(true);
      ear.addModule(ejbJar);
      MockArchiveManifest.addManifest(ear);
      DeploymentUnit unit = assertDeploy(ear);
      Class<?> plainJavaBeanClass = getClass(PlainJavaBean.class, unit);
      Deployment deployment1 = initializeDeploymentBean(unit);
View Full Code Here

  
   public void testEjbJarInEar_WarWithLibInEar() throws Exception
   {
      // ejb.ear
      EnterpriseArchive ejbEar = ShrinkWrap.create(EnterpriseArchive.class, "ejb.ear");
      JavaArchive ejbJar = createEjbJar(true);
      ejbEar.addModule(ejbJar);
      MockArchiveManifest.addManifest(ejbEar);
      DeploymentUnit unit = assertDeploy(ejbEar);
      Class<?> plainJavaBeanClass = getClass(PlainJavaBean.class, unit);
      Deployment deployment1 = initializeDeploymentBean(unit);
View Full Code Here

      assertBDAId(war2BDA, "web2.war");
      assertExpectedClasses(war2BDA, NotWBJsfBean.class);
      Class<?> notWBJsfBeanWar2Class = getClass(NotWBJsfBean.class, war2Unit);
      Class<?> crmWebBeanWar2Class = getClass(CrmWebBean.class, war2Unit);
     
      JavaArchive ejbJar = createEjbJar("ejb.jar", true, BusinessInterface.class);
      DeploymentUnit ejbJarUnit = assertDeploy(ejbJar);
      Deployment ejbJarDeployment = initializeDeploymentBean(ejbJarUnit);
      BeanDeploymentArchive ejbJarBDA = ejbJarDeployment.getBeanDeploymentArchives().iterator().next();
      assertBDAId(ejbJarBDA, "ejb.jar");
      assertExpectedClasses(ejbJarBDA, BusinessInterface.class);
      Class<?> businessInterfaceClass = getClass(BusinessInterface.class, ejbJarUnit);
     
      EnterpriseArchive ear1 = ShrinkWrap.create(EnterpriseArchive.class, "full.ear");
      WebArchive warInEar1 = createWarWithLibs(false, true, true);
      ear1.addModule(warInEar1);
      ear1.addModule(war2);
      JavaArchive ejbJarInEar1 = createEjbJar("ejbInFullEar.jar", false, MySLSBean.class);
      ear1.addModule(ejbJarInEar1);
      createLib(ear1, "lib1.jar", false, ExternalWebBean.class);
      createLib(ear1, "lib2.jar", true, A.class);
      createLib(ear1, "lib3.jar", false, B.class);
      MockArchiveManifest.addManifest(ear1);
      DeploymentUnit ear1Unit = assertDeploy(ear1);
      Deployment ear1Deployment = initializeDeploymentBean(ear1Unit);
      BeanDeploymentArchive ear1BDA = null, ear1War1BDA = null, ear1War2BDA = null;
      for (BeanDeploymentArchive bda: ear1Deployment.getBeanDeploymentArchives())
      {
         if (bda.getId().contains(WAR_NAME))
         {
            ear1War1BDA = bda;
         }
         else if (bda.getId().contains("web2.war"))
         {
            ear1War2BDA = bda;
         }
         else
         {
            ear1BDA = bda;
         }
      }
      assertBDAId(ear1BDA, "full.ear");
      assertExpectedClasses(ear1BDA, A.class);
      assertBDAId(ear1War1BDA, "full.ear/" + WAR_NAME);
      assertExpectedClasses(ear1War1BDA, UIWebBean.class, CrmWebBean.class);
      assertBDAId(ear1War2BDA, "full.ear/web2.war");
      assertExpectedClasses(ear1War2BDA, NotWBJsfBean.class);
      Class<?> servletWebBeanEar1Class = null, uiWebBeanEar1Class = null,
               crmWebBeanEar1War1Class = null, notWBJsfBeanEar1Class = null,
               crmWebBeanEar1War2Class = null;
      for (DeploymentUnit ear1Child: ear1Unit.getChildren())
      {
         if (ear1Child.getName().contains(WAR_NAME))
         {
           servletWebBeanEar1Class = getClass(ServletWebBean.class, ear1Child);
           uiWebBeanEar1Class = getClass(UIWebBean.class, ear1Child);
           crmWebBeanEar1War1Class = getClass(CrmWebBean.class, ear1Child);
         }
         else if (ear1Child.getName().contains("web2.war"))
         {
            notWBJsfBeanEar1Class = getClass(NotWBJsfBean.class, ear1Child);
            crmWebBeanEar1War2Class = getClass(CrmWebBean.class, ear1Child);
         }
      }
      Class<?> externalWebBeanClass = getClass(ExternalWebBean.class, ear1Unit);
      Class<?> aClass = getClass(A.class, ear1Unit);
      Class<?> bClass = getClass(B.class, ear1Unit);
     
      EnterpriseArchive ear2 = ShrinkWrap.create(EnterpriseArchive.class, "ejbWLibs.ear");
      JavaArchive ejbJarInEar2 = createEjbJar("ejbInEar2.jar", true, PlainJavaBean.class);
      ear2.addModule(ejbJarInEar2);
      createLib(ear2, "lib1.jar", false, SomeUtil.class);
      createLib(ear2, "lib2.jar", true, CrmWebBean.class);
      MockArchiveManifest.addManifest(ear2);
      DeploymentUnit ear2Unit = assertDeploy(ear2);
View Full Code Here

      return createEjbJar(EJB_JAR_NAME, jarCDI, PlainJavaBean.class);
   }
  
   protected JavaArchive createEjbJar(String jarName, boolean jarCDI, Class<?>... classes)
   {
      JavaArchive ejbJar = ShrinkWrap.create(JavaArchive.class, jarName);
      for (Class<?> clazz: classes)
      {
         ejbJar.addClass(clazz);
      }
      MockArchiveManifest.addManifest(ejbJar, jarCDI);
      return ejbJar;
   }
View Full Code Here

      return war;
   }

   protected void createLib(LibraryContainer<?> archive, String libName, boolean cdi, Class<?>... classes)
   {
      JavaArchive lib = ShrinkWrap.create(JavaArchive.class, libName);
      if (cdi)
      {
         MockArchiveManifest.addCDIManifest(lib);
      }
      for (Class<?> libClass: classes)
      {
         lib.addClass(libClass);
      }
      archive.addLibrary(lib);
   }
View Full Code Here

TOP

Related Classes of org.jboss.shrinkwrap.api.spec.JavaArchive

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.