aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/aai/datarouter/policy/SpikeAggregateGenericVnfProcessorStubbed.java
blob: 5bd35f6056886224654205bcff567eeff58511f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package org.onap.aai.datarouter.policy;

import java.io.FileNotFoundException;

import org.onap.aai.datarouter.entity.DocumentStoreDataEntity;

public class SpikeAggregateGenericVnfProcessorStubbed extends SpikeAggregateGenericVnfProcessor {
	

	public SpikeAggregateGenericVnfProcessorStubbed(SpikeEventPolicyConfig 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) {
		}
	}
}