summaryrefslogtreecommitdiffstats
path: root/LogParser/src/test/java/org/onap
diff options
context:
space:
mode:
authoramshegokar <AS00500801@techmahindra.com>2017-09-07 11:05:47 +0530
committeramshegokar <AS00500801@techmahindra.com>2017-09-07 11:26:29 +0530
commit81d5df62133aa7bdb9c64b3d227a2838a0a2b83c (patch)
tree5e9729c288fc49908bd947ffed4cb87beed9f1f5 /LogParser/src/test/java/org/onap
parent490459f7fe922c8448e8a38b87fd48e5e71d7b4c (diff)
Use Reg Ex
Use Reg Ex for Drive letter Issue-ID: POLICY-203 Change-Id: Ic8aaa0728a43936cd4c6e1ed590e01ba8f0fbf9b Signed-off-by: amshegokar <AS00500801@techmahindra.com>
Diffstat (limited to 'LogParser/src/test/java/org/onap')
-rw-r--r--LogParser/src/test/java/org/onap/xacml/parser/ParseLogTest.java8
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();