summaryrefslogtreecommitdiffstats
path: root/src/test/java/org
diff options
context:
space:
mode:
authorrenealr <reneal.rogers@amdocs.com>2018-03-19 10:48:51 -0400
committerrenealr <reneal.rogers@amdocs.com>2018-03-19 14:23:00 -0400
commit3357aaeb4b8fb08e8ccf5fe65c539ea9bb41caf5 (patch)
tree6a4f7c40478b2758ceea21552e78d318c64bc3df /src/test/java/org
parente5da3da7d7e0430a8d8d5c7c4a031c3ba557e247 (diff)
enable suggestions to use search data service
Added logic to ensure that suggestions are enabled using the search data service Issue-ID: AAI-895 Change-Id: If0bc6a56a4700a0f96584048676ee1a15db63592 Signed-off-by: renealr <reneal.rogers@amdocs.com>
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/onap/aai/sparky/aggregatevnf/search/AggregateVnfSearchProviderTest.java62
-rw-r--r--src/test/java/org/onap/aai/sparky/search/SearchServiceAdapterTest.java1
2 files changed, 63 insertions, 0 deletions
diff --git a/src/test/java/org/onap/aai/sparky/aggregatevnf/search/AggregateVnfSearchProviderTest.java b/src/test/java/org/onap/aai/sparky/aggregatevnf/search/AggregateVnfSearchProviderTest.java
new file mode 100644
index 0000000..5a24edf
--- /dev/null
+++ b/src/test/java/org/onap/aai/sparky/aggregatevnf/search/AggregateVnfSearchProviderTest.java
@@ -0,0 +1,62 @@
+package org.onap.aai.sparky.aggregatevnf.search;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.aai.restclient.client.OperationResult;
+import org.onap.aai.restclient.client.RestClient;
+import org.onap.aai.restclient.enums.RestAuthenticationMode;
+import org.onap.aai.sparky.dal.rest.config.RestEndpointConfig;
+import org.onap.aai.sparky.search.SearchServiceAdapter;
+import org.onap.aai.sparky.search.entity.QuerySearchEntity;
+
+public class AggregateVnfSearchProviderTest {
+
+ private AggregateVnfSearchProvider aggregateVnfSearchProvider;
+ private RestEndpointConfig restEndpointConfig;
+ private SearchServiceAdapter searchserviceAdapter;
+ private QuerySearchEntity querySearchEntity;
+ private String successResponsePayload;
+ private OperationResult successResult = null;
+ private String goodDrTargetUrl = "https://0.0.0.0:9502/ui-request/servicegraph";
+
+ @Before
+ public void init() throws Exception {
+
+ restEndpointConfig = new RestEndpointConfig();
+ successResponsePayload = "good-payload";
+ successResult = new OperationResult(200, successResponsePayload);
+ restEndpointConfig.setRestAuthenticationMode(RestAuthenticationMode.SSL_BASIC);
+ searchserviceAdapter = Mockito.mock(SearchServiceAdapter.class);
+ aggregateVnfSearchProvider =
+ new AggregateVnfSearchProvider(searchserviceAdapter, "auto-suggest", "schema");
+ querySearchEntity = new QuerySearchEntity();
+
+ }
+
+ @Test
+ public void updateValues() {
+
+ assertNotNull(aggregateVnfSearchProvider.search(querySearchEntity));
+ aggregateVnfSearchProvider.setAutoSuggestIndexName("auto-suggest-index-1");
+
+ }
+
+ @Test
+ public void testProxyMessage_Success() {
+ Mockito.when(searchserviceAdapter.doPost(Mockito.eq(goodDrTargetUrl), Mockito.anyString(),
+ Mockito.eq(MediaType.APPLICATION_JSON_TYPE.toString()))).thenReturn(successResult);
+ }
+
+}
diff --git a/src/test/java/org/onap/aai/sparky/search/SearchServiceAdapterTest.java b/src/test/java/org/onap/aai/sparky/search/SearchServiceAdapterTest.java
index 7963528..90acfa4 100644
--- a/src/test/java/org/onap/aai/sparky/search/SearchServiceAdapterTest.java
+++ b/src/test/java/org/onap/aai/sparky/search/SearchServiceAdapterTest.java
@@ -40,6 +40,7 @@ public class SearchServiceAdapterTest {
assertNotNull(searchServiceAdapter.getTxnHeader());
assertNotNull(searchServiceAdapter.buildSearchServiceQueryUrl("searchentity-localhost"));
assertNotNull(searchServiceAdapter.buildSearchServiceUrlForApi("searchentity-localhost","2.0"));
+ assertNotNull(searchServiceAdapter.buildSuggestServiceQueryUrl("searchentity-localhost"));
}