summaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessorStubbed.java
diff options
context:
space:
mode:
authorrv871f <richard.vondadelszen@amdocs.com>2018-03-20 10:21:42 -0400
committerrv871f <richard.vondadelszen@amdocs.com>2018-03-20 11:03:34 -0400
commitbf99eb77b31a4cfbc590762cc6ba669820c21439 (patch)
tree6251d665e64a09eb98e79540967dff832f4226b4 /src/test/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessorStubbed.java
parent1aae9de4d596a1108818c2d035225a3ba2737501 (diff)
Process VNF event from spike
Issue-ID: AAI-899 Change-Id: I2d056734e6af0fe0b4efe92681971e2b74153a0e Signed-off-by: rv871f <richard.vondadelszen@amdocs.com>
Diffstat (limited to 'src/test/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessorStubbed.java')
-rw-r--r--src/test/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessorStubbed.java54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/test/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessorStubbed.java b/src/test/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessorStubbed.java
new file mode 100644
index 0000000..100ff0a
--- /dev/null
+++ b/src/test/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessorStubbed.java
@@ -0,0 +1,54 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.aai.datarouter.policy;
+
+import java.io.FileNotFoundException;
+
+import org.onap.aai.datarouter.entity.DocumentStoreDataEntity;
+
+public class SpikeEntitySearchProcessorStubbed extends SpikeEntitySearchProcessor {
+
+
+ public SpikeEntitySearchProcessorStubbed(SpikeEventPolicyConfig config) throws FileNotFoundException {
+ super(config);
+
+ }
+
+ protected void handleSearchServiceOperation(DocumentStoreDataEntity eventEntity, String action, String index) {
+ //Stub out the actual call to Search Data service and instead store/update documents in memory
+ try {
+ switch (action.toLowerCase()) {
+ case "create":
+ InMemorySearchDatastore.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if variable == c1
+ break;
+ case "update":
+ InMemorySearchDatastore.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if variable == c1
+ break;
+ case "delete":
+ InMemorySearchDatastore.remove(eventEntity.getId()); // they are executed if variable == c1
+ break;
+ default:
+ break;
+ }
+ } catch (Exception ex) {
+ }
+ }
+}