ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgerg...@apache.org
Subject ambari git commit: AMBARI-20727 Small fixes in Log Search (mgergely)
Date Wed, 31 May 2017 09:59:44 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 4f36e1454 -> b1f971717


AMBARI-20727 Small fixes in Log Search (mgergely)

Change-Id: I82c90696a963691ec6e26d91fe88a21055a00e0c


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b1f97171
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b1f97171
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b1f97171

Branch: refs/heads/trunk
Commit: b1f9717173086a8a6aef59def8a9f4b9ab01a412
Parents: 4f36e14
Author: Miklos Gergely <mgergely@hortonworks.com>
Authored: Wed May 31 11:51:09 2017 +0200
Committer: Miklos Gergely <mgergely@hortonworks.com>
Committed: Wed May 31 11:51:09 2017 +0200

----------------------------------------------------------------------
 .../ambari-logsearch-appender/pom.xml           |   3 +-
 .../logsearch/steps/LogSearchApiSteps.java      |   6 +-
 .../ambari-logsearch-logfeeder/pom.xml          |   2 -
 .../src/main/resources/log4j.xml                |   3 +-
 .../ambari-logsearch-server/pom.xml             |   2 -
 .../AbstractLogRequestFacetQueryConverter.java  |   2 +
 .../handler/ListCollectionHandler.java          |   1 +
 .../logsearch/manager/AuditLogsManager.java     |  11 +-
 .../ambari/logsearch/manager/ManagerBase.java   |   5 +-
 .../logsearch/manager/ServiceLogsManager.java   |  62 ++++----
 .../LogsearchAuthSuccessHandler.java            |   4 -
 .../web/filters/LogsearchKrbFilter.java         |  62 ++++----
 .../web/model/JWTAuthenticationToken.java       |   2 +-
 .../src/main/resources/log4j.xml                | 158 ++++++++++---------
 .../server/upgrade/UpgradeCatalog300.java       |  19 +++
 .../0.5.0/properties/logfeeder-log4j.xml.j2     |   2 +-
 .../0.5.0/properties/logsearch-log4j.xml.j2     |   2 +-
 .../server/upgrade/UpgradeCatalog300Test.java   |  33 ++++
 18 files changed, 218 insertions(+), 161 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f97171/ambari-logsearch/ambari-logsearch-appender/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-appender/pom.xml b/ambari-logsearch/ambari-logsearch-appender/pom.xml
index e14d576..1580737 100644
--- a/ambari-logsearch/ambari-logsearch-appender/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-appender/pom.xml
@@ -23,9 +23,8 @@
     <groupId>org.apache.ambari</groupId>
     <version>2.0.0.0-SNAPSHOT</version>
   </parent>
-  <groupId>org.apache.ambari</groupId>
+  
   <artifactId>ambari-logsearch-appender</artifactId>
-  <version>2.0.0.0-SNAPSHOT</version>
   <packaging>jar</packaging>
   <name>Ambari Logsearch Appender</name>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f97171/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/LogSearchApiSteps.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/LogSearchApiSteps.java b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/LogSearchApiSteps.java
index bcfc4db..90fff94 100644
--- a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/LogSearchApiSteps.java
+++ b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/LogSearchApiSteps.java
@@ -41,7 +41,6 @@ import java.io.IOException;
 import java.net.URISyntaxException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -81,12 +80,13 @@ public class LogSearchApiSteps {
     JsonNode expected = mapper.readTree(jsonExpected);
     JsonNode result = mapper.readTree(response);
     JsonNode patch = JsonDiff.asJson(expected, result);
-    List<Object> diffObjects = mapper.convertValue(patch, List.class);
+    List<?> diffObjects = mapper.convertValue(patch, List.class);
     assertDiffs(diffObjects, expected);
 
   }
 
