diff options
author | Steven Blimkie <Steven.Blimkie@amdocs.com> | 2018-03-20 15:17:16 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-03-20 15:17:16 +0000 |
commit | 1f928a54df22e2efa1c135a9d16ccb278caccd31 (patch) | |
tree | 2d44f2311d6166502191e6fb7219b3ef0a5fd0d0 /src/test | |
parent | b6cf54a6092ea2666c990fe552a569fce16511e7 (diff) | |
parent | 3357aaeb4b8fb08e8ccf5fe65c539ea9bb41caf5 (diff) |
Merge "enable suggestions to use search data service"
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/onap/aai/sparky/aggregatevnf/search/AggregateVnfSearchProviderTest.java | 62 | ||||
-rw-r--r-- | src/test/java/org/onap/aai/sparky/search/SearchServiceAdapterTest.java | 1 |
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")); } |