aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorFraboni, Gino (gf403a) <gino.fraboni@amdocs.com>2017-07-20 13:35:06 -0400
committergfraboni <gino.fraboni@amdocs.com>2017-07-20 13:36:12 -0400
commit629c4dc6e90840f164af0091eb00c4bcf4033f83 (patch)
tree5ebf43f889dd95c0fc7eb7d91552f4790bec8b75 /src/test
parent895cd72a962de1868151288d4df1510db5280fab (diff)
Reject doc create requests if index does not exist
[AAI-62] Search Data Service should not implicitly create indexes on document write... Search Data Service will now explicitly block a document create or update if the associated index does not already exist in the document store. Change-Id: Ie96364da754aa6a2cb554b06f62a7a647181bcce Signed-off-by: gfraboni <gino.fraboni@amdocs.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/openecomp/sa/rest/StubEsController.java17
-rw-r--r--src/test/java/org/openecomp/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpControllerTest.java8
2 files changed, 16 insertions, 9 deletions
diff --git a/src/test/java/org/openecomp/sa/rest/StubEsController.java b/src/test/java/org/openecomp/sa/rest/StubEsController.java
index f3e5619..8f8a06f 100644
--- a/src/test/java/org/openecomp/sa/rest/StubEsController.java
+++ b/src/test/java/org/openecomp/sa/rest/StubEsController.java
@@ -60,7 +60,8 @@ public class StubEsController implements DocumentStoreInterface {
@Override
- public OperationResult createIndex(String index, DocumentSchema documentSchema) {
+ public OperationResult createIndex(String index,
+ DocumentSchema documentSchema) {
// Just return an OK result, with the parameters that we were passed
// bundled in the response string. This allows unit tests to validate
@@ -91,8 +92,11 @@ public class StubEsController implements DocumentStoreInterface {
}
@Override
- public DocumentOperationResult createDocument(String indexName,
- DocumentStoreDataEntity document) throws DocumentStoreOperationException {
+ public DocumentOperationResult createDocument(String indexName,
+ DocumentStoreDataEntity document,
+ boolean allowImplicitIndexCreation)
+ throws DocumentStoreOperationException {
+
DocumentOperationResult opResult = buildSampleDocumentOperationResult();
if (indexName.equals(DOES_NOT_EXIST_INDEX)) {
@@ -110,8 +114,11 @@ public class StubEsController implements DocumentStoreInterface {
}
@Override
- public DocumentOperationResult updateDocument(String indexName,
- DocumentStoreDataEntity document) throws DocumentStoreOperationException {
+ public DocumentOperationResult updateDocument(String indexName,
+ DocumentStoreDataEntity document,
+ boolean allowImplicitIndexCreation)
+ throws DocumentStoreOperationException {
+
DocumentOperationResult opResult = buildSampleDocumentOperationResult();
if (indexName.equals(DOES_NOT_EXIST_INDEX)) {
diff --git a/src/test/java/org/openecomp/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpControllerTest.java b/src/test/java/org/openecomp/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpControllerTest.java
index 2439f48..f8c6f7f 100644
--- a/src/test/java/org/openecomp/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpControllerTest.java
+++ b/src/test/java/org/openecomp/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpControllerTest.java
@@ -69,7 +69,7 @@ public class ElasticSearchHttpControllerTest {
@Test
public void testCreateDocument() throws Exception {
- OperationResult result = elasticSearch.createDocument("test", testDocument);
+ OperationResult result = elasticSearch.createDocument("test", testDocument, false);
System.out.println(result);
DocumentStoreDataEntityImpl ds = new DocumentStoreDataEntityImpl();
@@ -83,7 +83,7 @@ public class ElasticSearchHttpControllerTest {
public void testUpdateDocument() throws Exception {
testDocument.setEdgeTagQueryEntityFieldValue("567890");
- OperationResult result = elasticSearch.updateDocument("test", testDocument);
+ OperationResult result = elasticSearch.updateDocument("test", testDocument, false);
System.out.println(result);
result = elasticSearch.getDocument("test", testDocument);
@@ -110,7 +110,7 @@ public class ElasticSearchHttpControllerTest {
doc.setSearchTagIDs("" + i);
doc.setSearchTags("service-instance-id");
- OperationResult result = elasticSearch.createDocument("test", doc);
+ OperationResult result = elasticSearch.createDocument("test", doc, false);
System.out.println(result);
}
}
@@ -142,7 +142,7 @@ public class ElasticSearchHttpControllerTest {
doc.setSearchTagIDs("321");
doc.setSearchTags("service-instance-id");
- OperationResult result = elasticSearch.createDocument("test", doc);
+ OperationResult result = elasticSearch.createDocument("test", doc, false);
System.out.println(result);
}