update sync queries to use searh data service
[aai/sparky-be.git] / sparkybe-onap-service / src / test / java / org / onap / aai / sparky / autosuggestion / sync / VnfAliasSuggestionSynchronizerTest.java
index 1a14256..e72b0df 100644 (file)
@@ -22,7 +22,7 @@ import org.onap.aai.sparky.config.oxm.OxmModelLoader;
 import org.onap.aai.sparky.config.oxm.OxmModelProcessor;
 import org.onap.aai.sparky.config.oxm.SuggestionEntityDescriptor;
 import org.onap.aai.sparky.dal.ActiveInventoryAdapter;
-import org.onap.aai.sparky.dal.ElasticSearchAdapter;
+import org.onap.aai.sparky.search.SearchServiceAdapter;
 import org.onap.aai.sparky.search.filters.config.FiltersConfig;
 import org.onap.aai.sparky.search.filters.config.FiltersDetailsConfig;
 import org.onap.aai.sparky.search.filters.config.FiltersForViewsConfig;
@@ -44,7 +44,7 @@ public class VnfAliasSuggestionSynchronizerTest {
   private NetworkStatisticsConfig esStatConfig;
   private OxmEntityLookup oxmEntityLookup;
   private GeoEntityLookup geoEntityLookup;
-  private ElasticSearchAdapter esAdapter;
+  private SearchServiceAdapter searchServiceAdapter;
   private ActiveInventoryAdapter aaiAdapter;
   private FiltersConfig filtersConfig;
 
@@ -120,7 +120,7 @@ public class VnfAliasSuggestionSynchronizerTest {
 
     oxmEntityLookup = new OxmEntityLookup();
 
-    esAdapter = Mockito.mock(ElasticSearchAdapter.class);
+    searchServiceAdapter = Mockito.mock(SearchServiceAdapter.class);
     aaiAdapter = Mockito.mock(ActiveInventoryAdapter.class);
 
 
@@ -186,10 +186,10 @@ public class VnfAliasSuggestionSynchronizerTest {
         aaiStatConfig, esStatConfig, filtersConfig);
 
     vnfAliasSuggestionSynchronizer.setAaiAdapter(aaiAdapter);
-    vnfAliasSuggestionSynchronizer.setElasticSearchAdapter(esAdapter);
+    vnfAliasSuggestionSynchronizer.setSearchServiceAdapter(searchServiceAdapter);
 
     assertNotNull(vnfAliasSuggestionSynchronizer.getAaiAdapter());
-    assertNotNull(vnfAliasSuggestionSynchronizer.getElasticSearchAdapter());
+    assertNotNull(vnfAliasSuggestionSynchronizer.getSearchServiceAdapter());
 
   }
 
@@ -201,7 +201,7 @@ public class VnfAliasSuggestionSynchronizerTest {
 
 
     vnfAliasSuggestionSynchronizer.setAaiAdapter(aaiAdapter);
-    vnfAliasSuggestionSynchronizer.setElasticSearchAdapter(esAdapter);
+    vnfAliasSuggestionSynchronizer.setSearchServiceAdapter(searchServiceAdapter);
 
     String nodesQueryResponse = TestResourceLoader
         .getTestResourceDataJson("/sync/aai/activeInventory_generic-vnf_nodesQuery_response.json");
@@ -244,7 +244,7 @@ public class VnfAliasSuggestionSynchronizerTest {
         .thenReturn(new OperationResult(200, TestResourceLoader
             .getTestResourceDataJson("/sync/aai/generic-vnf-generic-vnf-3_full_depth.json")));
 
-    Mockito.when(esAdapter.buildElasticSearchGetDocUrl(Mockito.anyString(), Mockito.anyString()))
+    Mockito.when(searchServiceAdapter.buildSearchServiceDocUrl(Mockito.anyString(), Mockito.anyString()))
         .thenReturn("http://server.proxy:9200/myindex/mytype/doc1",
             "http://server.proxy:9200/myindex/mytype/doc2",
             "http://server.proxy:9200/myindex/mytype/doc3");
@@ -252,15 +252,15 @@ public class VnfAliasSuggestionSynchronizerTest {
     /*
      * Our initial gets from elastic search should be record-not-found
      */
-    Mockito.when(esAdapter.doGet(Matchers.contains("doc1"), Mockito.any()))
+    Mockito.when(searchServiceAdapter.doGet(Matchers.contains("doc1"), Mockito.any()))
         .thenReturn(new OperationResult(404, null));
-    Mockito.when(esAdapter.doGet(Matchers.contains("doc2"), Mockito.any()))
+    Mockito.when(searchServiceAdapter.doGet(Matchers.contains("doc2"), Mockito.any()))
         .thenReturn(new OperationResult(404, null));
-    Mockito.when(esAdapter.doGet(Matchers.contains("doc3"), Mockito.any()))
+    Mockito.when(searchServiceAdapter.doGet(Matchers.contains("doc3"), Mockito.any()))
         .thenReturn(new OperationResult(404, null));
 
 
-    Mockito.when(esAdapter.doPut(Matchers.contains("doc"), Mockito.any(), Mockito.any()))
+    Mockito.when(searchServiceAdapter.doPut(Matchers.contains("doc"), Mockito.any(), Mockito.any()))
         .thenReturn(new OperationResult(200, null));
 
     OperationState syncState = vnfAliasSuggestionSynchronizer.doSync();
@@ -283,7 +283,7 @@ public class VnfAliasSuggestionSynchronizerTest {
 
 
     vnfAliasSuggestionSynchronizer.setAaiAdapter(aaiAdapter);
-    vnfAliasSuggestionSynchronizer.setElasticSearchAdapter(esAdapter);
+    vnfAliasSuggestionSynchronizer.setSearchServiceAdapter(searchServiceAdapter);
 
     String nodesQueryResponse = TestResourceLoader
         .getTestResourceDataJson("/sync/aai/activeInventory_generic-vnf_nodesQuery_response.json");
@@ -326,7 +326,7 @@ public class VnfAliasSuggestionSynchronizerTest {
         .thenReturn(new OperationResult(200, TestResourceLoader
             .getTestResourceDataJson("/sync/aai/generic-vnf-generic-vnf-3_full_depth.json")));
 
-    Mockito.when(esAdapter.buildElasticSearchGetDocUrl(Mockito.anyString(), Mockito.anyString()))
+    Mockito.when(searchServiceAdapter.buildSearchServiceDocUrl(Mockito.anyString(), Mockito.anyString()))
         .thenReturn("http://server.proxy:9200/myindex/mytype/doc1",
             "http://server.proxy:9200/myindex/mytype/doc2",
             "http://server.proxy:9200/myindex/mytype/doc3");
@@ -334,11 +334,11 @@ public class VnfAliasSuggestionSynchronizerTest {
     /*
      * Our initial gets from elastic search should be record-not-found
      */
-    Mockito.when(esAdapter.doGet(Matchers.contains("doc1"), Mockito.any()))
+    Mockito.when(searchServiceAdapter.doGet(Matchers.contains("doc1"), Mockito.any()))
         .thenReturn(new OperationResult(404, null));
-    Mockito.when(esAdapter.doGet(Matchers.contains("doc2"), Mockito.any()))
+    Mockito.when(searchServiceAdapter.doGet(Matchers.contains("doc2"), Mockito.any()))
         .thenReturn(new OperationResult(404, null));
-    Mockito.when(esAdapter.doGet(Matchers.contains("doc3"), Mockito.any()))
+    Mockito.when(searchServiceAdapter.doGet(Matchers.contains("doc3"), Mockito.any()))
         .thenReturn(new OperationResult(404, null));
 
 
@@ -346,7 +346,7 @@ public class VnfAliasSuggestionSynchronizerTest {
      * Elastic Search puts always fail with a version conflict = 409
      */
 
-    Mockito.when(esAdapter.doPut(Matchers.contains("doc"), Mockito.any(), Mockito.any()))
+    Mockito.when(searchServiceAdapter.doPut(Matchers.contains("doc"), Mockito.any(), Mockito.any()))
         .thenReturn(new OperationResult(409, null));
 
     OperationState syncState = vnfAliasSuggestionSynchronizer.doSync();