Package org.jboss.metatype.api.values

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


      // heapMemoryUsage
      ManagedProperty heapMemoryUsage = props.get("heapMemoryUsage");
      assertNotNull(heapMemoryUsage);
      assertEquals("object representing the heap memory usage.", heapMemoryUsage.getDescription());
      CompositeValue heapMemoryUsageMV = CompositeValue.class.cast(heapMemoryUsage.getValue());
      assertNotNull(heapMemoryUsageMV);
      getLog().debug("heapMemoryUsageMV; "+heapMemoryUsageMV);
      MemoryUsage heapMemoryUsageMU = ManagementFactoryUtils.unwrapMemoryUsage(heapMemoryUsageMV);
      assertTrue(heapMemoryUsageMU.getInit() >= 0);
      assertTrue(heapMemoryUsageMU.getUsed() >= 1000);
      assertTrue(heapMemoryUsageMU.getMax() >= heapMemoryUsageMU.getCommitted());
      assertTrue(heapMemoryUsageMU.getCommitted() >=  heapMemoryUsageMU.getUsed());

      // nonHeapMemoryUsage
      ManagedProperty nonHeapMemoryUsage = props.get("nonHeapMemoryUsage");
      assertNotNull(nonHeapMemoryUsage);
      assertEquals("object representing the non-heap memory usage.", nonHeapMemoryUsage.getDescription());
      CompositeValue nonHeapMemoryUsageMV = CompositeValue.class.cast(nonHeapMemoryUsage.getValue());
      assertNotNull(nonHeapMemoryUsageMV);
      getLog().debug("nonHeapMemoryUsageMV; "+nonHeapMemoryUsageMV);
      MemoryUsage nonHeapMemoryUsageMU = ManagementFactoryUtils.unwrapMemoryUsage(nonHeapMemoryUsageMV);
      assertTrue(nonHeapMemoryUsageMU.getInit() >= 0);
      assertTrue(nonHeapMemoryUsageMU.getUsed() >= 1000);
View Full Code Here


      MetaValue tid0InfoMV = getThreadInfo.invoke(tid0SV);
      assertNotNull(tid0InfoMV);
      assertTrue(tid0InfoMV instanceof CompositeValue);
      log.debug(tid0InfoMV);
      CompositeValue tid0InfoCV = (CompositeValue) tid0InfoMV;
      ThreadInfo tid0Info = ManagementFactoryUtils.unwrapThreadInfo(tid0InfoCV);
      log.debug(tid0Info);
   }
View Full Code Here

      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

   {
      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(name + " -- property defaultHostName has no value", val);
      assertEquals(name + " -- type of defaultHostName value isn't String", String.class.getName(), val.getMetaType().getClassName());
      assertTrue(name + " -- property defaultHostName value is SimpleValue", val instanceof SimpleValue);
      // Only do further validation of the binding sets that the AS normally ships;
      // ignore any earlier ones that other tests may have added since we don't
      // know the correct assertions
      if ("ports-default".equals(name) || "ports-01".equals(name) || "ports-02".equals(name) || "ports-03".equals(name))
      {
         assertEquals(name + " -- correct defaultHostName value", InetAddress.getByName(getServerHost()), InetAddress.getByName((String) ((SimpleValue) val).getValue()));
      }
        
      val =  bindingSet.get("portOffset");
      assertNotNull(name + " -- property portOffset has no value", val);
      assertTrue(name + " -- 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(name + " -- property overrideBindings has no value", val);
      assertTrue(name + " -- property overrideBindings value is CollectionValue", val instanceof CollectionValue);
      MetaValue[] elements = ((CollectionValue) val).getElements();
      getLog().info(elements);
      for (MetaValue element : elements)
View Full Code Here

         MetaValue m0 = listAllMessagesElements[0];
         MetaType m0MT = m0.getMetaType();
         assertTrue("m0MT.isComposite", m0MT.isComposite());
         assertTrue("m0MT instanceof CompositeMetaType", m0MT instanceof CompositeMetaType);
         assertTrue("m0 instanceof CompositeValue", m0 instanceof CompositeValue);
         CompositeValue m0MV = (CompositeValue) m0;
         log.debug("m0MV.values: "+m0MV.values());
      }
   }
View Full Code Here

      CollectionValue subscriptionsCV = (CollectionValue) subscriptions;
      assertTrue("subscriptions.size > 0", subscriptionsCV.getSize() > 0);
      MetaValue[] subscriptionsMVs = subscriptionsCV.getElements();
      for(MetaValue mv : subscriptionsMVs)
      {
         CompositeValue cv = (CompositeValue) mv;
         MetaValue name = cv.get("name");
         log.info(name);
         MetaValue clientID = cv.get("clientID");
         log.info(clientID);
         MetaValue durable = cv.get("durable");
         log.info(durable);
         MetaValue selector = cv.get("selector");
         log.info(selector);
         MetaValue id = cv.get("id");
         log.info(id);
         MetaValue maxSize = cv.get("maxSize");
         log.info(maxSize);
         MetaValue messageCount = cv.get("messageCount");
         log.info(messageCount);
      }
   }
View Full Code Here

         assertEquals(1, nondurable.getValue());
         assertEquals(0, durable.getValue());
         assertEquals(1, all.getValue());
         assertEquals(10, allMessageCount.getValue());
  
         CompositeValue messageCounter = (CompositeValue) messageCounters.iterator().next();
         assertNotNull(messageCounter);
        
         SimpleValue count = (SimpleValue) messageCounter.get("messageCount");
         assertEquals(count, allMessageCount);
      }
      finally
      {
         pub.close();
View Full Code Here

      // 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

      ManagedProperty connectionProperties = mo.getProperty("config-property");
      MetaType cpType = connectionProperties.getMetaType();
      assertTrue("connection-properties.type="+cpType, cpType instanceof CompositeMetaType);
      Object cpValue = connectionProperties.getValue();
      assertTrue("connection-properties.value="+cpValue, cpValue instanceof CompositeValue);
      CompositeValue cvalue = (CompositeValue) cpValue;
      // Now update the values
      MapCompositeValueSupport map = (MapCompositeValueSupport) cvalue;

      // Test simple property types
      ManagedProperty xatx = mo.getProperty("xa-transaction");
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.