Package org.jboss.metatype.api.values

Examples of org.jboss.metatype.api.values.MetaValue


      DeploymentTemplateInfo dsInfo = mgtView.getTemplate("LocalTxDataSourceTemplate");
      assertNotNull(dsInfo);
      //
      for(ManagedProperty property : dsInfo.getProperties().values())
      {
         MetaValue v = propValues.get(property.getName());
         if(v != null)
         {
            property.setValue(v);
            property.setField(Fields.META_TYPE, v.getMetaType());
         }
      }
      //
      mgtView.applyTemplate("LocalTestDS", dsInfo);
     
View Full Code Here


      validatePropertyMetaValues(props);

      // Validate the config-property
      ManagedProperty configProperty = hsqldb.getProperty("config-property");
      assertNotNull(configProperty);
      MetaValue value = configProperty.getValue();
      assertTrue("MapCompositeMetaType", value.getMetaType() instanceof MapCompositeMetaType);
      log.debug("config-property: "+configProperty);
      assertTrue(value instanceof CompositeValue);
      log.debug("config-property.value: "+value);


      // Validate more details on specific properties
      ManagedProperty interleaving  = props.get("interleaving");
      assertNotNull("interleaving", interleaving);
      assertNotNull("interleaving.value", interleaving.getValue());
      ManagedProperty poolJndiName = props.get("poolJndiName");
      assertNotNull("poolJndiName", poolJndiName);
      assertNotNull("poolJndiName.value", poolJndiName.getValue());

      ManagedProperty securityDomain = props.get("security-domain");
      assertNotNull("security-domain", securityDomain);
      MetaType securityDomainType = securityDomain.getMetaType();
      assertTrue("security-domain type is a GenericMetaType", securityDomainType instanceof CompositeMetaType);
      log.debug("security-domain type: "+securityDomainType);
      MetaValue securityDomainValue = securityDomain.getValue();
      assertTrue("security-domain value is a GenericValue", securityDomainValue instanceof CompositeValue);
      log.debug("security-domain value: "+securityDomainValue);
   }
View Full Code Here

   {
      ManagedOperation op = this.registry.getManagedOperation(opID);
      if(param == null)
         param = new MetaValue[0];
     
      MetaValue result = null;
      if (componentName != null)
      {
         result = (MetaValue) dispatcher.invoke(componentName, op, param);
      }
      return result;
View Full Code Here

      xaPropValues.put("URL", "jdbc:hsqldb");
      xaPropValues.put("User", "sa");
      xaPropValues.put("Password", "");

      //MetaValue metaValue = getMetaValueFactory().create(xaPropValues, getMapType());
      MetaValue metaValue = this.compositeValueMap(xaPropValues);
      propValues.put("xa-datasource-properties", metaValue);

      createComponentTest("XADataSourceTemplate", propValues, "testXaDs",
         KnownComponentTypes.DataSourceTypes.XA.getType(), jndiName);
      // Query the interleaving
      ManagementView mgtView = getManagementView();
      ComponentType type = KnownComponentTypes.DataSourceTypes.XA.getType();
      ManagedComponent txcf = mgtView.getComponent(jndiName, type);
      assertNotNull(txcf);
      ManagedProperty interleaving = txcf.getProperty("interleaving");
      assertNotNull("interleaving", interleaving);
      MetaValue interleavingMV = interleaving.getValue();
      assertNotNull("interleaving.value", interleavingMV);
      assertEquals("interleaving.value is true", SimpleValueSupport.wrap(Boolean.TRUE), interleavingMV);
   }
View Full Code Here

      Map<String, String> xaProps = new HashMap<String, String>();
      xaProps.put("SessionDefaultType", "javax.jms.Topic");
      xaProps.put("SessionDefaultType.type", "java.lang.String");
      xaProps.put("JmsProviderAdapterJNDI", "java:/DefaultJMSProvider");
      xaProps.put("JmsProviderAdapterJNDI.type", "java.lang.String");
      MetaValue metaValue = this.compositeValueMap(xaProps);

      propValues.put("config-property", metaValue);

      propValues.put("xa-transaction", SimpleValueSupport.wrap(Boolean.FALSE));
      propValues.put("xa-resource-timeout", SimpleValueSupport.wrap(new Integer(256)));

      // todo: how to set the specific domain?
      //ApplicationManagedSecurityMetaData secDomain = new ApplicationManagedSecurityMetaData();
      //props.get("security-domain").setValue(secDomain);

      createComponentTest("TxConnectionFactoryTemplate", propValues, "testTxCf",
         new ComponentType("ConnectionFactory", "Tx"), jndiName);
      // Query the interleaving
      ManagementView mgtView = getManagementView();
      ComponentType type = new ComponentType("ConnectionFactory", "Tx");
      ManagedComponent txcf = mgtView.getComponent(jndiName, type);
      assertNotNull(txcf);
      ManagedProperty interleaving = txcf.getProperty("interleaving");
      assertNotNull("interleaving", interleaving);
      MetaValue interleavingMV = interleaving.getValue();
      assertNotNull("interleaving.value", interleavingMV);
     
   }
