3f5988f32f78dee447b6606f0d7ae100240aa7ed
[aai/sparky-be.git] / src / test / java / org / onap / aai / sparky / viewandinspect / VisualizationTransformerTest.java
1 package org.onap.aai.sparky.viewandinspect;
2
3 import java.io.IOException;
4 import java.util.HashMap;
5 import java.util.Map;
6
7 import org.junit.Before;
8 import org.junit.Test;
9 import org.onap.aai.sparky.config.oxm.OxmEntityLookup;
10 import org.onap.aai.sparky.subscription.config.SubscriptionConfig;
11 import org.onap.aai.sparky.util.OxmModelAndProcessorHelper;
12 import org.onap.aai.sparky.viewandinspect.config.VisualizationConfigs;
13 import org.onap.aai.sparky.viewandinspect.entity.ActiveInventoryNode;
14 import org.onap.aai.sparky.viewandinspect.entity.GraphMeta;
15 import org.onap.aai.sparky.viewandinspect.entity.SparkyGraphNode;
16 import org.onap.aai.sparky.viewandinspect.services.VisualizationTransformer;
17 import org.onap.aai.sparky.viewandinspect.util.SchemaVisualizationTestDataBuilder;
18
19 import com.fasterxml.jackson.core.JsonParseException;
20 import com.fasterxml.jackson.databind.DeserializationFeature;
21 import com.fasterxml.jackson.databind.JsonMappingException;
22 import com.fasterxml.jackson.databind.JsonNode;
23 import com.fasterxml.jackson.databind.ObjectMapper;
24
25 public class VisualizationTransformerTest {
26
27   VisualizationTransformer testTransformer;
28   VisualizationConfigs visConfig;
29   SubscriptionConfig subConfig;
30   GraphMeta graphMeta;
31   OxmEntityLookup oxmEntityLookup;
32   
33   
34   @Before
35   public void init() throws Exception {
36     this.visConfig = new VisualizationConfigs();
37     this.subConfig = new SubscriptionConfig();
38     this.graphMeta = new GraphMeta();
39     this.oxmEntityLookup = OxmModelAndProcessorHelper.getInstance().getOxmEntityLookup();
40    
41     this.testTransformer = new VisualizationTransformer(visConfig, subConfig);
42   }
43   
44   @Test
45   public void testGenerateVisualizationOutput() throws JsonParseException, JsonMappingException, IOException {
46     ObjectMapper mapper = new ObjectMapper();
47     mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
48
49       JsonNode elasticValue = mapper.readValue(SchemaVisualizationTestDataBuilder.getRawRootNode(), JsonNode.class);
50
51   }
52
53   public ActiveInventoryNode generateActiveInventoryNode(String id, String type, String selfLink, String primaryKeyName, String primaryKeyValue) {
54     ActiveInventoryNode testAin = new ActiveInventoryNode(visConfig, oxmEntityLookup);
55     
56     testAin.setNodeId(id);
57     testAin.setEntityType(type);
58     testAin.setSelfLink(selfLink);
59     testAin.setPrimaryKeyName(primaryKeyName);
60     testAin.setPrimaryKeyValue(primaryKeyValue);
61     
62     return testAin;
63   }
64   
65   public SparkyGraphNode generateSparkyGraphNode(ActiveInventoryNode ain) {
66     
67     SparkyGraphNode testSparkyGraphNode = new SparkyGraphNode(ain, visConfig, subConfig);
68     
69     return testSparkyGraphNode;
70   }
71   
72   public Map<String, ActiveInventoryNode> generateFlatNodeArray() {
73     Map<String, ActiveInventoryNode> nodeArray = new HashMap<String, ActiveInventoryNode>();
74     
75     return nodeArray;
76   }
77 }