import org.onap.aai.sparky.config.oxm.SuggestionEntityDescriptor;
import org.onap.aai.sparky.config.oxm.SuggestionEntityLookup;
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;
private NetworkStatisticsConfig esStatConfig;
- private ElasticSearchAdapter esAdapter;
+ private SearchServiceAdapter searchServiceAdapter;
private ActiveInventoryAdapter aaiAdapter;
@Inject
- esAdapter = Mockito.mock(ElasticSearchAdapter.class);
+ searchServiceAdapter = Mockito.mock(SearchServiceAdapter.class);
aaiAdapter = Mockito.mock(ActiveInventoryAdapter.class);
esStatConfig, oxmEntityLookup, suggestionEntityLookup, filtersConfig);
suggestionSynchronizer.setAaiAdapter(aaiAdapter);
- suggestionSynchronizer.setElasticSearchAdapter(esAdapter);
+ suggestionSynchronizer.setSearchServiceAdapter(searchServiceAdapter);
assertNotNull(suggestionSynchronizer.getAaiAdapter());
- assertNotNull(suggestionSynchronizer.getElasticSearchAdapter());
+ assertNotNull(suggestionSynchronizer.getSearchServiceAdapter());
}
suggestionSynchronizer.setAaiAdapter(aaiAdapter);
- suggestionSynchronizer.setElasticSearchAdapter(esAdapter);
+ suggestionSynchronizer.setSearchServiceAdapter(searchServiceAdapter);
String nodesQueryResponse = TestResourceLoader
.getTestResourceDataJson("/sync/aai/activeInventory_generic-vnf_nodesQuery_response.json");
.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");
/*
* 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 = suggestionSynchronizer.doSync();
suggestionSynchronizer.setAaiAdapter(aaiAdapter);
- suggestionSynchronizer.setElasticSearchAdapter(esAdapter);
+ suggestionSynchronizer.setSearchServiceAdapter(searchServiceAdapter);
String nodesQueryResponse = TestResourceLoader
.getTestResourceDataJson("/sync/aai/activeInventory_generic-vnf_nodesQuery_response.json");
.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");
/*
* 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));
* 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 = suggestionSynchronizer.doSync();