summaryrefslogtreecommitdiffstats
path: root/LogParser
diff options
context:
space:
mode:
Diffstat (limited to 'LogParser')
-rw-r--r--LogParser/parserlog.properties6
-rw-r--r--LogParser/pom.xml14
-rw-r--r--LogParser/src/test/java/org/openecomp/xacml/parser/ParseLogTest.java42
3 files changed, 29 insertions, 33 deletions
diff --git a/LogParser/parserlog.properties b/LogParser/parserlog.properties
index 8b0ac753f..caac6c378 100644
--- a/LogParser/parserlog.properties
+++ b/LogParser/parserlog.properties
@@ -21,15 +21,15 @@
#Health Check Values
RESOURCE_NAME=logparser_pap01
javax.persistence.jdbc.driver=com.mysql.jdbc.Driver
-javax.persistence.jdbc.url=jdbc:mysql://localhost:3306/xacml
+javax.persistence.jdbc.url=jdbc:mysql://localhost:3306/ecomp_sdk
javax.persistence.jdbc.user=policy_user
-javax.persistence.jdbc.password=password
+javax.persistence.jdbc.password=policy_user
#Log Parser application values
JDBC_DRIVER=com.mysql.jdbc.Driver
JDBC_URL=jdbc:mysql://localhost:3306/log
JDBC_USER=policy_user
-JDBC_PASSWORD=password
+JDBC_PASSWORD=policy_user
SERVER=https://localhost:9091/pap/
LOGTYPE=PAP
LOGPATH=C:\\Workspaces\\HealthCheck\\pap-rest.log
diff --git a/LogParser/pom.xml b/LogParser/pom.xml
index e7659796b..20e06045a 100644
--- a/LogParser/pom.xml
+++ b/LogParser/pom.xml
@@ -50,6 +50,12 @@
<groupId>org.openecomp.policy.common</groupId>
<artifactId>integrity-monitor</artifactId>
<version>${common-modules.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>log4j</groupId>
@@ -75,7 +81,13 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
- <version>1.9.5</version>
+ <version>2.7.22</version>
+ </dependency>
+ <!-- https://mvnrepository.com/artifact/org.mockito/mockito-all -->
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.10.19</version>
</dependency>
</dependencies>
<build>
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