Package org.jboss.managed.api

Examples of org.jboss.managed.api.ManagedOperation


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

      assertEquals("Ops count is 8", 8, ops.size());
      ManagedOperation getThreadInfo = ManagedOperationMatcher.findOperation(ops,
            "getThreadInfo", SimpleMetaType.LONG_PRIMITIVE, SimpleMetaType.INTEGER_PRIMITIVE);
      assertNotNull("getThreadInfo", getThreadInfo);
      log.debug(getThreadInfo);

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


   }
  
   public void testQueueOperations() throws Exception
   {
      ManagedComponent component = getManagementView().getComponent("testCreateQueue", QueueType);
      ManagedOperation o = getOperation(component, "listMessageCounterAsHTML", new String[0]);
      MetaValue v = o.invoke(new MetaValue[0]);
      assertNotNull("null operation return value", v);
      log.debug("result" + v);
   }
View Full Code Here

   {
      ManagementView mgtView = getManagementView();
      ManagedComponent queue = mgtView.getComponent("testCreateQueue", QueueType);
      assertNotNull(queue);
      assertEquals("running", RunState.RUNNING, queue.getRunState());
      ManagedOperation stop = getOperation(queue, "stop", new String[0]);
      stop.invoke(new MetaValue[0]);
     
      mgtView.reload();
      queue = mgtView.getComponent("testCreateQueue", QueueType);
      log.info("runtstate: " + queue.getRunState());
   }
View Full Code Here

      Set<ManagedOperation> ops = topic.getOperations();
      log.info("Topic ops: "+ops);
      Map<String, ManagedOperation> opsByName = new HashMap<String, ManagedOperation>();
      for(ManagedOperation op : ops)
         opsByName.put(op.getName(), op);
      ManagedOperation listNonDurableSubscriptions = opsByName.get("listNonDurableSubscriptions");
      assertNotNull(listNonDurableSubscriptions);
      MetaValue subscriptions = listNonDurableSubscriptions.invoke();
      log.info(subscriptions);
      assertTrue(subscriptions instanceof CollectionValue);
      CollectionValue subscriptionsCV = (CollectionValue) subscriptions;
      assertTrue("subscriptions.size > 0", subscriptionsCV.getSize() > 0);
      MetaValue[] subscriptionsMVs = subscriptionsCV.getElements();
View Full Code Here

   }

   public void testTopicOperations() throws Exception
   {
      ManagedComponent component = getManagementView().getComponent("testCreateTopic", TopicType);
      ManagedOperation o = getOperation(component, "listAllSubscriptionsAsHTML", new String[0]);
      MetaValue v = o.invoke(new MetaValue[0]);
      assertNotNull("null operation return value", v);
      log.debug("result" + v);
   }
View Full Code Here

      ManagedProperty messageCounter = component.getProperty("messageCounter");
      assertNotNull("messageCounter", messageCounter);

      // Clear any
      Set<ManagedOperation> ops = component.getOperations();
      ManagedOperation removeAllMessages = ManagedOperationMatcher.findOperation(ops, "removeAllMessages");
      assertNotNull("removeAllMessages", removeAllMessages);
      removeAllMessages.invoke();
      assertEquals(SimpleValueSupport.wrap(0), messageCount.getValue());

      // Send a message
      Queue queue = (Queue) getInitialContext().lookup(jndiName);
      assertNotNull(queue);
      QueueConnectionFactory qCf = (QueueConnectionFactory) getInitialContext().lookup("ConnectionFactory");
      QueueConnection c = qCf.createQueueConnection();
      c.start();
      QueueSession s = c.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
      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");
      assertNotNull("listAllMessages", listAllMessages);
      MetaValue msgs = listAllMessages.invoke();
      assertNotNull(msgs);
      log.info("listAllMessages.MV: "+msgs);
      assertTrue("msgs is a CollectionValue", msgs instanceof CollectionValue);
      CollectionValue msgsCV = (CollectionValue) msgs;
      MetaValue[] msgsMVs = msgsCV.getElements();
View Full Code Here

   }

   protected ManagedOperation getOperation(ManagedComponent comp, String name, String[] signature)
   {
      assertNotNull(comp);
      ManagedOperation operation = null;
      for(ManagedOperation o : comp.getOperations())
      {
         if(o.getName().equals(name))
         {
            if(Arrays.equals(signature, o.getReflectionSignature()))
View Full Code Here

public class ManagedOperationMatcher
{
   public static ManagedOperation findOperation(Set<ManagedOperation> ops, String name,
         MetaType... signature)
   {
      ManagedOperation match = null;
      for(ManagedOperation op : ops)
      {
         if(op.getName().equals(name))
         {
            // Validate parameters
View Full Code Here

         {
            ManagementOperation managementOp = getAnnotation(ManagementOperation.class, methodInfo, metaData);
            if (managementOp == null)
               continue;

            ManagedOperation op = getManagedOperation(methodInfo, managementOp, metaData);
            operations.add(op);
         }
      }

      ManagedObjectImpl result = new ManagedObjectImpl(name, properties);
View Full Code Here

         {
            ManagementOperation managementOp = methodInfo.getUnderlyingAnnotation(ManagementOperation.class);
            if (managementOp == null)
               continue;

            ManagedOperation op = getManagedOperation(methodInfo, managementOp);
            operations.add(op);
         }
      }

      ManagedObjectImpl result = new ManagedObjectImpl(name, properties);
View Full Code Here

TOP

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

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.