summaryrefslogtreecommitdiffstats
path: root/src/test/java/org
diff options
context:
space:
mode:
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"));
}