Package org.jboss.metatype.api.values

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


      // Security config
      Map<String, MetaValue> values = new HashMap<String, MetaValue>();
      values.put("admin", createCompositeValue(true, true, true));
      values.put("publisher", createCompositeValue(true, true, false));
      values.put("user", createCompositeValue(true, null, null));
      CompositeValue map = new MapCompositeValueSupport(values, securityConfType);
      propValues.put("securityConfig", map);
     
      createComponentTest("QueueTemplate", propValues, getName(), QueueType, jndiName);
      ManagedComponent queue = activeView.getComponent("testCreateSecureQueue", QueueType);
      assertNotNull(queue);
View Full Code Here


      // Message 1
      sender.send(s.createTextMessage("Hey!"));

      SimpleValue messageCount1 = (SimpleValue) messageCount.getValue();
      assertTrue((Integer) (messageCount1).getValue() > 0);
      CompositeValue messageCounterCV = (CompositeValue) messageCounter.getValue();
      log.info(messageCounterCV);
      assertEquals(messageCounterCV.get("messageCount"), messageCount1);

      // Message 2
      sender.send(s.createTextMessage("Message2"));
     
      SimpleValue messageCount2 = (SimpleValue) messageCount.getValue();
      assertTrue(messageCount2.compareTo(messageCount1) > 0);
      messageCounterCV = (CompositeValue) messageCounter.getValue();
      assertEquals(messageCounterCV.get("messageCount"), messageCount2);
     
      //
      ManagedOperation listAllMessages = ManagedOperationMatcher.findOperation(ops, "listAllMessages");
      assertNotNull("listAllMessages", listAllMessages);
      MetaValue msgs = listAllMessages.invoke();
      assertNotNull(msgs);
      log.info("listAllMessages.MV: "+msgs);
      assertTrue("msgs is a CollectionValue", msgs instanceof CollectionValue);
      CollectionValue msgsCV = (CollectionValue) msgs;
      MetaValue[] msgsMVs = msgsCV.getElements();
      assertTrue("listAllMessages length > 0", msgsMVs.length > 0);
      for(MetaValue mv : msgsMVs)
      {
         assertTrue(mv instanceof CompositeValue);
         CompositeValue cv = (CompositeValue) mv;
         MetaValue JMSMessageID = cv.get("JMSMessageID");
         log.info(JMSMessageID);
         assertNotNull(JMSMessageID);
         MetaValue JMSCorrelationID = cv.get("JMSCorrelationID");
         log.info(JMSCorrelationID);
         MetaValue JMSTimestamp = cv.get("JMSTimestamp");
         log.info(JMSTimestamp);
         assertNotNull(JMSTimestamp);
      }
      c.stop();
      c.close();
View Full Code Here

         property.setValue(SimpleValueSupport.wrap(34));
        
        
         ManagedProperty configProps = mc.getProperty("connection-properties");
         assertNotNull(configProps);
         CompositeValue collection = (CompositeValue) configProps.getValue();
         configProps.setValue(collection);
        
        
         // update component
         mgtView.updateComponent(mc);
