diff options
author | 2017-09-07 12:29:55 +0000 | |
---|---|---|
committer | 2017-09-07 12:29:55 +0000 | |
commit | 461b2b7eeca1586423349bc0c4c65f80f027292d (patch) | |
tree | c9f1b896f942ea42bd9612a52cb8a80ce5cbfe73 /LogParser/src/test/java/org/onap/xacml | |
parent | 1628052b1b8a6fd4d784b82c8266367d2c203ace (diff) | |
parent | 81d5df62133aa7bdb9c64b3d227a2838a0a2b83c (diff) |
Merge "Use Reg Ex"
Diffstat (limited to 'LogParser/src/test/java/org/onap/xacml')
-rw-r--r-- | LogParser/src/test/java/org/onap/xacml/parser/ParseLogTest.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/LogParser/src/test/java/org/onap/xacml/parser/ParseLogTest.java b/LogParser/src/test/java/org/onap/xacml/parser/ParseLogTest.java index b02a1435d..c12797f28 100644 --- a/LogParser/src/test/java/org/onap/xacml/parser/ParseLogTest.java +++ b/LogParser/src/test/java/org/onap/xacml/parser/ParseLogTest.java @@ -31,6 +31,8 @@ import java.io.IOException; import java.io.InputStreamReader; import java.util.Date; import java.util.Properties; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.junit.After; import org.junit.Before; @@ -57,6 +59,7 @@ public class ParseLogTest { public void setUp() throws Exception { System.setProperty("com.sun.management.jmxremote.port", "9998"); im = Mockito.mock(IntegrityMonitor.class); + String regex = "^\\/[a-zA-Z]\\:\\/"; try { Mockito.doNothing().when(im).startTransaction(); @@ -66,7 +69,10 @@ public class ParseLogTest { Mockito.doNothing().when(im).endTransaction(); ClassLoader classLoader = getClass().getClassLoader(); configFile = classLoader.getResource("test_config.properties").getFile(); - if(configFile.startsWith("/C:/")){ + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(configFile); + + if (matcher.find()) { configFile = configFile.substring(1); } testFile1 = classLoader.getResource("LineTest.txt").getFile(); |