View Full Code Here

      Map<String, String> xaProps = new HashMap<String, String>();
      xaProps.put("SessionDefaultType", "javax.jms.Topic");
      xaProps.put("SessionDefaultType.type", "java.lang.String");
      xaProps.put("JmsProviderAdapterJNDI", "java:/DefaultJMSProvider");
      xaProps.put("JmsProviderAdapterJNDI.type", "java.lang.String");
      MetaValue metaValue = this.compositeValueMap(xaProps);

      propValues.put("config-property", metaValue);

      propValues.put("xa-transaction", SimpleValueSupport.wrap(Boolean.TRUE));
      propValues.put("xa-resource-timeout", SimpleValueSupport.wrap(new Integer(256)));
      propValues.put("interleaving", SimpleValueSupport.wrap(Boolean.TRUE));

      // todo: how to set the specific domain?
      //ApplicationManagedSecurityMetaData secDomain = new ApplicationManagedSecurityMetaData();
      //props.get("security-domain").setValue(secDomain);

      createComponentTest("TxConnectionFactoryTemplate", propValues, "testTxXACf",
         new ComponentType("ConnectionFactory", "Tx"), jndiName);
      // Query the interleaving
      ManagementView mgtView = getManagementView();
      ComponentType type = new ComponentType("ConnectionFactory", "Tx");
      ManagedComponent txcf = mgtView.getComponent(jndiName, type);
      assertNotNull(txcf);
      ManagedProperty interleaving = txcf.getProperty("interleaving");
      assertNotNull("interleaving", interleaving);
      MetaValue interleavingMV = interleaving.getValue();
      assertNotNull("interleaving.value", interleavingMV);
      assertEquals(SimpleValueSupport.wrap(Boolean.TRUE), interleavingMV);
   }
View Full Code Here

      Map<String, String> xaProps = new HashMap<String, String>();
      xaProps.put("SessionDefaultType", "javax.jms.Topic");
      xaProps.put("SessionDefaultType.type", "java.lang.String");
      xaProps.put("JmsProviderAdapterJNDI", "java:/DefaultJMSProvider");
      xaProps.put("JmsProviderAdapterJNDI.type", "java.lang.String");
      MetaValue metaValue = this.compositeValueMap(xaProps);
      propValues.put("config-property", metaValue);

      propValues.put("config-property",
            new MapCompositeValueSupport(new HashMap<String, MetaValue>(),
                  new MapCompositeMetaType(SimpleMetaType.STRING)));
      // todo: how to set the specific domain?
      //ApplicationManagedSecurityMetaData secDomain = new ApplicationManagedSecurityMetaData();
      //props.get("security-domain").setValue(secDomain);

      ComponentType compType = new ComponentType("ConnectionFactory", "NoTx");
      createComponentTest("NoTxConnectionFactoryTemplate", propValues, "testNoTxCf", compType, jndiName);

      // Validate the config-property
      ManagementView mgtView = getManagementView();
      ManagedComponent dsMC = getManagedComponent(mgtView, compType, jndiName);
      ManagedProperty configProperty = dsMC.getProperty("config-property");
      assertNotNull(configProperty);
      MetaValue value = configProperty.getValue();
      assertTrue("MapCompositeMetaType", value.getMetaType() instanceof MapCompositeMetaType);
     
      MapCompositeValueSupport cValue = (MapCompositeValueSupport) value;
      cValue.put("testKey", new SimpleValueSupport(SimpleMetaType.STRING, "testValue"));
     
      mgtView.updateComponent(dsMC);
View Full Code Here

      // TODO: update MetaValueFactory for MapCompositeMetaType
      // MetaValue metaValue = getMetaValueFactory().create(xaPropValues, getMapType());
      MapCompositeValueSupport metaValue = new MapCompositeValueSupport(SimpleMetaType.STRING);
      for(String key : map.keySet())
      {
         MetaValue value = SimpleValueSupport.wrap(map.get(key));
         metaValue.put(key, value);
      }

      return metaValue;
   }
