summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/aai/sparky/search/filters/FilterProcessorTest.java373
-rw-r--r--src/test/java/org/onap/aai/sparky/search/filters/FilteredSearchHelperTest.java69
-rw-r--r--src/test/java/org/onap/aai/sparky/search/filters/entity/DiscoverFiltersRequest.java40
-rw-r--r--src/test/java/org/onap/aai/sparky/search/filters/entity/ViewConfiguration.java68
-rw-r--r--src/test/java/org/onap/aai/sparky/search/filters/entity/ViewFilter.java57
-rw-r--r--src/test/resources/filters/AggregationSuggestionEntity_getIndexDocumentJson_expected.json1
-rw-r--r--src/test/resources/filters/aaiui_filters.json88
-rw-r--r--src/test/resources/filters/aaiui_views.json38
-rw-r--r--src/test/resources/filters/filterAggregationEndpoint_emptyRequestBody_expectedResponse.json1
-rw-r--r--src/test/resources/filters/filterAggregationEndpoint_emptyRequestFilterArray_expectedResponse.json1
-rw-r--r--src/test/resources/filters/filterAggregationEndpoint_emptyRequestFilterArray_requestBody.json3
-rw-r--r--src/test/resources/filters/filterAggregationEndpoint_successPath_expectedResponse.json1
-rw-r--r--src/test/resources/filters/filterAggregationEndpoint_successPath_operationResult.json1
-rw-r--r--src/test/resources/filters/filterAggregationEndpoint_successPath_requestBody.json11
14 files changed, 752 insertions, 0 deletions
diff --git a/src/test/java/org/onap/aai/sparky/search/filters/FilterProcessorTest.java b/src/test/java/org/onap/aai/sparky/search/filters/FilterProcessorTest.java
new file mode 100644
index 0000000..a6c4f22
--- /dev/null
+++ b/src/test/java/org/onap/aai/sparky/search/filters/FilterProcessorTest.java
@@ -0,0 +1,373 @@
+/**
+ * ============LICENSE_START=================================================== SPARKY (AAI UI
+ * service) ============================================================================ Copyright ©
+ * 2017 AT&T Intellectual Property. Copyright © 2017 Amdocs All rights reserved.
+ * ============================================================================ Licensed under the
+ * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License. ============LICENSE_END=====================================================
+ *
+ * ECOMP and OpenECOMP are trademarks and service marks of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.sparky.search.filters;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.json.Json;
+import javax.json.JsonArray;
+import javax.json.JsonObject;
+import javax.json.JsonReader;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.component.restlet.RestletConstants;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
+import org.onap.aai.sparky.search.filters.FilterProcessor;
+import org.onap.aai.sparky.search.filters.FilteredSearchHelper;
+import org.onap.aai.sparky.search.filters.config.UiFilterConfig;
+import org.onap.aai.sparky.search.filters.config.UiFilterListItemConfig;
+import org.onap.aai.sparky.search.filters.config.UiFilterOptionsValuesConfig;
+import org.onap.aai.sparky.search.filters.config.FiltersDetailsConfig;
+import org.onap.aai.sparky.search.filters.config.FiltersConfig;
+import org.onap.aai.sparky.search.filters.config.UiViewListItemConfig;
+import org.onap.aai.sparky.search.filters.entity.DiscoverFiltersRequest;
+import org.onap.aai.sparky.search.filters.entity.ViewConfiguration;
+import org.onap.aai.sparky.search.filters.entity.ViewFilter;
+import org.onap.aai.sparky.util.NodeUtils;
+import org.onap.aai.sparky.search.filters.config.FiltersForViewsConfig;
+import org.restlet.Request;
+import org.restlet.Response;
+import org.restlet.data.MediaType;
+import org.restlet.data.Status;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class FilterProcessorTest {
+
+ private FilterProcessor filterProcessor;
+ private Exchange mockExchange;
+ private Message mockRequestMessage;
+ private Message mockResponseMessage;
+ private Request mockRestletRequest;
+ private Response mockRestletResponse;
+ private FilteredSearchHelper filteredSearchHelper;
+ private ObjectMapper mapper;
+
+ protected UiViewListItemConfig generateViewConfig(ViewConfiguration viewConfig) {
+
+ UiViewListItemConfig uiViewConfig = new UiViewListItemConfig(viewConfig.getViewName(), null);
+
+ List<UiFilterListItemConfig> filters = new ArrayList<UiFilterListItemConfig>();
+
+ for (ViewFilter viewFilter : viewConfig.getViewFilters()) {
+ filters.add(new UiFilterListItemConfig(viewFilter.getId(), viewFilter.getDefaultValue()));
+ }
+
+ uiViewConfig.setListOfFilters(filters);
+
+ return uiViewConfig;
+ }
+
+ protected FiltersConfig generateDefaultViewsFilterConfig() {
+
+ FiltersForViewsConfig uiViewsConfig = new FiltersForViewsConfig();
+ FiltersConfig viewFilterConfig = FiltersConfig.getInstance();
+
+ List<UiViewListItemConfig> views = new ArrayList<UiViewListItemConfig>();
+
+ // Default filter value to use below
+ UiFilterOptionsValuesConfig defaultValue =
+ new UiFilterOptionsValuesConfig("Today", "Last 0 hours");
+
+ // VNF View - 4 Filters
+ ViewConfiguration vnfViewConfig = new ViewConfiguration("vnfSearch");
+ vnfViewConfig.addViewFilter(new ViewFilter("1", null));
+ vnfViewConfig.addViewFilter(new ViewFilter("2", null));
+ vnfViewConfig.addViewFilter(new ViewFilter("7", null));
+ vnfViewConfig.addViewFilter(new ViewFilter("8", null));
+ views.add(generateViewConfig(vnfViewConfig));
+
+ // View and Inspect (Schema) - 0 Filters
+ ViewConfiguration viewInspectConfig = new ViewConfiguration("viewInspect");
+ views.add(generateViewConfig(viewInspectConfig));
+
+ // Data Integrity - 4 Filters
+ ViewConfiguration dataIntegrityConfig = new ViewConfiguration("dataIntegrity");
+ dataIntegrityConfig.addViewFilter(new ViewFilter("3", null));
+ dataIntegrityConfig.addViewFilter(new ViewFilter("4", null));
+ dataIntegrityConfig.addViewFilter(new ViewFilter("5", defaultValue));
+ dataIntegrityConfig.addViewFilter(new ViewFilter("6", null));
+ views.add(generateViewConfig(dataIntegrityConfig));
+
+ uiViewsConfig.setViews(views);
+
+ viewFilterConfig.setViewsConfig(uiViewsConfig);
+
+ List<UiFilterOptionsValuesConfig> optionsValues = new ArrayList<UiFilterOptionsValuesConfig>();
+ optionsValues.add(new UiFilterOptionsValuesConfig("Today", "Last 0 hours"));
+ optionsValues.add(new UiFilterOptionsValuesConfig("Since Yesterday", "Last 24 hours"));
+ optionsValues.add(new UiFilterOptionsValuesConfig("Since Last Week", "Last 7 days"));
+ optionsValues.add(new UiFilterOptionsValuesConfig("Since Last Month", "Last 30 days"));
+ optionsValues.add(new UiFilterOptionsValuesConfig("Custom Range", "Custom Range"));
+
+
+
+ FiltersDetailsConfig uiFiltersConfig = new FiltersDetailsConfig();
+
+ List<UiFilterConfig> uiFilterConfig = new ArrayList<UiFilterConfig>();
+ uiFilterConfig.add(new UiFilterConfig("1", "filterName1", "Display Name 1", "dropDown", "false",
+ "Any 1", null, "options", null, null));
+ uiFilterConfig.add(new UiFilterConfig("2", "filterName2", "Display Name 2", "dropDown", "false",
+ "Any 2", null, "options", null, null));
+ uiFilterConfig.add(new UiFilterConfig("3", "filterName3", "Display Name 3", "dropDown", "false",
+ "Any 3", null, "options", null, null));
+ uiFilterConfig.add(new UiFilterConfig("4", "filterName4", "Display Name 4", "dropDown", "false",
+ "Any 4", null, "options", null, null));
+ uiFilterConfig.add(new UiFilterConfig("5", "filterName5", "Display Name 5", "date", "false",
+ "Any 5", defaultValue, "dynamicOptions", optionsValues, null));
+ uiFilterConfig.add(new UiFilterConfig("6", "filterName6", "Display Name 6", "dropDown", "false",
+ "Any 6", null, "options", null, null));
+ uiFilterConfig.add(new UiFilterConfig("7", "filterName7", "Display Name 7", "dropDown", "false",
+ "Any 7", null, "options", null, null));
+ uiFilterConfig.add(new UiFilterConfig("8", "filterName8", "Display Name 8", "dropDown", "false",
+ "Any 8", null, "options", null, null));
+
+ uiFiltersConfig.setFilters(uiFilterConfig);
+
+ viewFilterConfig.setFiltersConfig(uiFiltersConfig);
+
+ return viewFilterConfig;
+ }
+
+ @Before
+ public void init() {
+ mockExchange = Mockito.mock(Exchange.class);
+ mockRequestMessage = Mockito.mock(Message.class);
+ mockResponseMessage = Mockito.mock(Message.class);
+ mockRestletRequest = Mockito.mock(Request.class);
+ mockRestletResponse = Mockito.mock(Response.class);
+
+ filteredSearchHelper = new FilteredSearchHelper(generateDefaultViewsFilterConfig());
+ filterProcessor = new FilterProcessor(filteredSearchHelper);
+
+ mapper = new ObjectMapper();
+ }
+
+
+ @Test
+ public void validateDefaultConstructor() {
+ assertNotNull(filterProcessor.getMapper());
+ assertNotNull(filterProcessor.getFilteredSearchHelper());
+ }
+
+ private void verifyResponseAndNumFiltersForBadRequest(Status expectedStatus,
+ int numExpectedFilters) throws JsonParseException, JsonMappingException, IOException {
+
+ ArgumentCaptor<Status> responseCodeCaptor = ArgumentCaptor.forClass(Status.class);
+ Mockito.verify(mockRestletResponse, Mockito.atLeast(1)).setStatus(responseCodeCaptor.capture());
+ assertEquals(expectedStatus, responseCodeCaptor.getValue());
+
+ ArgumentCaptor<String> entityPayload = ArgumentCaptor.forClass(String.class);
+ ArgumentCaptor<MediaType> payloadMediaType = ArgumentCaptor.forClass(MediaType.class);
+ Mockito.verify(mockRestletResponse, Mockito.atLeast(1)).setEntity(entityPayload.capture(),
+ payloadMediaType.capture());
+ assertNotNull(entityPayload.getValue());
+
+ ArgumentCaptor<Response> responseObject = ArgumentCaptor.forClass(Response.class);
+ Mockito.verify(mockResponseMessage, Mockito.atLeast(1)).setBody(responseObject.capture());
+ assertEquals(MediaType.APPLICATION_JSON, payloadMediaType.getValue());
+
+ JsonReader jsonReader = Json.createReader(new StringReader(entityPayload.getValue()));
+ JsonObject responsePayload = jsonReader.readObject();
+
+ JsonObject filters = responsePayload.getJsonObject("filters");
+ assertEquals(0, filters.size());
+ }
+
+ private void initializeMocks(String requestPayload) {
+
+ Mockito.when(mockRequestMessage.getBody(String.class)).thenReturn(requestPayload);
+
+ Mockito.when(mockExchange.getIn()).thenReturn(mockRequestMessage);
+ Mockito.when(mockExchange.getOut()).thenReturn(mockResponseMessage);
+
+ Mockito.when(mockRequestMessage.getHeader(RestletConstants.RESTLET_REQUEST, Request.class))
+ .thenReturn(mockRestletRequest);
+ Mockito.when(mockRequestMessage.getHeader(RestletConstants.RESTLET_RESPONSE, Response.class))
+ .thenReturn(mockRestletResponse);
+ }
+
+
+ @Test
+ public void testGetFiltersWithValues_success_path() throws IOException {
+
+ // Initialize for call against 'vnfSearch'
+ DiscoverFiltersRequest vnfSearchrequest = new DiscoverFiltersRequest();
+ vnfSearchrequest.setViewName("vnfSearch");
+
+ initializeMocks(NodeUtils.convertObjectToJson(vnfSearchrequest, false));
+
+ // Test call against 'vnfSearch'
+ filterProcessor.getFiltersWithValues(mockExchange);
+
+ ArgumentCaptor<Status> vnfResponseCodeCaptor = ArgumentCaptor.forClass(Status.class);
+ Mockito.verify(mockRestletResponse, Mockito.atLeast(1))
+ .setStatus(vnfResponseCodeCaptor.capture());
+ assertEquals(Status.SUCCESS_OK, vnfResponseCodeCaptor.getValue());
+
+ ArgumentCaptor<String> vnfEntityPayload = ArgumentCaptor.forClass(String.class);
+ ArgumentCaptor<MediaType> vnfPayloadMediaType = ArgumentCaptor.forClass(MediaType.class);
+ Mockito.verify(mockRestletResponse, Mockito.atLeast(1)).setEntity(vnfEntityPayload.capture(),
+ vnfPayloadMediaType.capture());
+ assertNotNull(vnfEntityPayload.getValue());
+
+ ArgumentCaptor<Response> vnfResponseObject = ArgumentCaptor.forClass(Response.class);
+ Mockito.verify(mockResponseMessage, Mockito.atLeast(1)).setBody(vnfResponseObject.capture());
+ assertEquals(MediaType.APPLICATION_JSON, vnfPayloadMediaType.getValue());
+
+ JsonReader vnfJsonReader = Json.createReader(new StringReader(vnfEntityPayload.getValue()));
+ JsonObject vnfResponsePayload = vnfJsonReader.readObject();
+
+ JsonObject vnfFilters = vnfResponsePayload.getJsonObject("filters");
+ assertNotNull(vnfFilters);
+ assertEquals(4, vnfFilters.size());
+
+ JsonObject filterOne = vnfFilters.getJsonObject("1");
+ assertNotNull(filterOne);
+ assertEquals("Display Name 1", filterOne.getString("label"));
+
+ JsonObject filterEight = vnfFilters.getJsonObject("8");
+ assertNotNull(filterEight);
+ JsonObject eightInnerControl =
+ filterEight.getJsonObject("controls").getJsonObject("filterName8");
+ assertEquals(4, eightInnerControl.size());
+ assertEquals("dropDown", eightInnerControl.getString("type"));
+ assertEquals("false", eightInnerControl.getString("multiSelect"));
+ assertEquals("Any 8", eightInnerControl.getString("watermark"));
+ assertEquals(0, eightInnerControl.getJsonArray("options").size());
+
+ // Initialize for call against 'dataIntegrity'
+ DiscoverFiltersRequest dataIntegrityRequest = new DiscoverFiltersRequest();
+ dataIntegrityRequest.setViewName("dataIntegrity");
+
+ initializeMocks(NodeUtils.convertObjectToJson(dataIntegrityRequest, false));
+
+ // Test call against 'dataIntegrity'
+ filterProcessor.getFiltersWithValues(mockExchange);
+
+ ArgumentCaptor<Status> dIResponseCodeCaptor = ArgumentCaptor.forClass(Status.class);
+ Mockito.verify(mockRestletResponse, Mockito.atLeast(1))
+ .setStatus(dIResponseCodeCaptor.capture());
+ assertEquals(Status.SUCCESS_OK, dIResponseCodeCaptor.getValue());
+
+ ArgumentCaptor<String> dIEntityPayload = ArgumentCaptor.forClass(String.class);
+ ArgumentCaptor<MediaType> dIPayloadMediaType = ArgumentCaptor.forClass(MediaType.class);
+ Mockito.verify(mockRestletResponse, Mockito.atLeast(1)).setEntity(dIEntityPayload.capture(),
+ dIPayloadMediaType.capture());
+ assertNotNull(dIEntityPayload.getValue());
+
+ ArgumentCaptor<Response> dIResponseObject = ArgumentCaptor.forClass(Response.class);
+ Mockito.verify(mockResponseMessage, Mockito.atLeast(1)).setBody(dIResponseObject.capture());
+ assertEquals(MediaType.APPLICATION_JSON, dIPayloadMediaType.getValue());
+
+ JsonReader dIJsonReader = Json.createReader(new StringReader(dIEntityPayload.getValue()));
+ JsonObject dIResponsePayload = dIJsonReader.readObject();
+
+ JsonObject dIFilters = dIResponsePayload.getJsonObject("filters");
+ assertNotNull(dIFilters);
+ assertEquals(4, dIFilters.size());
+
+ JsonObject filterFour = dIFilters.getJsonObject("4");
+ assertNotNull(filterFour);
+ assertEquals("Display Name 4", filterFour.getString("label"));
+
+ JsonObject filterFive = dIFilters.getJsonObject("5");
+ assertNotNull(filterFive);
+ JsonObject fiveInnerControl = filterFive.getJsonObject("controls").getJsonObject("filterName5");
+ assertEquals(5, fiveInnerControl.size());
+ assertEquals("date", fiveInnerControl.getString("type"));
+ assertEquals("false", fiveInnerControl.getString("multiSelect"));
+ assertEquals("Any 5", fiveInnerControl.getString("watermark"));
+ JsonArray dynamicOptions = fiveInnerControl.getJsonArray("dynamicOptions");
+ assertEquals(5, dynamicOptions.size());
+ JsonObject today = dynamicOptions.getJsonObject(0);
+ assertEquals("Today", today.getString("decode"));
+ }
+
+ @Test
+ public void testGetFiltersWithValues_viewNameNull() throws IOException {
+
+ DiscoverFiltersRequest discoverFiltersRequest = new DiscoverFiltersRequest();
+ initializeMocks(NodeUtils.convertObjectToJson(discoverFiltersRequest, false));
+
+ // Method under test
+ filterProcessor.getFiltersWithValues(mockExchange);
+
+ verifyResponseAndNumFiltersForBadRequest(Status.SUCCESS_OK, 0);
+ }
+
+ @Test
+ public void testGetFiltersWithValues_viewNameEmptyString() throws IOException {
+
+ DiscoverFiltersRequest discoverFiltersRequest = new DiscoverFiltersRequest();
+ discoverFiltersRequest.setViewName("");
+
+ initializeMocks(NodeUtils.convertObjectToJson(discoverFiltersRequest, false));
+
+ // Method under test
+ filterProcessor.getFiltersWithValues(mockExchange);
+
+ verifyResponseAndNumFiltersForBadRequest(Status.SUCCESS_OK, 0);
+ }
+
+ @Test
+ public void testGetFiltersWithValues_requestPayloadIsNull() throws IOException {
+
+ initializeMocks(null);
+
+ // Method under test
+ filterProcessor.getFiltersWithValues(mockExchange);
+
+ verifyResponseAndNumFiltersForBadRequest(Status.SUCCESS_OK, 0);
+ }
+
+ @Test
+ public void testGetFiltersWithValues_requestPayloadIsEmptyString() throws IOException {
+
+ initializeMocks("");
+
+ // Method under test
+ filterProcessor.getFiltersWithValues(mockExchange);
+
+ verifyResponseAndNumFiltersForBadRequest(Status.SUCCESS_OK, 0);
+ }
+
+ @Test
+ public void testGetFiltersWithValues_requestPayloadCausesException() throws IOException {
+
+ initializeMocks("{");
+
+ // Method under test
+ filterProcessor.getFiltersWithValues(mockExchange);
+
+ verifyResponseAndNumFiltersForBadRequest(Status.SUCCESS_OK, 0);
+ }
+}
diff --git a/src/test/java/org/onap/aai/sparky/search/filters/FilteredSearchHelperTest.java b/src/test/java/org/onap/aai/sparky/search/filters/FilteredSearchHelperTest.java
new file mode 100644
index 0000000..aa37d42
--- /dev/null
+++ b/src/test/java/org/onap/aai/sparky/search/filters/FilteredSearchHelperTest.java
@@ -0,0 +1,69 @@
+/**
+ * ============LICENSE_START===================================================
+ * SPARKY (AAI UI service)
+ * ============================================================================
+ * Copyright © 2017 AT&T Intellectual Property.
+ * Copyright © 2017 Amdocs
+ * All rights reserved.
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ *
+ * ECOMP and OpenECOMP are trademarks
+ * and service marks of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.sparky.search.filters;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.aai.sparky.search.filters.FilteredSearchHelper;
+import org.onap.aai.sparky.search.filters.config.FiltersConfig;
+
+public class FilteredSearchHelperTest {
+
+ private static FilteredSearchHelper filteredSearchHelper;
+
+ @BeforeClass
+ public static void init() throws IOException {
+ FiltersConfig config = FiltersConfig.getInstance();
+ config.setFilterMappingsFileName("src/test/resources/filters/aaiui_views.json");
+ config.setFiltersFileName("src/test/resources/filters/aaiui_filters.json");
+ System.out.println("SETTING UIVIEWSCONFIG");
+ config.setViewsConfig(config.readUiViewsConfig());
+ System.out.println("SETTING UIFILTERSCONFIG");
+ config.setFiltersConfig(config.readUiFiltersConfig());
+
+ filteredSearchHelper = new FilteredSearchHelper(config);
+ }
+
+ @Test
+ public void testDoFilterDiscovery_validViewName() {
+ assertEquals(4, filteredSearchHelper.doFilterDiscovery("vnfSearch").getFilters().size());
+ assertEquals(4, filteredSearchHelper.doFilterDiscovery("dataIntegrity").getFilters().size());
+ }
+
+ @Test
+ public void testDoFilterDiscovery_invalidViewName_nameGiven() {
+ assertEquals(0, filteredSearchHelper.doFilterDiscovery("InvalidViewName").getFilters().size());
+ }
+
+ @Test
+ public void testDoFilterDiscovery_invalidViewName_emptyString() {
+ assertEquals(0, filteredSearchHelper.doFilterDiscovery("").getFilters().size());
+ }
+}
diff --git a/src/test/java/org/onap/aai/sparky/search/filters/entity/DiscoverFiltersRequest.java b/src/test/java/org/onap/aai/sparky/search/filters/entity/DiscoverFiltersRequest.java
new file mode 100644
index 0000000..336e3b1
--- /dev/null
+++ b/src/test/java/org/onap/aai/sparky/search/filters/entity/DiscoverFiltersRequest.java
@@ -0,0 +1,40 @@
+/**
+ * ============LICENSE_START===================================================
+ * SPARKY (AAI UI service)
+ * ============================================================================
+ * Copyright © 2017 AT&T Intellectual Property.
+ * Copyright © 2017 Amdocs
+ * All rights reserved.
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ *
+ * ECOMP and OpenECOMP are trademarks
+ * and service marks of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.sparky.search.filters.entity;
+
+public class DiscoverFiltersRequest {
+
+ private String viewName;
+
+ public String getViewName() {
+ return viewName;
+ }
+
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+
+}
diff --git a/src/test/java/org/onap/aai/sparky/search/filters/entity/ViewConfiguration.java b/src/test/java/org/onap/aai/sparky/search/filters/entity/ViewConfiguration.java
new file mode 100644
index 0000000..f6c352b
--- /dev/null
+++ b/src/test/java/org/onap/aai/sparky/search/filters/entity/ViewConfiguration.java
@@ -0,0 +1,68 @@
+/**
+ * ============LICENSE_START===================================================
+ * SPARKY (AAI UI service)
+ * ============================================================================
+ * Copyright © 2017 AT&T Intellectual Property.
+ * Copyright © 2017 Amdocs
+ * All rights reserved.
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ *
+ * ECOMP and OpenECOMP are trademarks
+ * and service marks of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.sparky.search.filters.entity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ViewConfiguration {
+
+ private String viewName;
+ private List<ViewFilter> viewFilters;
+
+ public ViewConfiguration() {
+ viewFilters = new ArrayList<ViewFilter>();
+ }
+
+ public ViewConfiguration(String viewName) {
+ viewFilters = new ArrayList<ViewFilter>();
+ this.setViewName(viewName);
+ }
+
+ public String getViewName() {
+ return viewName;
+ }
+
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+
+ public List<ViewFilter> getViewFilters() {
+ return viewFilters;
+ }
+
+ public void setViewFilters(List<ViewFilter> viewFilters) {
+ this.viewFilters = viewFilters;
+ }
+
+ public void addViewFilter(ViewFilter viewFilter) {
+ if (viewFilters != null) {
+ if (!viewFilters.contains(viewFilter)) {
+ viewFilters.add(viewFilter);
+ }
+ }
+ }
+}
diff --git a/src/test/java/org/onap/aai/sparky/search/filters/entity/ViewFilter.java b/src/test/java/org/onap/aai/sparky/search/filters/entity/ViewFilter.java
new file mode 100644
index 0000000..94832d5
--- /dev/null
+++ b/src/test/java/org/onap/aai/sparky/search/filters/entity/ViewFilter.java
@@ -0,0 +1,57 @@
+/**
+ * ============LICENSE_START===================================================
+ * SPARKY (AAI UI service)
+ * ============================================================================
+ * Copyright © 2017 AT&T Intellectual Property.
+ * Copyright © 2017 Amdocs
+ * All rights reserved.
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ *
+ * ECOMP and OpenECOMP are trademarks
+ * and service marks of AT&T Intellectual Property.
+ */
+
+package org.onap.aai.sparky.search.filters.entity;
+
+import org.onap.aai.sparky.search.filters.config.UiFilterOptionsValuesConfig;
+
+public class ViewFilter {
+
+ private String id;
+ private UiFilterOptionsValuesConfig defaultValue;
+
+ public ViewFilter() {}
+
+ public ViewFilter(String id, UiFilterOptionsValuesConfig defaultValue) {
+ this.id = id;
+ this.defaultValue = defaultValue;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public UiFilterOptionsValuesConfig getDefaultValue() {
+ return defaultValue;
+ }
+
+ public void setDefaultValue(UiFilterOptionsValuesConfig defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+}
diff --git a/src/test/resources/filters/AggregationSuggestionEntity_getIndexDocumentJson_expected.json b/src/test/resources/filters/AggregationSuggestionEntity_getIndexDocumentJson_expected.json
new file mode 100644
index 0000000..53e9ec9
--- /dev/null
+++ b/src/test/resources/filters/AggregationSuggestionEntity_getIndexDocumentJson_expected.json
@@ -0,0 +1 @@
+"filterList":[{"filterId":"1"},{"filterId":"2"},{"filterId":"7"},{"filterId":"8"}] \ No newline at end of file
diff --git a/src/test/resources/filters/aaiui_filters.json b/src/test/resources/filters/aaiui_filters.json
new file mode 100644
index 0000000..31716ed
--- /dev/null
+++ b/src/test/resources/filters/aaiui_filters.json
@@ -0,0 +1,88 @@
+{
+ "filters": [
+ {
+ "filterId": "1",
+ "filterName": "Orchestration-Status",
+ "displayName": "Orchestration Status",
+ "dataType": "list",
+ "dataSource": {
+ "indexName": "aggregate_generic-vnf_index",
+ "docType": "default",
+ "fieldName": "orchestration-status"
+ }
+ },
+ {
+ "filterId": "2",
+ "filterName": "Prov-Status",
+ "displayName": "Provisioning Status",
+ "dataType": "list",
+ "dataSource": {
+ "indexName": "aggregate_generic-vnf_index",
+ "docType": "default",
+ "fieldName": "prov-status"
+ }
+ },
+ {
+ "filterId": "3",
+ "filterName": "Severity",
+ "displayName": "Severity",
+ "dataType": "list",
+ "dataSource": {
+ "indexName": "di-violations",
+ "docType": "default",
+ "fieldName": "severity"
+ }
+ },
+ {
+ "filterId": "4",
+ "filterName": "Category",
+ "displayName": "Category",
+ "dataType": "list",
+ "dataSource": {
+ "indexName": "di-violations",
+ "docType": "default",
+ "fieldName": "category"
+ }
+ },
+ {
+ "filterId": "5",
+ "filterName": "Date",
+ "displayName": "Date",
+ "dataType": "date"
+ },
+ {
+ "filterId": "6",
+ "filterName": "EntityType",
+ "displayName": "Object Type",
+ "dataType": "list",
+ "dataSource": {
+ "indexName": "di-violations",
+ "docType": "default",
+ "fieldName": "entityType"
+ }
+ },
+ {
+ "filterId": "7",
+ "filterName": "NF-Type",
+ "displayName": "Network Function Type",
+ "dataType": "list",
+ "dataSource": {
+ "indexName": "aggregate_generic-vnf_index",
+ "docType": "default",
+ "fieldName": "nf-type"
+ }
+ },
+ {
+ "filterId": "8",
+ "filterName": "NF-Role",
+ "displayName": "Network Function Role",
+ "dataType": "list",
+ "dataSource": {
+ "indexName": "aggregate_generic-vnf_index",
+ "docType": "default",
+ "fieldName": "nf-role"
+ }
+ }
+
+ ]
+} \ No newline at end of file
diff --git a/src/test/resources/filters/aaiui_views.json b/src/test/resources/filters/aaiui_views.json
new file mode 100644
index 0000000..e6ece9f
--- /dev/null
+++ b/src/test/resources/filters/aaiui_views.json
@@ -0,0 +1,38 @@
+{
+ "views": [
+ {
+ "viewName" : "vnfSearch",
+ "filters" : [
+ {
+ "filterId": "1"
+ },
+ {
+ "filterId": "2"
+ },
+ {
+ "filterId": "7"
+ },
+ {
+ "filterId": "8"
+ }
+ ]
+ },
+ {
+ "viewName" : "dataIntegrity",
+ "filters" : [
+ {
+ "filterId": "3"
+ },
+ {
+ "filterId": "4"
+ },
+ {
+ "filterId": "5"
+ },
+ {
+ "filterId": "6"
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/src/test/resources/filters/filterAggregationEndpoint_emptyRequestBody_expectedResponse.json b/src/test/resources/filters/filterAggregationEndpoint_emptyRequestBody_expectedResponse.json
new file mode 100644
index 0000000..95a2b16
--- /dev/null
+++ b/src/test/resources/filters/filterAggregationEndpoint_emptyRequestBody_expectedResponse.json
@@ -0,0 +1 @@
+{"count":0} \ No newline at end of file
diff --git a/src/test/resources/filters/filterAggregationEndpoint_emptyRequestFilterArray_expectedResponse.json b/src/test/resources/filters/filterAggregationEndpoint_emptyRequestFilterArray_expectedResponse.json
new file mode 100644
index 0000000..36ae0a5
--- /dev/null
+++ b/src/test/resources/filters/filterAggregationEndpoint_emptyRequestFilterArray_expectedResponse.json
@@ -0,0 +1 @@
+{"groupby_aggregation":[{"totalChartHits":0,"buckets":[]}]} \ No newline at end of file
diff --git a/src/test/resources/filters/filterAggregationEndpoint_emptyRequestFilterArray_requestBody.json b/src/test/resources/filters/filterAggregationEndpoint_emptyRequestFilterArray_requestBody.json
new file mode 100644
index 0000000..ba7d987
--- /dev/null
+++ b/src/test/resources/filters/filterAggregationEndpoint_emptyRequestFilterArray_requestBody.json
@@ -0,0 +1,3 @@
+{
+ "filters": []
+} \ No newline at end of file
diff --git a/src/test/resources/filters/filterAggregationEndpoint_successPath_expectedResponse.json b/src/test/resources/filters/filterAggregationEndpoint_successPath_expectedResponse.json
new file mode 100644
index 0000000..e2c5766
--- /dev/null
+++ b/src/test/resources/filters/filterAggregationEndpoint_successPath_expectedResponse.json
@@ -0,0 +1 @@
+{"total":116,"aggregations":{"prov-status":[{"doc_count":77,"key":""},{"doc_count":2,"key":"PREPROV"}],"orchestration-status":[{"doc_count":116,"key":"Created"}]}}
diff --git a/src/test/resources/filters/filterAggregationEndpoint_successPath_operationResult.json b/src/test/resources/filters/filterAggregationEndpoint_successPath_operationResult.json
new file mode 100644
index 0000000..753a11f
--- /dev/null
+++ b/src/test/resources/filters/filterAggregationEndpoint_successPath_operationResult.json
@@ -0,0 +1 @@
+{"took":39,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":116,"max_score":0.0,"hits":[]},"aggregations":{"prov-status":{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[{"key":"","doc_count":77},{"key":"PREPROV","doc_count":2}]},"orchestration-status":{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[{"key":"Created","doc_count":116}]}}} \ No newline at end of file
diff --git a/src/test/resources/filters/filterAggregationEndpoint_successPath_requestBody.json b/src/test/resources/filters/filterAggregationEndpoint_successPath_requestBody.json
new file mode 100644
index 0000000..c321760
--- /dev/null
+++ b/src/test/resources/filters/filterAggregationEndpoint_successPath_requestBody.json
@@ -0,0 +1,11 @@
+{
+ "filters": [
+ {
+ "filterId": "1",
+ "filterValue": "Created"
+ },
+ {
+ "filterId": "2"
+ }
+ ]
+} \ No newline at end of file