summaryrefslogtreecommitdiffstats
path: root/src/test/java/org/openecomp/datarouter/policy/EntityEventPolicyStubbed.java
diff options
context:
space:
mode:
authorBansal, Nitin (nb121v) <nitin.bansal@amdocs.com>2017-09-05 10:31:47 -0400
committerBansal, Nitin (nb121v) <nitin.bansal@amdocs.com>2017-09-05 10:33:47 -0400
commit1e6752c966b48eb2351416691c96f9858c54f978 (patch)
treeb228a9671afec17a4e4680b4e56ba4804bd21d21 /src/test/java/org/openecomp/datarouter/policy/EntityEventPolicyStubbed.java
parent98d2d4fa91a9e9dc4a4444fe9aee0bf299de7d7b (diff)
Improve SONAR coverage in aai/data-router
Change-Id: I568a2eda367e29dbf013881bdf03aeef3312e319 Issue-ID: AAI-214 Signed-off-by: Bansal, Nitin (nb121v) <nitin.bansal@amdocs.com>
Diffstat (limited to 'src/test/java/org/openecomp/datarouter/policy/EntityEventPolicyStubbed.java')
-rw-r--r--src/test/java/org/openecomp/datarouter/policy/EntityEventPolicyStubbed.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/java/org/openecomp/datarouter/policy/EntityEventPolicyStubbed.java b/src/test/java/org/openecomp/datarouter/policy/EntityEventPolicyStubbed.java
new file mode 100644
index 0000000..cdc0fad
--- /dev/null
+++ b/src/test/java/org/openecomp/datarouter/policy/EntityEventPolicyStubbed.java
@@ -0,0 +1,34 @@
+package org.openecomp.datarouter.policy;
+
+import java.io.FileNotFoundException;
+
+import org.openecomp.datarouter.entity.DocumentStoreDataEntity;
+
+public class EntityEventPolicyStubbed extends EntityEventPolicy {
+
+
+ public EntityEventPolicyStubbed(EntityEventPolicyConfig 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) {
+ }
+ }
+}