5bd35f6056886224654205bcff567eeff58511f3
[aai/data-router.git] / src / test / java / org / onap / aai / datarouter / policy / SpikeAggregateGenericVnfProcessorStubbed.java
1 package org.onap.aai.datarouter.policy;
2
3 import java.io.FileNotFoundException;
4
5 import org.onap.aai.datarouter.entity.DocumentStoreDataEntity;
6
7 public class SpikeAggregateGenericVnfProcessorStubbed extends SpikeAggregateGenericVnfProcessor {
8         
9
10         public SpikeAggregateGenericVnfProcessorStubbed(SpikeEventPolicyConfig 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 }