aboutsummaryrefslogtreecommitdiffstats
path: root/LogParser/src
diff options
context:
space:
mode:
authorRavindra Bakkamanthala <rb7147@att.com>2017-05-15 12:53:18 -0400
committerRavindra Bakkamanthala <rb7147@att.com>2017-05-15 13:55:23 -0400
commit7e547eaa55920dfbc9691eab33bb728395b50cf2 (patch)
tree5d0d64928b4754f65b427cb79b43718f16019582 /LogParser/src
parentdda032f8bb161d54eb1f59de2b4a3efb774fc4d1 (diff)
Policy TestSuite Enabled
Change-Id: I9f98c7dcdcf98713d73544956d873a84fc82adf7 Signed-off-by: Ravindra Bakkamanthala <rb7147@att.com>
Diffstat (limited to 'LogParser/src')
-rw-r--r--LogParser/src/test/java/org/openecomp/xacml/parser/ParseLogTest.java42
1 files changed, 13 insertions, 29 deletions
diff --git a/LogParser/src/test/java/org/openecomp/xacml/parser/ParseLogTest.java b/LogParser/src/test/java/org/openecomp/xacml/parser/ParseLogTest.java
index dd4007735..621f39742 100644
--- a/LogParser/src/test/java/org/openecomp/xacml/parser/ParseLogTest.java
+++ b/LogParser/src/test/java/org/openecomp/xacml/parser/ParseLogTest.java
@@ -20,39 +20,31 @@
package org.openecomp.xacml.parser;
-/*import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.text.SimpleDateFormat;
-import java.util.Collections;
import java.util.Date;
import java.util.Properties;
-import org.openecomp.policy.common.im.AdministrativeStateException;
-import org.openecomp.policy.common.im.IntegrityMonitor;
-import org.openecomp.policy.common.im.StandbyStatusException;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
-import org.openecomp.xacml.parser.LogEntryObject;
-import org.openecomp.xacml.parser.ParseLog;
+import org.openecomp.policy.common.im.AdministrativeStateException;
+import org.openecomp.policy.common.im.IntegrityMonitor;
+import org.openecomp.policy.common.im.StandbyStatusException;
import org.openecomp.xacml.parser.LogEntryObject.LOGTYPE;
public class ParseLogTest {
- private ParseLog logParser = new ParseLog();
private Properties config = new Properties();
private String configFile = "test_config.properties";
- private static Properties myProp;
- private static Properties systemProps;
- private static String resourceName;
private IntegrityMonitor im;
@@ -61,9 +53,6 @@ public class ParseLogTest {
System.setProperty("com.sun.management.jmxremote.port", "9998");
im = Mockito.mock(IntegrityMonitor.class);
- // Need PowerMockito for mocking static method getInstance(...)
- // PowerMockito.mockStatic(IntegrityMonitor.class);
-
try {
Mockito.doNothing().when(im).startTransaction();
} catch (StandbyStatusException | AdministrativeStateException e) {
@@ -77,23 +66,21 @@ public class ParseLogTest {
public void tearDown() {
File file = new File("nonExistFile.txt");
file.delete();
-// systemProps.remove("com.sun.management.jmxremote.port");
}
- @Test
+ //@Test
public void testMain() {
try {
-
- logParser.main(null);
+ ParseLog.main(null);
} catch (Exception e) {
- //fail();
+ fail();
}
}
@Test
public void testCountLines() throws IOException {
String fileName = "LineTest.txt";
- int returnValue = logParser.countLines(fileName);
+ int returnValue = ParseLog.countLines(fileName);
assertEquals(9, returnValue);
}
@@ -120,7 +107,7 @@ public class ParseLogTest {
config.put("LOGPATH", "C:\\Workspaces\\HealthCheck\\pap-rest.log");
config.put("PARSERLOGPATH", "IntegrityMonitor.log");
- Properties returnConfig = logParser.getPropertiesValue(configFile);
+ Properties returnConfig = ParseLog.getPropertiesValue(configFile);
assertEquals(config.get("RESOURCE_NAME"), returnConfig.get("RESOURCE_NAME"));
@@ -137,8 +124,8 @@ public class ParseLogTest {
public void testParseDate(){
String line = "2016-02-23 08:07:30";
Date returnValue = ParseLog.parseDate(line, "yyyy-MM-dd HH:mm:ss", false);
-
- assertEquals("Tue Feb 23 08:07:30 CST 2016", returnValue.toString());
+ line = returnValue.toString().substring(0, returnValue.toString().lastIndexOf(":30")+3);
+ assertEquals("Tue Feb 23 08:07:30", line);
}
@Test
@@ -343,14 +330,12 @@ public class ParseLogTest {
@Test
public void testPullOutLogValuesNull(){
// Open the file
- FileInputStream fstream;
LogEntryObject retrunObject = ParseLog.pullOutLogValues("", "Console");
assertEquals(null, retrunObject);
}
@Test
public void testLogEntryObject(){
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
// Open the file
@@ -379,5 +364,4 @@ public class ParseLogTest {
Mockito.doNothing().when(im).endTransaction();
ParseLog.process(line, "pap");
}
-}
-*/ \ No newline at end of file
+} \ No newline at end of file