ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oleew...@apache.org
Subject [37/59] [abbrv] ambari git commit: AMBARI-18310. Logsearch - Refactor solr query layer (oleewere)
Date Sat, 05 Nov 2016 16:35:32 GMT
http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
index 43ee5db..605560e 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
@@ -276,6 +276,7 @@ define(['require',
         require(['views/tabs/VisualSearchView'], function (VisualSearchView) {
           var data = _.values(Globals.serviceLogsColumns);
           var columns = _.without(data, _.findWhere(data, "logtime"));
+          console.log("service columns: " + JSON.stringify(columns))
           that.RVisualSearchIncCol.show(new VisualSearchView({
             viewName: "includeServiceColumns",
             placeholder: "Include Search",
@@ -287,7 +288,7 @@ define(['require',
               var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedServiceLogMappings, false);
               return {
                 includeQuery: JSON.stringify(obj),
-                query: query
+                iMessage: query
               }
             }
           }));
@@ -302,7 +303,7 @@ define(['require',
               var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedServiceLogMappings, false);
               return {
                 excludeQuery: JSON.stringify(obj),
-                query: query
+                eMessage: query
               }
             }
           }));

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
index 3740716..2d39e36 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
@@ -199,9 +199,6 @@ define(['require',
             downloadLogFile: function(obj) {
                 obj.utcOffset = moment().utcOffset();
                 obj.startIndex = this.logFileCollection.state.currentPage * this.logFileCollection.state.pageSize;
-                //			var params = $.param(_.pick(_.extend({},this.logFileCollection.queryParams,
-                //				{startIndex : this.logFileCollection.state.currentPage * this.logFileCollection.state.pageSize},obj),
-                //				'component','from','to','host','level','unit','startIndex','pageSize','format','utcOffset'));
                 var params = $.param(_.extend({}, this.logFileCollection.queryParams, obj));
                 var url = "api/v1/service/logs/export?" + params;
                 window.open(url);
@@ -305,60 +302,43 @@ define(['require',
                 });
             },
             renderVisualSearch: function() {
-                var that = this;
-                var data = _.values(Globals.serviceLogsColumns);
-                var columns = _.without(data, _.findWhere(data, "logtime"));
-                require(['views/tabs/VisualSearchView'], function(VisualSearchView) {
-                    /*that.RVSSearch.show(new VisualSearchView({
-                    	viewName : "includeExclude",
-                    	vent : that.vent,
-                    	globalVent:that.globalVent,
-                    	params : that.params,
-                    	eventName : "search:include:exclude"
-                    }));*/
-                    that.RVisualSearchIncCol.show(new VisualSearchView({
-                        params: that.params,
-                        viewName: "includeServiceColumns",
-                        placeholder: "Include Search",
-                        vent: that.vent,
-                        globalVent: that.globalVent,
-                        customOptions: columns,
-                        eventName: Globals.eventName.serviceLogsIncludeColumns,
-                        myFormatData: function(query, searchCollection) {
-                            var obj = [];
-                            searchCollection.each(function(m) {
-                                var data = {};
-                                data[m.get("category")] = m.get("value");
-                                obj.push(data);
-                            });
-                            return {
-                                includeQuery: JSON.stringify(obj),
-                                query: query
-                            }
-                        }
-                    }));
-                    that.RVisualSearchExCol.show(new VisualSearchView({
-                        params: that.params,
-                        viewName: "excludeServiceColumns",
-                        placeholder: "Exclude Search",
-                        vent: that.vent,
-                        globalVent: that.globalVent,
-                        customOptions: columns,
-                        eventName: Globals.eventName.serviceLogsExcludeColumns,
-                        myFormatData: function(query, searchCollection) {
-                            var obj = [];
-                            searchCollection.each(function(m) {
-                                var data = {};
-                                data[m.get("category")] = m.get("value");
-                                obj.push(data);
-                            });
-                            return {
-                                excludeQuery: JSON.stringify(obj),
-                                query: query
-                            }
-                        }
-                    }));
-                });
+              var that = this;
+              var data = _.values(Globals.serviceLogsColumns);
+              var columns = _.without(data, _.findWhere(data, "logtime"));
+              require(['views/tabs/VisualSearchView'], function (VisualSearchView) {
+                that.RVisualSearchIncCol.show(new VisualSearchView({
+                  params: that.params,
+                  viewName: "includeServiceColumns",
+                  placeholder: "Include Search",
+                  vent: that.vent,
+                  globalVent: that.globalVent,
+                  customOptions: columns,
+                  eventName: Globals.eventName.serviceLogsIncludeColumns,
+                  myFormatData: function (query, searchCollection) {
+                    var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedServiceLogMappings, false);
+                    return {
+                      includeQuery: JSON.stringify(obj),
+                      iMessage: query
+                    }
+                  }
+                }));
+                that.RVisualSearchExCol.show(new VisualSearchView({
+                  params: that.params,
+                  viewName: "excludeServiceColumns",
+                  placeholder: "Exclude Search",
+                  vent: that.vent,
+                  globalVent: that.globalVent,
+                  customOptions: columns,
+                  eventName: Globals.eventName.serviceLogsExcludeColumns,
+                  myFormatData: function (query, searchCollection) {
+                    var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedServiceLogMappings, false);
+                    return {
+                      excludeQuery: JSON.stringify(obj),
+                      eMessage: query
+                    }
+                  }
+                }));
+              });
             },
             renderHistogram: function() {
                 var that = this;

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/troubleshoot/TroubleShootLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/troubleshoot/TroubleShootLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/troubleshoot/TroubleShootLayoutView.js
index a6445c6..b19f3ce 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/troubleshoot/TroubleShootLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/troubleshoot/TroubleShootLayoutView.js
@@ -82,7 +82,7 @@ define(['backbone',
 
                     }
                 });
-                this.serviceLogsCollection.url = Globals.baseURL + "service/logs/anygraph";
+                this.serviceLogsCollection.url = Globals.baseURL + "service/logs/count/anygraph";
                 this.serviceLogsCollection.modelAttrName = "graphData";
                 
             	this.topUsers = new VNameValueList([],{
@@ -91,7 +91,7 @@ define(['backbone',
                         pageSize: 9999
                     }
     			});
-    			this.topUsers.url = Globals.baseURL + "audit/logs/users";
+    			this.topUsers.url = Globals.baseURL + "audit/logs/resources/10";
     			this.topUsers.modelAttrName = "graphData";
     			
     			this.serviceLoadCollection = new VLogList([], {
@@ -133,7 +133,7 @@ define(['backbone',
             },
             onRender : function(){
             	var that = this;
-            	this.fetchTopUsers(this.params);
+            	this.fetchTopUsers(_.extend({field : "reqUser"},this.params));
             	this.serviceLogsCollection.getServicesInfo({
                 	success : function(resp){
                 		Globals.servicesInfo = resp;

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
index 8620c11..7b1a9a9 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
@@ -61,7 +61,7 @@
     "resType": "Res Type",
     "resource": "Resource",
     "result": "Result",
-    "sess": "Sess",
+    "sess": "Session",
     "text": "Text",
     "type": "Type",
     "ugi": "UGI",

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/tabs/LogFileView_tmpl.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/tabs/LogFileView_tmpl.html b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/tabs/LogFileView_tmpl.html
index f86190c..0f0f143 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/tabs/LogFileView_tmpl.html
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/tabs/LogFileView_tmpl.html
@@ -15,38 +15,6 @@
   limitations under the License.
 -->
 <div class="row">
-	<!--  div class="col-md-3">
-		<div class="row">
-			<div class="col-md-12">
-				<div class="box">
-					<div class="box-header">
-						<div class="box-name">
-							<span>Search</span>
-						</div>
-						<div class="box-icons">
-							<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
-							</a> <a class=""> <i class="fa fa-gear"></i>
-							</a> <a class="close-link"> <i class="fa fa-close"></i>
-							</a>
-						</div>
-						<div class="no-move"></div>
-					</div>
-					<div class="box-content">
-						<div class="input-group">
-							<input data-id="hierarchySearch" type="text" class="form-control"
-								placeholder="Search" value="*:*"> <span
-								class="input-group-btn">
-								<button data-id="hierarchySearchBtn"
-									class="btn btn-default btn-search" type="button">
-									<i class="fa fa-search"></i>
-								</button>
-							</span>
-						</div>
-					</div>
-				</div>
-			</div>
-		</div>
-	</div-->
 	<div class="col-md-12">
 		<div class="row topLevelFilter">
             <div id="r_LogLevel" class="col-md-5"></div>
@@ -54,28 +22,17 @@
             <div id="r_LogSnapShot" class="col-md-1 col-sm-2"></div>
             <div class="row ">
 				<div class="col-md-12 fixedSearchBox hiddeBox">
-					<!-- div id="r_VSSearch"></div-->
 					<div class="col-md-6" data-id="r_vsSearchIncCol"></div>
 					<div class="col-md-6" data-id="r_vsSearchExCol"></div>	
 				</div>
 			</div>
         </div>
         <div class="setHeight_LogFile"></div>
-<!-- 		<div class="row">
-			<div class="col-md-12">
-				<div id="r_LogLevel"></div>
-			</div>
-		</div> -->
 		<div class="row">
 			<div class="col-md-12">
 					<div id="r_Histogram"></div>
 			</div>
 		</div>
-	<!-- 	<div class="row row-margin-bottom">
-			<div class="col-md-12">
-				<div id="r_VSSearch"></div>
-			</div>
-		</div> -->
 		<div class="row">
 			<div class="col-md-12">
 				<div class="box">
@@ -97,17 +54,13 @@
 								<i class="fa fa-sign-out"></i>
 							</a>
 							<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
-							</a> 
-							<!-- <a class="expand-link"> <i class="fa fa-expand"></i></a>
-							<a class="close-link"> <i class="fa fa-close"></i></a> -->
-							
+							</a>
 						</div>
 						<div class="no-move"></div>
 					</div>
 					<div class="box-content">
 						<div class="col-md-4 advance-find">
 							<div class="input-group">
-								<!-- span class="input-group-addon">1 of 40</span -->
 								<span class="input-group-btn">
     							<button data-id="lock" title="Lock position" class="btn btn-default btn-search no-margin" type="button"><i class="fa fa-unlock"></i>
     							</button></span> 
@@ -135,7 +88,6 @@
 									</button>
 									<button data-id="cancelFind" class="btn btn-default btn-search no-margin" style="display:none;">cancel</button>
 									<button style="display:none;" class="no-margin btn-notification pageNotation" type="button"> </button>
-									<!-- <span class="pageNotation"></span> -->
 								</span>
 							</div>
 						</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AbstractRequestConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AbstractRequestConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AbstractRequestConverterTest.java
new file mode 100644
index 0000000..04bd1af
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AbstractRequestConverterTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.BaseLogRequest;
+import org.apache.ambari.logsearch.model.request.impl.CommonSearchRequest;
+
+public class AbstractRequestConverterTest {
+
+  public void fillBaseLogRequestWithTestData(BaseLogRequest request) {
+    fillCommonRequestWithTestData(request);
+    request.setFrom("2016-09-13T22:00:01.000Z");
+    request.setTo("2016-09-14T22:00:01.000Z");
+    request.setMustBe("logsearch_app,secure_log");
+    request.setMustNot("hst_agent,system_message");
+    request.setIncludeQuery("[{\"log_message\" : \"myincludemessage\"}]");
+    request.setExcludeQuery("[{\"log_message\" : \"myexcludemessage\"}]");
+  }
+
+  public void fillCommonRequestWithTestData(CommonSearchRequest request) {
+    request.setStartIndex("0");
+    request.setPage("0");
+    request.setPageSize("25");
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditBarGraphRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditBarGraphRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditBarGraphRequestQueryConverterTest.java
new file mode 100644
index 0000000..ef12f71
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditBarGraphRequestQueryConverterTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.AuditBarGraphRequest;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class AuditBarGraphRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private AuditBarGraphRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new AuditBarGraphRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    AuditBarGraphRequest request = new AuditBarGraphRequest();
+    // WHEN
+    fillBaseLogRequestWithTestData(request);
+    request.setUnit("+1HOUR");
+    // THEN
+    SolrQuery query = underTest.convert(request);
+    assertEquals("?q=*%3A*&facet=true&facet.pivot=%7B%21range%3Dr1%7Drepo&facet.mincount=1&facet.limit=-1&facet.sort=index" +
+      "&facet.range=%7B%21tag%3Dr1%7DevtTime&f.evtTime.facet.range.start=2016-09-13T22%3A00%3A01.000Z&f.evtTime.facet.range.end=2016-09-14T22%3A00%3A01.000Z&f.evtTime.facet.range.gap=%2B1HOUR&rows=0&start=0",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConvertWithoutData() {
+    // GIVEN
+    AuditBarGraphRequest request = new AuditBarGraphRequest();
+    // WHEN
+    SolrQuery query = underTest.convert(request);
+    // THEN
+    assertEquals(Integer.valueOf(0), query.getRows());
+    assertEquals(-1, query.getFacetLimit());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditComponentRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditComponentRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditComponentRequestQueryConverterTest.java
new file mode 100644
index 0000000..d6ecdd5
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditComponentRequestQueryConverterTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.AuditComponentRequest;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.data.solr.core.DefaultQueryParser;
+import org.springframework.data.solr.core.query.SimpleFacetQuery;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+
+public class AuditComponentRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private AuditComponentsRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new AuditComponentsRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    AuditComponentRequest request = new AuditComponentRequest();
+    fillCommonRequestWithTestData(request);
+    // WHEN
+    SimpleFacetQuery facetQuery = underTest.convert(request);
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(facetQuery);
+    // THEN
+    assertEquals("?q=*%3A*&start=0&rows=25&sort=repo+asc&facet=true&facet.mincount=1&facet.limit=-1&facet.sort=index&facet.field=repo",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConvertWithoutData() {
+    // GIVEN
+    AuditComponentRequest request = new AuditComponentRequest();
+    // WHEN
+    SimpleFacetQuery facetQuery = underTest.convert(request);
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(facetQuery);
+    // THEN
+    assertNotNull(facetQuery);
+    assertEquals("?q=*%3A*&start=0&rows=99999&sort=repo+asc&facet=true&facet.mincount=1&facet.limit=-1&facet.sort=index&facet.field=repo",
+      query.toQueryString());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditLogRequestConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditLogRequestConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditLogRequestConverterTest.java
new file mode 100644
index 0000000..ec6aad7
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditLogRequestConverterTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.AuditLogRequest;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.data.solr.core.DefaultQueryParser;
+import org.springframework.data.solr.core.query.SimpleQuery;
+
+import static org.junit.Assert.assertEquals;
+
+public class AuditLogRequestConverterTest extends AbstractRequestConverterTest {
+
+  private AuditLogRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new AuditLogRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    AuditLogRequest request = new AuditLogRequest();
+    fillBaseLogRequestWithTestData(request);
+    // WHEN
+    SimpleQuery simpleQuery = underTest.convert(request);
+    SolrQuery queryResult = new DefaultQueryParser().doConstructSolrQuery(simpleQuery);
+    // THEN
+    assertEquals("?q=*%3A*&start=0&rows=25&fq=repo%3A%28logsearch_app+secure_log%29&fq=-repo%3A%28hst_agent+system_message%29" +
+      "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&sort=evtTime+desc%2Cseq_num+desc",
+      queryResult.toQueryString());
+  }
+
+  @Test
+  public void testConvertWithoutData() {
+    // GIVEN
+    AuditLogRequest request = new AuditLogRequest();
+    // WHEN
+    SimpleQuery simpleQuery = underTest.convert(request);
+    SolrQuery queryResult = new DefaultQueryParser().doConstructSolrQuery(simpleQuery);
+    // THEN
+    assertEquals("?q=*%3A*&start=0&rows=99999&sort=evtTime+desc%2Cseq_num+desc", queryResult.toQueryString());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverterTest.java
new file mode 100644
index 0000000..71e91e1
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverterTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.AuditServiceLoadRequest;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.data.solr.core.DefaultQueryParser;
+
+import static org.junit.Assert.assertEquals;
+
+public class AuditServiceLoadRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private AuditServiceLoadRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new AuditServiceLoadRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    AuditServiceLoadRequest request = new AuditServiceLoadRequest();
+    fillBaseLogRequestWithTestData(request);
+    // WHEN
+    SolrQuery solrQuery = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3A*myincludemessage*&" +
+      "fq=-log_message%3A*myexcludemessage*&fq=repo%3A%28logsearch_app+secure_log%29&fq=-repo%3A%28hst_agent+system_message%29" +
+      "&facet=true&facet.mincount=1&facet.limit=10&facet.field=repo", solrQuery.toQueryString());
+  }
+
+  @Test
+  public void testConvertWithoutData() {
+    // GIVEN
+    AuditServiceLoadRequest request = new AuditServiceLoadRequest();
+    // WHEN
+    SolrQuery solrQuery = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B*+TO+*%5D&facet=true&facet.mincount=1&facet.limit=10&facet.field=repo",
+      solrQuery.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java
new file mode 100644
index 0000000..1ade3c0
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogRequest;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.data.solr.core.DefaultQueryParser;
+import org.springframework.data.solr.core.query.SimpleQuery;
+
+import static org.junit.Assert.assertEquals;
+
+public class BaseServiceLogRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private BaseServiceLogRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new BaseServiceLogRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvertRequest() {
+    // GIVEN
+    ServiceLogRequest logRequest = new ServiceLogRequest();
+    fillBaseLogRequestWithTestData(logRequest);
+    logRequest.setLevel("FATAL,ERROR,WARN,UNKNOWN");
+    logRequest.setFileName("myfile");
+    logRequest.setComponentName("component");
+    logRequest.setHostName("logsearch.com");
+    // WHEN
+    SimpleQuery query = underTest.convert(logRequest);
+    DefaultQueryParser defaultQueryParser = new DefaultQueryParser();
+    SolrQuery solrQuery = defaultQueryParser.doConstructSolrQuery(query);
+
+    // THEN
+    assertEquals("?q=*%3A*&start=0&rows=25&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*" +
+      "&fq=host%3Alogsearch.com&fq=path%3Amyfile&fq=type%3Acomponent&fq=level%3A%28FATAL+ERROR+WARN+UNKNOWN%29" +
+      "&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&sort=logtime+desc%2Cseq_num+desc",
+      solrQuery.toQueryString());
+  }
+
+  @Test
+  public void testConvertRequestWithoutData() {
+    // GIVEN
+    ServiceLogRequest logRequest = new ServiceLogRequest();
+    // WHEN
+    SimpleQuery query = underTest.convert(logRequest);
+    // THEN
+    assertEquals(Integer.valueOf(99999), query.getRows());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/FieldAuditLogRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/FieldAuditLogRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/FieldAuditLogRequestQueryConverterTest.java
new file mode 100644
index 0000000..1864af3
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/FieldAuditLogRequestQueryConverterTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.FieldAuditLogRequest;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.data.solr.core.DefaultQueryParser;
+
+import static org.junit.Assert.assertEquals;
+
+public class FieldAuditLogRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private FieldAuditLogRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new FieldAuditLogRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    FieldAuditLogRequest request = new FieldAuditLogRequest();
+    fillBaseLogRequestWithTestData(request);
+    request.setTop(10);
+    request.setField("myfield");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&" +
+      "fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&fq=repo%3A%28logsearch_app+secure_log%29&" +
+      "fq=-repo%3A%28hst_agent+system_message%29&facet=true&facet.mincount=1&facet.limit=10&facet.pivot=myfield%2Crepo",
+      query.toQueryString());
+  }
+
+  @Test(expected = IllegalArgumentException.class) // TODO: later use @Valid on the fields to validate object
+  public void testConvertWithoutData() {
+    // GIVEN
+    FieldAuditLogRequest request = new FieldAuditLogRequest();
+    // WHEN
+    new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestConverterTest.java
new file mode 100644
index 0000000..487ad11
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestConverterTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.ServiceAnyGraphRequest;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.data.solr.core.DefaultQueryParser;
+
+import static org.junit.Assert.assertEquals;
+
+public class ServiceLogAnyGraphRequestConverterTest extends AbstractRequestConverterTest {
+
+  private ServiceLogAnyGraphRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new ServiceLogAnyGraphRequestQueryConverter();
+  }
+
+  @Test
+  public void testConverter() {
+    // GIVEN
+    ServiceAnyGraphRequest request = new ServiceAnyGraphRequest();
+    request.setUnit("+1HOUR");
+    fillBaseLogRequestWithTestData(request);
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3A*myincludemessage*" +
+      "&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29" +
+      "&facet=true&facet.mincount=1&facet.limit=10&facet.field=level", query.toQueryString());
+  }
+
+  @Test
+  public void testConverterWithoutData() {
+    // GIVEN
+    ServiceAnyGraphRequest request = new ServiceAnyGraphRequest();
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B*+TO+*%5D&facet=true&facet.mincount=1&facet.limit=10&facet.field=level",
+      query.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverterTest.java
new file mode 100644
index 0000000..47f7a6d
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverterTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogComponentLevelRequest;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.data.solr.core.DefaultQueryParser;
+
+import static org.junit.Assert.assertEquals;
+
+public class ServiceLogComponentLevelRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private ServiceLogComponentLevelRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new ServiceLogComponentLevelRequestQueryConverter();
+  }
+
+  @Test
+  public void testConverter() {
+    // GIVEN
+    ServiceLogComponentLevelRequest request = new ServiceLogComponentLevelRequest();
+    fillBaseLogRequestWithTestData(request);
+    request.setComponentName("mycomponent");
+    request.setLevel("WARN,ERROR,FATAL");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3A*myincludemessage*" +
+      "&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29" +
+      "&fq=level%3A%28WARN+ERROR+FATAL%29&facet=true&facet.mincount=1&facet.limit=10&facet.sort=index&facet.pivot=type%2Clevel",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConverterWithoutData() {
+    // GIVEN
+    ServiceLogComponentLevelRequest request = new ServiceLogComponentLevelRequest();
+    request.setLevel("WARN,ERROR,FATAL");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B*+TO+*%5D&fq=level%3A%28WARN+ERROR+FATAL%29&facet=true" +
+      "&facet.mincount=1&facet.limit=10&facet.sort=index&facet.pivot=type%2Clevel", query.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverterTest.java
new file mode 100644
index 0000000..d40bda0
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverterTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogComponentHostRequest;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.data.solr.core.DefaultQueryParser;
+
+import static org.junit.Assert.assertEquals;
+
+public class ServiceLogComponentRequestFacetQueryConverterTest extends AbstractRequestConverterTest {
+
+  private ServiceLogComponentRequestFacetQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new ServiceLogComponentRequestFacetQueryConverter();
+  }
+
+  @Test
+  public void testConverter() {
+    // GIVEN
+    ServiceLogComponentHostRequest request = new ServiceLogComponentHostRequest();
+    fillBaseLogRequestWithTestData(request);
+    request.setComponentName("mycomponent");
+    request.setLevel("WARN,ERROR,FATAL");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D" +
+      "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29" +
+      "&fq=-type%3A%28hst_agent+system_message%29&fq=level%3A%28WARN+ERROR+FATAL%29&facet=true&facet.mincount=1&facet.limit=10" +
+      "&facet.sort=index&facet.pivot=type%2Chost%2Clevel&facet.pivot=type%2Clevel",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConverterWithoutData() {
+    // GIVEN
+    ServiceLogComponentHostRequest request = new ServiceLogComponentHostRequest();
+    request.setLevel("WARN,ERROR,FATAL");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B*+TO+*%5D&fq=level%3A%28WARN+ERROR+FATAL%29" +
+      "&facet=true&facet.mincount=1&facet.limit=10&facet.sort=index&facet.pivot=type%2Chost%2Clevel&facet.pivot=type%2Clevel",
+      query.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverterTest.java
new file mode 100644
index 0000000..a4a3256
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverterTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogLevelCountRequest;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.data.solr.core.DefaultQueryParser;
+
+import static org.junit.Assert.assertEquals;
+
+public class ServiceLogLevelCountRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private ServiceLogLevelCountRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new ServiceLogLevelCountRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    ServiceLogLevelCountRequest request = new ServiceLogLevelCountRequest();
+    fillBaseLogRequestWithTestData(request);
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D" +
+      "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29" +
+      "&fq=-type%3A%28hst_agent+system_message%29&facet=true&facet.mincount=1&facet.limit=10&facet.field=level",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConvertWithoutData() {
+    // GIVEN
+    ServiceLogLevelCountRequest request = new ServiceLogLevelCountRequest();
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B*+TO+*%5D&facet=true&facet.mincount=1&facet.limit=10&facet.field=level",
+      query.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelDateRangeRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelDateRangeRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelDateRangeRequestQueryConverterTest.java
new file mode 100644
index 0000000..b941437
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelDateRangeRequestQueryConverterTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.ServiceGraphRequest;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class ServiceLogLevelDateRangeRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private ServiceLogLevelDateRangeRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new ServiceLogLevelDateRangeRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    ServiceGraphRequest request = new ServiceGraphRequest();
+    fillBaseLogRequestWithTestData(request);
+    request.setUnit("+1HOUR");
+    request.setLevel("WARN,ERROR,FATAL");
+    // WHEN
+    SolrQuery query = underTest.convert(request);
+    // THEN
+    assertEquals("?q=*%3A*&facet=true&facet.pivot=%7B%21range%3Dr1%7Dlevel&facet.mincount=1&facet.limit=-1" +
+      "&facet.sort=index&facet.range=%7B%21tag%3Dr1%7Dlogtime&f.logtime.facet.range.start=2016-09-13T22%3A00%3A01.000Z" +
+      "&f.logtime.facet.range.end=2016-09-14T22%3A00%3A01.000Z&f.logtime.facet.range.gap=%2B1HOUR&rows=0&start=0&fq=level%3A%28WARN+OR+ERROR+OR+FATAL%29",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConvertWithoutData() {
+    // GIVEN
+    ServiceGraphRequest request = new ServiceGraphRequest();
+    request.setUnit("+1HOUR"); // minimal data for date range gap
+    request.setFrom("2016-09-13T22:00:01.000Z");
+    request.setTo("2016-09-14T22:00:01.000Z");
+    // WHEN
+    SolrQuery query = underTest.convert(request);
+    // THEN
+    assertEquals("?q=*%3A*&facet=true&facet.pivot=%7B%21range%3Dr1%7Dlevel&facet.mincount=1&facet.limit=-1&facet.sort=index" +
+      "&facet.range=%7B%21tag%3Dr1%7Dlogtime&f.logtime.facet.range.start=2016-09-13T22%3A00%3A01.000Z" +
+      "&f.logtime.facet.range.end=2016-09-14T22%3A00%3A01.000Z&f.logtime.facet.range.gap=%2B1HOUR&rows=0&start=0",
+      query.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTreeRequestFacetQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTreeRequestFacetQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTreeRequestFacetQueryConverterTest.java
new file mode 100644
index 0000000..481bfeb
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTreeRequestFacetQueryConverterTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogHostComponentRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogLevelCountRequest;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.data.solr.core.DefaultQueryParser;
+
+import static org.junit.Assert.assertEquals;
+
+public class ServiceLogTreeRequestFacetQueryConverterTest extends AbstractRequestConverterTest {
+  private ServiceLogTreeRequestFacetQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new ServiceLogTreeRequestFacetQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    ServiceLogHostComponentRequest request = new ServiceLogHostComponentRequest();
+    fillBaseLogRequestWithTestData(request);
+    request.setLevel("WARN,ERROR,FATAL");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3A*myincludemessage*" +
+      "&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29&fq=level%3A%28WARN+ERROR+FATAL%29" +
+      "&facet=true&facet.mincount=1&facet.limit=10&facet.sort=index&facet.pivot=host%2Ctype%2Clevel&facet.pivot=host%2Clevel",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConvertWithoutData() {
+    // GIVEN
+    ServiceLogHostComponentRequest request = new ServiceLogHostComponentRequest();
+    request.setLevel("WARN,ERROR,FATAL");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B*+TO+*%5D&fq=level%3A%28WARN+ERROR+FATAL%29&facet=true&facet.mincount=1" +
+      "&facet.limit=10&facet.sort=index&facet.pivot=host%2Ctype%2Clevel&facet.pivot=host%2Clevel",
+      query.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTruncatedRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTruncatedRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTruncatedRequestQueryConverterTest.java
new file mode 100644
index 0000000..41761bc
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTruncatedRequestQueryConverterTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogTruncatedRequest;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.data.solr.core.DefaultQueryParser;
+
+import static org.junit.Assert.assertEquals;
+
+public class ServiceLogTruncatedRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private ServiceLogTruncatedRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new ServiceLogTruncatedRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    ServiceLogTruncatedRequest request = new ServiceLogTruncatedRequest();
+    fillBaseLogRequestWithTestData(request);
+    request.setScrollType("0");
+    request.setNumberRows(10);
+    request.setId("id");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&start=0&rows=10&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29" +
+      "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&sort=logtime+desc%2Cseq_num+desc",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConvertWithoutData() {
+    // GIVEN
+    ServiceLogTruncatedRequest request = new ServiceLogTruncatedRequest();
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&start=0&sort=logtime+desc%2Cseq_num+desc",
+      query.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/StringFieldFacetQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/StringFieldFacetQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/StringFieldFacetQueryConverterTest.java
new file mode 100644
index 0000000..3597779
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/StringFieldFacetQueryConverterTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.data.solr.core.DefaultQueryParser;
+import org.springframework.data.solr.core.query.SimpleQuery;
+
+import static org.junit.Assert.assertEquals;
+
+public class StringFieldFacetQueryConverterTest extends AbstractRequestConverterTest {
+  private StringFieldFacetQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new StringFieldFacetQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    String field = "myfield";
+    // WHEN
+    SimpleQuery simpleQuery = underTest.convert(field);
+    SolrQuery queryResult = new DefaultQueryParser().doConstructSolrQuery(simpleQuery);
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&facet=true&facet.mincount=1&facet.limit=-1&facet.field=myfield",
+      queryResult.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverterTest.java
new file mode 100644
index 0000000..adeaf5b
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverterTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.AuditLogRequest;
+import org.apache.ambari.logsearch.model.request.impl.UserConfigRequest;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.data.solr.core.DefaultQueryParser;
+import org.springframework.data.solr.core.query.SimpleQuery;
+
+import static org.junit.Assert.assertEquals;
+
+public class UserConfigRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private UserConfigRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new UserConfigRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    UserConfigRequest request = new UserConfigRequest();
+    request.setRowType("myRowType"); // TODO: validate these 3 fields @Valid on UserConfigRequest object -> not null
+    request.setUserId("myUserId");
+    request.setFilterName("myFilterName");
+    // WHEN
+    SolrQuery queryResult = underTest.convert(request);
+    // THEN
+    assertEquals("?q=*%3A*&fq=rowtype%3AmyRowType&fq=username%3AmyUserId+OR+share_username_list%3AmyUserId" +
+      "&fq=filtername%3A*myFilterName*&start=0&rows=10&sort=filtername+asc",
+      queryResult.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverterTest.java
new file mode 100644
index 0000000..7728876
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverterTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.UserExportRequest;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.data.solr.core.DefaultQueryParser;
+
+import static org.junit.Assert.assertEquals;
+
+public class UserExportRequestQueryConverterTest extends AbstractRequestConverterTest {
+  private UserExportRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new UserExportRequestQueryConverter();
+  }
+
+  @Test
+  public void testConverter() {
+    // GIVEN
+    UserExportRequest request = new UserExportRequest();
+    fillBaseLogRequestWithTestData(request);
+    request.setFormat("myFormat");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D" +
+      "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&fq=repo%3A%28logsearch_app+secure_log%29" +
+      "&fq=-repo%3A%28hst_agent+system_message%29&facet=true&facet.mincount=1&facet.limit=10&facet.pivot=reqUser%2Crepo&facet.pivot=resource%2Crepo",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConverterWithoutData() {
+    // GIVEN
+    UserExportRequest request = new UserExportRequest();
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B*+TO+*%5D&facet=true&facet.mincount=1&facet.limit=10" +
+      "&facet.pivot=reqUser%2Crepo&facet.pivot=resource%2Crepo",
+      query.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImpl.java
index 061c607..eab0c04 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImpl.java
@@ -64,7 +64,7 @@ public class LoggingRequestHelperImpl implements LoggingRequestHelper {
 
   private static final String LOGSEARCH_QUERY_PATH = "/api/v1/service/logs";
 
-  private static final String LOGSEARCH_GET_LOG_LEVELS_PATH = "/api/v1/service/logs/levels/counts/namevalues";
+  private static final String LOGSEARCH_GET_LOG_LEVELS_PATH = "/api/v1/service/logs/levels/counts";
 
   private static final String LOGSEARCH_ADMIN_CREDENTIAL_NAME = "logsearch.admin.credential";
 


Mime
View raw message