Adjust sparky parent pom
[aai/sparky-be.git] / sparkybe-onap-service / src / test / java / org / onap / aai / sparky / viewandinspect / VisualizationTransformerTest.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2017-2018 Amdocs
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *       http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.aai.sparky.viewandinspect;
23
24 import java.io.IOException;
25 import java.util.HashMap;
26 import java.util.Map;
27
28 import org.junit.Before;
29 import org.junit.Test;
30 import org.onap.aai.sparky.config.oxm.OxmEntityLookup;
31 import org.onap.aai.sparky.subscription.config.SubscriptionConfig;
32 import org.onap.aai.sparky.util.OxmModelAndProcessorHelper;
33 import org.onap.aai.sparky.viewandinspect.config.VisualizationConfigs;
34 import org.onap.aai.sparky.viewandinspect.entity.ActiveInventoryNode;
35 import org.onap.aai.sparky.viewandinspect.entity.GraphMeta;
36 import org.onap.aai.sparky.viewandinspect.entity.SparkyGraphNode;
37 import org.onap.aai.sparky.viewandinspect.services.VisualizationTransformer;
38 import org.onap.aai.sparky.viewandinspect.util.SchemaVisualizationTestDataBuilder;
39
40 import com.fasterxml.jackson.core.JsonParseException;
41 import com.fasterxml.jackson.databind.DeserializationFeature;
42 import com.fasterxml.jackson.databind.JsonMappingException;
43 import com.fasterxml.jackson.databind.JsonNode;
44 import com.fasterxml.jackson.databind.ObjectMapper;
45
46 public class VisualizationTransformerTest {
47
48   VisualizationTransformer testTransformer;
49   VisualizationConfigs visConfig;
50   SubscriptionConfig subConfig;
51   GraphMeta graphMeta;
52   OxmEntityLookup oxmEntityLookup;
53   
54   
55   @Before
56   public void init() throws Exception {
57     this.visConfig = new VisualizationConfigs();
58     this.subConfig = new SubscriptionConfig();
59     this.graphMeta = new GraphMeta();
60     this.oxmEntityLookup = OxmModelAndProcessorHelper.getInstance().getOxmEntityLookup();
61    
62     this.testTransformer = new VisualizationTransformer(visConfig, subConfig);
63   }
64   
65   @Test
66   public void testGenerateVisualizationOutput() throws JsonParseException, JsonMappingException, IOException {
67     ObjectMapper mapper = new ObjectMapper();
68     mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
69
70       JsonNode elasticValue = mapper.readValue(SchemaVisualizationTestDataBuilder.getRawRootNode(), JsonNode.class);
71
72   }
73
74   public ActiveInventoryNode generateActiveInventoryNode(String id, String type, String selfLink, String primaryKeyName, String primaryKeyValue) {
75     ActiveInventoryNode testAin = new ActiveInventoryNode(visConfig, oxmEntityLookup);
76     
77     testAin.setNodeId(id);
78     testAin.setEntityType(type);
79     testAin.setSelfLink(selfLink);
80     testAin.setPrimaryKeyName(primaryKeyName);
81     testAin.setPrimaryKeyValue(primaryKeyValue);
82     
83     return testAin;
84   }
85   
86   public SparkyGraphNode generateSparkyGraphNode(ActiveInventoryNode ain) {
87     
88     SparkyGraphNode testSparkyGraphNode = new SparkyGraphNode(ain, visConfig, subConfig);
89     
90     return testSparkyGraphNode;
91   }
92   
93   public Map<String, ActiveInventoryNode> generateFlatNodeArray() {
94     Map<String, ActiveInventoryNode> nodeArray = new HashMap<String, ActiveInventoryNode>();
95     
96     return nodeArray;
97   }
98 }