use of org.apache.oro.text.regex.PatternMatcher in project jmeter by apache.
the class ApdexPerTransactionTest method testSampleNameMatching.
@Test
public void testSampleNameMatching() {
/* matching pairs :
* sample(\d+) sample2
* sample(\d+) sample12
* scenar01-12 scenar01-12
* samples12 samples12
* */
String[] sampleNames = { "sample2", "sample12", "scenar01-12", "samples12" };
Map<String, Long[]> apdex = ReportGeneratorConfiguration.getApdexPerTransactionParts(apdexString);
for (String sampleName : sampleNames) {
boolean hasMatched = false;
for (Map.Entry<String, Long[]> entry : apdex.entrySet()) {
org.apache.oro.text.regex.Pattern regex = JMeterUtils.getPatternCache().getPattern(entry.getKey());
PatternMatcher matcher = JMeterUtils.getMatcher();
if (matcher.matches(sampleName, regex)) {
hasMatched = true;
}
}
assertTrue(hasMatched);
}
}
Aggregations