Package org.jboss.deployers.spi.attachments

Examples of org.jboss.deployers.spi.attachments.MutableAttachments


      mutable.addAttachment(TestComponentMetaDataContainer.class, md);
   }
  
   protected static void makeFail(PredeterminedManagedObjectAttachments attachments, Deployer deployer)
   {
      MutableAttachments mutable = (MutableAttachments) attachments.getPredeterminedManagedObjects();
      mutable.addAttachment("fail", deployer);
   }
View Full Code Here


  
   protected abstract MutableAttachments getMutable();

   public void testAddAttachmentErrors() throws Exception
   {
      MutableAttachments mutable = getMutable();
     
      try
      {
         mutable.addAttachment((String) null, "attachment");
         fail("Should not be here!");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      try
      {
         mutable.addAttachment("name", null);
         fail("Should not be here!");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      try
      {
         mutable.addAttachment(null, "attachment", String.class);
         fail("Should not be here!");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      try
      {
         mutable.addAttachment("name", null, String.class);
         fail("Should not be here!");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      try
      {
         mutable.addAttachment("name", "attachment", null);
         fail("Should not be here!");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      try
      {
         mutable.addAttachment((Class<String>) null, "attachment");
         fail("Should not be here!");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      try
      {
         mutable.addAttachment(String.class, null);
         fail("Should not be here!");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
View Full Code Here

      }
   }
  
   public void testAddAttachmentByName() throws Exception
   {
      MutableAttachments mutable = getMutable();
      ExpectedAttachments expected = new ExpectedAttachments();
      assertAddFreshAttachmentByName(mutable, expected, "name1", "attachment1");
      assertAddFreshAttachmentByName(mutable, expected, "name2", "attachment2");
     
      assertAddReplaceAttachmentByName(mutable, expected, "name1", "different1", "attachment1");
View Full Code Here

      return result;
   }
  
   public void testAddAttachmentByNameAndType() throws Exception
   {
      MutableAttachments mutable = getMutable();
      ExpectedAttachments expected = new ExpectedAttachments();
      assertAddFreshAttachmentByNameAndType(mutable, expected, "name1", "attachment1", String.class);
      assertAddFreshAttachmentByNameAndType(mutable, expected, "name2", "attachment2", String.class);
     
      assertAddReplaceAttachmentByNameAndType(mutable, expected, "name1", "different1", "attachment1", String.class);
View Full Code Here

      return result;
   }
  
   public void testAddAttachmentByType() throws Exception
   {
      MutableAttachments mutable = getMutable();
      ExpectedAttachments expected = new ExpectedAttachments();
      assertAddFreshAttachmentByType(mutable, expected, Integer.class, 1);
      assertAddFreshAttachmentByType(mutable, expected, String.class, "attachment");
     
      assertAddReplaceAttachmentByType(mutable, expected, String.class, "different", "attachment");
View Full Code Here

      return result;
   }
  
   public void testRemoveAttachmentErrors() throws Exception
   {
      MutableAttachments mutable = getMutable();
     
      try
      {
         mutable.removeAttachment((String) null);
         fail("Should not be here!");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      try
      {
         mutable.removeAttachment(null, String.class);
         fail("Should not be here!");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      try
      {
         mutable.removeAttachment("name", null);
         fail("Should nt be here!");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      try
      {
         mutable.removeAttachment((Class<String>) null);
         fail("Should not be here!");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
View Full Code Here

      TestServiceMetaDataICF tsicf = new TestServiceMetaDataICF();
      mof.setInstanceClassFactory(TestServiceMetaData.class, tsicf);

      // Deploy a datasource with local and xa factories
      Deployment ctx1 = createSimpleDeployment("deployment1");
      MutableAttachments a1 = (MutableAttachments) ctx1.getPredeterminedManagedObjects();

      DSMetaData dsmd = new DSMetaData();
      dsmd.setDiplayName("deployment1 DS");
      // The base LocalDataSourceMeta
      LocalDataSourceMetaData ds = new LocalDataSourceMetaData();
      ds.setJndiName("java:DefaultDS1");
      ds.setMaxSize(100);
      ds.setMinSize(10);
      ds.setPassword("password1".toCharArray());
      ds.setUsername("username1");
      SecMetaData smd1 = new SecMetaData();
      smd1.setDomain("java:/jaas/domain1");
      ds.setSecurityMetaData(smd1);

      ArrayList<ConnMetaData> deployments = new ArrayList<ConnMetaData>();
      deployments.add(ds);
      dsmd.setDeployments(deployments);

      a1.addAttachment(DSMetaData.class, dsmd);

      // The mbeans associated with the local DS
      TestServiceMetaData localMBeans = new TestServiceMetaData();
      localMBeans.setObjectName("jboss.jca:service.SecurityDomain");
      localMBeans.setCode(SimpleMetaData.class.getName());
      ArrayList<TestServiceAttributeMetaData> localMBeanAttrs = new ArrayList<TestServiceAttributeMetaData>();
      localMBeanAttrs.add(new TestServiceAttributeMetaData("java:/jaas/domain1", "domain"));
      localMBeanAttrs.add(new TestServiceAttributeMetaData("java:DefaultDS1", "jndiName"));
      TestServiceAttributeMetaData typeAttribute = new TestServiceAttributeMetaData(SimpleMetaData.SecurityDeploymentType.NONE, "type");
      localMBeanAttrs.add(typeAttribute);
      localMBeans.setAttributes(localMBeanAttrs);
      a1.addAttachment(TestServiceMetaData.class, localMBeans);
      ps.addDeployment(ctx1);

      Deployment ctx2 = createSimpleDeployment("deployment2");
      MutableAttachments a2 = (MutableAttachments)ctx2.getPredeterminedManagedObjects();

      TestServiceMetaData localMBeans2 = new TestServiceMetaData();
      localMBeans2.setCode(RuntimeComponentMetaData.class.getName());
      ArrayList<TestServiceAttributeMetaData> localMBeanAttrs2 = new ArrayList<TestServiceAttributeMetaData>();
      localMBeanAttrs2.add(new TestServiceAttributeMetaData("java:/jaas/domain2", "domain"));
      CustomName customName = new CustomName("runtime-name-1");
      localMBeanAttrs2.add(new TestServiceAttributeMetaData(customName, "customName"));
      localMBeans2.setAttributes(localMBeanAttrs2);
      a2.addAttachment(TestServiceMetaData.class, localMBeans2);
      ps.addDeployment(ctx2);

      ps.process();

      ManagedObject mo = ps.getManagedObject("java:/jaas/domain1/SecurityDomain");
View Full Code Here

      ArrayList<ConnMetaData> deployments = new ArrayList<ConnMetaData>();
      deployments.add(ds);
      deployments.add(xads);
      dsmd.setDeployments(deployments);

      MutableAttachments a1 = (MutableAttachments) ctx1.getPredeterminedManagedObjects();
      a1.addAttachment(DSMetaData.class, dsmd);
      // The mbeans associated with the local DS
      TestServiceMetaData localMBeans = new TestServiceMetaData();
      localMBeans.setCode(DSService.class.getName());
      ArrayList<TestServiceAttributeMetaData> localMBeanAttrs = new ArrayList<TestServiceAttributeMetaData>();
      localMBeanAttrs.add(new TestServiceAttributeMetaData("java:DefaultDS1", "managementName"));
      localMBeans.setAttributes(localMBeanAttrs);
      a1.addAttachment(TestServiceMetaData.class, localMBeans);
      ps.addDeployment(ctx1);

      // Deploy security domain1
      Deployment secCtx1 = createSimpleDeployment("sec-domain1");
      MutableAttachments sda1 = (MutableAttachments) secCtx1.getPredeterminedManagedObjects();
      SecurityDeployment sd1 = new SecurityDeployment();
      sd1.setDomainName("java:/jaas/domain1");
      sda1.addAttachment(SecurityDeployment.class, sd1);
      ps.addDeployment(secCtx1);
      // Deploy security domain2
      Deployment secCtx2 = createSimpleDeployment("sec-domain2");
      MutableAttachments sda2 = (MutableAttachments) secCtx2.getPredeterminedManagedObjects();
      SecurityDeployment sd2 = new SecurityDeployment();
      sd2.setDomainName("java:/jaas/domain2");
      sda2.addAttachment(SecurityDeployment.class, sd2);
      ps.addDeployment(secCtx2);

      // Process the deployments to build the ManagedObjects
      ps.process();
View Full Code Here

      BeanMetaDataFactory md1 = getConstructorTester();
      BeanMetaDataFactory md2 = getInjectionTester();
      BeanMetaDataFactory md3 = getStartTester();
      BeanMetaDataFactory md4 = getAliasTester();
      deployment.setBeanFactories(Arrays.asList(md1, md2, md3, md4));
      MutableAttachments attachments = (MutableAttachments) context.getPredeterminedManagedObjects();
      attachments.addAttachment("KernelDeployerTest", deployment);

      assertDeploy(context);
      try
      {
         assertSimpleAnnotated("Constructor");
View Full Code Here

      requirements.addRequirement(requirement);
   }

   protected static void addMetaData(PredeterminedManagedObjectAttachments attachments, ClassLoadingMetaData md)
   {
      MutableAttachments mutable = (MutableAttachments) attachments.getPredeterminedManagedObjects();
      mutable.addAttachment(ClassLoadingMetaData.class, md);
   }
View Full Code Here

TOP

Related Classes of org.jboss.deployers.spi.attachments.MutableAttachments

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.