public void testQueueViewMbean() throws Exception {
  try {
    addMessages();
    validateCounts(MESSAGE_COUNT,MESSAGE_COUNT,MESSAGE_COUNT * 2);
    List<String> tokens=Arrays.asList(new String[]{"*"});
    for (    String token : tokens) {
      List<ObjectInstance> queueList=JmxMBeansUtil.queryMBeans(createJmxConnection(),"type=Broker,brokerName=localbroker,destinationType=Queue,destinationName=" + token);
      for (      ObjectInstance queue : queueList) {
        ObjectName queueName=queue.getObjectName();
        QueueViewMBean proxy=MBeanServerInvocationHandler.newProxyInstance(createJmxConnection(),queueName,QueueViewMBean.class,true);
        int removed=proxy.removeMatchingMessages(MSG_SEL_WITH_PROPERTY);
        LOG.info("Removed: " + removed);
      }
    }
    validateCounts(0,MESSAGE_COUNT,MESSAGE_COUNT);
  }
  finally {
    purgeAllMessages();
  }
}

public void testQueueViewMbean ( ) throws Exception { try { addMessages ( ) ; validateCounts ( MESSAGE_COUNT , MESSAGE_COUNT , MESSAGE_COUNT * 2 ) ; List < String > tokens = Arrays . asList ( new String [ ] { "*" } ) ; for ( String token : tokens ) { List < ObjectInstance > queueList = JmxMBeansUtil . queryMBeans ( createJmxConnection ( ) , "type=Broker,brokerName=localbroker,destinationType=Queue,destinationName=" + token ) ; for ( ObjectInstance queue : queueList ) { ObjectName queueName = queue . getObjectName ( ) ; QueueViewMBean proxy = MBeanServerInvocationHandler . newProxyInstance ( createJmxConnection ( ) , queueName , QueueViewMBean . class , true ) ; int removed = proxy . removeMatchingMessages ( MSG_SEL_WITH_PROPERTY ) ; LOG . info ( "Removed: " + removed ) ; } } validateCounts ( 0 , MESSAGE_COUNT , MESSAGE_COUNT ) ; } finally { purgeAllMessages ( ) ; } }
this test ensures that the queueviewmbean will work .
