X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Forg%2Fopenecomp%2Fdatarouter%2Fpolicy%2FEntityEventPolicyStubbed.java;fp=src%2Ftest%2Fjava%2Forg%2Fopenecomp%2Fdatarouter%2Fpolicy%2FEntityEventPolicyStubbed.java;h=cdc0fadd842225a3115d96a23f3edb8bce23ca8c;hb=1e6752c966b48eb2351416691c96f9858c54f978;hp=0000000000000000000000000000000000000000;hpb=98d2d4fa91a9e9dc4a4444fe9aee0bf299de7d7b;p=aai%2Fdata-router.git 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) { + } + } +}