Process VNF event from spike
[aai/data-router.git] / src / test / java / org / onap / aai / datarouter / policy / SpikeAggregateGenericVnfProcessorStubbed.java
diff --git a/src/test/java/org/onap/aai/datarouter/policy/SpikeAggregateGenericVnfProcessorStubbed.java b/src/test/java/org/onap/aai/datarouter/policy/SpikeAggregateGenericVnfProcessorStubbed.java
new file mode 100644 (file)
index 0000000..5bd35f6
--- /dev/null
@@ -0,0 +1,34 @@
+package org.onap.aai.datarouter.policy;
+
+import java.io.FileNotFoundException;
+
+import org.onap.aai.datarouter.entity.DocumentStoreDataEntity;
+
+public class SpikeAggregateGenericVnfProcessorStubbed extends SpikeAggregateGenericVnfProcessor {
+       
+
+       public SpikeAggregateGenericVnfProcessorStubbed(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) {
+               }
+       }
+}