You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ol...@apache.org on 2018/09/24 19:47:22 UTC

[ambari] 07/12: Fix UTs + logging changes

This is an automated email from the ASF dual-hosted git repository.

oleewere pushed a commit to branch branch-feature-logsearch-ga
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit 2abe3c7a67986c9cae97612fef23230b047c66f8
Author: Oliver Szabo <ol...@gmail.com>
AuthorDate: Sun Sep 23 19:28:02 2018 +0200

    Fix UTs + logging changes
---
 .../src/test/resources/log4j.xml                   | 34 --------------
 .../src/test/resources/log4j2-test.xml             | 23 ++++++++++
 .../apache/ambari/logfeeder/output/S3Uploader.java |  8 +++-
 .../org/apache/ambari/logfeeder/util/S3Util.java   |  2 +-
 .../ambari/logfeeder/filter/FilterGrokTest.java    | 10 ----
 .../ambari/logfeeder/filter/FilterJSONTest.java    | 10 ----
 .../logfeeder/filter/FilterKeyValueTest.java       |  9 ----
 .../ambari/logfeeder/input/InputFileTest.java      |  6 ---
 .../logfeeder/mapper/MapperAnonymizeTest.java      |  5 --
 .../ambari/logfeeder/mapper/MapperDateTest.java    |  8 ----
 .../logfeeder/mapper/MapperFieldCopyTest.java      |  4 --
 .../logfeeder/mapper/MapperFieldNameTest.java      |  4 --
 .../logfeeder/mapper/MapperFieldValueTest.java     |  5 --
 .../ambari/logfeeder/output/OutputKafkaTest.java   |  4 --
 .../ambari/logfeeder/output/S3UploaderTest.java    | 15 ++++--
 .../apache/ambari/logfeeder/util/S3UtilTest.java   |  4 ++
 .../src/test/resources/log4j.xml                   | 53 ----------------------
 .../src/test/resources/log4j2-test.xml             | 23 ++++++++++
 .../rest/error/GeneralExceptionMapper.java         |  6 +--
 .../LogsearchFileAuthenticationProviderTest.java   |  6 +--
 .../src/test/resources/log4j2-test.xml             | 23 ++++++++++
 21 files changed, 98 insertions(+), 164 deletions(-)

