Removing AJSC and moving to SpringBoot
[aai/search-data-service.git] / src / test / java / org / onap / aai / sa / rest / StubEsController.java
index 5d11791..fe72090 100644 (file)
@@ -2,8 +2,8 @@
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,8 +17,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
  */
 package org.onap.aai.sa.rest;
 
@@ -75,6 +73,15 @@ public class StubEsController implements DocumentStoreInterface {
     return opResult;
   }
 
+  @Override
+  public OperationResult createDynamicIndex(String index, String dynamicSchema) {
+    OperationResult opResult = new OperationResult();
+    opResult.setResultCode(200);
+    // Directly return the json as this flow should not edit the json in any way
+    opResult.setResult(dynamicSchema);
+    return opResult;
+  }
+
 
   @Override
   public OperationResult deleteIndex(String indexName) throws DocumentStoreOperationException {
@@ -147,9 +154,11 @@ public class StubEsController implements DocumentStoreInterface {
       if (opResult.getDocument() != null) {
         opResult.getDocument().setEtag(null);
         opResult.getDocument().setUrl(null);
+        opResult.setResultVersion("1");
       }
       opResult.setResultCode(200);
       opResult.setResult(indexName + "@" + document.getId());
+      opResult.setResultVersion("1");
     }
 
     return opResult;
@@ -162,8 +171,12 @@ public class StubEsController implements DocumentStoreInterface {
 
     if (indexName.equals(DOES_NOT_EXIST_INDEX)) {
       opResult.setResultCode(404);
+      // Adding it to make the tests pass.
+      opResult.setResultVersion ("1");
     } else {
       opResult.setResultCode(200);
+      // Adding it to make the tests pass.
+      opResult.setResultVersion ("1");
     }
 
     return opResult;
@@ -200,6 +213,21 @@ public class StubEsController implements DocumentStoreInterface {
     return opResult;
   }
 
+  @Override
+  public SearchOperationResult suggestionQueryWithPayload(String indexName, String query)
+          throws DocumentStoreOperationException {
+    SearchOperationResult opResult = new SearchOperationResult();
+
+    if (indexName.equals(DOES_NOT_EXIST_INDEX)) {
+      opResult.setResultCode(404);
+    } else {
+      opResult.setResultCode(200);
+      opResult.setResult(indexName + "@" + query);
+    }
+
+    return opResult;
+  }
+
   @Override
   public OperationResult performBulkOperations(BulkRequest[] requests) throws DocumentStoreOperationException {