2 * ============LICENSE_START=======================================================
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
22 package org.onap.aai.sparky.viewandinspect.entity;
24 import static org.junit.Assert.assertFalse;
25 import static org.junit.Assert.assertNotNull;
26 import static org.junit.Assert.assertNull;
28 import java.util.HashMap;
30 import org.junit.Before;
31 import org.junit.Test;
32 import org.onap.aai.sparky.config.oxm.OxmEntityLookup;
33 import org.onap.aai.sparky.subscription.config.SubscriptionConfig;
34 import org.onap.aai.sparky.viewandinspect.config.VisualizationConfigs;
36 public class SparkyGraphNodeTest {
39 private SparkyGraphNode graphNode;
40 private ActiveInventoryNode activeInventoryNode;
41 private SubscriptionConfig subscriptionConfigs;
42 private VisualizationConfigs visualConfigs;
43 private OxmEntityLookup oxmEntityLookup;
44 private HashMap<String,String> itemProperties;
45 private NodeMeta nodeMeta;
48 public void init() throws Exception {
50 oxmEntityLookup = new OxmEntityLookup();
51 visualConfigs = new VisualizationConfigs();
52 subscriptionConfigs = new SubscriptionConfig();
53 nodeMeta = new NodeMeta(visualConfigs);
54 itemProperties = new HashMap<String,String>();
55 activeInventoryNode = new ActiveInventoryNode(visualConfigs,oxmEntityLookup);
57 graphNode = new SparkyGraphNode(activeInventoryNode,visualConfigs,subscriptionConfigs);
63 public void updateValues() {
65 graphNode.setId("graphID");
66 assertNotNull(graphNode.getId());
67 assertFalse(graphNode.isRootNode());
68 graphNode.setItemNameKey("selectedsearchedNodeClass");
69 assertNotNull(graphNode.getItemNameKey());
70 graphNode.setItemNameValue("generalNodeClass");
71 assertNotNull(graphNode.getItemNameValue());
72 graphNode.setResourceKey("searchedNodeClass");
73 assertNotNull(graphNode.getResourceKey());
74 graphNode.setItemType("/etc/aaiEntityNodeDescriptors.json");
75 assertNotNull(graphNode.getItemType());
77 graphNode.setItemProperties(itemProperties);
78 assertNotNull(graphNode.getItemProperties());
79 graphNode.setNodeMeta(nodeMeta);
80 assertNotNull(graphNode.getNodeMeta());
81 assertNotNull(graphNode.toString());
83 graphNode.setId(null);
84 assertNull(graphNode.getId());
85 assertFalse(graphNode.isRootNode());
86 graphNode.setItemNameKey(null);
87 assertNull(graphNode.getItemNameKey());
88 graphNode.setItemNameValue(null);
89 assertNull(graphNode.getItemNameValue());
90 graphNode.setResourceKey(null);
91 assertNull(graphNode.getResourceKey());
92 graphNode.setItemType(null);
93 assertNull(graphNode.getItemType());
94 graphNode.setItemProperties(null);
95 assertNull(graphNode.getItemProperties());
96 graphNode.setNodeMeta(null);
97 assertNull(graphNode.getNodeMeta());
98 assertNotNull(graphNode.toString());