Package org.jboss.metatype.api.values

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


        MetaType genericMetaType = ProfileServiceTestUtil.createMetaTypes().get(ProfileServiceTestUtil.GENERIC_TYPE);
        GenericValue genericValue = new GenericValueSupport((GenericMetaType) genericMetaType, "GenericValue");
        PropertyAdapter adapter1 = PropertyAdapterFactory.getPropertyAdapter(genericValue);
        assert adapter1 instanceof PropertyMapToGenericValueAdapter : "Should be the PropertyMap to Generic adapter";

        SimpleValue simpleValue = SimpleValueSupport.wrap("SimpleValue");
        PropertyAdapter adapter2 = PropertyAdapterFactory.getPropertyAdapter(simpleValue);
        assert adapter2 instanceof PropertySimpleToSimpleValueAdapter : "Should be the PropertySimple to Simple adapter";

    }
View Full Code Here


      CompositeMetaType compType = (CompositeMetaType) secDomain.getMetaType();
      assertNotNull(compType);
      CompositeValue sdCV = (CompositeValue) secDomain.getValue();
      assertNotNull("security-domain.CV", sdCV);

      SimpleValue domainName = (SimpleValue) sdCV.get("domain");
      assertNotNull("security-domain.domain", domainName);
      assertEquals(SimpleValueSupport.wrap("java:/jaas/SomeDomain"), domainName);
      assertNotNull("security-domain.deploymentType", sdCV.get("securityDeploymentType"));
      assertEquals("APPLICATION", ((EnumValue) sdCV.get("securityDeploymentType")).getValue());
      assertFalse(lds.getSecurityMetaData() instanceof SecurityDomainApplicationManagedMetaData);
View Full Code Here

   protected void assertRow(TableValue table, Serializable key, Serializable value)
   {
      CompositeValue v = (CompositeValue) table.get(new MetaValue[] { SimpleValueSupport.wrap(key) });
      assertNotNull(v);
      // Assert value
      SimpleValue simple = (SimpleValue) v.get("value");
      assertNotNull(simple);
      assertEquals(value, simple.getValue());     
   }
View Full Code Here

