Package org.jboss.system.metadata

Examples of org.jboss.system.metadata.ServiceMetaData


      assertOthers(metaData);
   }

   public void testConstructorOneArg() throws Exception
   {
      ServiceMetaData metaData = unmarshalSingleMBean();
     
      String[] expectedSignature = new String[] { "signature1" };
      String[] expectedParams = new String[] { "param1" };
     
      assertConstructor(expectedSignature, expectedParams, metaData);
View Full Code Here


      assertOthers(metaData);
   }

   public void testConstructorTwoArgs() throws Exception
   {
      ServiceMetaData metaData = unmarshalSingleMBean();
     
      String[] expectedSignature = new String[] { "signature1", "signature2" };
      String[] expectedParams = new String[] { "param1", "param2" };
     
      assertConstructor(expectedSignature, expectedParams, metaData);
View Full Code Here

      assertOthers(metaData);
   }

   public void testConstructorEmptyValue() throws Exception
   {
      ServiceMetaData metaData = unmarshalSingleMBean();
     
      String[] expectedSignature = new String[] { "signature1" };
      String[] expectedParams = new String[] { "" };
     
      assertConstructor(expectedSignature, expectedParams, metaData);
View Full Code Here

      super(name);
   }

   protected ServiceAttributeMetaData unmarshallSingleAttribute() throws Exception
   {
      ServiceMetaData metaData = unmarshalSingleMBean();
      assertOthers(metaData);
      List<ServiceAttributeMetaData> attributes = metaData.getAttributes();
      assertNotNull(attributes);
      assertEquals(1, attributes.size());
      return attributes.get(0);
   }
View Full Code Here

      return attributes.get(0);
   }

   protected ServiceValueMetaData unmarshallSingleValue() throws Exception
   {
      ServiceMetaData metaData = unmarshalSingleMBean();
      assertOthers(metaData);
      List<ServiceAttributeMetaData> attributes = metaData.getAttributes();
      assertNotNull(attributes);
      assertEquals(1, attributes.size());
      ServiceAttributeMetaData attribute = attributes.get(0);
      assertAttributeName(attribute, "Attribute");
      ServiceValueMetaData result = attribute.getValue();
View Full Code Here

      super(name);
   }

   public void testAliasEmpty() throws Exception
   {
      ServiceMetaData service = unmarshalSingleMBean();
      assertNull(service.getAliases());
   }
View Full Code Here

      assertNull(service.getAliases());
   }

   public void testAliasSingle() throws Exception
   {
      ServiceMetaData service = unmarshalSingleMBean();
      List<String> aliases = service.getAliases();
      assertNotNull(aliases);
      assertEquals(1, aliases.size());
      assertEquals("SingleAlias", aliases.iterator().next());
   }
View Full Code Here

      assertEquals("SingleAlias", aliases.iterator().next());
   }

   public void testAliasMultiple() throws Exception
   {
      ServiceMetaData service = unmarshalSingleMBean();
      List<String> aliases = service.getAliases();
      assertNotNull(aliases);
      assertEquals(3, aliases.size());
      for(int i = 0; i < aliases.size(); i++)
         assertEquals("Alias#" + i, aliases.get(i));
   }
