Package org.jboss.managed.api

Examples of org.jboss.managed.api.ManagedProperty


   {
      IndexedArray result = new IndexedArray();
     
      // First confirm the expected binding set is there
     
      ManagedProperty prop = properties.get("bindingSets");
      assertNotNull("Missing property bindingSets", prop);
      MetaValue val =  prop.getValue();
      assertNotNull("property bindingSets has no value", val);
      assertTrue("property bindingSets value is CollectionValue", val instanceof CollectionValue);
      MetaValue[] elements = ((CollectionValue) val).getElements();
      assertNotNull(elements);
      assertEquals(numSets, elements.length);
      result.array = elements;
      boolean sawAdded = false;
      for (int i = 0; i < elements.length; i++)
      {
         MetaValue mv = elements[i];
         if ("ports-test".equals(getSimpleValue(mv, "name")))
         {
            sawAdded = true;
            assertEquals("added binding set has correct defaultHostName",
                  "localhost", getSimpleValue(mv, "defaultHostName"));
            assertEquals("added binding set has correct portOffset",
                  portOffset, getSimpleValue(mv, "portOffset", Integer.class).intValue());
            MetaValue overVal = ((CompositeValue) mv).get("overrideBindings");
            assertTrue(overVal instanceof CollectionValue);
            MetaValue[] overrides = ((CollectionValue) overVal).getElements();
            assertNotNull("added binding set has overrides", overrides);
            assertEquals("added binding set has correct # of overrides", 1, overrides.length);
            mv = overrides[0];
            assertEquals("added binding set has AddedOverrideBinding",
                  "AddedOverrideBinding", getSimpleValue(mv, "serviceName"));
            assertNull("AddedOverrideBinding has null bindingName",
                       getSimpleValue(mv, "bindingName"));
            assertEquals("AddedOverrideBinding has correct description",
                       "description", getSimpleValue(mv, "description"));
            assertNull("AddedOverrideBinding has null hostName",
                  getSimpleValue(mv, "hostName"));
            assertEquals("AddedOverrideBinding has correct port",
                  overrideBindingPort, getSimpleValue(mv, "port", Integer.class).intValue());
            assertFalse("AddedOverrideBinding has correct fixedHostName",
                  getSimpleValue(mv, "fixedHostName", Boolean.class).booleanValue());
            assertFalse("AddedOverrideBinding has correct fixedPort",
                  getSimpleValue(mv, "fixedPort", Boolean.class).booleanValue());
            result.index = i;
            break;
         }
      }
      assertTrue(sawAdded);
     
      // Next validate the expected actual bindings are there
      prop = properties.get("serviceBindings");
      assertNotNull("Missing property serviceBindings", prop);
      val =  prop.getValue();
      assertNotNull("property serviceBindings has no value", val);
      assertTrue("property serviceBindings value is Composite", val instanceof CompositeValue);
      val = ((CompositeValue) val).get("ports-test");
      assertNotNull(val);
      assertTrue("property serviceBindings value is CollectionValue", val instanceof CollectionValue);
View Full Code Here


     
      // Test ThreadInfo MetaValue wrap/unwrap
      MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();

      // Properties
      ManagedProperty allThreadIds = mo.getProperty("allThreadIds");
      assertNotNull(allThreadIds);
      MetaValue allThreadIdsMV = allThreadIds.getValue();
      assertTrue("allThreadIds is Array", allThreadIdsMV instanceof ArrayValue);
      ArrayValue idsArray = ArrayValue.class.cast(allThreadIdsMV);
      assertTrue(idsArray.getLength() > 10);
      SimpleValue tid0SV = SimpleValue.class.cast(idsArray.getValue(0));
      ManagedProperty currentThreadCpuTime = mo.getProperty("currentThreadCpuTime");
      assertNotNull(currentThreadCpuTime);
      long x = (Long) metaValueFactory.unwrap(currentThreadCpuTime.getValue());
      assertTrue(x > 1000);
      ManagedProperty currentThreadUserTime = mo.getProperty("currentThreadUserTime");
      assertNotNull(currentThreadUserTime);
      ManagedProperty daemonThreadCount = mo.getProperty("daemonThreadCount");
      assertNotNull(daemonThreadCount);
      x = (Integer) metaValueFactory.unwrap(daemonThreadCount.getValue());
      assertTrue(x > 1);
      ManagedProperty peakThreadCount = mo.getProperty("peakThreadCount");
      assertNotNull(peakThreadCount);
      x = (Integer) metaValueFactory.unwrap(peakThreadCount.getValue());
      assertTrue(x > 10);
      ManagedProperty threadCount = mo.getProperty("threadCount");
      assertNotNull(threadCount);
      x = (Integer) metaValueFactory.unwrap(threadCount.getValue());
      assertTrue(x > 10);
      ManagedProperty totalStartedThreadCount = mo.getProperty("totalStartedThreadCount");
      assertNotNull(totalStartedThreadCount);
      x = (Long) metaValueFactory.unwrap(totalStartedThreadCount.getValue());
      assertTrue(x > 10);
      ManagedProperty currentThreadCpuTimeSupported = mo.getProperty("currentThreadCpuTimeSupported");
      assertNotNull(currentThreadCpuTimeSupported);
      Boolean flag = (Boolean) metaValueFactory.unwrap(currentThreadCpuTimeSupported.getValue());
      assertNotNull(flag);
      ManagedProperty threadContentionMonitoringEnabled = mo.getProperty("threadContentionMonitoringEnabled");
      assertNotNull(threadContentionMonitoringEnabled);
      flag = (Boolean) metaValueFactory.unwrap(threadContentionMonitoringEnabled.getValue());
      assertNotNull(flag);
      ManagedProperty threadContentionMonitoringSupported = mo.getProperty("threadContentionMonitoringSupported");
      assertNotNull(threadContentionMonitoringSupported);
      flag = (Boolean) metaValueFactory.unwrap(threadContentionMonitoringSupported.getValue());
      assertNotNull(flag);
      ManagedProperty threadCpuTimeEnabled = mo.getProperty("threadCpuTimeEnabled");
      assertNotNull(threadCpuTimeEnabled);
      flag = (Boolean) metaValueFactory.unwrap(threadCpuTimeEnabled.getValue());
      assertNotNull(flag);
      ManagedProperty threadCpuTimeSupported = mo.getProperty("threadCpuTimeSupported");
      assertNotNull(threadCpuTimeSupported);
      flag = (Boolean) metaValueFactory.unwrap(threadCpuTimeSupported.getValue());
      assertNotNull(flag);

      // Ops
      Set<ManagedOperation> ops = mo.getOperations();
      log.debug(ops);
View Full Code Here

      assertEquals(ManagementFactory.RUNTIME_MXBEAN_NAME, mo.getName());

      RuntimeMXBean mbean = ManagementFactory.getRuntimeMXBean();
      MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
     
      ManagedProperty bootClassPath = mo.getProperty("bootClassPath");
      String x = (String) metaValueFactory.unwrap(bootClassPath.getValue());
      assertTrue(x.length() > 0);
      ManagedProperty classPath = mo.getProperty("classPath");
      x = (String) metaValueFactory.unwrap(classPath.getValue());
      assertTrue(x.length() > 0);
      ManagedProperty libraryPath = mo.getProperty("libraryPath");
      x = (String) metaValueFactory.unwrap(libraryPath.getValue());
      assertTrue(x.length() > 0);
      ManagedProperty managementSpecVersion = mo.getProperty("managementSpecVersion");
      x = (String) metaValueFactory.unwrap(managementSpecVersion.getValue());
      assertEquals(mbean.getManagementSpecVersion(), x);     
      ManagedProperty specName = mo.getProperty("specName");
      x = (String) metaValueFactory.unwrap(specName.getValue());
      assertEquals(mbean.getSpecName(), x);     
      ManagedProperty specVendor = mo.getProperty("specVendor");
      x = (String) metaValueFactory.unwrap(specVendor.getValue());
      assertEquals(mbean.getSpecVendor(), x);     
      ManagedProperty specVersion = mo.getProperty("specVersion");
      x = (String) metaValueFactory.unwrap(specVersion.getValue());
      assertEquals(mbean.getSpecVersion(), x);     
      ManagedProperty vmName = mo.getProperty("vmName");
      x = (String) metaValueFactory.unwrap(vmName.getValue());
      assertEquals(mbean.getVmName(), x);     
      ManagedProperty vmVendor = mo.getProperty("vmVendor");
      x = (String) metaValueFactory.unwrap(vmVendor.getValue());
      assertEquals(mbean.getVmVendor(), x);     
      ManagedProperty vmVersion = mo.getProperty("vmVersion");
      x = (String) metaValueFactory.unwrap(vmVersion.getValue());
      assertEquals(mbean.getVmVersion(), x);
      ManagedProperty startTime = mo.getProperty("startTime");
      long time = (Long) metaValueFactory.unwrap(startTime.getValue());
      assertTrue(time > 10000000);
      ManagedProperty uptime = mo.getProperty("uptime");
      time = (Long) metaValueFactory.unwrap(uptime.getValue());
      ManagedProperty inputArguments = mo.getProperty("inputArguments");
      List<String> ls = (List<String>) metaValueFactory.unwrap(inputArguments.getValue());
      assertTrue(ls.size() > 0);
      ManagedProperty systemProperties = mo.getProperty("systemProperties");
      MetaValue sysPropsMV = systemProperties.getValue();
      Map<String, String> sysProps = (Map<String, String>) metaValueFactory.unwrap(sysPropsMV);
      log.debug(sysProps);
      assertNotNull(sysProps.get("jboss.home.dir"));
      assertTrue(sysProps.get("jboss.home.dir") instanceof String);
      assertNotNull(sysProps.get("jboss.server.home.dir"));
View Full Code Here

      ComponentType type = new ComponentType("MBean", "Platform");
      ManagedComponent mo = mgtView.getComponent(ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME, type);
      assertNotNull(mo);
      assertEquals(ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME, mo.getName());

      ManagedProperty arch = mo.getProperty("arch");
      assertNotNull(arch);
      ManagedProperty availableProcessors = mo.getProperty("availableProcessors");
      assertNotNull(availableProcessors);
      SimpleValue procsSV = (SimpleValue) availableProcessors.getValue();
      Integer procs = (Integer) procsSV.getValue();
      assertTrue(procs.intValue() >= 1);
      ManagedProperty version = mo.getProperty("version");
      assertNotNull(version);
      log.debug(version.getValue());
   }
