List of usage examples for javax.management.openmbean TabularData size
public int size();
From source file:org.apache.qpid.systest.management.jmx.ConnectionManagementTest.java
private TabularData getChannelsDataWithRetry(final ManagedConnection mBean) throws IOException, JMException { TabularData channelsData = mBean.channels(); int retries = 0; while (channelsData.size() == 0 && retries < 5) { sleep();//from w ww. jav a 2 s . c om channelsData = mBean.channels(); retries++; } return channelsData; }
From source file:org.apache.qpid.systest.management.jmx.QueueManagementTest.java
/** * Tests {@link ManagedQueue#viewMessages(long, long)} interface. *//*from w ww . j a va2s .co m*/ public void testViewSingleMessage() throws Exception { final List<Message> sentMessages = sendMessage(_session, _sourceQueue, 1); syncSession(_session); final Message sentMessage = sentMessages.get(0); assertEquals("Unexpected queue depth", 1, _managedSourceQueue.getMessageCount().intValue()); // Check the contents of the message final TabularData tab = _managedSourceQueue.viewMessages(1l, 1l); assertEquals("Unexpected number of rows in table", 1, tab.size()); final Iterator<CompositeData> rowItr = (Iterator<CompositeData>) tab.values().iterator(); final CompositeData row1 = rowItr.next(); assertNotNull("Message should have AMQ message id", row1.get(ManagedQueue.MSG_AMQ_ID)); assertEquals("Unexpected queue position", 1l, row1.get(ManagedQueue.MSG_QUEUE_POS)); assertEquals("Unexpected redelivered flag", Boolean.FALSE, row1.get(ManagedQueue.MSG_REDELIVERED)); // Check the contents of header (encoded in a string array) final String[] headerArray = (String[]) row1.get(ManagedQueue.MSG_HEADER); assertNotNull("Expected message header array", headerArray); final Map<String, String> headers = headerArrayToMap(headerArray); final String expectedJMSMessageID = isBroker010() ? sentMessage.getJMSMessageID().replace("ID:", "") : sentMessage.getJMSMessageID(); final String expectedFormattedJMSTimestamp = FastDateFormat .getInstance(ManagedQueue.JMSTIMESTAMP_DATETIME_FORMAT).format(sentMessage.getJMSTimestamp()); assertEquals("Unexpected JMSMessageID within header", expectedJMSMessageID, headers.get("JMSMessageID")); assertEquals("Unexpected JMSPriority within header", String.valueOf(sentMessage.getJMSPriority()), headers.get("JMSPriority")); assertEquals("Unexpected JMSTimestamp within header", expectedFormattedJMSTimestamp, headers.get("JMSTimestamp")); }