Package org.jboss.metatype.api.values

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


      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


      ManagedProperty password = props.get("password");
      password.setValue(SimpleValueSupport.wrap(""));

      // Remove the
      ManagedProperty useJavaCtx = props.get("use-java-context");
      SimpleValue nullBoolean = SimpleValueSupport.wrap(false);
      ((SimpleValueSupport)nullBoolean).setValue(null);
      useJavaCtx.setValue(nullBoolean);
      useJavaCtx.setRemoved(true);
     
      mgtView.applyTemplate("testRemovedProperties", dsInfo);
View Full Code Here

      // 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);
      Map<String, ManagedOperation> opsByName = new HashMap<String, ManagedOperation>();
      for(ManagedOperation op : ops)
View Full Code Here

      try
      {
         for(int i = 0; i < 10; i++)
            pub.send(session.createTextMessage("Message nr " + i));
        
         SimpleValue nondurable = (SimpleValue)component.getProperty("nonDurableSubscriptionsCount").getValue();
         SimpleValue durable = (SimpleValue)component.getProperty("durableSubscriptionsCount").getValue();
         SimpleValue all = (SimpleValue)component.getProperty("allSubscriptionsCount").getValue();
         SimpleValue allMessageCount = (SimpleValue)component.getProperty("allMessageCount").getValue();
        
         CollectionValue messageCounters = (CollectionValue) component.getProperty("messageCounters").getValue();
         assertNotNull(messageCounters);
        
         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

      QueueSender sender = s.createSender(queue);
     
      // 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");
View Full Code Here

      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);
     

      // Try invoking listThreadCpuUtilization and checking freeMemory until it changes
View Full Code Here

      return activeView;
   }

   private long getLong(ManagedProperty prop)
   {
      SimpleValue mv = (SimpleValue) prop.getValue();
      Number value = (Number) mv.getValue();
      return value.longValue();
   }
View Full Code Here

      assertNotNull(restored);
     
      mo = update(new PrimitiveMetaData(), restored);
     
      assertEquals("newName", getMVF().unwrap(mo.getProperty("name").getValue()));
      SimpleValue integer = (SimpleValue) mo.getProperty("integer").getValue();
      assertEquals(111, getMVF().unwrap(integer));
      assertTrue("actual " + integer , SimpleMetaType.INTEGER_PRIMITIVE.isValue(integer));
      assertEquals("optional", ((SimpleValue) mo.getProperty("optionalName").getValue()).getValue());
     
   }
View Full Code Here

      assertNotNull(p);
     
      MapCompositeValueSupport composite = (MapCompositeValueSupport) p.getValue();
      assertNotNull(composite);
     
      SimpleValue v = (SimpleValue) composite.get("testString2");
      assertNotNull(v);
     
      composite.put("testString2", SimpleValueSupport.wrap("changedString"));
     
      PersistedManagedObject restored = restore(mo);
      assertNotNull(restored);
     
      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

   public ObjectName unwrapMetaValue(MetaValue metaValue)
   {
      if(metaValue == null)
         return null;

      SimpleValue sv = (SimpleValue) metaValue;     
      // ignore a null object name
      if(sv.getValue() == null)
         return null;
     
      String str = sv.getValue().toString();
      try
      {
         return new ObjectName(str);
      }
      catch(Exception e)
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.