diff --git a/ambari-logsearch/ambari-logsearch-config-api/src/test/resources/log4j.xml b/ambari-logsearch/ambari-logsearch-config-api/src/test/resources/log4j.xml
deleted file mode 100644
index 6d968f9..0000000
--- a/ambari-logsearch/ambari-logsearch-config-api/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You 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.
--->
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-  <appender name="console" class="org.apache.log4j.ConsoleAppender">
-    <param name="Target" value="System.out" />
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
-      <!-- <param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/> -->
-    </layout>
-  </appender>
-
-  <root>
-    <priority value="warn" />
-    <appender-ref ref="console" />
-  </root>
-
-</log4j:configuration>
diff --git a/ambari-logsearch/ambari-logsearch-config-api/src/test/resources/log4j2-test.xml b/ambari-logsearch/ambari-logsearch-config-api/src/test/resources/log4j2-test.xml
new file mode 100644
index 0000000..a8694ce
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-config-api/src/test/resources/log4j2-test.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You 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.
+-->
+<Configuration>
+  <Loggers>
+    <Root level="fatal">
+    </Root>
+  </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3Uploader.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3Uploader.java
index 9e0f8b8..4273cc7 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3Uploader.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3Uploader.java
@@ -137,7 +137,7 @@ public class S3Uploader implements Runnable {
     File sourceFile = createCompressedFileForUpload(fileToUpload, compressionAlgo);
 
     logger.info("Starting S3 upload " + sourceFile + " -> " + bucketName + ", " + s3Path);
-    S3Util.writeFileIntoS3File(sourceFile.getAbsolutePath(), bucketName, s3Path, s3Endpoint, s3AccessKey, s3SecretKey);
+    writeFileIntoS3File(sourceFile, bucketName, s3Path, s3Endpoint, s3AccessKey, s3SecretKey);
 
     // delete local compressed file
     sourceFile.delete();
@@ -151,6 +151,12 @@ public class S3Uploader implements Runnable {
   }
 
   @VisibleForTesting
+  protected void writeFileIntoS3File(File sourceFile, String bucketName, String s3Path,
+                                     String s3Endpoint, String s3AccessKey, String s3SecretKey) {
+    S3Util.writeFileIntoS3File(sourceFile.getAbsolutePath(), bucketName, s3Path, s3Endpoint, s3AccessKey, s3SecretKey);
+  }
+
+  @VisibleForTesting
   protected File createCompressedFileForUpload(File fileToUpload, String compressionAlgo) {
     File outputFile = new File(fileToUpload.getParent(), fileToUpload.getName() + "_" + new Date().getTime() +
         "." + compressionAlgo);
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/S3Util.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/S3Util.java
index 632594b..07b5f4f 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/S3Util.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/S3Util.java
@@ -62,7 +62,7 @@ public class S3Util {
     StringBuilder s3Key = new StringBuilder();
     if (s3Path != null) {
       String[] s3PathParts = s3Path.replace(LogFeederConstants.S3_PATH_START_WITH, "").split(LogFeederConstants.S3_PATH_SEPARATOR);
-      ArrayList<String> s3PathList = new ArrayList<String>(Arrays.asList(s3PathParts));
+      ArrayList<String> s3PathList = new ArrayList<>(Arrays.asList(s3PathParts));
       s3PathList.remove(0);// remove bucketName
       for (int index = 0; index < s3PathList.size(); index++) {
         if (index > 0) {
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterGrokTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterGrokTest.java
index 8d3967b..f3d9078 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterGrokTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterGrokTest.java
@@ -26,7 +26,6 @@ import org.apache.ambari.logfeeder.plugin.input.Input;
 import org.apache.ambari.logfeeder.plugin.manager.OutputManager;
 import org.apache.ambari.logsearch.config.api.model.inputconfig.FilterGrokDescriptor;
 import org.apache.ambari.logsearch.config.json.model.inputconfig.impl.FilterGrokDescriptorImpl;
-import org.apache.log4j.Logger;
 import org.easymock.Capture;
 import org.easymock.CaptureType;
 import org.easymock.EasyMock;
@@ -39,7 +38,6 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 public class FilterGrokTest {
-  private static final Logger LOG = Logger.getLogger(FilterGrokTest.class);
 
   private FilterGrok filterGrok;
   private OutputManager mockOutputManager;
@@ -58,8 +56,6 @@ public class FilterGrokTest {
 
   @Test
   public void testFilterGrok_parseMessage() throws Exception {
-    LOG.info("testFilterGrok_parseMessage()");
-
     FilterGrokDescriptorImpl filterGrokDescriptor = new FilterGrokDescriptorImpl();
     filterGrokDescriptor.setMessagePattern("(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{GREEDYDATA:log_message}");
     filterGrokDescriptor.setMultilinePattern("^(%{TIMESTAMP_ISO8601:logtime})");
@@ -84,8 +80,6 @@ public class FilterGrokTest {
 
   @Test
   public void testFilterGrok_parseMultiLineMessage() throws Exception {
-    LOG.info("testFilterGrok_parseMultiLineMessage()");
-
     FilterGrokDescriptorImpl filterGrokDescriptor = new FilterGrokDescriptorImpl();
     filterGrokDescriptor.setMessagePattern("(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{GREEDYDATA:log_message}");
     filterGrokDescriptor.setMultilinePattern("^(%{TIMESTAMP_ISO8601:logtime})");
@@ -114,8 +108,6 @@ public class FilterGrokTest {
 
   @Test
   public void testFilterGrok_notMatchingMesagePattern() throws Exception {
-    LOG.info("testFilterGrok_notMatchingMesagePattern()");
-
     FilterGrokDescriptorImpl filterGrokDescriptor = new FilterGrokDescriptorImpl();
     filterGrokDescriptor.setMessagePattern("(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{GREEDYDATA:log_message}");
     filterGrokDescriptor.setMultilinePattern("^(%{TIMESTAMP_ISO8601:logtime})");
@@ -134,8 +126,6 @@ public class FilterGrokTest {
 
   @Test
   public void testFilterGrok_noMesagePattern() throws Exception {
-    LOG.info("testFilterGrok_noMesagePattern()");
-
     FilterGrokDescriptorImpl filterGrokDescriptor = new FilterGrokDescriptorImpl();
     filterGrokDescriptor.setMultilinePattern("^(%{TIMESTAMP_ISO8601:logtime})");
     init(filterGrokDescriptor);
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterJSONTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterJSONTest.java
index a328eb8..b1b0c55 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterJSONTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterJSONTest.java
@@ -30,7 +30,6 @@ import org.apache.ambari.logfeeder.conf.LogFeederProps;
 import org.apache.ambari.logfeeder.input.InputFileMarker;
 import org.apache.ambari.logfeeder.plugin.manager.OutputManager;
 import org.apache.ambari.logsearch.config.json.model.inputconfig.impl.FilterJsonDescriptorImpl;
-import org.apache.log4j.Logger;
 import org.easymock.Capture;
 import org.easymock.CaptureType;
 import org.easymock.EasyMock;
@@ -42,7 +41,6 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 public class FilterJSONTest {
-  private static final Logger LOG = Logger.getLogger(FilterJSONTest.class);
 
   private FilterJSON filterJson;
   private OutputManager mockOutputManager;
@@ -60,8 +58,6 @@ public class FilterJSONTest {
 
   @Test
   public void testJSONFilterCode_convertFields() throws Exception {
-    LOG.info("testJSONFilterCode_convertFields()");
-
     init(new FilterJsonDescriptorImpl());
 
     mockOutputManager.write(EasyMock.capture(capture), EasyMock.anyObject(InputFileMarker.class));
@@ -85,8 +81,6 @@ public class FilterJSONTest {
 
   @Test
   public void testJSONFilterCode_logTimeOnly() throws Exception {
-    LOG.info("testJSONFilterCode_logTimeOnly()");
-
     init(new FilterJsonDescriptorImpl());
 
     mockOutputManager.write(EasyMock.capture(capture), EasyMock.anyObject(InputFileMarker.class));
@@ -110,8 +104,6 @@ public class FilterJSONTest {
 
   @Test
   public void testJSONFilterCode_lineNumberOnly() throws Exception {
-    LOG.info("testJSONFilterCode_lineNumberOnly()");
-
     init(new FilterJsonDescriptorImpl());
 
     mockOutputManager.write(EasyMock.capture(capture), EasyMock.anyObject(InputFileMarker.class));
@@ -131,8 +123,6 @@ public class FilterJSONTest {
   
   @Test
   public void testJSONFilterCode_invalidJson() throws Exception {
-    LOG.info("testJSONFilterCode_invalidJson()");
-    
     init(new FilterJsonDescriptorImpl());
     
     String inputStr = "invalid json";
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java
index efda7e2..bba8d8b 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java
@@ -25,7 +25,6 @@ import org.apache.ambari.logfeeder.input.InputFileMarker;
 import org.apache.ambari.logfeeder.plugin.manager.OutputManager;
 import org.apache.ambari.logsearch.config.api.model.inputconfig.FilterKeyValueDescriptor;
 import org.apache.ambari.logsearch.config.json.model.inputconfig.impl.FilterKeyValueDescriptorImpl;
-import org.apache.log4j.Logger;
 import org.easymock.Capture;
 import org.easymock.CaptureType;
 import org.easymock.EasyMock;
@@ -37,7 +36,6 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 public class FilterKeyValueTest {
-  private static final Logger LOG = Logger.getLogger(FilterKeyValueTest.class);
 
   private FilterKeyValue filterKeyValue;
   private OutputManager mockOutputManager;
@@ -55,8 +53,6 @@ public class FilterKeyValueTest {
 
   @Test
   public void testFilterKeyValue_extraction() throws Exception {
-    LOG.info("testFilterKeyValue_extraction()");
-
     FilterKeyValueDescriptorImpl filterKeyValueDescriptor = new FilterKeyValueDescriptorImpl();
     filterKeyValueDescriptor.setSourceField("keyValueField");
     filterKeyValueDescriptor.setFieldSplit("&");
@@ -79,8 +75,6 @@ public class FilterKeyValueTest {
 
   @Test
   public void testFilterKeyValue_extractionWithBorders() throws Exception {
-    LOG.info("testFilterKeyValue_extractionWithBorders()");
-
     FilterKeyValueDescriptorImpl filterKeyValueDescriptor = new FilterKeyValueDescriptorImpl();
     filterKeyValueDescriptor.setSourceField("keyValueField");
     filterKeyValueDescriptor.setFieldSplit("&");
@@ -104,8 +98,6 @@ public class FilterKeyValueTest {
 
   @Test
   public void testFilterKeyValue_missingSourceField() throws Exception {
-    LOG.info("testFilterKeyValue_missingSourceField()");
-
     FilterKeyValueDescriptorImpl filterKeyValueDescriptor = new FilterKeyValueDescriptorImpl();
     filterKeyValueDescriptor.setFieldSplit("&");
     init(filterKeyValueDescriptor);
@@ -122,7 +114,6 @@ public class FilterKeyValueTest {
 
   @Test
   public void testFilterKeyValue_noSourceFieldPresent() throws Exception {
-    LOG.info("testFilterKeyValue_noSourceFieldPresent()");
 
     FilterKeyValueDescriptorImpl filterKeyValueDescriptor = new FilterKeyValueDescriptorImpl();
     filterKeyValueDescriptor.setSourceField("keyValueField");
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputFileTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputFileTest.java
index 0a95342..02d141f 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputFileTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputFileTest.java
@@ -33,7 +33,6 @@ import org.apache.ambari.logfeeder.plugin.manager.CheckpointManager;
 import org.apache.ambari.logfeeder.plugin.manager.InputManager;
 import org.apache.ambari.logsearch.config.json.model.inputconfig.impl.InputFileDescriptorImpl;
 import org.apache.commons.io.FileUtils;
-import org.apache.log4j.Logger;
 import org.easymock.EasyMock;
 import org.junit.After;
 import org.junit.AfterClass;
@@ -46,7 +45,6 @@ import org.junit.rules.ExpectedException;
 import static org.junit.Assert.assertEquals;
 
 public class InputFileTest {
-  private static final Logger LOG = Logger.getLogger(InputFileTest.class);
 
   private static final String TEST_DIR_NAME = "/logfeeder_test_dir/";
   private static final File TEST_DIR = new File(FileUtils.getTempDirectoryPath() + TEST_DIR_NAME);
@@ -133,8 +131,6 @@ public class InputFileTest {
 
   @Test
   public void testInputFile_process3Rows() throws Exception {
-    LOG.info("testInputFile_process3Rows()");
-
     File testFile = createFile("process3.log");
 
     init(testFile.getAbsolutePath());
@@ -157,8 +153,6 @@ public class InputFileTest {
 
   @Test
   public void testInputFile_noLogPath() throws Exception {
-    LOG.info("testInputFile_noLogPath()");
-
     expectedException.expect(NullPointerException.class);
 
     init(null);
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperAnonymizeTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperAnonymizeTest.java
index c22f312..7953615 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperAnonymizeTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperAnonymizeTest.java
@@ -22,7 +22,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.ambari.logsearch.config.json.model.inputconfig.impl.MapAnonymizeDescriptorImpl;
-import org.apache.log4j.Logger;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
@@ -30,11 +29,9 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 public class MapperAnonymizeTest {
-  private static final Logger LOG = Logger.getLogger(MapperAnonymizeTest.class);
 
   @Test
   public void testMapperAnonymize_anonymize() {
-    LOG.info("testMapperAnonymize_anonymize()");
 
     MapAnonymizeDescriptorImpl mapAnonymizeDescriptorImpl = new MapAnonymizeDescriptorImpl();
     mapAnonymizeDescriptorImpl.setPattern("secret <hide> / <hide> is here");
@@ -51,7 +48,6 @@ public class MapperAnonymizeTest {
 
   @Test
   public void testMapperAnonymize_anonymize2() {
-    LOG.info("testMapperAnonymize_anonymize2()");
 
     MapAnonymizeDescriptorImpl mapAnonymizeDescriptorImpl = new MapAnonymizeDescriptorImpl();
     mapAnonymizeDescriptorImpl.setPattern("<hide> / <hide> is the secret");
@@ -69,7 +65,6 @@ public class MapperAnonymizeTest {
 
   @Test
   public void testMapperAnonymize_noPattern() {
-    LOG.info("testMapperAnonymize_noPattern()");
 
     MapAnonymizeDescriptorImpl mapAnonymizeDescriptorImpl = new MapAnonymizeDescriptorImpl();
 
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java
index 5e94996..d0643ea 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java
@@ -27,7 +27,6 @@ import java.util.Map;
 import org.apache.ambari.logfeeder.common.LogFeederConstants;
 import org.apache.ambari.logsearch.config.json.model.inputconfig.impl.MapDateDescriptorImpl;
 import org.apache.commons.lang3.time.DateUtils;
-import org.apache.log4j.Logger;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
@@ -35,11 +34,9 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 public class MapperDateTest {
-  private static final Logger LOG = Logger.getLogger(MapperDateTest.class);
 
   @Test
   public void testMapperDate_epoch() {
-    LOG.info("testMapperDate_epoch()");
 
     MapDateDescriptorImpl mapDateDescriptor = new MapDateDescriptorImpl();
     mapDateDescriptor.setTargetDatePattern("epoch");
@@ -60,7 +57,6 @@ public class MapperDateTest {
 
   @Test
   public void testMapperDate_pattern() throws Exception {
-    LOG.info("testMapperDate_pattern()");
 
     MapDateDescriptorImpl mapDateDescriptor = new MapDateDescriptorImpl();
     mapDateDescriptor.setTargetDatePattern("yyyy-MM-dd HH:mm:ss.SSS");
@@ -82,7 +78,6 @@ public class MapperDateTest {
 
   @Test
   public void testMapperDate_noDatePattern() {
-    LOG.info("testMapperDate_noDatePattern()");
 
     MapDateDescriptorImpl mapDateDescriptor = new MapDateDescriptorImpl();
 
@@ -92,7 +87,6 @@ public class MapperDateTest {
 
   @Test
   public void testMapperDate_notParsableDatePattern() {
-    LOG.info("testMapperDate_notParsableDatePattern()");
 
     MapDateDescriptorImpl mapDateDescriptor = new MapDateDescriptorImpl();
     mapDateDescriptor.setTargetDatePattern("not_parsable_content");
@@ -103,7 +97,6 @@ public class MapperDateTest {
 
   @Test
   public void testMapperDate_invalidEpochValue() {
-    LOG.info("testMapperDate_invalidEpochValue()");
 
     MapDateDescriptorImpl mapDateDescriptor = new MapDateDescriptorImpl();
     mapDateDescriptor.setTargetDatePattern("epoch");
@@ -121,7 +114,6 @@ public class MapperDateTest {
 
   @Test
   public void testMapperDate_invalidDateStringValue() {
-    LOG.info("testMapperDate_invalidDateStringValue()");
 
     MapDateDescriptorImpl mapDateDescriptor = new MapDateDescriptorImpl();
     mapDateDescriptor.setTargetDatePattern("yyyy-MM-dd HH:mm:ss.SSS");
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldCopyTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldCopyTest.java
index 5c6cc93..32c8b99 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldCopyTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldCopyTest.java
@@ -22,7 +22,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.ambari.logsearch.config.json.model.inputconfig.impl.MapFieldCopyDescriptorImpl;
-import org.apache.log4j.Logger;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
@@ -30,11 +29,9 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 public class MapperFieldCopyTest {
-  private static final Logger LOG = Logger.getLogger(MapperFieldCopyTest.class);
 
   @Test
   public void testMapperFieldCopy_copyField() {
-    LOG.info("testMapperFieldCopy_copyField()");
 
     MapFieldCopyDescriptorImpl mapFieldCopyDescriptor = new MapFieldCopyDescriptorImpl();
     mapFieldCopyDescriptor.setCopyName("someOtherField");
@@ -54,7 +51,6 @@ public class MapperFieldCopyTest {
 
   @Test
   public void testMapperFieldCopy_noNewFieldName() {
-    LOG.info("testMapperFieldCopy_noNewFieldName()");
 
     MapFieldCopyDescriptorImpl mapFieldCopyDescriptor = new MapFieldCopyDescriptorImpl();
 
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldNameTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldNameTest.java
index f74c9f8..b1dbd4d 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldNameTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldNameTest.java
@@ -22,7 +22,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.ambari.logsearch.config.json.model.inputconfig.impl.MapFieldNameDescriptorImpl;
-import org.apache.log4j.Logger;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
@@ -30,11 +29,9 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 public class MapperFieldNameTest {
-  private static final Logger LOG = Logger.getLogger(MapperFieldNameTest.class);
 
   @Test
   public void testMapperFieldName_replaceField() {
-    LOG.info("testMapperFieldName_replaceField()");
 
     MapFieldNameDescriptorImpl mapFieldNameDescriptor = new MapFieldNameDescriptorImpl();
     mapFieldNameDescriptor.setNewFieldName("someOtherField");
@@ -54,7 +51,6 @@ public class MapperFieldNameTest {
 
   @Test
   public void testMapperFieldName_noNewFieldName() {
-    LOG.info("testMapperFieldName_noNewFieldName()");
 
     MapFieldNameDescriptorImpl mapFieldNameDescriptor = new MapFieldNameDescriptorImpl();
 
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldValueTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldValueTest.java
index 92befa9..1c82a1e 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldValueTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldValueTest.java
@@ -22,7 +22,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.ambari.logsearch.config.json.model.inputconfig.impl.MapFieldValueDescriptorImpl;
-import org.apache.log4j.Logger;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
@@ -30,11 +29,9 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 public class MapperFieldValueTest {
-  private static final Logger LOG = Logger.getLogger(MapperFieldValueTest.class);
 
   @Test
   public void testMapperFieldValue_replaceValue() {
-    LOG.info("testMapperFieldValue_replaceValue()");
 
     MapFieldValueDescriptorImpl mapFieldValueDescriptor = new MapFieldValueDescriptorImpl();
     mapFieldValueDescriptor.setPreValue("someValue");
@@ -54,7 +51,6 @@ public class MapperFieldValueTest {
 
   @Test
   public void testMapperFieldValue_noPostValue() {
-    LOG.info("testMapperFieldValue_noPostValue()");
 
     MapFieldValueDescriptorImpl mapFieldValueDescriptor = new MapFieldValueDescriptorImpl();
 
@@ -64,7 +60,6 @@ public class MapperFieldValueTest {
 
   @Test
   public void testMapperFieldValue_noPreValueFound() {
-    LOG.info("testMapperFieldValue_noPreValueFound()");
 
     MapFieldValueDescriptorImpl mapFieldValueDescriptor = new MapFieldValueDescriptorImpl();
     mapFieldValueDescriptor.setPreValue("someValue");
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputKafkaTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputKafkaTest.java
index 1623738..ad8c225 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputKafkaTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputKafkaTest.java
@@ -39,7 +39,6 @@ import org.junit.Test;
 import org.junit.rules.ExpectedException;
 
 public class OutputKafkaTest {
-  private static final Logger LOG = Logger.getLogger(OutputKafkaTest.class);
 
   private static final String TEST_TOPIC = "test topic";
 
@@ -63,7 +62,6 @@ public class OutputKafkaTest {
 
   @Test
   public void testOutputKafka_uploadData() throws Exception {
-    LOG.info("testOutputKafka_uploadData()");
 
     Map<String, Object> config = new HashMap<String, Object>();
     config.put("broker_list", "some broker list");
@@ -95,7 +93,6 @@ public class OutputKafkaTest {
 
   @Test
   public void testOutputKafka_noBrokerList() throws Exception {
-    LOG.info("testOutputKafka_noBrokerList()");
 
     expectedException.expect(Exception.class);
     expectedException.expectMessage("For kafka output, bootstrap broker_list is needed");
@@ -109,7 +106,6 @@ public class OutputKafkaTest {
 
   @Test
   public void testOutputKafka_noTopic() throws Exception {
-    LOG.info("testOutputKafka_noBrokerList()");
 
     expectedException.expect(Exception.class);
     expectedException.expectMessage("For kafka output, topic is needed");
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/S3UploaderTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/S3UploaderTest.java
index 5477f5c..8c61914 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/S3UploaderTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/S3UploaderTest.java
@@ -45,6 +45,7 @@ public class S3UploaderTest {
     Map<String, Object> configs = setupS3Configs();
 
     S3OutputConfiguration s3OutputConfiguration = new S3OutputConfiguration(configs);
+    expect(compressedFile.getAbsolutePath()).andReturn(TEST_BUCKET + "/" + LOG_TYPE + "/" +fileName);
     expect(compressedFile.delete()).andReturn(true);
     expect(fileToUpload.delete()).andReturn(true);
     replay(fileToUpload, compressedFile);
@@ -54,7 +55,8 @@ public class S3UploaderTest {
       protected File createCompressedFileForUpload(File fileToUpload, String compressionAlgo) {
         return compressedFile;
       }
-      protected void uploadFileToS3(String bucketName, String s3Key, File localFile, String accessKey, String secretKey) {
+      @Override
+      protected void writeFileIntoS3File(File sourceFile, String bucketName, String s3Path, String s3Endpoint, String s3AccessKey, String s3SecretKey) {
       }
     };
     String resolvedPath = s3Uploader.uploadFile(fileToUpload, LOG_TYPE);
@@ -80,7 +82,9 @@ public class S3UploaderTest {
       protected File createCompressedFileForUpload(File fileToUpload, String compressionAlgo) {
         return compressedFile;
       }
-      protected void uploadFileToS3(String bucketName, String s3Key, File localFile, String accessKey, String secretKey) {
+
+      @Override
+      protected void writeFileIntoS3File(File sourceFile, String bucketName, String s3Path, String s3Endpoint, String s3AccessKey, String s3SecretKey) {
       }
     };
     s3Uploader.uploadFile(fileToUpload, LOG_TYPE);
@@ -106,7 +110,8 @@ public class S3UploaderTest {
       protected File createCompressedFileForUpload(File fileToUpload, String compressionAlgo) {
         return compressedFile;
       }
-      protected void uploadFileToS3(String bucketName, String s3Key, File localFile, String accessKey, String secretKey) {
+      @Override
+      protected void writeFileIntoS3File(File sourceFile, String bucketName, String s3Path, String s3Endpoint, String s3AccessKey, String s3SecretKey) {
       }
     };
     s3Uploader.uploadFile(fileToUpload, LOG_TYPE);
@@ -128,6 +133,7 @@ public class S3UploaderTest {
     S3OutputConfiguration s3OutputConfiguration = new S3OutputConfiguration(configs);
     expect(compressedFile.delete()).andReturn(true);
     expect(fileToUpload.delete()).andReturn(true);
+    expect(compressedFile.getAbsolutePath()).andReturn(TEST_BUCKET + "/" + LOG_TYPE + "/" +fileName);
     replay(fileToUpload, compressedFile);
 
     S3Uploader s3Uploader = new S3Uploader(s3OutputConfiguration, true, LOG_TYPE) {
@@ -135,7 +141,8 @@ public class S3UploaderTest {
       protected File createCompressedFileForUpload(File fileToUpload, String compressionAlgo) {
         return compressedFile;
       }
-      protected void uploadFileToS3(String bucketName, String s3Key, File localFile, String accessKey, String secretKey) {
+      @Override
+      protected void writeFileIntoS3File(File sourceFile, String bucketName, String s3Path, String s3Endpoint, String s3AccessKey, String s3SecretKey) {
       }
     };
     s3Uploader.uploadFile(fileToUpload, LOG_TYPE);
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/util/S3UtilTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/util/S3UtilTest.java
index 02918be..51c34a2 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/util/S3UtilTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/util/S3UtilTest.java
@@ -21,8 +21,11 @@ package org.apache.ambari.logfeeder.util;
 import static org.junit.Assert.assertEquals;
 
 import org.apache.ambari.logfeeder.util.S3Util;
+import org.junit.Test;
 
 public class S3UtilTest {
+
+  @Test
   public void testS3Util_pathToBucketName() throws Exception {
     String s3Path = "s3://bucket_name/path/file.txt";
     String expectedBucketName = "bucket_name";
@@ -30,6 +33,7 @@ public class S3UtilTest {
     assertEquals(expectedBucketName, actualBucketName);
   }
 
+  @Test
   public void testS3Util_pathToS3Key() throws Exception {
     String s3Path = "s3://bucket_name/path/file.txt";
     String expectedS3key = "path/file.txt";
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/resources/log4j.xml b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/resources/log4j.xml
deleted file mode 100644
index 1d28fcc..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You 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.
--->
-<!DOCTYPE log4j:configuration SYSTEM "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-  <appender name="console" class="org.apache.log4j.ConsoleAppender">
-    <param name="Target" value="System.out" />
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
-      <!-- <param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/> -->
-    </layout>
-  </appender>
-
-  <!-- Logs to suppress BEGIN -->
-  <category name="org.apache.solr.common.cloud.ZkStateReader" additivity="false">
-    <priority value="error" />
-    <appender-ref ref="console" />
-  </category>
-
-  <category name="apache.solr.client.solrj.impl.CloudSolrClient" additivity="false">
-    <priority value="fatal" />
-    <appender-ref ref="console" />
-  </category>
-  <!-- Logs to suppress END -->
-
-  <category name="org.apache.ambari.logfeeder" additivity="false">
-    <priority value="info" />
-    <appender-ref ref="console" /> 
-    <!-- <appender-ref ref="daily_rolling_file" /> -->
-  </category>
-
-  <root>
-    <priority value="warn" />
-    <!-- <appender-ref ref="console" /> -->
-    <!-- <appender-ref ref="daily_rolling_file" /> -->
-  </root>
- 
-</log4j:configuration>  
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/resources/log4j2-test.xml b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/resources/log4j2-test.xml
new file mode 100644
index 0000000..a8694ce
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/resources/log4j2-test.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You 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.
+-->
+<Configuration>
+  <Loggers>
+    <Root level="fatal">
+    </Root>
+  </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/rest/error/GeneralExceptionMapper.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/rest/error/GeneralExceptionMapper.java
index 81f13fd..703dbad 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/rest/error/GeneralExceptionMapper.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/rest/error/GeneralExceptionMapper.java
@@ -36,8 +36,8 @@ import org.apache.ambari.logsearch.common.StatusMessage;
 import org.apache.ambari.logsearch.manager.AlreadyExistsException;
 import org.apache.ambari.logsearch.manager.MalformedInputException;
 import org.apache.ambari.logsearch.manager.NotFoundException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.springframework.web.bind.MethodArgumentNotValidException;
 
 import com.fasterxml.jackson.core.JsonParseException;
@@ -48,7 +48,7 @@ import com.google.common.collect.Maps;
 @Named
 @Provider
 public class GeneralExceptionMapper implements ExceptionMapper<Exception> {
-  private static final Logger LOG = LoggerFactory.getLogger(GeneralExceptionMapper.class);
+  private static final Logger LOG = LogManager.getLogger(GeneralExceptionMapper.class);
   static final String INTERNAL_SERVER_ERROR_MESSAGE = "Something went wrong, For more details check the logs or configuration.";
 
   private static final Map<Class<? extends Exception>, Response.Status> exceptionStatusCodeMap = Maps.newHashMap();
diff --git a/ambari-logsearch/ambari-logsearch-server/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProviderTest.java b/ambari-logsearch/ambari-logsearch-server/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProviderTest.java
index 0c3ed29..1027d77 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProviderTest.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProviderTest.java
@@ -173,7 +173,7 @@ public class LogsearchFileAuthenticationProviderTest {
   
   @Test
   public void testAuthenticationNoPassword() {
-    List<GrantedAuthority> grantedAuths = Arrays.<GrantedAuthority>asList(new SimpleGrantedAuthority("ROLE_USER"));
+    List<GrantedAuthority> grantedAuths = Arrays.asList(new SimpleGrantedAuthority("ROLE_USER"));
     User user = new User("principal", null, grantedAuths);
     
     expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true);
@@ -215,9 +215,9 @@ public class LogsearchFileAuthenticationProviderTest {
   
   @Test
   public void testAuthenticationSuccessful() {
-    List<GrantedAuthority> grantedAuths = Arrays.<GrantedAuthority>asList(new SimpleGrantedAuthority("ROLE_USER"));
+    List<GrantedAuthority> grantedAuths = Arrays.asList(new SimpleGrantedAuthority("ROLE_USER"));
     String encodedPassword = passwordEncoder.encode("credentials");
-    User user = new User("principal", "credentials", grantedAuths);
+    User user = new User("principal", encodedPassword, grantedAuths);
     
     expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true);
     expect(mockUserDetailsService.loadUserByUsername("principal")).andReturn(user);
diff --git a/ambari-logsearch/ambari-logsearch-server/src/test/resources/log4j2-test.xml b/ambari-logsearch/ambari-logsearch-server/src/test/resources/log4j2-test.xml
new file mode 100644
index 0000000..a8694ce
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-server/src/test/resources/log4j2-test.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You 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.
+-->
+<Configuration>
+  <Loggers>
+    <Root level="fatal">
+    </Root>
+  </Loggers>
+</Configuration>
\ No newline at end of file