aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/openecomp/datarouter/policy/EntityEventPolicyStubbed.java
blob: b36108f0497a36cb219790bef7fc3e138d302229 (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.openecomp.datarouter.policy;

import java.io.FileNotFoundException;

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

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) {
		}
	}
}