[jboss-cvs] JBossAS SVN: r88161 - branches/Branch_5_x/testsuite/src/main/org/jboss/test/jca/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon May 4 13:51:49 EDT 2009
Author: jesper.pedersen
Date: 2009-05-04 13:51:49 -0400 (Mon, 04 May 2009)
New Revision: 88161
Modified:
branches/Branch_5_x/testsuite/src/main/org/jboss/test/jca/test/StatisticsFormatterUnitTestCase.java
Log:
Use regex
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/jca/test/StatisticsFormatterUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/jca/test/StatisticsFormatterUnitTestCase.java 2009-05-04 17:09:52 UTC (rev 88160)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/jca/test/StatisticsFormatterUnitTestCase.java 2009-05-04 17:51:49 UTC (rev 88161)
@@ -26,6 +26,8 @@
import java.io.StringWriter;
import java.net.URL;
import java.sql.Connection;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.management.Attribute;
import javax.management.ObjectName;
@@ -154,10 +156,10 @@
expectedConn1Buffer.append("Max Connections In Use Count:1\n");
expectedConn1Buffer.append("Connections Destroyed Count:0\n");
expectedConn1Buffer.append("Connections In Use Count:1\n");
- expectedConn1Buffer.append("Total Block Time:0\n");
- expectedConn1Buffer.append("Average Block Time For Sub Pool:0\n");
- expectedConn1Buffer.append("Maximum Wait Time For Sub Pool:0\n");
- expectedConn1Buffer.append("Total Timed Out:0\n");
+ expectedConn1Buffer.append("Total Block Time:\\d+\n");
+ expectedConn1Buffer.append("Average Block Time For Sub Pool:\\d+\n");
+ expectedConn1Buffer.append("Maximum Wait Time For Sub Pool:\\d+\n");
+ expectedConn1Buffer.append("Total Timed Out:\\d+\n");
expectedConn1Buffer.append("\n");
expectedConn1Buffer.append(POOL_SEPERATOR);
expectedConn1Buffer.append("\n\n");
@@ -172,10 +174,10 @@
expectedConn2Buffer.append("Max Connections In Use Count:2\n");
expectedConn2Buffer.append("Connections Destroyed Count:0\n");
expectedConn2Buffer.append("Connections In Use Count:2\n");
- expectedConn2Buffer.append("Total Block Time:0\n");
- expectedConn2Buffer.append("Average Block Time For Sub Pool:0\n");
- expectedConn2Buffer.append("Maximum Wait Time For Sub Pool:0\n");
- expectedConn2Buffer.append("Total Timed Out:0\n");
+ expectedConn2Buffer.append("Total Block Time:\\d+\n");
+ expectedConn2Buffer.append("Average Block Time For Sub Pool:\\d+\n");
+ expectedConn2Buffer.append("Maximum Wait Time For Sub Pool:\\d+\n");
+ expectedConn2Buffer.append("Total Timed Out:\\d+\n");
expectedConn2Buffer.append("\n");
expectedConn2Buffer.append(POOL_SEPERATOR);
expectedConn2Buffer.append("\n\n");
@@ -198,15 +200,23 @@
Object conn1Stats = StatisticsHelper.listFormattedStatistics(getServer());
assertTrue(conn1Stats instanceof String);
- assertEquals(conn1Stats, expectedConn1Buffer.toString());
+ Pattern p1 = Pattern.compile(expectedConn1Buffer.toString());
+ Matcher m1 = p1.matcher((String)conn1Stats);
+
+ assertTrue(m1.matches());
+
Connection conn2 = ds.getConnection("sa", "");
Object conn2Stats = StatisticsHelper.listFormattedStatistics(getServer());
assertTrue(conn2Stats instanceof String);
- assertEquals(conn2Stats, expectedConn2Buffer.toString());
+ Pattern p2 = Pattern.compile(expectedConn2Buffer.toString());
+ Matcher m2 = p2.matcher((String)conn2Stats);
+
+ assertTrue(m2.matches());
+
conn1.close();
conn2.close();
More information about the jboss-cvs-commits
mailing list