aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/openecomp/datarouter/entity
diff options
context:
space:
mode:
authorrenealr <reneal.rogers@amdocs.com>2018-06-19 10:50:41 -0400
committerrenealr <reneal.rogers@amdocs.com>2018-06-19 11:40:30 -0400
commitaec897fe708e37b6a58f2aff04be5de14eabd403 (patch)
tree37cb605fa01acc2140bf79b8226da00448fe03c9 /src/test/java/org/openecomp/datarouter/entity
parentf518411876d6830d83d051a915f0b21bdfdcb43e (diff)
add the gap event transformer
add the gap event transformer and add stub data for test cases Issue-ID: AAI-1230 Change-Id: I95f6f050ca4d2d7ea3a288e05f69c6be66a9222b Signed-off-by: renealr <reneal.rogers@amdocs.com>
Diffstat (limited to 'src/test/java/org/openecomp/datarouter/entity')
-rw-r--r--src/test/java/org/openecomp/datarouter/entity/SuggestionSearchEntityTest.java155
1 files changed, 0 insertions, 155 deletions
diff --git a/src/test/java/org/openecomp/datarouter/entity/SuggestionSearchEntityTest.java b/src/test/java/org/openecomp/datarouter/entity/SuggestionSearchEntityTest.java
deleted file mode 100644
index 4d48e83..0000000
--- a/src/test/java/org/openecomp/datarouter/entity/SuggestionSearchEntityTest.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.datarouter.entity;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Scanner;
-
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.onap.aai.datarouter.entity.SuggestionSearchEntity;
-import org.onap.aai.datarouter.search.filters.config.UiFiltersSchemaUtility;
-
-public class SuggestionSearchEntityTest {
- private static SuggestionSearchEntity suggestionSearchEntity;
-
- @Before
- public void setUpBeforeTest() {
- UiFiltersSchemaUtility filtersSchemaUtility = Mockito.mock(UiFiltersSchemaUtility.class);
- Mockito.when(filtersSchemaUtility.loadUiFiltersConfig()).thenReturn(null);
-
- suggestionSearchEntity = new SuggestionSearchEntity();
- suggestionSearchEntity.setFiltersSchemaUtility(filtersSchemaUtility);
- suggestionSearchEntity.setEntityType("generic-vnf");
- suggestionSearchEntity.setEntityTypeAliases(Arrays.asList("VNFs"));
- }
-
- /**
- * Read in the contents of the given file (can include sub-path) in test/resources folder
- *
- * @param filePath The file name or path (relative to test/resources) to read from
- * @return The contents of the file as a String
- */
- public String getResourceFileContents(String filePath) {
- StringBuilder result = new StringBuilder("");
-
- ClassLoader classLoader = getClass().getClassLoader();
- File file = new File(classLoader.getResource(filePath).getFile());
-
- try (Scanner scanner = new Scanner(file)) {
- while (scanner.hasNextLine()) {
- String line = scanner.nextLine();
- result.append(line).append("\n");
- }
-
- scanner.close();
-
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- return result.toString();
- }
-
- @Test
- public void testGetAsJson_multipleFilterAttributableStatusesIncluded() throws IOException {
- String expectedOutput =
- getResourceFileContents("uifilters/testGetAsJson_multipleFilterAttributableStatusesIncluded_expectedValue.json");
-
- List<String> suggestionInputPermutations = Arrays.asList(
- "provStatus1 orchestrationStatus1 generic-vnf",
- "provStatus1 generic-vnf orchestrationStatus1",
- "orchestrationStatus1 generic-vnf provStatus1",
- "orchestrationStatus1 provStatus1 generic-vnf",
- "generic-vnf provStatus1 orchestrationStatus1",
- "generic-vnf orchestrationStatus1 provStatus1");
-
- Map<String, String>inputOutputData = new HashMap<>();
- inputOutputData.put("prov-status", "provStatus1");
- inputOutputData.put("orchestration-status", "orchestrationStatus1");
-
- // Build UI filters JSON string
- JSONObject payloadFilter1 = new JSONObject();
- payloadFilter1.put("filterId", "1");
- payloadFilter1.put("filterValue", "orchestrationStatus1");
-
- JSONObject payloadFilter2 = new JSONObject();
- payloadFilter2.put("filterId", "2");
- payloadFilter2.put("filterValue", "provStatus1");
-
- JSONArray payloadFilters = new JSONArray();
- payloadFilters.put(payloadFilter2);
- payloadFilters.put(payloadFilter1);
-
- JSONObject filterPayload = new JSONObject();
- filterPayload.put("filterList", payloadFilters);
-
- suggestionSearchEntity.setSuggestionInputPermutations(suggestionInputPermutations);
- suggestionSearchEntity.setInputOutputData(inputOutputData);
- suggestionSearchEntity.setFilterPayload(filterPayload);
-
- String actualOutput = suggestionSearchEntity.getAsJson();
-
- assertEquals(expectedOutput.trim(), actualOutput.trim());
- }
-
- @Test
- public void testGetAsJson_singleFilterAttributableStatusIncluded() throws IOException {
- String expectedOutput =
- getResourceFileContents("uifilters/testGetAsJson_singleFilterAttributableStatusIncluded_expectedValue.json");
-
- List<String> suggestionInputPermutations = Arrays.asList(
- "provStatus1 generic-vnf",
- "generic-vnf provStatus1");
-
- Map<String, String>inputOutputData = new HashMap<>();
- inputOutputData.put("prov-status", "provStatus1");
-
- // Build UI filters JSON string
- JSONObject payloadFilter1 = new JSONObject();
- payloadFilter1.put("filterId", "2");
- payloadFilter1.put("filterValue", "provStatus1");
-
- JSONArray payloadFilters = new JSONArray();
- payloadFilters.put(payloadFilter1);
-
- JSONObject filterPayload = new JSONObject();
- filterPayload.put("filterList", payloadFilters);
-
- suggestionSearchEntity.setSuggestionInputPermutations(suggestionInputPermutations);
- suggestionSearchEntity.setInputOutputData(inputOutputData);
- suggestionSearchEntity.setFilterPayload(filterPayload);
-
- String actualOutput = suggestionSearchEntity.getAsJson();
-
- assertEquals(expectedOutput.trim(), actualOutput.trim());
- }
-}