-  private void assertDiffs(List<Object> diffObjects, JsonNode expected) {
+  @SuppressWarnings("unchecked")
+  private void assertDiffs(List<?> diffObjects, JsonNode expected) {
     for (Object diffObj : diffObjects) {
       String path = ((Map<String, String>) diffObj).get("path");
       Assert.assertTrue(expected.at(path).isMissingNode());

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f97171/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml b/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
index 5d6f8b6..ddef52f 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
@@ -26,8 +26,6 @@
   <modelVersion>4.0.0</modelVersion>
 
   <artifactId>ambari-logsearch-logfeeder</artifactId>
-  <groupId>org.apache.ambari</groupId>
-  <version>2.0.0.0-SNAPSHOT</version>
   <packaging>jar</packaging>
   <name>Ambari Logsearch Log Feeder</name>
   <url>http://maven.apache.org</url>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f97171/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/log4j.xml b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/log4j.xml
index 8a3d26d..8d5174e 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/log4j.xml
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/log4j.xml
@@ -15,7 +15,8 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!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">

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f97171/ambari-logsearch/ambari-logsearch-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/pom.xml b/ambari-logsearch/ambari-logsearch-server/pom.xml
index b505c12..7cd90eb 100755
--- a/ambari-logsearch/ambari-logsearch-server/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-server/pom.xml
@@ -22,10 +22,8 @@
     <version>2.0.0.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.ambari</groupId>
   <artifactId>ambari-logsearch-server</artifactId>
   <packaging>jar</packaging>
-  <version>2.0.0.0-SNAPSHOT</version>
   <url>http://maven.apache.org</url>
   <name>Ambari Logsearch Server</name>
   <properties>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f97171/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/converter/AbstractLogRequestFacetQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/converter/AbstractLogRequestFacetQueryConverter.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/converter/AbstractLogRequestFacetQueryConverter.java
index d5e807b..db34684 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/converter/AbstractLogRequestFacetQueryConverter.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/converter/AbstractLogRequestFacetQueryConverter.java
@@ -67,9 +67,11 @@ public abstract class AbstractLogRequestFacetQueryConverter<SOURCE extends BaseL
 
   public abstract LogType getLogType();
 
+  @SuppressWarnings("unused")
   public void appendFacetQuery(SimpleFacetQuery facetQuery, SOURCE request) {
   }
 
+  @SuppressWarnings("unused")
   public void appendFacetOptions(FacetOptions facetOptions, SOURCE request) {
     facetOptions.setFacetLimit(-1);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f97171/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/handler/ListCollectionHandler.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/handler/ListCollectionHandler.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/handler/ListCollectionHandler.java
index 124ce40..b2c8e4f 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/handler/ListCollectionHandler.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/handler/ListCollectionHandler.java
@@ -33,6 +33,7 @@ public class ListCollectionHandler implements SolrZkRequestHandler<List<String>>
 
   private static final Logger LOG = LoggerFactory.getLogger(ListCollectionHandler.class);
 
+  @SuppressWarnings("unchecked")
   @Override
   public List<String> handle(CloudSolrClient solrClient, SolrPropsConfig solrPropsConfig) throws Exception {
     try {

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f97171/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/AuditLogsManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/AuditLogsManager.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/AuditLogsManager.java
index 99d2675..4f3fcbb 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/AuditLogsManager.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/AuditLogsManager.java
@@ -46,9 +46,9 @@ import org.apache.ambari.logsearch.model.request.impl.AuditBarGraphRequest;
 import org.apache.ambari.logsearch.model.request.impl.AuditComponentRequest;
 import org.apache.ambari.logsearch.model.request.impl.AuditLogRequest;
 import org.apache.ambari.logsearch.model.request.impl.AuditServiceLoadRequest;
-import org.apache.ambari.logsearch.model.request.impl.FieldAuditLogRequest;
 import org.apache.ambari.logsearch.model.request.impl.TopFieldAuditLogRequest;
 import org.apache.ambari.logsearch.model.request.impl.UserExportRequest;
+import org.apache.ambari.logsearch.model.response.AuditLogData;
 import org.apache.ambari.logsearch.model.response.AuditLogResponse;
 import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse;
 import org.apache.ambari.logsearch.model.response.GroupListResponse;
@@ -74,7 +74,7 @@ import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.A
 import static org.apache.ambari.logsearch.solr.SolrConstants.CommonLogConstants.CLUSTER;
 
 @Named
-public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResponse> {
+public class AuditLogsManager extends ManagerBase<AuditLogData, AuditLogResponse> {
   private static final Logger logger = Logger.getLogger(AuditLogsManager.class);
 
   private static final String AUDIT_LOG_TEMPLATE = "audit_log_txt.ftl";
@@ -208,8 +208,11 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
   }
 
   @Override
-  protected List<SolrAuditLogData> convertToSolrBeans(QueryResponse response) {
-    return response.getBeans(SolrAuditLogData.class);
+  protected List<AuditLogData> convertToSolrBeans(QueryResponse response) {
+    List<SolrAuditLogData> solrAuditLogData = response.getBeans(SolrAuditLogData.class);
+    List<AuditLogData> auditLogData = new ArrayList<>();
+    auditLogData.addAll( solrAuditLogData );
+    return auditLogData;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f97171/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
index cddfc85..9ae1961 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
@@ -25,7 +25,6 @@ import java.util.List;
 
 import com.google.common.collect.Lists;
 import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.model.response.GroupListResponse;
 import org.apache.ambari.logsearch.model.response.LogData;
 import org.apache.ambari.logsearch.model.response.LogSearchResponse;
 import org.apache.ambari.logsearch.dao.SolrDaoBase;
@@ -40,9 +39,7 @@ import org.springframework.data.solr.core.DefaultQueryParser;
 import org.springframework.data.solr.core.query.SimpleQuery;
 import org.springframework.data.solr.core.query.SolrDataQuery;
 
-import static org.apache.ambari.logsearch.solr.SolrConstants.CommonLogConstants.CLUSTER;
-
-public abstract class ManagerBase<LOG_DATA_TYPE extends LogData, SEARCH_RESPONSE extends LogSearchResponse> extends JsonManagerBase {
+public abstract class ManagerBase<LOG_DATA_TYPE extends LogData, SEARCH_RESPONSE extends LogSearchResponse<LOG_DATA_TYPE>> extends JsonManagerBase {
   private static final Logger logger = Logger.getLogger(ManagerBase.class);
 
   public ManagerBase() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f97171/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/ServiceLogsManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/ServiceLogsManager.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/ServiceLogsManager.java
index cb9e806..9ae8b9a 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/ServiceLogsManager.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/ServiceLogsManager.java
@@ -72,7 +72,6 @@ import org.apache.ambari.logsearch.model.response.ServiceLogResponse;
 import org.apache.ambari.logsearch.converter.BaseServiceLogRequestQueryConverter;
 import org.apache.ambari.logsearch.converter.ServiceLogTruncatedRequestQueryConverter;
 import org.apache.ambari.logsearch.solr.ResponseDataGenerator;
-import org.apache.ambari.logsearch.solr.SolrConstants;
 import org.apache.ambari.logsearch.solr.model.SolrComponentTypeLogData;
 import org.apache.ambari.logsearch.solr.model.SolrHostLogData;
 import org.apache.ambari.logsearch.solr.model.SolrServiceLogData;
@@ -110,7 +109,7 @@ import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants
 import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOGTIME;
 
 @Named
-public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceLogResponse> {
+public class ServiceLogsManager extends ManagerBase<ServiceLogData, ServiceLogResponse> {
   private static final Logger logger = Logger.getLogger(ServiceLogsManager.class);
 
   private static final String SERVICE_LOG_TEMPLATE = "service_log_txt.ftl";
@@ -239,7 +238,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     return responseDataGenerator.generateBarGraphDataResponseWithRanges(response, LEVEL, true);
   }
 
-  public LogListResponse getPageByKeyword(ServiceLogRequest request, String event)
+  public LogListResponse<ServiceLogData> getPageByKeyword(ServiceLogRequest request, String event)
     throws SolrServerException {
     String defaultChoice = "0";
     String keyword = request.getKeyWord();
@@ -251,7 +250,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     return getPageForKeywordByType(request, keyword, isNext, event);
   }
 
-  private LogListResponse getPageForKeywordByType(ServiceLogRequest request, String keyword, boolean isNext, String event) {
+  private LogListResponse<ServiceLogData> getPageForKeywordByType(ServiceLogRequest request, String keyword, boolean isNext, String event) {
     String fromDate = request.getFrom(); // store start & end dates
     String toDate = request.getTo();
     boolean timeAscending = LogSearchConstants.ASCENDING_ORDER.equals(request.getSortType());
@@ -421,6 +420,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
       File file = File.createTempFile(fileName, format);
       FileOutputStream fis = new FileOutputStream(file);
       fis.write(textToSave.getBytes());
+      fis.close();
       return Response
         .ok(file, MediaType.APPLICATION_OCTET_STREAM)
         .header("Content-Disposition", "attachment;filename=" + fileName + format)
@@ -451,7 +451,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
 
   public ServiceLogResponse getAfterBeforeLogs(ServiceLogTruncatedRequest request) {
     ServiceLogResponse logResponse = new ServiceLogResponse();
-    List<SolrServiceLogData> docList = null;
+    List<ServiceLogData> docList = null;
     String scrollType = request.getScrollType() != null ? request.getScrollType() : "";
 
     String logTime = null;
@@ -515,8 +515,11 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
   }
 
   @Override
-  protected List<SolrServiceLogData> convertToSolrBeans(QueryResponse response) {
-    return response.getBeans(SolrServiceLogData.class);
+  protected List<ServiceLogData> convertToSolrBeans(QueryResponse response) {
+    List<SolrServiceLogData> solrServiceLogData = response.getBeans(SolrServiceLogData.class);
+    List<ServiceLogData> serviceLogData = new ArrayList<>();
+    serviceLogData.addAll(solrServiceLogData);
+    return serviceLogData;
   }
 
   @Override
@@ -524,19 +527,19 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     return new ServiceLogResponse();
   }
 
-  private List<LogData> getLogDataListByFieldType(Class clazz, QueryResponse response, List<Count> fieldList) {
-    List<LogData> groupList = getComponentBeans(clazz, response);
+  private <T extends LogData> List<T> getLogDataListByFieldType(Class<T> clazz, QueryResponse response, List<Count> fieldList) {
+    List<T> groupList = getComponentBeans(clazz, response);
     String temp = "";
     for (Count cnt : fieldList) {
-      LogData logData = createNewFieldByType(clazz, cnt, temp);
+      T logData = createNewFieldByType(clazz, cnt, temp);
       groupList.add(logData);
     }
     return groupList;
   }
 
-  private <T extends LogData> List<LogData> getComponentBeans(Class<T> clazz, QueryResponse response) {
+  private <T extends LogData> List<T> getComponentBeans(Class<T> clazz, QueryResponse response) {
     if (clazz.isAssignableFrom(SolrHostLogData.class) || clazz.isAssignableFrom(SolrComponentTypeLogData.class)) {
-      return (List<LogData>) response.getBeans(clazz);
+      return response.getBeans(clazz);
     } else {
       throw new UnsupportedOperationException();
     }
@@ -547,15 +550,13 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     solrQuery.setQuery("*:*");
     SolrUtil.addListFilterToSolrQuery(solrQuery, CLUSTER, clusters);
     GroupListResponse collection = new GroupListResponse();
-    SolrUtil.setFacetField(solrQuery,
-      field);
+    SolrUtil.setFacetField(solrQuery, field);
     SolrUtil.setFacetSort(solrQuery, LogSearchConstants.FACET_INDEX);
     QueryResponse response = serviceLogsSolrDao.process(solrQuery);
     if (response == null) {
       return collection;
     }
-    FacetField facetField = response
-      .getFacetField(field);
+    FacetField facetField = response.getFacetField(field);
     if (facetField == null) {
       return collection;
     }
@@ -567,7 +568,9 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     if (docList == null) {
       return collection;
     }
-    List<LogData> groupList = getLogDataListByFieldType(clazz, response, fieldList);
+    List<T> logDataListByFieldType = getLogDataListByFieldType(clazz, response, fieldList);
+    List<LogData> groupList = new ArrayList<>();
+    groupList.addAll(logDataListByFieldType);
 
     collection.setGroupList(groupList);
     if (!docList.isEmpty()) {
@@ -577,22 +580,21 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     return collection;
   }
 
-  private <T extends LogData> LogData createNewFieldByType(Class<T> clazz, Count count, String temp) {
+  @SuppressWarnings("unchecked")
+  private <T extends LogData> T createNewFieldByType(Class<T> clazz, Count count, String temp) {
     temp = count.getName();
     LogData result = null;
-    if (clazz.isAssignableFrom(SolrHostLogData.class)) {
-      SolrHostLogData fieldData = new SolrHostLogData();
-      fieldData.setHost(temp);
-      result = fieldData;
-    } else if (clazz.isAssignableFrom(SolrComponentTypeLogData.class)) {
-      SolrComponentTypeLogData fieldData = new SolrComponentTypeLogData();
-      fieldData.setType(temp);
-      result = fieldData;
-    }
-    if (result != null) {
-      return result;
+    if (clazz.equals(SolrHostLogData.class)) {
+      result = new SolrHostLogData();
+      ((SolrHostLogData)result).setHost(temp);
+    } else if (clazz.equals(SolrComponentTypeLogData.class)) {
+      result = new SolrComponentTypeLogData();
+      ((SolrComponentTypeLogData)result).setType(temp);
+    } else {
+      throw new UnsupportedOperationException();
     }
-    throw new UnsupportedOperationException();
+    
+    return (T)result;
   }
   
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f97171/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchAuthSuccessHandler.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchAuthSuccessHandler.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchAuthSuccessHandler.java
index cf9d200..756cb2e 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchAuthSuccessHandler.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchAuthSuccessHandler.java
@@ -24,14 +24,10 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.log4j.Logger;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
 
 public class LogsearchAuthSuccessHandler implements AuthenticationSuccessHandler {
-  private static final Logger logger = Logger.getLogger(LogsearchAuthSuccessHandler.class);
-
-
   @Override
   public void onAuthenticationSuccess(HttpServletRequest request,
       HttpServletResponse response, Authentication authentication)

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f97171/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKrbFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKrbFilter.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKrbFilter.java
index f4e70d7..b4c68fb 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKrbFilter.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKrbFilter.java
@@ -150,13 +150,13 @@ public class LogsearchKrbFilter implements Filter {
         * 1000; //10 hours
     initializeSecretProvider(filterConfig);
 
-    initializeAuthHandler(authHandlerClassName, filterConfig);
+    initializeAuthHandler(authHandlerClassName);
 
     cookieDomain = config.getProperty(COOKIE_DOMAIN, null);
     cookiePath = config.getProperty(COOKIE_PATH, null);
   }
 
-  protected void initializeAuthHandler(String authHandlerClassName, FilterConfig filterConfig)
+  private void initializeAuthHandler(String authHandlerClassName)
       throws ServletException {
     try {
       Class<?> klass = Thread.currentThread().getContextClassLoader().loadClass(authHandlerClassName);
@@ -168,7 +168,7 @@ public class LogsearchKrbFilter implements Filter {
     }
   }
 
-  protected void initializeSecretProvider(FilterConfig filterConfig)
+  private void initializeSecretProvider(FilterConfig filterConfig)
       throws ServletException {
     secretProvider = (SignerSecretProvider) filterConfig.getServletContext().
         getAttribute(SIGNER_SECRET_PROVIDER_ATTRIBUTE);
@@ -184,20 +184,20 @@ public class LogsearchKrbFilter implements Filter {
     signer = new Signer(secretProvider);
   }
 
-  public static SignerSecretProvider constructSecretProvider(
+  private static SignerSecretProvider constructSecretProvider(
       ServletContext ctx, Properties config,
       	boolean disallowFallbackToRandomSecretProvider) throws Exception {
     long validity = Long.parseLong(config.getProperty(AUTH_TOKEN_VALIDITY,
         "36000")) * 1000;
 
-		String name = config.getProperty(SIGNER_SECRET_PROVIDER);
-		if (StringUtils.isEmpty(name)) {
-			if (!disallowFallbackToRandomSecretProvider) {
-				name = "random";
-			} else {
-				name = "file";
-			}
-		}
+    String name = config.getProperty(SIGNER_SECRET_PROVIDER);
+    if (StringUtils.isEmpty(name)) {
+      if (!disallowFallbackToRandomSecretProvider) {
+        name = "random";
+      } else {
+        name = "file";
+      }
+    }
 
     SignerSecretProvider provider;
     if ("file".equals(name)) {
@@ -263,7 +263,7 @@ public class LogsearchKrbFilter implements Filter {
    * @return if a custom implementation of a SignerSecretProvider is being used.
    */
   protected boolean isCustomSignerSecretProvider() {
-	Class<?> clazz = secretProvider != null ? secretProvider.getClass() : null;
+    Class<?> clazz = secretProvider != null ? secretProvider.getClass() : null;
     return clazz != FileSignerSecretProvider.class && clazz !=
         RandomSignerSecretProvider.class && clazz != ZKSignerSecretProvider
         .class;
@@ -327,16 +327,16 @@ public class LogsearchKrbFilter implements Filter {
   protected Properties getConfiguration(String configPrefix, FilterConfig filterConfig) throws ServletException {
     Properties props = new Properties();
     if(filterConfig != null){
-	    Enumeration<?> names = filterConfig.getInitParameterNames();
-	    if(names != null){
-		    while (names.hasMoreElements()) {
-		      String name = (String) names.nextElement();
-		      if (name != null && configPrefix != null && name.startsWith(configPrefix)) {
-		        String value = filterConfig.getInitParameter(name);
-		        props.put(name.substring(configPrefix.length()), value);
-		      }
-		    }
-	    }
+      Enumeration<?> names = filterConfig.getInitParameterNames();
+      if(names != null){
+        while (names.hasMoreElements()) {
+          String name = (String) names.nextElement();
+          if (name != null && configPrefix != null && name.startsWith(configPrefix)) {
+            String value = filterConfig.getInitParameter(name);
+            props.put(name.substring(configPrefix.length()), value);
+          }
+        }
+      }
     }
     return props;
   }
@@ -395,12 +395,12 @@ public class LogsearchKrbFilter implements Filter {
     if (tokenStr != null) {
       token = AuthenticationToken.parse(tokenStr);
       if(token != null){
-	      if (!token.getType().equals(authHandler.getType())) {
-        	throw new AuthenticationException("Invalid AuthenticationToken type");
-	      }
-	      if (token.isExpired()) {
-        	throw new AuthenticationException("AuthenticationToken expired");
-	      }
+        if (!token.getType().equals(authHandler.getType())) {
+          throw new AuthenticationException("Invalid AuthenticationToken type");
+        }
+        if (token.isExpired()) {
+          throw new AuthenticationException("AuthenticationToken expired"); 
+        }
       }
     }
     return token;
@@ -434,7 +434,7 @@ public class LogsearchKrbFilter implements Filter {
         token = getToken(httpRequest);
       }
       catch (AuthenticationException ex) {
-    	ex.printStackTrace();
+        ex.printStackTrace();
         logger.warn("AuthenticationToken ignored: " + ex.getMessage());
         // will be sent back in a 401 unless filter authenticates
         authenticationEx = ex;
@@ -546,7 +546,7 @@ public class LogsearchKrbFilter implements Filter {
    * because of the fact that Hadoop is stuck at servlet 2.5 and jetty 6
    * right now.
    */
-  public static void createAuthCookie(HttpServletResponse resp, String token,
+  private static void createAuthCookie(HttpServletResponse resp, String token,
                                       String domain, String path, long expires,
                                       boolean isSecure) {
     StringBuilder sb = new StringBuilder(AuthenticatedURL.AUTH_COOKIE)

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f97171/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/model/JWTAuthenticationToken.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/model/JWTAuthenticationToken.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/model/JWTAuthenticationToken.java
index 35175b6..dfac191 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/model/JWTAuthenticationToken.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/model/JWTAuthenticationToken.java
@@ -30,7 +30,7 @@ public class JWTAuthenticationToken extends AbstractAuthenticationToken {
   private String principal;
 
   public JWTAuthenticationToken(String principal, String credential) {
-    super((Collection)null);
+    super((Collection<? extends GrantedAuthority>)null);
     this.principal = principal;
     this.credential = credential;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f97171/ambari-logsearch/ambari-logsearch-server/src/main/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/resources/log4j.xml b/ambari-logsearch/ambari-logsearch-server/src/main/resources/log4j.xml
index 547841a..dd85da8 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/resources/log4j.xml
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/resources/log4j.xml
@@ -1,56 +1,64 @@
 <?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">
+<!--
+  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" />
-		</layout>
-	</appender>
-
-	<!-- <appender name="rolling_file" class="org.apache.log4j.RollingFileAppender">
-		<param name="file" value="logs/logsearch-app.log" />
-		<param name="Threshold" value="info" />
-		<param name="append" value="true" />
-		<param name="maxFileSize" value="10MB" />
-		<param name="maxBackupIndex" value="10" />
-		<layout class="org.apache.log4j.PatternLayout">
-			<param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
-		</layout>
-	</appender>
-
-	<appender name="audit_rolling_file" class="org.apache.log4j.RollingFileAppender">
-		<param name="file" value="logs/logsearch-audit.log" />
-		<param name="Threshold" value="info" />
-		<param name="append" value="true" />
-		<param name="maxFileSize" value="10MB" />
-		<param name="maxBackupIndex" value="10" />
-		<layout class="org.apache.log4j.PatternLayout">
-			<param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
-		</layout>
-	</appender>
-
-	<appender name="performance_analyzer" class="org.apache.log4j.RollingFileAppender">
-		<param name="file" value="logs/logsearch-performance.log" />
-		<param name="Threshold" value="info" />
-		<param name="append" value="true" />
-		<param name="maxFileSize" value="10MB" />
-		<param name="maxBackupIndex" value="10" />
-
-		<layout class="org.apache.log4j.PatternLayout">
-			<param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
-		</layout>
-	</appender>
+  <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" />
+    </layout>
+  </appender>
+
+  <!-- <appender name="rolling_file" class="org.apache.log4j.RollingFileAppender">
+    <param name="file" value="logs/logsearch-app.log" />
+    <param name="Threshold" value="info" />
+    <param name="append" value="true" />
+    <param name="maxFileSize" value="10MB" />
+    <param name="maxBackupIndex" value="10" />
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
+    </layout>
+  </appender>
+
+  <appender name="audit_rolling_file" class="org.apache.log4j.RollingFileAppender">
+    <param name="file" value="logs/logsearch-audit.log" />
+    <param name="Threshold" value="info" />
+    <param name="append" value="true" />
+    <param name="maxFileSize" value="10MB" />
+    <param name="maxBackupIndex" value="10" />
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
+    </layout>
+  </appender>
+
+  <appender name="performance_analyzer" class="org.apache.log4j.RollingFileAppender">
+    <param name="file" value="logs/logsearch-performance.log" />
+    <param name="Threshold" value="info" />
+    <param name="append" value="true" />
+    <param name="maxFileSize" value="10MB" />
+    <param name="maxBackupIndex" value="10" />
+
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
+    </layout>
+  </appender>
  -->
 
 <!-- logsearch appender config for the all above appender -->
@@ -85,35 +93,35 @@
     <layout class="org.apache.ambari.logsearch.appender.LogsearchConversion" />
   </appender>
  
-	<!-- Logs to suppress BEGIN -->
-	<category name="org.apache.solr.common.cloud.ZkStateReader" additivity="false">
-	  <priority value="error" />
-	  <appender-ref ref="console" />
-	</category>
-	<!-- Logs to suppress END -->
-
-	<logger name="org.apache.ambari.logsearch.audit"
-		additivity="true">
-		<!-- <appender-ref ref="audit_rolling_file" />-->
+  <!-- Logs to suppress BEGIN -->
+  <category name="org.apache.solr.common.cloud.ZkStateReader" additivity="false">
+    <priority value="error" />
+    <appender-ref ref="console" />
+  </category>
+  <!-- Logs to suppress END -->
+
+  <logger name="org.apache.ambari.logsearch.audit"
+    additivity="true">
+    <!-- <appender-ref ref="audit_rolling_file" />-->
         <appender-ref ref="audit_rolling_file_json" />
-	</logger>
+  </logger>
 
-	<logger name="org.apache.ambari.logsearch.performance"
-		additivity="false">
-		<!-- <appender-ref ref="performance_analyzer" />-->
+  <logger name="org.apache.ambari.logsearch.performance"
+    additivity="false">
+    <!-- <appender-ref ref="performance_analyzer" />-->
         <appender-ref ref="performance_analyzer_json" />
-	</logger>
+  </logger>
 
-	<logger name="org.apache.ambari.logsearch" additivity="false">
-		<!-- <appender-ref ref="console" /> -->
-		<!-- <appender-ref ref="rolling_file" />-->
+  <logger name="org.apache.ambari.logsearch" additivity="false">
+    <!-- <appender-ref ref="console" /> -->
+    <!-- <appender-ref ref="rolling_file" />-->
         <appender-ref ref="rolling_file_json" />
-	</logger>
+  </logger>
 
-	<root>
-		<level value="warn" />
-		<!-- <appender-ref ref="console" /> -->
-		<!--<appender-ref ref="rolling_file" />-->
+  <root>
+    <level value="warn" />
+    <!-- <appender-ref ref="console" /> -->
+    <!--<appender-ref ref="rolling_file" />-->
         <appender-ref ref="rolling_file_json" />
-	</root>
+  </root>
 </log4j:configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f97171/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
index 44fbd4d..945526a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
@@ -24,6 +24,7 @@ import java.sql.Statement;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -348,6 +349,24 @@ public class UpgradeCatalog300 extends AbstractUpgradeCatalog {
             newProperties.put("logfeeder.include.default.level", defaultLogLevels);
             updateConfigurationPropertiesForCluster(cluster, "logfeeder-properties", newProperties, true, true);
           }
+
+          Config logfeederLog4jProperties = cluster.getDesiredConfigByType("logfeeder-log4j");
+          if (logfeederLog4jProperties != null) {
+            String content = logfeederLog4jProperties.getProperties().get("content");
+            if (content.contains("<!DOCTYPE log4j:configuration SYSTEM \"log4j.dtd\">")) {
+              content = content.replace("<!DOCTYPE log4j:configuration SYSTEM \"log4j.dtd\">", "<!DOCTYPE log4j:configuration SYSTEM \"http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd\">");
+              updateConfigurationPropertiesForCluster(cluster, "logfeeder-log4j", Collections.singletonMap("content", content), true, true);
+            }
+          }
+          
+          Config logsearchLog4jProperties = cluster.getDesiredConfigByType("logsearch-log4j");
+          if (logsearchLog4jProperties != null) {
+            String content = logsearchLog4jProperties.getProperties().get("content");
+            if (content.contains("<!DOCTYPE log4j:configuration SYSTEM \"log4j.dtd\">")) {
+              content = content.replace("<!DOCTYPE log4j:configuration SYSTEM \"log4j.dtd\">", "<!DOCTYPE log4j:configuration SYSTEM \"http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd\">");
+              updateConfigurationPropertiesForCluster(cluster, "logsearch-log4j", Collections.singletonMap("content", content), true, true);
+            }
+          }
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f97171/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-log4j.xml.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-log4j.xml.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-log4j.xml.j2
index a818fe0..697d672 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-log4j.xml.j2
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-log4j.xml.j2
@@ -15,7 +15,7 @@ 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">
+<!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"/>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f97171/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-log4j.xml.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-log4j.xml.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-log4j.xml.j2
index 63f9f0a..98f58f2 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-log4j.xml.j2
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-log4j.xml.j2
@@ -15,7 +15,7 @@ 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">
+<!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"/>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f97171/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
index c949ca2..dbc77af 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
@@ -324,10 +324,37 @@ public class UpgradeCatalog300Test {
     expect(controller.createConfig(anyObject(Cluster.class), eq("logsearch-properties"), capture(logSearchPropertiesCapture),
         anyString(), EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
 
+    Map<String, String> oldLogFeederLog4j = ImmutableMap.of(
+        "content", "<!DOCTYPE log4j:configuration SYSTEM \"log4j.dtd\">");
+
+    Map<String, String> expectedLogFeederLog4j = ImmutableMap.of(
+        "content", "<!DOCTYPE log4j:configuration SYSTEM \"http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd\">");
+
+    Config mockLogFeederLog4j = easyMockSupport.createNiceMock(Config.class);
+    expect(cluster.getDesiredConfigByType("logfeeder-log4j")).andReturn(mockLogFeederLog4j).atLeastOnce();
+    expect(mockLogFeederLog4j.getProperties()).andReturn(oldLogFeederLog4j).anyTimes();
+    Capture<Map<String, String>> logFeederLog4jCapture = EasyMock.newCapture();
+    expect(controller.createConfig(anyObject(Cluster.class), anyString(), capture(logFeederLog4jCapture), anyString(),
+        EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
+
+    Map<String, String> oldLogSearchLog4j = ImmutableMap.of(
+        "content", "<!DOCTYPE log4j:configuration SYSTEM \"log4j.dtd\">");
+
+    Map<String, String> expectedLogSearchLog4j = ImmutableMap.of(
+        "content", "<!DOCTYPE log4j:configuration SYSTEM \"http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd\">");
+
+    Config mockLogSearchLog4j = easyMockSupport.createNiceMock(Config.class);
+    expect(cluster.getDesiredConfigByType("logsearch-log4j")).andReturn(mockLogSearchLog4j).atLeastOnce();
+    expect(mockLogSearchLog4j.getProperties()).andReturn(oldLogSearchLog4j).anyTimes();
+    Capture<Map<String, String>> logSearchLog4jCapture = EasyMock.newCapture();
+    expect(controller.createConfig(anyObject(Cluster.class), anyString(), capture(logSearchLog4jCapture), anyString(),
+        EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
+
     replay(clusters, cluster);
     replay(controller, injector2);
     replay(confSomethingElse1, confSomethingElse2, confLogSearchConf1, confLogSearchConf2);
     replay(logSearchPropertiesConf, logFeederPropertiesConf);
+    replay(mockLogFeederLog4j, mockLogSearchLog4j);
     new UpgradeCatalog300(injector2).updateLogSearchConfigs();
     easyMockSupport.verifyAll();
 
@@ -342,5 +369,11 @@ public class UpgradeCatalog300Test {
     
     Map<String,String> newLogSearchProperties = logSearchPropertiesCapture.getValue();
     assertTrue(Maps.difference(Collections.<String, String> emptyMap(), newLogSearchProperties).areEqual());
+
+    Map<String, String> updatedLogFeederLog4j = logFeederLog4jCapture.getValue();
+    assertTrue(Maps.difference(expectedLogFeederLog4j, updatedLogFeederLog4j).areEqual());
+
+    Map<String, String> updatedLogSearchLog4j = logSearchLog4jCapture.getValue();
+    assertTrue(Maps.difference(expectedLogSearchLog4j, updatedLogSearchLog4j).areEqual());
   }
 }


Mime
View raw message