diff --git a/LogParser/src/META-INF/MANIFEST.MF b/LogParser/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..254272e
--- /dev/null
+++ b/LogParser/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path: 
+
diff --git a/LogParser/src/main/java/org/openecomp/xacml/parser/LogEntryObject.java b/LogParser/src/main/java/org/openecomp/xacml/parser/LogEntryObject.java
new file mode 100644
index 0000000..4b03d2a
--- /dev/null
+++ b/LogParser/src/main/java/org/openecomp/xacml/parser/LogEntryObject.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * LogParser
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.xacml.parser;
+
+import java.util.Date;
+
+public class LogEntryObject {
+
+	private  String system;
+	private String description;
+	private Date date;
+	private String remote;
+	private String systemType;
+	private LOGTYPE logType;
+	
+	public enum LOGTYPE {
+		INFO, ERROR, SEVERE, WARN;
+	}
+		
+	public String getSystem() {
+		return system;
+	}
+	public void setSystem(String system) {
+		this.system = system;
+	}
+	public String getDescription() {
+		return description;
+	}
+	public void setDescription(String description) {
+		this.description = description;
+	}
+	public Date getDate() {
+		return date;
+	}
+	public void setDate(Date date) {
+		this.date = date;
+	}
+	public String getRemote() {
+		return remote;
+	}
+	public void setRemote(String remote) {
+		this.remote = remote;
+	}
+	public String getSystemType() {
+		return systemType;
+	}
+	public void setSystemType(String systemType) {
+		this.systemType = systemType;
+	}
+	public LOGTYPE getLogType() {
+		return logType;
+	}
+	public void setLogType(LOGTYPE logType) {
+		this.logType = logType;
+	}	
+}
diff --git a/LogParser/src/main/java/org/openecomp/xacml/parser/ParseLog.java b/LogParser/src/main/java/org/openecomp/xacml/parser/ParseLog.java
new file mode 100644
index 0000000..5303bac
--- /dev/null
+++ b/LogParser/src/main/java/org/openecomp/xacml/parser/ParseLog.java
@@ -0,0 +1,437 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * LogParser
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.xacml.parser;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.LineNumberReader;
+import java.io.RandomAccessFile;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.text.Format;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Stream;
+
+import org.openecomp.policy.common.im.AdministrativeStateException;
+import org.openecomp.policy.common.im.IntegrityMonitor;
+import org.openecomp.policy.common.im.StandbyStatusException;
+
+import org.apache.log4j.Logger;
+import org.openecomp.xacml.parser.LogEntryObject.LOGTYPE;
+
+/**
+ * Parse log files and store the information in a H2 database.
+ * 
+ *
+ */
+public class ParseLog {
+	
+	private static final Logger logger = Logger.getLogger(ParseLog.class.getName());
+
+	private static String system;
+	private static int lastNumberRead = 0;
+	private static String type;
+	private static long startFileSize;
+	private static String systemLogFile;
+	private static String logFile;
+	
+	private static String JDBC_URL;
+	private static String JDBC_USER;
+	private static String JDBC_PASSWORD = "";
+	private static String JDBC_DRIVER;
+	private static int maxLength = 255;   //Max length that is allowed in the DB table
+	private static String resourceName;
+	private static long sleepTimer = 50000;
+	static IntegrityMonitor im;
+	
+	public static void main(String[] args) throws Exception {
+
+		Properties logProperties = getPropertiesValue("parserlog.properties");
+		Path filePath = Paths.get(logFile);
+		File file = new File(logFile);
+		File fileLog = new File(systemLogFile);
+		startFileSize = file.length();
+			
+		im = IntegrityMonitor.getInstance(resourceName,logProperties );
+		
+		logger.info("System: " + system );  
+		logger.info("System type: " + type );  
+		logger.info("Logging File: " + systemLogFile );
+		logger.info("log file: " + logFile);
+		logger.info("JDBC_URL: " + JDBC_URL);
+		logger.info("JDBC_DRIVER: " + JDBC_DRIVER);
+		
+		String filesRead = PullLastLineRead(fileLog);
+		if (filesRead!= null){			
+			filesRead = filesRead.replaceAll("(\\r\\n|\\n)", "<br />");
+			lastNumberRead= Integer.parseInt(filesRead.trim());
+		}else{
+			lastNumberRead = 0;
+		}
+		startFileSize =  countLines(logFile);
+		logger.info("File Line Count: " + startFileSize + " value read in: " + lastNumberRead);
+		if (startFileSize < lastNumberRead ){
+			logger.error("Filed Rolled: set Last number read to 0");
+			lastNumberRead = 0;
+		}
+		Runnable  runnable = new Runnable (){
+		public void run(){
+			while (true){		
+	             
+				if (file.isFile()){
+					try (Stream<String> lines = Files.lines(filePath, Charset.defaultCharset()).onClose(() -> logger.info("Last line Read: " + lastNumberRead)).skip(lastNumberRead)) {
+						
+						lines.forEachOrdered(line -> process(line, type));
+		
+					} catch (IOException e) {
+						logger.error("Error processing line in log file: " + e);
+					}	
+				}
+				try {
+					Thread.sleep(sleepTimer);
+					startFileSize =  countLines(logFile);
+				} catch (InterruptedException | IOException e) {
+					logger.error("Error: " + e);
+				}
+				
+				logger.info("File Line Count: " + startFileSize + " value read in: " + lastNumberRead);
+				if (startFileSize < lastNumberRead ){
+					logger.info("Failed Rolled: set Last number read to 0");
+					lastNumberRead = 0;
+				}
+			}	
+		}
+		};
+		
+		Thread thread = new Thread(runnable);
+		thread.start();
+
+	}			
+
+	public static int countLines(String filename) throws IOException {
+	    LineNumberReader reader  = new LineNumberReader(new FileReader(filename));
+	    int cnt = 0;
+	    String lineRead = "";
+	    while ((lineRead = reader.readLine()) != null) {}
+
+	    cnt = reader.getLineNumber(); 
+	    reader.close();
+	    return cnt;
+	}	
+	
+	public static String PullLastLineRead(File file) throws IOException {
+		if(!file.exists()){
+			file.createNewFile();
+			return null;
+		}
+		RandomAccessFile randomAccessFile = new RandomAccessFile(file, "r");
+        int lines = 0;
+        StringBuilder builder = new StringBuilder();
+        long length = file.length();
+        length--;
+        randomAccessFile.seek(length);
+        for(long seek = length; seek >= 0; --seek){
+            randomAccessFile.seek(seek);
+            char c = (char)randomAccessFile.read();
+            builder.append(c);
+            if(c == '\n'){
+                builder = builder.reverse();
+                if (builder.toString().contains("Last line Read:")){
+            		String[] parseString = builder.toString().split("Last line Read:");
+            		String returnValue = parseString[1].replace("\r", "");
+            		return returnValue.trim();
+            		//return parseString[2].replace("\r", "");
+            	}
+                lines++;
+                builder = null;
+                builder = new StringBuilder();
+             }
+
+        }
+		return null;
+	}
+
+	public static LogEntryObject pullOutLogValues(String line, String type){
+		Date date;
+		LogEntryObject logEntry = new LogEntryObject();
+		logEntry.setSystemType(type);
+		String description = null;
+		
+		logEntry.setSystem(system);
+		
+		//Values for PDP/PAP log file
+		if(line.contains("||INFO||") || line.contains("||ERROR||")){
+			String[] splitString = line.split("[||]");
+			String dateString = splitString[0].substring(0, 19);
+			logEntry.setDescription(splitString[splitString.length-1]);	
+
+			//parse out date
+			date = parseDate(dateString.replace("T", " "), "yyyy-MM-dd HH:mm:ss", false);
+			logEntry.setDate(date);
+			
+			logEntry.setRemote(parseRemoteSystem(line));
+			if (line.contains("||INFO||")){
+				logEntry.setLogType(LOGTYPE.INFO);
+			}else{
+				logEntry.setLogType(LOGTYPE.ERROR);
+			}		
+		}else if (line.contains("INFO") && line.contains(")-")){
+			//parse out description
+			logEntry.setDescription(line.substring(line.indexOf(")-")+3));
+
+			date = parseDate(line, "yy_MM_dd_HH_mm_ss", true);
+			logEntry.setDate(date);
+	
+			logEntry.setRemote(parseRemoteSystem(line));
+			logEntry.setLogType(LOGTYPE.INFO);
+		} else if (line.contains("INFO") && line.contains("--- [")){
+			//parse out description
+			String temp = line.substring(line.indexOf("---")+1);
+			String[] split = temp.split(":");
+
+			logEntry.setDescription(split[1]);
+
+			//parse out date
+			date = parseDate(line, "yyyy-MM-dd HH:mm:ss", false);
+			logEntry.setDate(date);
+			
+			//remote system
+			logEntry.setRemote(parseRemoteSystem(line));
+			logEntry.setLogType(LOGTYPE.INFO);
+		}else if (line.contains("SEVERE") && line.contains("[main]")){			
+			String[] splitString = line.split(" ");
+			
+			for (int i = 5; i < splitString.length; i++){
+				description = description +  " " + splitString[i];
+			}
+
+			logEntry.setDescription(description);
+			//parse out date
+			date = parseDate(line, "dd-MMM-yyyy HH:mm:ss", false);
+			logEntry.setDate(date);
+			logEntry.setLogType(LOGTYPE.SEVERE);
+		} else if (line.contains("WARN") && line.contains(")-")){
+			//parse out description
+
+			logEntry.setDescription(line.substring(line.indexOf(")-")+3));
+
+			//parse out date
+			date = parseDate(line, "yy_MM_dd_HH_mm_ss", true);
+			logEntry.setDate(date);
+			
+			//remote system
+			logEntry.setRemote(parseRemoteSystem(line));
+			logEntry.setLogType(LOGTYPE.WARN);
+		}else if (line.contains("WARNING") && type =="PyPDP"){
+			String[] splitString = line.split(" ");
+			for (int i = 5; i < splitString.length; i++){
+				description = description +  " " + splitString[i];
+			}
+
+			//parse out date
+			date = parseDate(line, "dd-MMM-yyyy HH:mm:ss", false);
+			logEntry.setDate(date);
+			logEntry.setLogType(LOGTYPE.WARN);
+		}else if (line.contains("ERROR") && line.contains(")-")){
+			//parse out description
+			description = line.substring(line.indexOf(")-")+3);
+
+			//parse out date
+			date = parseDate(line, "yy_MM_dd_HH_mm_ss", true);
+			logEntry.setDate(date);
+			//remote system
+			logEntry.setRemote(parseRemoteSystem(line));
+			logEntry.setLogType(LOGTYPE.ERROR);
+		}else {
+			return null;
+		}
+		
+
+		return logEntry;
+	}
+
+	private static void DBClose(Connection conn) {
+		try {
+			conn.close();
+		} catch (SQLException e) {
+			logger.error("Error closing DB Connection: " + e);
+			
+		}
+	}
+
+	public static void process(String line, String type)  {
+		LogEntryObject returnLogValue = null;
+		if (im!=null){
+			try {
+				im.startTransaction();
+			} catch (AdministrativeStateException e) {
+				logger.error("Error received" + e);
+				
+			} catch (StandbyStatusException e) {
+				logger.error("Error received" + e);
+			}
+		}
+		returnLogValue = pullOutLogValues(line, type);
+		lastNumberRead++;
+		if (returnLogValue!=null){
+			writeDB(returnLogValue);
+		}
+		if (im!=null){
+			im.endTransaction();
+		}
+	}
+	
+	private static void writeDB(LogEntryObject returnLogValue) {
+		Connection conn = DBConnection(JDBC_DRIVER, JDBC_URL, JDBC_USER,JDBC_PASSWORD);
+		DBAccesss(conn, returnLogValue.getSystem(), returnLogValue.getDescription(),  
+						returnLogValue.getDate(), returnLogValue.getRemote(), 
+						returnLogValue.getSystemType(), returnLogValue.getLogType().toString());
+		DBClose(conn);	
+	}
+
+	private static Connection DBConnection(String driver, String jdbc, String user, String pass){
+        
+        try {
+        	Class.forName(driver);
+			Connection conn = DriverManager.getConnection(jdbc, user, pass);
+			return conn;
+		} catch ( Exception e) {
+			logger.error("Error connecting to DB: " + e);
+		}
+		return null;
+	}
+	private static void DBAccesss(Connection conn, String system, String description, Date date, String remote, String type, String logType)  {
+		
+		String sdate = null;
+		
+		if (date!=null){
+			Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+			sdate = formatter.format(date);		
+		}
+		
+		//ensure the length of description is less than the maximumm db char length
+		if (description.length() > maxLength) {
+			description = description.substring(0, maxLength);
+		}
+		
+		try {
+			PreparedStatement prep = conn.prepareStatement("insert into SYSTEMLOGDB values (NULL, ?, ?, ?,  ?,  ?, ?);");
+			prep.setString(1, system);
+			prep.setString(2, description);
+			prep.setString(3, remote);
+			prep.setString(4, type);
+			prep.setString(5, sdate);
+			prep.setString(6, logType);
+
+			prep.executeUpdate();
+			prep.close();
+
+		} catch (SQLException e1) {
+			logger.error("Error trying to excute SQL Statment: " + e1);
+		}
+	}
+
+	public static Date parseDate(String dateline, String pattern, boolean singleSplit)  {
+		
+		Date returnDate;
+		String[] splitString = dateline.split(" ");
+		SimpleDateFormat formatter = new SimpleDateFormat(pattern);	
+		if (singleSplit){
+			try {
+				returnDate = formatter.parse(splitString[0]);
+			} catch (ParseException e) {
+				logger.error("Unable to parse date for line: " + dateline);
+				returnDate = null;
+			}
+		}else{
+			String tmpString = splitString[0] + " " + splitString[1];
+			try {
+				returnDate = formatter.parse(tmpString);
+			} catch (ParseException e) {
+				logger.error("Unable to parse date for line: " + dateline);
+				returnDate = null;
+			}
+		}
+			
+		return returnDate; 
+	}
+
+	
+	public static String parseRemoteSystem(String line) {
+		
+		if (line.contains("http") && !(line.contains("www.w3.org"))){
+	
+			Pattern pattern = Pattern.compile("://(.+?)/");
+			Matcher remote = pattern.matcher(line);
+			if (remote.find())
+			{
+				return remote.group(1);
+			} 
+		}
+		return null;
+	}
+	
+	public static Properties getPropertiesValue(String fileName) {
+		Properties config = new Properties();
+		Path file = Paths.get(fileName);
+		if (Files.notExists(file)) {
+			logger.info("File doesn't exist in the specified Path "	+ file.toString());
+		}else{ 
+			if (file.toString().endsWith(".properties")) {
+				InputStream in;
+				try {
+					in = new FileInputStream(file.toFile());
+					config.load(in);
+							
+					resourceName = config.getProperty("RESOURCE_NAME");
+					system = config.getProperty("SERVER");
+					type = config.getProperty("LOGTYPE");
+					systemLogFile = config.getProperty("PARSERLOGPATH");
+					logFile = config.getProperty("LOGPATH");
+					JDBC_URL = config.getProperty("JDBC_URL").replace("'", "");
+					JDBC_USER = config.getProperty("JDBC_USER");
+					JDBC_DRIVER =  config.getProperty("JDBC_DRIVER");
+					JDBC_PASSWORD = config.getProperty("JDBC_PASSWORD");
+					return config;
+
+				} catch (IOException e) {					
+					logger.info("Error porcessing Cofnig file will be unable to create Health Check");
+				}
+				
+			}
+		}
+		return null;
+	}	
+}
diff --git a/LogParser/src/main/scripts/parserlog.sh b/LogParser/src/main/scripts/parserlog.sh
new file mode 100644
index 0000000..79ea8a3
--- /dev/null
+++ b/LogParser/src/main/scripts/parserlog.sh
@@ -0,0 +1,130 @@
+###
+# ============LICENSE_START=======================================================
+# LogParser
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#      http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+#!/bin/sh
+#
+# init script for a Java application
+#
+
+#Arguments for application
+SERVER=http://localhost:8070/pap/
+LOGTYPE=PAP 
+LOGPATH="/var/lib/servers/pap/logs/catalina.out"
+PARSERLOGPATH="$POLICY_HOME/logs/parserlog.log"
+JDBC_URL="jdbc:h2:tcp://localhost:9092/log"
+JDBC_USER="sa"
+JDBC_DRIVER="org.h2.Driver"
+JDBC_PASSWORD=""
+SERVICE="LogParser.jar"
+
+# Check the application status
+#
+# This function checks if the application is running
+check_status() {
+
+  # Running pgrep with some arguments to check if the PID exists
+  if pgrep -f "$SERVICE $SERVER $LOGTYPE" ; then
+     RESULT=$(pgrep -f ${SERVICE})
+     return $RESULT
+  fi
+  return 0
+  # In any another case, return 0
+
+}
+
+# Starts the application
+start() {
+
+  # At first checks if the application is already started calling the check_status
+  # function
+  check_status
+
+  # $? is a special variable that hold the "exit status of the most recently executed
+  # foreground pipeline"
+  pid=$?
+
+  if [ $pid -ne 0 ] ; then
+    echo "The application is already started"
+    exit 1
+  fi
+
+  # If the application isn't running, starts it
+  echo -n "Starting application: "
+
+  # Redirects default and error output to a log file
+  java -jar LogParser.jar $SERVER $LOGTYPE $LOGPATH $PARSERLOGPATH $JDBC_URL $JDBC_USER $JDBC_DRIVER $JDBC_PASSWORD>> $POLICY_HOME/logs/parserlog.log 2>&1 &
+  echo "OK"
+}
+
+# Stops the application
+stop() {
+
+  # Like as the start function, checks the application status
+  check_status
+
+  pid=$?
+
+  if [ $pid -eq 0 ] ; then
+    echo "Application is already stopped"
+    exit 1
+  fi
+
+  # Kills the application process
+  echo -n "Stopping application: "
+  kill -9 $pid &
+  echo "OK"
+}
+
+# Show the application status
+status() {
+
+  # The check_status function, again...
+  check_status
+
+  # If the PID was returned means the application is running
+  if [ $? -ne 0 ] ; then
+    echo "Application is started"
+  else
+    echo "Application is stopped"
+  fi
+
+}
+
+# Main logic, a simple case to call functions
+case "$1" in
+  start)
+    start
+    ;;
+  stop)
+    stop
+    ;;
+  status)
+    status
+    ;;
+  restart|reload)
+    stop
+    start
+    ;;
+  *)
+    echo "Usage: $0 {start|stop|restart|reload|status}"
+    exit 1
+esac
+
+exit 0
diff --git a/LogParser/src/test/java/org/openecomp/xacml/parser/ParseLogTest.java b/LogParser/src/test/java/org/openecomp/xacml/parser/ParseLogTest.java
new file mode 100644
index 0000000..08df57a
--- /dev/null
+++ b/LogParser/src/test/java/org/openecomp/xacml/parser/ParseLogTest.java
@@ -0,0 +1,382 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * LogParser
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.xacml.parser;
+
+import static org.junit.Assert.*;
+
+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.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;
+
+	
+	@Before
+	public void setUp() throws Exception {
+		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) {
+			fail();
+		}
+		Mockito.doNothing().when(im).endTransaction();
+
+	}
+
+	@After
+	public void tearDown() {
+		File file = new File("nonExistFile.txt");
+		file.delete();
+//		systemProps.remove("com.sun.management.jmxremote.port");
+	}
+
+	@Test
+	public void testMain() {
+		try {	
+			
+			logParser.main(null);
+		} catch (Exception e) {
+			//fail();
+		}
+	}
+
+	@Test
+	public void testCountLines() throws IOException {
+		String fileName = "LineTest.txt";
+		int returnValue = logParser.countLines(fileName);
+		
+		assertEquals(9, returnValue);
+	}
+	
+	@Test
+	public void testParseRemoteSystem() {
+		String line = "||org.openecomp.policy.pap.xacml.rest.XACMLPapServlet$Heartbeat.run(XACMLPapServlet.java:2801)||Heartbeat 'https://localhost:8081/pdp/' status='UP_TO_DATE'";
+		String returnValue = ParseLog.parseRemoteSystem(line);
+		assertEquals("localhost:8081", returnValue);
+	}
+
+	@Test
+	public void testGetPropertiesValue() {
+		config = new Properties();
+		config.put("RESOURCE_NAME", "logparser_pap01");
+		config.put("JDBC_DRIVER" ,"com.mysql.jdbc.Driver");
+		config.put("JDBC_URL", "jdbc:mysql://localhost:3306/");
+		config.put("JDBC_USER", "root");
+		config.put("JDBC_PASSWORD", "password");
+		config.put("JMX_URL", "service:jmx:rmi:///jndi/rmi://localhost:9998/jmxrmi");
+		config.put("SERVER", "password");
+		config.put("JDBC_PASSWORD", "https://localhost:9091/pap/");
+		config.put("LOGTYPE", "PAP");
+		config.put("LOGPATH", "C:\\Workspaces\\HealthCheck\\pap-rest.log");
+		config.put("PARSERLOGPATH", "IntegrityMonitor.log");
+		
+		Properties returnConfig = logParser.getPropertiesValue(configFile);
+
+		
+		assertEquals(config.get("RESOURCE_NAME"), returnConfig.get("RESOURCE_NAME"));	
+	}
+	
+	@Test
+	public void testGetPropertiesFail() {	
+		Properties returnValue = ParseLog.getPropertiesValue("nonExistFile");
+		
+		assertEquals(null, returnValue);	
+	}
+
+	@Test
+	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());
+	}
+	
+	@Test
+	public  void  testParseDateFail(){
+		String line = "2016-02-23 08:07:30";
+		Date returnValue = ParseLog.parseDate(line, "yyyy-MM-dd HH:mm:ss", true);
+		
+		assertEquals(null, returnValue);
+	}
+	
+	@Test
+	public void testPullLastLineRead(){
+		
+		File file = new File("LineTest.txt");
+		String returnValue = null;
+		try {
+			returnValue = ParseLog.PullLastLineRead(file).trim();
+		} catch (IOException e) {
+			fail();
+		}		
+		assertEquals("12", returnValue);
+
+	}
+	
+	@Test
+	public void testPullLastLineReadNoFile(){
+		
+		File file = new File("nonExistFile.txt");
+		try {
+			assertEquals(null, ParseLog.PullLastLineRead(file));
+		} catch (IOException e) {
+			fail();
+		}
+	}
+	@Test
+	public void testPullLastLineReadFail(){
+		
+		File file = new File("LineTest2.txt");
+		try {
+			assertEquals(null, ParseLog.PullLastLineRead(file));
+		} catch (IOException e) {
+			fail();
+		}
+	}
+
+	@Test
+	public void testPullOutLogValues(){
+		//ERROR_VALUE
+		// Open the file
+		FileInputStream fstream;
+		try {
+			fstream = new FileInputStream("LineTest.txt");
+			BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
+			String strLine = br.readLine();
+			LogEntryObject retrunObject = ParseLog.pullOutLogValues(strLine, "ERROR");
+			assertEquals("ERROR_VALUE", retrunObject.getDescription());
+			br.close();
+		} catch (IOException e) {
+			fail();
+		}	
+//		assert(true);
+	}
+	@Test
+	public void testPullOutLogValuesSecond(){
+		//ERROR_VALUE
+		// Open the file
+		FileInputStream fstream;
+		try {
+			fstream = new FileInputStream("LineTest.txt");
+			BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
+			String strLine = br.readLine();
+			strLine = br.readLine();
+			LogEntryObject retrunObject = ParseLog.pullOutLogValues(strLine, "INFO");
+			assertEquals(LOGTYPE.INFO, retrunObject.getLogType());
+			br.close();
+		} catch (IOException e) {
+			fail();
+		}	
+	}
+	
+	@Test
+	public void testPullOutLogValuesThird(){
+		//ERROR_VALUE
+		// Open the file
+		FileInputStream fstream;
+		try {
+			int number = 3;
+			fstream = new FileInputStream("LineTest.txt");
+			BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
+			String strLine = br.readLine();
+			for (int i =0; i < number; i++){
+				strLine = br.readLine();
+			}
+			LogEntryObject retrunObject = ParseLog.pullOutLogValues(strLine, "PAP");
+			assertEquals(LOGTYPE.INFO, retrunObject.getLogType());
+			br.close();
+		} catch (IOException e) {
+			fail();
+		}	
+	}
+
+	@Test
+	public void testPullOutLogValuesFourth(){
+		// Open the file
+		FileInputStream fstream;
+		try {
+			int number = 4;
+			fstream = new FileInputStream("LineTest.txt");
+			BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
+			String strLine = br.readLine();
+			for (int i =0; i < number; i++){
+				strLine = br.readLine();
+			}
+			LogEntryObject retrunObject = ParseLog.pullOutLogValues(strLine, "PAP");
+			assertEquals(LOGTYPE.INFO, retrunObject.getLogType());
+			br.close();
+		} catch (IOException e) {
+			fail();
+		}	
+	}
+	
+	@Test
+	public void testPullOutLogValuesFith(){
+		// Open the file
+		FileInputStream fstream;
+		try {
+			int number = 5;
+			fstream = new FileInputStream("LineTest.txt");
+			BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
+			String strLine = br.readLine();
+			for (int i =0; i < number; i++){
+				strLine = br.readLine();
+			}
+			LogEntryObject retrunObject = ParseLog.pullOutLogValues(strLine, "PyPDP");
+			assertEquals(LOGTYPE.WARN, retrunObject.getLogType());
+			br.close();
+		} catch (IOException e) {
+			fail();
+		}	
+	}
+	
+	@Test
+	public void testPullOutLogValuesSixth(){
+		// Open the file
+		FileInputStream fstream;
+		try {
+			int number = 6;
+			fstream = new FileInputStream("LineTest.txt");
+			BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
+			String strLine = br.readLine();
+			for (int i =0; i < number; i++){
+				strLine = br.readLine();
+			}
+			LogEntryObject retrunObject = ParseLog.pullOutLogValues(strLine, "PyPDP");
+			assertEquals(LOGTYPE.SEVERE, retrunObject.getLogType());
+			br.close();
+		} catch (IOException e) {
+			fail();
+		}	
+	}
+
+	@Test
+	public void testPullOutLogValuesSeven(){
+		// Open the file
+		FileInputStream fstream;
+		try {
+			int number = 7;
+			fstream = new FileInputStream("LineTest.txt");
+			BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
+			String strLine = br.readLine();
+			for (int i =0; i < number; i++){
+				strLine = br.readLine();
+			}
+			LogEntryObject retrunObject = ParseLog.pullOutLogValues(strLine, "Console");
+			assertEquals(LOGTYPE.ERROR, retrunObject.getLogType());
+			br.close();
+		} catch (IOException e) {
+			fail();
+		}	
+	}
+	
+	@Test
+	public void testPullOutLogValuesEight(){
+		// Open the file
+		FileInputStream fstream;
+		try {
+			int number = 8;
+			fstream = new FileInputStream("LineTest.txt");
+			BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
+			String strLine = br.readLine();
+			for (int i =0; i < number; i++){
+				strLine = br.readLine();
+			}
+			LogEntryObject retrunObject = ParseLog.pullOutLogValues(strLine, "pap");
+			assertEquals(LOGTYPE.WARN, retrunObject.getLogType());
+			br.close();
+		} catch (IOException e) {
+			fail();
+		}	
+	}
+	
+	@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
+		LogEntryObject logObject = new LogEntryObject();
+		logObject.setSystem("vm02");
+		logObject.setSystemType("pap");
+		logObject.setDate(date);
+		logObject.setRemote("remote");
+
+		assertEquals("vm02", logObject.getSystem());
+		assertEquals("pap", logObject.getSystemType());
+		assertEquals(date, logObject.getDate());
+		assertEquals("remote", logObject.getRemote());
+	}
+
+	@Test
+	public void testProcess(){
+		String line = "2015-04-01 09:13:44.947  DEBUG 17482 --- [nio-8480-exec-7] c.a.l.ecomp.policy.std.StdPolicyConfig   : config Retrieved ";
+	
+		im = Mockito.mock(IntegrityMonitor.class);
+		try {
+			Mockito.doNothing().when(im).startTransaction();
+		} catch (StandbyStatusException | AdministrativeStateException e) {
+			fail();
+		}
+		Mockito.doNothing().when(im).endTransaction();
+		ParseLog.process(line, "pap");
+	}
+}
