X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Forg%2Fonap%2Faai%2Fdatarouter%2Fpolicy%2FEntityEventPolicyStubbed.java;fp=src%2Ftest%2Fjava%2Forg%2Fonap%2Faai%2Fdatarouter%2Fpolicy%2FEntityEventPolicyStubbed.java;h=3ca17f3469fb749c7cdaae4692b26267ec5a5160;hb=2a5ff133471c5a69b0dfd760d2743f48112da9a0;hp=0000000000000000000000000000000000000000;hpb=e6be129e4865104321cdd6313f9729c4e7b07d22;p=aai%2Fdata-router.git diff --git a/src/test/java/org/onap/aai/datarouter/policy/EntityEventPolicyStubbed.java b/src/test/java/org/onap/aai/datarouter/policy/EntityEventPolicyStubbed.java new file mode 100644 index 0000000..3ca17f3 --- /dev/null +++ b/src/test/java/org/onap/aai/datarouter/policy/EntityEventPolicyStubbed.java @@ -0,0 +1,36 @@ +package org.onap.aai.datarouter.policy; + +import java.io.FileNotFoundException; + +import org.onap.aai.datarouter.entity.DocumentStoreDataEntity; +import org.onap.aai.datarouter.policy.EntityEventPolicy; +import org.onap.aai.datarouter.policy.EntityEventPolicyConfig; + +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) { + } + } +}