View Full Code Here

   {
      getLog().info(element);
     
      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

   }
  
   private void serviceBindingSetTest(MetaValue metaValue, Map<String, Integer> offsets) throws Exception
   {
      assertTrue(metaValue instanceof CompositeValue);
      CompositeValue bindingSet = (CompositeValue) metaValue;
     
      MetaValue val =  bindingSet.get("name");
      assertNotNull("property name has no value", val);
      assertTrue("property name value is SimpleValue", val instanceof SimpleValue);
      Object simpleVal = ((SimpleValue) val).getValue();
      assertTrue(simpleVal instanceof String);
      String name = (String) simpleVal;
     
      val =  bindingSet.get("defaultHostName");
      assertNotNull("property defaultHostName has no value", val);
      assertEquals("type of defaultHostName value isn't String", String.class.getName(), val.getMetaType().getClassName());
      assertTrue("property defaultHostName value is SimpleValue", val instanceof SimpleValue);
      assertEquals(InetAddress.getByName(getServerHost()), InetAddress.getByName((String) ((SimpleValue) val).getValue()));
     
      val =  bindingSet.get("portOffset");
      assertNotNull("property portOffset has no value", val);
      assertTrue("property portOffset value is SimpleValue", val instanceof SimpleValue);
      simpleVal = ((SimpleValue) val).getValue();
      assertTrue(simpleVal instanceof Integer);
      assertTrue(((Integer) simpleVal).intValue() > -1);
      offsets.put(name, (Integer) simpleVal);
     
      val =  bindingSet.get("overrideBindings");
      assertNotNull("property overrideBindings has no value", val);
      assertTrue("property overrideBindings value is CollectionValue", val instanceof CollectionValue);
      MetaValue[] elements = ((CollectionValue) val).getElements();
      getLog().info(elements);
      for (MetaValue element : elements)
View Full Code Here

   }
  
   private Checked serviceBindingMetadataTest(MetaValue metaValue)
   {
      assertTrue(metaValue instanceof CompositeValue);
      CompositeValue bindingMetadata = (CompositeValue) metaValue;
     
      Checked result = new Checked();
     
      MetaValue val =  bindingMetadata.get("fullyQualifiedName");
      assertNotNull("property fullyQualifiedName has no value", val);
      assertTrue("property fullyQualifiedName value is SimpleValue", val instanceof SimpleValue);
      assertNotNull("property fullyQualifiedName value is not null", ((SimpleValue) val).getValue());
     
      val =  bindingMetadata.get("serviceName");
      assertNotNull("property serviceName has no value", val);
      assertTrue("property serviceName value is SimpleValue", val instanceof SimpleValue);
      assertNotNull("property serviceName value is not null", ((SimpleValue) val).getValue());
     
      val =  bindingMetadata.get("bindingName");
      if (val != null)
      {
         result.bindingName = true;
         assertNotNull("property bindingName has no value", val);
         assertTrue("property bindingName value is SimpleValue", val instanceof SimpleValue);
         assertEquals("type of bindingName value isn't String", String.class.getName(), val.getMetaType().getClassName());
      }
     
      val =  bindingMetadata.get("bindingSetName");
      if (val != null)
      {
         assertNotNull("property bindingSetName has no value", val);
         assertTrue("property bindingSetName value is SimpleValue", val instanceof SimpleValue);
         assertEquals("type of bindingSetName value isn't String", String.class.getName(), val.getMetaType().getClassName());
      }
     
      val =  bindingMetadata.get("hostName");
      if (val != null)
      {
         result.hostname = true;
         assertTrue("property hostName value is SimpleValue", val instanceof SimpleValue);
         assertEquals("type of hostName value isn't String", String.class.getName(), val.getMetaType().getClassName());
      }
     
      val =  bindingMetadata.get("port");
      assertNotNull("property port has no value", val);
      assertTrue("property port value is SimpleValue", val instanceof SimpleValue);
      assertNotNull("property port value is not null", ((SimpleValue) val).getValue());
      assertEquals("type of port value isn't int", int.class.getName(), val.getMetaType().getClassName());
      assertNotNull("property port value is not null", ((SimpleValue) val).getValue());
     
      val =  bindingMetadata.get("description");
      if (val != null)
      {
         result.hostname = true;
         assertNotNull("property hostName has no value", val);
         assertTrue("property description value is SimpleValue", val instanceof SimpleValue);
         assertEquals("type of description value isn't String", String.class.getName(), val.getMetaType().getClassName());
      }
     
      val =  bindingMetadata.get("fixedPort");
      assertNotNull("property bindingName has no value", val);
      assertTrue("property bindingName value is SimpleValue", val instanceof SimpleValue);
      assertNotNull("property bindingName value is not null", ((SimpleValue) val).getValue());
      assertEquals("type of bindingName value isn't boolean", boolean.class.getName(), val.getMetaType().getClassName());
      assertNotNull("property bindingName value is not null", ((SimpleValue) val).getValue());
     
      val =  bindingMetadata.get("fixedHostName");
      assertNotNull("property bindingName has no value", val);
      assertTrue("property bindingName value is SimpleValue", val instanceof SimpleValue);
      assertNotNull("property bindingName value is not null", ((SimpleValue) val).getValue());
      assertEquals("type of bindingName value isn't boolean", boolean.class.getName(), val.getMetaType().getClassName());
      assertNotNull("property bindingName value is not null", ((SimpleValue) val).getValue());
View Full Code Here

   {
      ManagedObject mo = getMOF().initManagedObject(createMD(), null);
      assertNotNull(mo);
     
      ManagedProperty p = mo.getProperty("name");
      CompositeValue c = (CompositeValue) p.getValue();
      assertNotNull(c);
      PropertiesMetaValue properties = (PropertiesMetaValue) c.get("keyPropertyList");
      properties.put("v", "value5");

      // Assert xml information
      PersistedManagedObject restoredElement = restore(mo);
      assertNotNull(restoredElement);
View Full Code Here

      ManagedObject mo = createTestMetaDataMO();
      assertNotNull(mo);
      ManagedProperty p = mo.getProperty("primitive");
      assertNotNull(p);
     
      CompositeValue nested = (CompositeValue) p.getValue();
      MetaValue name = nested.get("name");
      assertNotNull(name);
      MetaValue integer = nested.get("integer");
      assertNotNull(integer);

      // Change values
      Map<String, MetaValue> changedMap = new HashMap<String, MetaValue>();
      changedMap.put("name", new SimpleValueSupport(
            (SimpleMetaType) name.getMetaType(), "newName"));
      changedMap.put("integer", new SimpleValueSupport(
            (SimpleMetaType) integer.getMetaType(), 111));
     
      // Set new values
      p.setValue(
            new CompositeValueSupport(nested.getMetaType(), changedMap)
            );

      // Save and restore
      PersistedManagedObject restored = restore(mo);
      assertNotNull(restored);
     
      // Create empty
      mo = update(new TestMetaData(), restored);
     
      p = mo.getProperty("primitive");
      nested = (CompositeValue) p.getValue();
      name = nested.get("name");
      assertNotNull(name);
      integer = nested.get("integer");
      assertNotNull(integer);
     
      //
      assertEquals(111, ((SimpleValue) integer).getValue());
      assertEquals("newName", ((SimpleValue) name).getValue());
View Full Code Here

      mo = update(new TestMetaData(), restored);
     
      p = mo.getProperty("testMap");
      assertNotNull(p);
     
      CompositeValue changedComposite = (CompositeValue) p.getValue();
      assertNotNull(changedComposite);
     
      v = (SimpleValue) changedComposite.get("testString2");
      assertEquals("changedString", v.getValue());
   }
View Full Code Here

         // Security
         Element security = d.createElement("security");
         for(String name : metaType.itemSet())
         {
            // Role
            CompositeValue row = (CompositeValue) value.get(name);
            // FIXME the MapMetaType might not be up 2 date
            if(row == null)
               continue;
           
            Element role = d.createElement("role");
            role.setAttribute("name", name);
           
            // For each attribute: read, write, create
            for(String attribute : attributes)
            {
               SimpleValue v = (SimpleValue) row.get(attribute);
               if(v != null && v.getValue() != null)
               {
                  role.setAttribute(attribute, ((Boolean)v.getValue()).toString());
               }
            }
View Full Code Here

TOP

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

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.