{
  
   public static <T> T getValueFromComposite(CompositeValue composite, String key, Class<T> type)
   {
      T result = null;
      SimpleValue sv = (SimpleValue) composite.get(key);
      if (sv != null)
      {
         Object val = sv.getValue();
         result = type.cast(val);
      }
      return result;
   }
View Full Code Here

   private static class FullyQualifiedNameComparator implements Comparator<CompositeValue>
   {

      public int compare(CompositeValue o1, CompositeValue o2)
      {
         SimpleValue sv1 = (SimpleValue) o1.get("fullyQualifiedName");
         if (sv1 == null)
         {
            throw new IllegalStateException(o1 + " has no fullyQualifiedName");
         }
         SimpleValue sv2 = (SimpleValue) o2.get("fullyQualifiedName");
         if (sv2 == null)
         {
            throw new IllegalStateException(o2 + " has no fullyQualifiedName");
         }
        
         String name1 = (String) sv1.getValue();
         String name2 = (String) sv2.getValue();
         return name1.compareTo(name2);
      }     
View Full Code Here

   private static class NameComparator implements Comparator<CompositeValue>
   {

      public int compare(CompositeValue o1, CompositeValue o2)
      {
         SimpleValue sv1 = (SimpleValue) o1.get("name");
         if (sv1 == null)
         {
            throw new IllegalStateException(o1 + " has no name");
         }
         SimpleValue sv2 = (SimpleValue) o2.get("name");
         if (sv2 == null)
         {
            throw new IllegalStateException(o2 + " has no name");
         }
        
         String name1 = (String) sv1.getValue();
         String name2 = (String) sv2.getValue();
         return name1.compareTo(name2);
      }     
View Full Code Here

   private static class FullyQualifiedNameComparator implements Comparator<CompositeValue>
   {

      public int compare(CompositeValue o1, CompositeValue o2)
      {
         SimpleValue sv1 = (SimpleValue) o1.get("fullyQualifiedName");
         if (sv1 == null)
         {
            throw new IllegalStateException(o1 + " has no fullyQualifiedName");
         }
         SimpleValue sv2 = (SimpleValue) o2.get("fullyQualifiedName");
         if (sv2 == null)
         {
            throw new IllegalStateException(o2 + " has no fullyQualifiedName");
         }
        
         String name1 = (String) sv1.getValue();
         String name2 = (String) sv2.getValue();
         return name1.compareTo(name2);
      }
View Full Code Here

      // totalLoadedClassCount
      ManagedProperty totalLoadedClassCount = props.get("totalLoadedClassCount");
      assertNotNull(totalLoadedClassCount);
      assertEquals(SimpleMetaType.LONG_PRIMITIVE, totalLoadedClassCount.getMetaType());
      assertEquals("the total number of classes loaded.", totalLoadedClassCount.getDescription());
      SimpleValue totalLoadedClassCountSV = SimpleValue.class.cast(totalLoadedClassCount.getValue());
      assertNotNull(totalLoadedClassCountSV);
      getLog().debug("totalLoadedClassCountSV"+totalLoadedClassCountSV);
      SimpleValue sv1 = SimpleValueSupport.wrap(new Long(100));
      assertTrue("> 100 classes loaded", sv1.compareTo(totalLoadedClassCountSV) < 0);
      // loadedClassCount
      ManagedProperty loadedClassCount = props.get("loadedClassCount");
      assertNotNull(loadedClassCount);
      assertEquals(SimpleMetaType.INTEGER_PRIMITIVE, loadedClassCount.getMetaType());
      assertEquals("the number of currently loaded classes.", loadedClassCount.getDescription());
      SimpleValue loadedClassCountSV = SimpleValue.class.cast(loadedClassCount.getValue());
      assertNotNull(loadedClassCountSV);
      getLog().debug("loadedClassCountSV"+loadedClassCountSV);
      assertTrue("> 100 classes loaded", sv1.compareTo(loadedClassCountSV) < 0);
      // unloadedClassCount
      ManagedProperty unloadedClassCount = props.get("unloadedClassCount");
      assertNotNull(unloadedClassCount);
      assertEquals(SimpleMetaType.LONG_PRIMITIVE, unloadedClassCount.getMetaType());
      assertEquals("the total number of unloaded classes.", unloadedClassCount.getDescription());
      SimpleValue unloadedClassCountSV = SimpleValue.class.cast(unloadedClassCount.getValue());
      assertNotNull(unloadedClassCountSV);
      getLog().debug("unloadedClassCountSV"+unloadedClassCountSV);
      // verbose
      ManagedProperty verbose = props.get("verbose");
      assertNotNull(verbose);
      assertEquals(SimpleMetaType.BOOLEAN_PRIMITIVE, verbose.getMetaType());
      assertEquals("the verbose output flag for the class loading system.", verbose.getDescription());
      SimpleValue verboseSV = SimpleValue.class.cast(verbose.getValue());
      assertNotNull(verboseSV);
      getLog().debug("verboseSV"+verboseSV);
     
   }
View Full Code Here

      // verbose
      ManagedProperty verbose = props.get("verbose");
      assertNotNull(verbose);
      assertEquals(SimpleMetaType.BOOLEAN_PRIMITIVE, verbose.getMetaType());
      assertEquals("the verbose output flag for the memory system.", verbose.getDescription());
      SimpleValue verboseSV = SimpleValue.class.cast(verbose.getValue());
      assertNotNull(verboseSV);
      getLog().debug("verboseSV; "+verboseSV);

      // The gc op
      Set<ManagedOperation> ops = mo.getOperations();
View Full Code Here

      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");
View Full Code Here

TOP

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

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.