View Full Code Here

      ManagementView managementView = getManagementView();
      ComponentType type = new ComponentType("ConnectionFactory", "Tx");
      ManagedComponent component = managementView.getComponent("JmsXA", type);
      assertNotNull(component);
  
      ManagedProperty property = component.getProperty("max-pool-size");
      assertNotNull(property);
     
      assertEquals(21, ((SimpleValue) property.getValue()).getValue());
   }
View Full Code Here

      ManagementView mgtView = getManagementView();
      ManagedComponent queue = mgtView.getComponent("DLQ", QueueType);
      assertNotNull(queue);
      assertEquals("DLQ", queue.getName());
      // Validate some of the expected properties
      ManagedProperty bindings = queue.getProperty("bindings");
      assertNotNull(bindings);
      assertEquals(ArrayMetaType.getArrayType(SimpleMetaType.STRING), bindings.getMetaType());
      Object o = bindings.getValue();
      assertNotNull(o);
      o = getMetaValueFactory().unwrap((MetaValue) o);
      assertTrue(o.getClass().toString(), o instanceof String[]);
      String[] entries = (String[]) o;
      assertEquals(1, entries.length);
View Full Code Here

      createComponentTest("QueueTemplate", propValues, getName(), type, jndiName);
      ManagedComponent queue = activeView.getComponent("testCreateQueue", type);
      assertNotNull(queue);
      assertEquals("testCreateQueue", queue.getName());

      ManagedProperty bindings = queue.getProperty("bindings");
      assertNotNull(bindings);
      MetaType bindingsType = bindings.getMetaType();
      assertEquals(ArrayMetaType.getArrayType(SimpleMetaType.STRING), bindingsType);
   }
