Author: alessio.soldano(a)jboss.com
Date: 2009-02-09 06:01:09 -0500 (Mon, 09 Feb 2009)
New Revision: 9261
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/JMSClientTestCase.java
Log:
[JBWS-2509] using MessageCount property on AS 5
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/JMSClientTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/JMSClientTestCase.java 2009-02-09
08:55:55 UTC (rev 9260)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/JMSClientTestCase.java 2009-02-09
11:01:09 UTC (rev 9261)
@@ -82,18 +82,26 @@
private int getMessageCount(String queue) throws Exception
{
ObjectName oname =
ObjectNameFactory.create("jboss.mq.destination:service=Queue,name=" + queue);
- String result = (String)getServer().invoke(oname, "listMessageCounter",
null, null);
- Element table = DOMUtils.parse(result);
- NodeList ths = table.getFirstChild().getChildNodes();
- int p = -1;
- for (int i=0; i<ths.getLength(); i++)
+ if (isTargetJBoss5OrGreater())
{
- if (ths.item(i).getTextContent().equalsIgnoreCase("Count"))
- p = i;
+ return (Integer)getServer().getAttribute(oname, "MessageCount");
}
- if (p == -1)
- throw new Exception("Cannot read the queue message count!");
- String count = table.getLastChild().getChildNodes().item(p).getTextContent();
- return Integer.parseInt(count);
+ else
+ {
+ String result = (String)getServer().invoke(oname,
"listMessageCounter", null, null);
+ Element table = DOMUtils.parse(result);
+ NodeList ths = table.getFirstChild().getChildNodes();
+ int p = -1;
+ for (int i=0; i<ths.getLength(); i++)
+ {
+ if (ths.item(i).getTextContent().equalsIgnoreCase("Count"))
+ p = i;
+ }
+ if (p == -1)
+ throw new Exception("Cannot read the queue message count!");
+ String count = table.getLastChild().getChildNodes().item(p).getTextContent();
+ return Integer.parseInt(count);
+ }
}
+
}
Show replies by date