View Full Code Here

   protected void deployWebModule(DeploymentUnit unit, JBossWebMetaData metaData, AbstractWarDeployment deployment) throws Exception
   {
      log.debug("deployWebModule: " + unit.getName());
      try
      {
         ServiceMetaData webModule = new ServiceMetaData();
         String name = getObjectName(metaData);
         ObjectName objectName = new ObjectName(name);
         webModule.setObjectName(objectName);
         webModule.setCode(WebModule.class.getName());
         // WebModule(DeploymentUnit, AbstractWarDeployer, AbstractWarDeployment)
         ServiceConstructorMetaData constructor = new ServiceConstructorMetaData();
         constructor.setSignature(new String[] { DeploymentUnit.class.getName(), AbstractWarDeployer.class.getName(), AbstractWarDeployment.class.getName() });
         constructor.setParameters(new Object[] { unit, this, deployment });
         webModule.setConstructor(constructor);

         List<ServiceAttributeMetaData> attrs = new ArrayList<ServiceAttributeMetaData>();

         ServiceAttributeMetaData attr = new ServiceAttributeMetaData();
         attr.setName("SecurityManagement");
         ServiceInjectionValueMetaData injectionValue = new ServiceInjectionValueMetaData(deployment.getSecurityManagementName());
         attr.setValue(injectionValue);
         attrs.add(attr);

         ServiceAttributeMetaData attrPR = new ServiceAttributeMetaData();
         attrPR.setName("PolicyRegistration");
         ServiceInjectionValueMetaData injectionValuePR = new ServiceInjectionValueMetaData(deployment.getPolicyRegistrationName());
         attrPR.setValue(injectionValuePR);
         attrs.add(attrPR);

         ServiceAttributeMetaData attrKernel = new ServiceAttributeMetaData();
         attrKernel.setName("Kernel");
         ServiceInjectionValueMetaData injectionValueKernel = new ServiceInjectionValueMetaData(KernelConstants.KERNEL_NAME);
         attrKernel.setValue(injectionValueKernel);
         attrs.add(attrKernel);

         webModule.setAttributes(attrs);

         // Dependencies...Still have old jmx names here
         Collection<String> depends = metaData.getDepends();
         List<ServiceDependencyMetaData> dependencies = new ArrayList<ServiceDependencyMetaData>();
         if (depends != null && depends.isEmpty() == false)
         {
            if (log.isTraceEnabled())
               log.trace(name + " has dependencies: " + depends);

            for (String iDependOn : depends)
            {
               ServiceDependencyMetaData sdmd = new ServiceDependencyMetaData();
               sdmd.setIDependOn(iDependOn);
               dependencies.add(sdmd);
            }
         }
        
         // SwitchBoard
         Barrier switchBoard = unit.getAttachment(Barrier.class);
         if (switchBoard != null)
         {
            // Setup switchboard dependency on the deployment
            ServiceDependencyMetaData switchBoardDependency = new AnyStateServiceDependencyMetaData(switchBoard.getId(), ControllerState.START, ControllerState.INSTALLED);
            dependencies.add(switchBoardDependency);
            log.debug("Added switchboard dependency: " + switchBoard.getId() + " for web module: " + name);
         }
         // Injection Manager
         InjectionManager injectionManager = unit.getAttachment(InjectionManager.class);
         if (injectionManager != null)
         {
            // set the InjectionManager on the deployment
            deployment.setInjectionManager(injectionManager);
            // Setup the Injector
            Environment webEnvironment = metaData.getJndiEnvironmentRefsGroup();
            if (webEnvironment != null)
            {
               // convert JBMETA metadata to jboss-injection specific metadata
               JndiEnvironmentRefsGroup jndiEnvironment = new JndiEnvironmentImpl(webEnvironment, unit.getClassLoader());
               // For optimization, we'll create an Injector only if there's atleast one InjectionTarget
               if (this.hasInjectionTargets(jndiEnvironment))
               {
                  // create the injector
                  EEInjector eeInjector = new EEInjector(jndiEnvironment);
                  // add the injector the injection manager
                  injectionManager.addInjector(eeInjector);
                  // Deploy the Injector as a MC bean (so that the fully populated naming context (obtained via the SwitchBoard
                  // Barrier) gets injected.
                  String injectorMCBeanName = this.getInjectorMCBeanName(unit);
                  BeanMetaData injectorBMD = this.createInjectorBMD(injectorMCBeanName, eeInjector, switchBoard);
                  unit.addAttachment(BeanMetaData.class + ":" + injectorMCBeanName, injectorBMD);
                 
                  // Add the Injector dependency on the deployment (so that the DU doesn't
                  // get started till the Injector is available)
                  ServiceDependencyMetaData injectorDepdendency = new ServiceDependencyMetaData();
                  injectorDepdendency.setIDependOn(injectorMCBeanName);
                  dependencies.add(injectorDepdendency);
                  log.debug("Added Injector dependency: " + injectorMCBeanName + " for web module: " + name);
               }
            }
         }

         // TODO: We haven't yet integrated PC and EJB reference providers in SwitchBoard.
         // The following sections will be removed after the RPs are made available
        
         // JBAS-6795 Add dependency on PersistenceContext references
         PersistenceContextReferencesMetaData pcRefs = metaData.getPersistenceContextRefs();
         if (pcRefs != null)
         {
            for (PersistenceContextReferenceMetaData pcRef : metaData.getPersistenceContextRefs())
            {
               // TODO: this is a duplication of the logic in PersistenceContextHandler
               String persistenceUnitName = pcRef.getPersistenceUnitName();
               String beanName = persistenceUnitDependencyResolver.resolvePersistenceUnitSupplier(unit, persistenceUnitName);
               ServiceDependencyMetaData sdmd = new ServiceDependencyMetaData();
               sdmd.setIDependOn(beanName);
               dependencies.add(sdmd);
            }
         }
        
         webModule.setDependencies(dependencies);

         // Here's where a bit of magic happens. By attaching the ServiceMetaData
         // to the deployment, we now make the deployment "relevant" to
         // deployers that use ServiceMetaData as an input (e.g. the
         // org.jboss.system.deployers.ServiceDeployer). Those deployers
View Full Code Here

      // assert
      assertEquals(SimpleValueSupport.wrap(123456),  component.getProperty("downCacheSize").getValue());
     
     
      // Assert attachment meta data
      ServiceMetaData service = deployment.getServices().get(0);
      assertNotNull(service);
      boolean foundAttribute = false;
      for(ServiceAttributeMetaData attribute : service.getAttributes())
      {
         if("DownCacheSize".equals(attribute.getName()))
         {
            String text = ((ServiceTextValueMetaData) attribute.getValue()).getText();
            assertEquals("123456", text);
View Full Code Here

TOP

Related Classes of org.jboss.system.metadata.ServiceMetaData

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.