View Full Code Here

      DeploymentTemplateInfo queue1Info = managementView.getTemplate(templateName);
      Map<String, ManagedProperty> testCreateQueue1Props = queue1Info.getProperties();
      log.debug("QueueTemplate#1: "+testCreateQueue1Props);
      for(String propName : testCreateQueue1Props.keySet())
      {
         ManagedProperty prop = testCreateQueue1Props.get(propName);
         assertNotNull("property " + propName + " found in template " + templateName, prop);
         log.debug("createComponentTest("+propName+") before: "+prop.getValue());
         prop.setValue(propValues.get(propName));
         log.debug("createComponentTest("+propName+") after: "+prop.getValue());
      }
      managementView.applyTemplate("testCreateQueue1", queue1Info);
      managementView.process();

      // testCreateQueue2
      jndiName = "testCreateQueue2";
      MetaValue jndiName2MV = SimpleValueSupport.wrap(jndiName);
      propValues.put("JNDIName", jndiName2MV);
      // Get a fresh template info view
      DeploymentTemplateInfo queue2Info = managementView.getTemplate(templateName);
      Map<String, ManagedProperty> testCreateQueue2Props = queue2Info.getProperties();
      log.debug("QueueTemplate#2: "+testCreateQueue2Props);
      // Validate the properties don't have the previous template values
      ManagedProperty jndiNameCheck1 = testCreateQueue2Props.get("JNDIName");
      assertFalse("Fresh temmplate properties does not have previous JNDIName",
            jndiName1MV.equals(jndiNameCheck1.getValue()));
      for(String propName : testCreateQueue2Props.keySet())
      {
         ManagedProperty prop = testCreateQueue2Props.get(propName);
         assertNotNull("property " + propName + " found in template " + templateName, prop);
         log.debug(propName+" before: "+prop.getValue());
         prop.setValue(propValues.get(propName));
         log.debug(propName+" after: "+prop.getValue());
      }
      managementView.applyTemplate("testCreateQueue2", queue2Info);
      managementView.process();

      // Validate the components
