Package org.jboss.metatype.api.values

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


      if (val != null)
      {
         assertTrue(val instanceof String);
      }
      assertNotNull(getSimpleValue(compVal, "className", String.class));
      MetaValue mv = compVal.get("protocolParameters");
      assertNotNull(mv);
      assertTrue(mv + " (" + mv.getClass().getSimpleName() + ") is a CompositeValue", mv instanceof CompositeValue);
      CompositeValue params = (CompositeValue) mv;
//      MetaValue[] elements = params.getElements();
      for (String paramName : params.getMetaType().keySet())
      {
         validateProtocolParameter(params.get(paramName));
View Full Code Here


      result.clusterName = getSimpleValue(compVal, "clusterName", String.class);     
      assertNotNull("Channel " + result.id + " has clusterName", result.clusterName);
     
      result.stackName = getSimpleValue(compVal, "stackName", String.class);
     
      MetaValue mv = compVal.get("protocolStackConfiguration");
      assertNotNull(result.stackName + " has a protocolStackConfiguration", mv);
      assertTrue("protocolStackConfiguration (" + mv.getClass().getSimpleName() + ") is a CollectionValue",mv instanceof CollectionValue);
      CollectionValue config = (CollectionValue) mv;
      MetaValue[] elements = config.getElements();
      for (MetaValue element : elements)
      {
         ManagedObjectTestUtil.validateProtocolStackConfiguration(element);
      }
     
      mv = compVal.get("channelObjectName");
      validateObjectNameMetaValue(mv);
     
      mv = compVal.get("protocolObjectNames");
      assertNotNull(result.stackName + " has protocolObjectNames", mv);
      assertTrue("protocolObjectNames (" + mv.getClass().getSimpleName() + ") is a CollectionValue", mv instanceof CollectionValue);
      CollectionValue protocolNames = (CollectionValue) mv;
      elements = protocolNames.getElements();
      for (MetaValue element : elements)
      {
         validateObjectNameMetaValue(element);
View Full Code Here

      CompositeValue compVal = (CompositeValue) metaValue;
      assertNotNull(getSimpleValue(compVal, "id", Long.class));
      assertNotNull(getSimpleValue(compVal, "creator", String.class));
      String coord = getSimpleValue(compVal, "coordinator", String.class);
      assertNotNull(coord);
      MetaValue mv = compVal.get("members");
      assertTrue(mv instanceof CollectionValue);
      CollectionValue protocolNames = (CollectionValue) mv;
      MetaValue[] elements = protocolNames.getElements();
      boolean foundCoord = false;
      for (MetaValue element : elements)
View Full Code Here

   public static <T> T getSimpleValue(MetaValue val, String key, Class<T> type)
   {
      T result = null;
      assertTrue(val instanceof CompositeValue);
      CompositeValue cval = (CompositeValue) val;
      MetaValue mv = cval.get(key);
      if (mv != null)
      {
         assertTrue(mv instanceof SimpleValue);
         Object obj = ((SimpleValue) mv).getValue();
         result = type.cast(obj);
View Full Code Here

      // Operations
      Set<ManagedOperation> ops = mc.getOperations();
      log.info("ServerInfo.ops: "+ ops);
      ManagedOperation listThreadCpuUtilization = ManagedOperationMatcher.findOperation(ops, "listThreadCpuUtilization");
      assertNotNull(listThreadCpuUtilization);
      MetaValue listThreadCpuUtilizationMV = listThreadCpuUtilization.invoke();
      // TODO
      assertNotNull(listThreadCpuUtilizationMV);
      assertEquals(SimpleMetaType.STRING, listThreadCpuUtilizationMV.getMetaType());
      SimpleValue listThreadCpuUtilizationSV = (SimpleValue) listThreadCpuUtilizationMV;
      String cpuUtilization = (String) listThreadCpuUtilizationSV.getValue();
      log.info(cpuUtilization);
      assertTrue(cpuUtilization.length() > 100);
     
View Full Code Here

      channel2 = factory.createMultiplexerChannel("shared1", "no2");
      channel2.connect("channel2");
     
      Set<ChannelInfo> channels = factory.getOpenChannels();
      OpenChannelsMapper testee = new OpenChannelsMapper();
      MetaValue val = testee.createMetaValue(testee.getMetaType(), channels);
      Set<ChannelIds> ids = ManagedObjectTestUtil.validateOpenChannels(val);
     
      for (ChannelIds cid : ids)
      {
         if ("no1".equals(cid.id))
View Full Code Here

      PropertyInfo propertyInfo = property.getField(Fields.PROPERTY_INFO, PropertyInfo.class);
      if(propertyInfo == null)
         propertyInfo = beanInfo.getProperty(name);
     
      Object bean = locateBean(attachment.getName());
      MetaValue mvalue = null;
      if(propertyInfo.isReadable() == false)
      {
         if(log.isTraceEnabled())
            log.trace("Skipping get of non-readable property: "+propertyInfo);
         return null;
View Full Code Here

         operations.put(mo.getName(), mo);
      }
     
      ManagedOperation mgdop = operations.get("showHistory");
      assertNotNull("HAPartition has showHistory", mgdop);
      MetaValue result = mgdop.invoke();
      assertNotNull(result);
     
      mgdop = operations.get("showHistoryAsXML");
      assertNotNull("HAPartition has showHistoryAsXML", mgdop);
      result = mgdop.invoke();
      assertNotNull(result);
     
      mgdop = operations.get("getDRMServiceNames");
      assertNotNull("HAPartition has getDRMServiceNames", mgdop);
      result = mgdop.invoke();
      assertTrue(result instanceof CollectionValue);
      MetaValue[] elements = ((CollectionValue) result).getElements();
      assertNotNull(elements);
      boolean found = false;
      for (MetaValue element : elements)
      {
         assertTrue(element instanceof SimpleValue);
         if (HAJNDI.equals(((SimpleValue) element).getValue()))
         {
            found = true;
            break;
         }
      }
      assertTrue(found);
     
      mgdop = operations.get("listDRMContent");     
      assertNotNull("HAPartition has listDRMContent", mgdop);
      result = mgdop.invoke();
      assertTrue(result instanceof SimpleValue);
      Object val = ((SimpleValue) result).getValue();
      assertTrue(val instanceof String);
      assertTrue(((String) val).indexOf(HAJNDI) > -1);
     
      mgdop = operations.get("listDRMContentAsXml");
      assertNotNull("HAPartition has listDRMContentAsXml", mgdop);
      result = mgdop.invoke();
      assertTrue(result instanceof SimpleValue);
      val = ((SimpleValue) result).getValue();
      assertTrue(val instanceof String);
      assertTrue(((String) val).indexOf(HAJNDI) > -1);
     
      mgdop = operations.get("getDRMServiceViewId");
      assertNotNull("HAPartition has getDRMServiceViewId", mgdop)
      MetaValue hajndiparam = SimpleValueSupport.wrap(HAJNDI);
      MetaValue[] hajndiparams = new MetaValue[]{hajndiparam};
      result = mgdop.invoke(hajndiparams);
      assertNotNull(result);
     
      mgdop = operations.get("lookupDRMNodeNames");
      assertNotNull("HAPartition has lookupDRMNodeNames", mgdop);
      result = mgdop.invoke(hajndiparams);
      assertTrue(result instanceof CollectionValue);
      elements = ((CollectionValue) result).getElements();
      assertNotNull(elements);
      assertEquals(2, elements.length);
     
      mgdop = operations.get("isDRMMasterForService");
      assertNotNull("HAPartition has isDRMMasterForService", mgdop);
      result = mgdop.invoke(hajndiparams);
      assertTrue(result instanceof SimpleValue);
      val = ((SimpleValue) result).getValue();
      assertTrue(val instanceof Boolean);
     
      mgdop = operations.get("create");
      assertNotNull("HAPartition has create", mgdop);
     
      mgdop = operations.get("start");
      assertNotNull("HAPartition has start", mgdop);
     
      mgdop = operations.get("stop");
      assertNotNull("HAPartition has stop", mgdop);
     
      mgdop = operations.get("destroy");
      assertNotNull("HAPartition has destroy", mgdop);
     
      assertEquals("Correct number of operations", 12, operations.size());
     
      for (Map.Entry<String, ManagedProperty> entry : mc.getProperties().entrySet())
      {
         getLog().debug(entry.getKey() + " == " + entry.getValue());
         ManagedObject mo = entry.getValue().getTargetManagedObject();
         if (mo != null)
         {
            getLog().debug(entry.getKey() + " -- ManagedObject == " + mo);
         }
      }
     
      ManagedProperty prop = mc.getProperty("stateString");
      assertNotNull("HAPartition has property stateString", prop);
      MetaValue metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertNotNull(val);
      assertTrue(val instanceof String);
     
View Full Code Here

                        onValues.toArray(new MetaValue[onValues.size()])));
         }
        
         data.put("localAddress", SimpleValueSupport.wrap(chInfo.getLocalAddress().toString()));
        
         MetaValue viewValue = createViewMetaValue(chInfo.getCurrentView());
         data.put("currentView", viewValue);
        
         elements.add(new MapCompositeValueSupport(data, CHANNEL_TYPE));
      }
      return new CollectionValueSupport(TYPE, elements.toArray(new MetaValue[elements.size()]));
View Full Code Here

      if (memberValues.length > 0)
      {
         viewMap.put("coordinator", memberValues[0]);
      }
     
      MetaValue viewValue = new MapCompositeValueSupport(viewMap, VIEW_TYPE);
      return viewValue;
   }
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.