diff options
author | Michal Kabaj <michal.kabaj@nokia.com> | 2018-02-01 11:04:08 +0100 |
---|---|---|
committer | Patrick Brady <pb071s@att.com> | 2018-02-01 23:03:03 +0000 |
commit | 36ca66b20d827cac5a6a2199e31369f6ad9e6a9c (patch) | |
tree | 592e10edb9d15746f4f46d6f7264131dfefdd219 /appc-config/appc-config-adaptor/provider/src/test/java | |
parent | 2ce03200e42e144eb45daf2732ab9164f2a57487 (diff) |
Use EELFLogger inside ConfigComponentAdaptor
Remove DebugLog implementation and replace its usage with EELFLogger.
Change-Id: Id98a398f4fa4f2131d6a1005932a248b5332f356
Issue-ID: APPC-539
Signed-off-by: Michal Kabaj <michal.kabaj@nokia.com>
Diffstat (limited to 'appc-config/appc-config-adaptor/provider/src/test/java')
-rw-r--r-- | appc-config/appc-config-adaptor/provider/src/test/java/org/onap/appc/ccadaptor/DebugLogTest.java | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/appc-config/appc-config-adaptor/provider/src/test/java/org/onap/appc/ccadaptor/DebugLogTest.java b/appc-config/appc-config-adaptor/provider/src/test/java/org/onap/appc/ccadaptor/DebugLogTest.java deleted file mode 100644 index 472bdc70d..000000000 --- a/appc-config/appc-config-adaptor/provider/src/test/java/org/onap/appc/ccadaptor/DebugLogTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.onap.appc.ccadaptor; - -import static junit.framework.TestCase.assertTrue; - -import java.io.BufferedReader; -import java.io.FileReader; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -public class DebugLogTest { - - @BeforeClass - public static void createEmptyLogFile() throws IOException { - Path logPath = Paths.get(buildTestResourcePath("rt.log")); - Files.createFile(logPath); - } - - @AfterClass - public static void removeLog() throws IOException { - Path existingLogPath = Paths.get(buildTestResourcePath("rt.log")); - Files.delete(existingLogPath); - } - - @Test - public void printRTAriDebug_shouldNotDoAnything_whenLogFileDoesNotExist() { - // GIVEN - Path nonExistingLogPath = Paths.get(buildTestResourcePath("nonExisting.log")); - - // WHEN - DebugLog debugLog = new DebugLog(nonExistingLogPath); - debugLog.printRTAriDebug("testMethod", "Custom Debug Message"); - - // THEN - assertTrue(Files.notExists(nonExistingLogPath)); - } - - @Test - public void printRTAriDebug_shouldWriteMessageToLogWithDate_whenLogFileExists() throws IOException { - // GIVEN - Path existingLogPath = Paths.get(buildTestResourcePath("rt.log")); - - // WHEN - DebugLog debugLog = new DebugLog(existingLogPath); - debugLog.printRTAriDebug("testMethod", "Custom Debug Message"); - - // THEN - String logEntry = readLogEntry(existingLogPath); - assertTrue(logEntry.matches("\\d{4}/\\d{2}/\\d{2} \\d{2}:\\d{2}:\\d{2} testMethod Custom Debug Message")); - } - - private static String buildTestResourcePath(String resourceName) { - String path = DebugLogTest.class.getClassLoader().getResource("./").getPath(); - return path + resourceName; - } - - private String readLogEntry(Path path) throws IOException { - try (BufferedReader br = new BufferedReader(new FileReader(path.toFile()))) { - return br.readLine(); - } - } -}
\ No newline at end of file |