View Full Code Here

      createComponentTest("TopicTemplate", propValues, getName(), TopicType, jndiName);
      ManagedComponent topic = activeView.getComponent("testCreateTopic", TopicType);
      assertNotNull(topic);
      assertEquals("testCreateTopic", topic.getName());
     
      ManagedProperty bindings = topic.getProperty("bindings");
      assertNotNull(bindings);
      MetaType bindingsType = bindings.getMetaType();
      assertEquals(ArrayMetaType.getArrayType(SimpleMetaType.STRING), bindingsType);
   }
View Full Code Here

      Message response = mc.receive();
      log.info("Consumer saw: "+response);

      // Check some stats
      log.info(topic.getProperties().keySet());
      ManagedProperty NonDurableSubscriptionsCount = topic.getProperty("nonDurableSubscriptionsCount");
      assertNotNull(NonDurableSubscriptionsCount);
      log.info(NonDurableSubscriptionsCount);
      SimpleValue NonDurableSubscriptionsCountMV = (SimpleValue) NonDurableSubscriptionsCount.getValue();
      log.info(NonDurableSubscriptionsCountMV);
      assertTrue(NonDurableSubscriptionsCountMV.compareTo(SimpleValueSupport.wrap(0)) > 0);

      Set<ManagedOperation> ops = topic.getOperations();
      log.info("Topic ops: "+ops);
View Full Code Here

TOP

Related Classes of org.jboss.managed.api.ManagedProperty

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.