View Full Code Here

         getLog().debug(entry.getKey() + " = " + entry.getValue());
      }
     
      ManagedProperty prop = properties.get("activeBindingSetName");
      assertNotNull("Missing property activeBindingSetName", prop);
      MetaValue val = prop.getValue();
      assertNotNull("property activeBindingSetName has no value", val);
      assertTrue("property activeBindingSetName value is SimpleValue", val instanceof SimpleValue);
      assertEquals("incorrect activeBindingSetName value", "ports-default", ((SimpleValue) val).getValue());
     
      prop = properties.get("standardBindings");
      assertNotNull("Missing property standardBindings", prop);
      val =  prop.getValue();
      assertNotNull("property standardBindings has no value", val);
      assertTrue("property standardBindings value is CollectionValue", val instanceof CollectionValue);
      MetaValue[] elements = ((CollectionValue) val).getElements();
      assertNotNull(elements);
      for (MetaValue mv : elements)
      {
         getLog().info(mv);
         serviceBindingMetadataTest(mv);
      }
     
      prop = properties.get("bindingSets");
      assertNotNull("Missing property bindingSets", prop);
      val =  prop.getValue();
      assertNotNull("property bindingSets has no value", val);
      assertTrue("property bindingSets value is CollectionValue", val instanceof CollectionValue);
      elements = ((CollectionValue) val).getElements();
      assertNotNull("property bindingSets value has elements", elements);
      Map<String, Integer> offsets = new HashMap<String, Integer>();
      for (MetaValue mv : elements)
      {
         getLog().info(mv);
         serviceBindingSetTest(mv, offsets);
      }
      assertEquals(Integer.valueOf(0), offsets.get("ports-default"));
      assertEquals(Integer.valueOf(100), offsets.get("ports-01"));
      assertEquals(Integer.valueOf(200), offsets.get("ports-02"));
      assertEquals(Integer.valueOf(300), offsets.get("ports-03"));
     
      prop = properties.get("serviceBindings");
      assertNotNull("Missing property serviceBindings", prop);
      log.info("serviceBindings: " + prop);
      val = prop.getValue();
      assertNotNull("property serviceBindings has no value", val);
      assertTrue("property serviceBindings value is CompositeValue", val instanceof CompositeValue);
      CompositeValue compVal = (CompositeValue) val;
      assertEquals("correct number of sets of actual bindings", offsets.size(), compVal.values().size());
      for (String bindingSetName : offsets.keySet())
      {
         MetaValue mv = compVal.get(bindingSetName);
         assertTrue(mv instanceof CollectionValue);
         CollectionValue colVal = (CollectionValue) mv;
         getLog().info(colVal.getElements());
         for (MetaValue element : colVal.getElements())
         {
View Full Code Here

     
      assertTrue(element instanceof CompositeValue);
     
      CompositeValue compValue = (CompositeValue) element;
     
      MetaValue metaval = compValue.get("serviceName");
      assertNotNull("has serviceName", metaval);
      assertTrue(metaval instanceof SimpleValue);
      assertTrue(((SimpleValue) metaval).getValue() instanceof String);
     
      metaval = compValue.get("bindingName");
      if (metaval != null)
      {
         assertTrue(metaval instanceof SimpleValue);
         Object val = ((SimpleValue) metaval).getValue();
         assertTrue(val instanceof String);
      }
     
      metaval = compValue.get("fullyQualifiedName");
      assertNotNull("has fullyQualifiedName", metaval);
      assertTrue(metaval instanceof SimpleValue);
      assertTrue(((SimpleValue) metaval).getValue() instanceof String);
     
      metaval = compValue.get("description");
      if (metaval != null)
      {
         assertTrue(metaval instanceof SimpleValue);
         Object val = ((SimpleValue) metaval).getValue();
         assertTrue(val instanceof String);
      }
     
      metaval = compValue.get("hostName");
      assertNotNull("has hostName", metaval);
      assertTrue(metaval instanceof SimpleValue);
      assertTrue(((SimpleValue) metaval).getValue() instanceof String);
     
      metaval = compValue.get("bindAddress");
      assertNotNull("has bindAddress", metaval);
      assertTrue(metaval instanceof ArrayValue);
      Object val = ((ArrayValue) metaval).getValue();
      assertTrue(val instanceof byte[]);
     
      metaval = compValue.get("port");
      assertNotNull("has port", metaval);
      assertTrue(metaval instanceof SimpleValue);
      assertEquals("type of port value isn't int", int.class.getName(), metaval.getMetaType().getClassName());
   }
View Full Code Here

TOP

Related Classes of org.jboss.metatype.api.values.MetaValue

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.