Package org.jboss.metadata.ear.spec

Examples of org.jboss.metadata.ear.spec.ModulesMetaData


   public void testConfiguredNameConflict() throws DeploymentException
   {
      DUIH duih = getDUIHWithParent(false);
      NamedModule md = getSingleAttachment(duih);
      md.setModuleName(TEST);
      ModulesMetaData modules = getModulesMetaData(duih);
      ModuleMetaData conflict = new ModuleMetaData();
      conflict.setName(SIMPLE_DU_JAR_PATH);
      conflict.setUniqueName(TEST);
      modules.add(conflict);
     
      DeploymentUnit unit = getDeploymentUnitProxy(duih);
      testee.deploy(unit);
      assertEquals(SIMPLE_TRIMMED_PATH, md.getModuleName());
      assertEquals(SIMPLE_TRIMMED_PATH, duih.getModuleName(NamedModule.class));
View Full Code Here


   }
  
   public void testNoConfiguredNameConflict() throws DeploymentException
   {
      DUIH duih = getDUIHWithParent(false);
      ModulesMetaData modules = getModulesMetaData(duih);
      ModuleMetaData conflict = new ModuleMetaData();
      conflict.setName(SIMPLE_DU_JAR_PATH);
      conflict.setUniqueName(SIMPLE_TRIMMED_PATH);
      modules.add(conflict);
     
      DeploymentUnit unit = getDeploymentUnitProxy(duih);
      testee.deploy(unit);
      assertEquals(SIMPLE_DU_WAR_PATH, getSingleAttachment(duih).getModuleName());
      assertEquals(SIMPLE_DU_WAR_PATH, duih.getModuleName(NamedModule.class));
View Full Code Here

   {
      DUIH duih = getDUIHWithParent(false);
      NamedModule md = getSingleAttachment(duih);
      md.setModuleName(TEST);
     
      ModulesMetaData modules = getModulesMetaData(duih);
      ModuleMetaData conflict = new ModuleMetaData();
      conflict.setName(SIMPLE_DU_JAR_PATH);
      conflict.setUniqueName(TEST);
      modules.add(conflict);
     
      ModuleMetaData conflict2 = new ModuleMetaData();
      conflict2.setName(SIMPLE_DU_RAR_PATH);
      conflict2.setUniqueName(SIMPLE_TRIMMED_PATH);
      modules.add(conflict2);
     
      ModuleMetaData conflict3 = new ModuleMetaData();
      conflict3.setName("pathological.war");
      conflict3.setUniqueName(SIMPLE_DU_WAR_PATH);
      modules.add(conflict3);
     
      ModuleMetaData conflict4 = new ModuleMetaData();
      conflict4.setName("more-pathological.war");
      conflict4.setUniqueName(SIMPLE_TRIMMED_PATH + "-1");
      modules.add(conflict4);
     
      String expected = "test-1";
     
      DeploymentUnit unit = getDeploymentUnitProxy(duih);
      testee.deploy(unit);
View Full Code Here

  
   public void testNoConfiguredNamePathologicalConflict() throws DeploymentException
   {
      DUIH duih = getDUIHWithParent(false);
     
      ModulesMetaData modules = getModulesMetaData(duih);
      ModuleMetaData conflict = new ModuleMetaData();
      conflict.setName(SIMPLE_DU_JAR_PATH);
      conflict.setUniqueName(TEST);
      modules.add(conflict);
     
      ModuleMetaData conflict2 = new ModuleMetaData();
      conflict2.setName(SIMPLE_DU_RAR_PATH);
      conflict2.setUniqueName(SIMPLE_TRIMMED_PATH);
      modules.add(conflict2);
     
      ModuleMetaData conflict3 = new ModuleMetaData();
      conflict3.setName("pathological.war");
      conflict3.setUniqueName(SIMPLE_DU_WAR_PATH);
      modules.add(conflict3);
     
      ModuleMetaData conflict4 = new ModuleMetaData();
      conflict4.setName("more-pathological.war");
      conflict4.setUniqueName(SIMPLE_TRIMMED_PATH + "-1");
      modules.add(conflict4);
     
      String expected = SIMPLE_TRIMMED_PATH + "-2";
     
      DeploymentUnit unit = getDeploymentUnitProxy(duih);
      testee.deploy(unit);
View Full Code Here

      // Set up an ear with a war, jar, ear
     
      DUIH parentDUIH = getParentDUIH(true);
      DeploymentUnit parent = getDeploymentUnitProxy(parentDUIH);
      JBossAppMetaData appmd = (JBossAppMetaData) parentDUIH.attachments.get(JBossAppMetaData.class);
      ModulesMetaData modsmd = appmd.getModules();
     
      DUIH war = getSingleAttachmentDUIH(); // this does most setup for war
      war.parent = parent;
      war.relativePath = SIMPLE_DU_WAR_PATH;
      ModuleMetaData warmod = appmd.getModule(SIMPLE_DU_WAR_PATH);
     
      DUIH jar = new DUIH();
      jar.attachments.put(JBossMetaData.class, new JBossMetaData());
      jar.parent = parent;
      jar.relativePath = SIMPLE_DU_JAR_PATH;
      jar.simpleName = SIMPLE_DU_JAR;
      ModuleMetaData jarmod = new ModuleMetaData();
      jarmod.setName(SIMPLE_DU_JAR_PATH);
      modsmd.add(jarmod);
     
      DUIH appClient = new DUIH();
      appClient.attachments.put(JBossClientMetaData.class, new JBossClientMetaData());
      appClient.parent = parent;
      appClient.relativePath = SIMPLE_DU_APPCLIENT_PATH;
      appClient.simpleName = SIMPLE_DU_APPCLIENT;
      ModuleMetaData appclientmod = new ModuleMetaData();
      appclientmod.setName(SIMPLE_DU_APPCLIENT_PATH);
      modsmd.add(appclientmod);
     
      // Make assertions simple by not letting anything have SIMPLE_TRIMMED_PATH
      ModuleMetaData conflict = new ModuleMetaData();
      conflict.setName("conflict.war");
      conflict.setUniqueName(SIMPLE_TRIMMED_PATH);
      modsmd.add(conflict);
     
      ExecutorService executor = Executors.newFixedThreadPool(3);
     
      CountDownLatch startLatch = new CountDownLatch(4);
      CountDownLatch finishLatch = new CountDownLatch(3);
View Full Code Here

   }
  
   private static JBossAppMetaData getJBossAppMetaData(boolean addModule)
   {
      JBossAppMetaData appmd = new JBossAppMetaData();
      appmd.setModules(new ModulesMetaData());
      if (addModule)
      {
         ModuleMetaData modmd = new ModuleMetaData();
         modmd.setName(SIMPLE_DU_WAR_PATH);
         appmd.getModules().add(modmd);        
View Full Code Here

   private String establishUniqueModuleName(DeploymentUnit unit, String configuredName, JBossAppMetaData appMetaData) throws DeploymentException
   {     
      String name = configuredName == null ? trimExtension(unit.getRelativePath()): configuredName;
     
      String modulePath = unit.getRelativePath();
      ModulesMetaData modules = appMetaData.getModules();
      if (modules == null)
      {
         throw new DeploymentException(unit + " has attached " + JBossAppMetaData.class.getSimpleName() +
               " but it has no associated " + ModulesMetaData.class.getSimpleName());
      }
      ModuleMetaData ourModule = null;
      String uniqueName = null;
      // Synchronize on the modules to ensure concurrent deployments of the
      // modules pass serially through this logic
      synchronized(modules)
      {
         ourModule = modules.get(modulePath);
         if (ourModule == null)
         {
            String parentUnitName = unit.getParent().getName();
            throw new DeploymentException("No module with relative path " +
                  modulePath + " found  in set of modules for " + parentUnitName + " "  + modules.keySet());
         }
        
          uniqueName = name;
          if (!isNameUnique(uniqueName, ourModule, modules))
          {
View Full Code Here

      super.createMetaData(unit, name, suffix);
      // new parsed metadata
      JBossAppMetaData parsed = unit.getAttachment(JBossAppMetaData.class);
      if (metaData != null && parsed != null)
      {
         ModulesMetaData mmd = metaData.getModules();
         if (mmd != null && mmd.isEmpty() == false)
         {
            ModulesMetaData parsedMMD = parsed.getModules();
            if (parsedMMD == null)
            {
               parsedMMD = new ModulesMetaData();
               parsed.setModules(parsedMMD);
            }
            parsedMMD.merge(parsedMMD, mmd);
         }
      }
      // parsed is the one we use after merged modules
      metaData = parsed;
View Full Code Here

   protected EarMetaData parse(VFSDeploymentUnit unit, VirtualFile file, EarMetaData root) throws Exception
   {
      EarMetaData ear = super.parse(unit,file, root);
      List<DeploymentUnit> children = unit.getChildren();
      ModulesMetaData modules = ear.getModules();
      if(children != null && modules != null)
      {
         for(DeploymentUnit child : children)
         {
            String moduleName = child.getSimpleName();
            ModuleMetaData module = modules.get(moduleName);
            if(module != null && module.getAlternativeDD() != null)
            {
               VirtualFile altDDFile = unit.getRoot().getChild(module.getAlternativeDD());
               if(altDDFile == null)
                  throw new IllegalStateException("Failed to locate alternative DD '" + module.getAlternativeDD() + "' in " + unit.getRoot().getPathName());
View Full Code Here

         {
            scanEar(file, appMetaData);
         }

         // Create subdeployments for the ear modules
         ModulesMetaData modules = appMetaData.getModules();
         if(modules != null)
         {
            for (ModuleMetaData mod : modules)
            {
               String fileName = mod.getFileName();
View Full Code Here

TOP

Related Classes of org.jboss.metadata.ear.spec.ModulesMetaData

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.