Package org.jboss.managed.api

Examples of org.jboss.managed.api.ManagedOperation


      ManagedComponent hsqldb = mgtView.getComponent("DefaultDS", type);
      Set<ManagedOperation> ops = hsqldb.getOperations();
      log.info("DefaultDS ops: "+ops);
      assertNotNull("Set<ManagedOperation>", ops);
      assertTrue("Set<ManagedOperation> > 0", ops.size() > 0);
      ManagedOperation listFormattedSubPoolStatistics = null;
      HashMap<String, ManagedOperation> opsByName = new HashMap<String, ManagedOperation>();
      for (ManagedOperation op : ops)
      {
         opsByName.put(op.getName(), op);
      }
      // Validate the listFormattedSubPoolStatistics op
      listFormattedSubPoolStatistics = opsByName.get("listFormattedSubPoolStatistics");
      assertNotNull("listFormattedSubPoolStatistics", listFormattedSubPoolStatistics);
      MetaValue[] params = {};
      Object result = listFormattedSubPoolStatistics.invoke(params);
      assertNotNull("Expecting non null result", result);
      log.info("listFormattedSubPoolStatistics.invoke: "+result);
      // It needs to be a MetaValue as well
      assertTrue("result is a MetaValue", result instanceof MetaValue);
      // Validate the listStatistics op
      ManagedOperation listStatistics = opsByName.get("listStatistics");
      assertNotNull("listStatistics", listStatistics);
      result = listStatistics.invoke(params);
      assertNotNull("Expecting non null result", result);
      log.info("listStatistics.invoke: "+result);
      // It needs to be a MetaValue as well
      assertTrue("result is a MetaValue", result instanceof MetaValue);
   }
View Full Code Here


      return dispatcher.get(componentName, mp);
   }

   public MetaValue invoke(Long opID, Object componentName, String methodName, MetaValue... param)
   {
      ManagedOperation op = this.registry.getManagedOperation(opID);
      if(param == null)
         param = new MetaValue[0];
     
      MetaValue result = null;
      if (componentName != null)
View Full Code Here

    * @return the operation
    * @throws IllegalStateException if the operation is not registered
    */
   public ManagedOperation getManagedOperation(Long opID)
   {
      ManagedOperation op = this.operations.get(opID);
      if(op == null)
         throw new IllegalStateException("operation not found for id " + opID);
      return op;
   }
View Full Code Here

      // The gc op
      Set<ManagedOperation> ops = mo.getOperations();
      assertNotNull(ops);
      assertEquals("There is 1 op", 1, ops.size());
      ManagedOperation gc = ops.iterator().next();
      assertEquals("gc", gc.getName());
      assertEquals("Runs the garbage collector", gc.getDescription());
      gc.invoke();
   }
View Full Code Here

      if (javaSpecVersion.equals("1.5") || javaSpecVersion.equals("5.0"))
         assertEquals(mo + " has wrong number of ManagedOperations.", 8, ops.size());
      else if (javaSpecVersion.equals("1.6") || javaSpecVersion.equals("6.0"))
         assertEquals(mo + " has wrong number of ManagedOperations.", 11, 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

      // Send a few messages so the message based ops have values
      sendQueueMsgs("testCreateQueue", component);

     
      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);
     
     
      // JBAS-7024,
      ManagedOperation listAllMessages = getOperation(component, "listAllMessages", new String[0]);
      MetaType listAllMessagesRT = listAllMessages.getReturnType();
      log.debug("listAllMessagesRT: " + listAllMessagesRT);
      MetaValue listAllMessagesMV = listAllMessages.invoke(new MetaValue[0]);
      assertNotNull("null operation return value", listAllMessagesMV);
      log.debug("result: " + listAllMessagesMV);
      MetaType resultType = listAllMessagesMV.getMetaType();
      log.debug("resultType: "+resultType);
      assertTrue("resultType instanceof CompositeMetaType", resultType instanceof CollectionMetaType);
View Full Code Here

   public void testQueueRestart() throws Exception
   {
      ManagedComponent component = getManagementView().getComponent("testCreateQueue", QueueType);
      assertEquals(RunState.RUNNING, component.getRunState());
      // Stop
      ManagedOperation o = getOperation(component, "stop", new String[0]);
      o.invoke(new MetaValue[0]);
      // Check runState dispatching
      assertEquals(RunState.STOPPED, component.getRunState());
      // Start
      o = getOperation(component, "start", new String[0]);
      o.invoke(new MetaValue[0]);
      //
      assertEquals(RunState.RUNNING, component.getRunState());
   }
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

      ManagedComponent component = mgtView.getComponent("jboss.messaging:service=ServerPeer", type);
      assertNotNull(component);
     
      log.info("Properties: "+component.getProperties().keySet());
     
      ManagedOperation o = getOperation(component, "listMessageCountersAsHTML", new String[0]);
      MetaValue v = o.invoke(new MetaValue[0]);
      assertNotNull("null operation return value", v);
      log.debug("result" + v);
   }
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.