aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpControllerTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpControllerTest.java')
-rw-r--r--src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpControllerTest.java35
1 files changed, 15 insertions, 20 deletions
diff --git a/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpControllerTest.java b/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpControllerTest.java
index 10e7d2c..e68534c 100644
--- a/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpControllerTest.java
+++ b/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpControllerTest.java
@@ -27,9 +27,6 @@ import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.onap.aai.sa.searchdbabstraction.elasticsearch.config.ElasticSearchConfig;
-import org.onap.aai.sa.searchdbabstraction.elasticsearch.dao.DocumentStoreDataEntity;
-import org.onap.aai.sa.searchdbabstraction.elasticsearch.dao.DocumentStoreDataEntityImpl;
-import org.onap.aai.sa.searchdbabstraction.elasticsearch.dao.ElasticSearchHttpController;
import org.onap.aai.sa.searchdbabstraction.entity.OperationResult;
import java.util.Properties;
@@ -40,16 +37,15 @@ public class ElasticSearchHttpControllerTest {
private static ElasticSearchHttpController elasticSearch;
private static AAIEntityTestObject testDocument;
- private static final String indexMappings =
- "{\r\n \"properties\": {\r\n \"entityType\": {\r\n \"type\": \"string\"\r\n },\r\n \"edgeTagQueryEntityFieldName\": {\r\n \"type\": \"string\",\r\n \"index\": \"no\"\r\n },\r\n \"edgeTagQueryEntityFieldValue\": {\r\n \"type\": \"string\",\r\n \"index\": \"no\"\r\n },\r\n \"searchTagIDs\" : {\r\n \"type\" : \"string\"\r\n },\r\n \"searchTags\": {\r\n \"type\": \"string\",\r\n \"analyzer\": \"nGram_analyzer\",\r\n \"search_analyzer\": \"whitespace_analyzer\"\r\n }\r\n }\r\n}";
- private static final String indexSettings =
- "{\r\n \"analysis\": {\r\n \"filter\": {\r\n \"nGram_filter\": {\r\n \"type\": \"nGram\",\r\n \"min_gram\": 1,\r\n \"max_gram\": 50,\r\n \"token_chars\": [\r\n \"letter\",\r\n \"digit\",\r\n \"punctuation\",\r\n \"symbol\"\r\n ]\r\n }\r\n },\r\n \"analyzer\": {\r\n \"nGram_analyzer\": {\r\n \"type\": \"custom\",\r\n \"tokenizer\": \"whitespace\",\r\n \"filter\": [\r\n \"lowercase\",\r\n \"asciifolding\",\r\n \"nGram_filter\"\r\n ]\r\n },\r\n \"whitespace_analyzer\": {\r\n \"type\": \"custom\",\r\n \"tokenizer\": \"whitespace\",\r\n \"filter\": [\r\n \"lowercase\",\r\n \"asciifolding\"\r\n ]\r\n }\r\n }\r\n }\r\n}";
+ private static final String indexMappings = "{\r\n \"properties\": {\r\n \"entityType\": {\r\n \"type\": \"string\"\r\n },\r\n \"edgeTagQueryEntityFieldName\": {\r\n \"type\": \"string\",\r\n \"index\": \"no\"\r\n },\r\n \"edgeTagQueryEntityFieldValue\": {\r\n \"type\": \"string\",\r\n \"index\": \"no\"\r\n },\r\n \"searchTagIDs\" : {\r\n \"type\" : \"string\"\r\n },\r\n \"searchTags\": {\r\n \"type\": \"string\",\r\n \"analyzer\": \"nGram_analyzer\",\r\n \"search_analyzer\": \"whitespace_analyzer\"\r\n }\r\n }\r\n}";
+ private static final String indexSettings = "{\r\n \"analysis\": {\r\n \"filter\": {\r\n \"nGram_filter\": {\r\n \"type\": \"nGram\",\r\n \"min_gram\": 1,\r\n \"max_gram\": 50,\r\n \"token_chars\": [\r\n \"letter\",\r\n \"digit\",\r\n \"punctuation\",\r\n \"symbol\"\r\n ]\r\n }\r\n },\r\n \"analyzer\": {\r\n \"nGram_analyzer\": {\r\n \"type\": \"custom\",\r\n \"tokenizer\": \"whitespace\",\r\n \"filter\": [\r\n \"lowercase\",\r\n \"asciifolding\",\r\n \"nGram_filter\"\r\n ]\r\n },\r\n \"whitespace_analyzer\": {\r\n \"type\": \"custom\",\r\n \"tokenizer\": \"whitespace\",\r\n \"filter\": [\r\n \"lowercase\",\r\n \"asciifolding\"\r\n ]\r\n }\r\n }\r\n }\r\n}";
@Before
public void setUp() throws Exception {
Properties properties = new Properties();
properties.put(ElasticSearchConfig.ES_IP_ADDRESS, "127.0.0.1");
properties.put(ElasticSearchConfig.ES_HTTP_PORT, "9200");
+// ElasticSearchConfig config = new ElasticSearchConfig(properties);
ElasticSearchConfig config = new ElasticSearchConfig(properties);
elasticSearch = new ElasticSearchHttpController(config);
@@ -62,15 +58,19 @@ public class ElasticSearchHttpControllerTest {
testDocument.setSearchTags("service-instance-id");
}
-
+//
@Test
public void testCreateTable() throws Exception {
- OperationResult result =
- elasticSearch.createTable("test", "aai-entities", indexSettings, indexMappings);
+ OperationResult result = elasticSearch.createTable("test", "aai-entities", indexSettings, indexMappings);
System.out.println(result);
}
@Test
+ public void testsuggestionQueryWithPayload() throws Exception {
+ Assert.assertNotNull(elasticSearch.suggestionQueryWithPayload("autoSuggest", "suggest-index"));
+ }
+//
+ @Test
public void testCreateDocument() throws Exception {
OperationResult result = elasticSearch.createDocument("test", testDocument, false);
System.out.println(result);
@@ -150,18 +150,11 @@ public class ElasticSearchHttpControllerTest {
}
@Test
- public void testsuggestionQueryWithPayload() throws Exception {
-
- Assert.assertNotNull(elasticSearch.suggestionQueryWithPayload("autoSuggest", "suggest-index"));
-
- }
-
- @Test
public void testDeleteIndex() throws Exception {
OperationResult result = elasticSearch.deleteIndex("test");
System.out.println(result);
}
-
+//
class AAIEntityTestObject implements DocumentStoreDataEntity {
private String id;
private String entityType;
@@ -227,10 +220,12 @@ public class ElasticSearchHttpControllerTest {
@Override
public String getContentInJson() {
try {
- return new JSONObject().put("entityType", entityType)
+ return new JSONObject()
+ .put("entityType", entityType)
.put("edgeTagQueryEntityFieldName", edgeTagQueryEntityFieldName)
.put("edgeTagQueryEntityFieldValue", edgeTagQueryEntityFieldValue)
- .put("searchTagIDs", searchTagIDs).put("searchTags", searchTags).toString();
+ .put("searchTagIDs", searchTagIDs)
+ .put("searchTags", searchTags).toString();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();