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