Renaming openecomp to onap
[aai/data-router.git] / src / test / java / org / onap / aai / datarouter / policy / EntityEventPolicyStubbed.java
1 package org.onap.aai.datarouter.policy;
2
3 import java.io.FileNotFoundException;
4
5 import org.onap.aai.datarouter.entity.DocumentStoreDataEntity;
6 import org.onap.aai.datarouter.policy.EntityEventPolicy;
7 import org.onap.aai.datarouter.policy.EntityEventPolicyConfig;
8
9 public class EntityEventPolicyStubbed extends EntityEventPolicy {
10         
11
12         public EntityEventPolicyStubbed(EntityEventPolicyConfig config) throws FileNotFoundException {
13                 super(config);
14                 
15         }
16
17         protected void handleSearchServiceOperation(DocumentStoreDataEntity eventEntity, String action, String index) {
18                 //Stub out the actual call to Search Data service and instead store/update documents in memory
19                 try {
20                         switch (action.toLowerCase()) {
21                         case "create":
22                                 InMemorySearchDatastore.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if variable == c1
23                                 break;
24                         case "update":
25                                 InMemorySearchDatastore.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if variable == c1
26                                 break;
27                         case "delete":
28                                 InMemorySearchDatastore.remove(eventEntity.getId()); // they are executed if variable == c1
29                                 break;
30                         default:
31                                 break;
32                         }
33                 } catch (Exception ex) {
34                 }
35         }
36 }