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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
/**
* ============LICENSE_START===================================================
* SPARKY (AAI UI service)
* ============================================================================
* Copyright © 2017 AT&T Intellectual Property.
* Copyright © 2017 Amdocs
* All rights reserved.
* ============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=====================================================
*
* ECOMP and OpenECOMP are trademarks
* and service marks of AT&T Intellectual Property.
*/
package org.onap.aai.sparky.viewandinspect.entity;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import org.junit.Before;
import org.junit.Test;
import org.onap.aai.restclient.client.OperationResult;
import org.onap.aai.sparky.config.oxm.OxmEntityLookup;
import org.onap.aai.sparky.viewandinspect.config.VisualizationConfigs;
public class ActiveInventoryNodeTest {
private ActiveInventoryNode activeInventoryNode;
private ArrayList<String> lst = new ArrayList<String>();
private OperationResult opResult;
private VisualizationConfigs visualConfig;
private OxmEntityLookup oxmEntityLookup;
@Before
public void init() throws Exception {
visualConfig = new VisualizationConfigs();
oxmEntityLookup = new OxmEntityLookup();
activeInventoryNode = new ActiveInventoryNode(visualConfig,oxmEntityLookup);
}
@Test
public void successfulInitializationAndUpdate() {
activeInventoryNode.addQueryParam("query-1");
activeInventoryNode.clearQueryParams();
activeInventoryNode.addQueryParams(lst);
assertNotNull(activeInventoryNode.getQueryParams());
assertNull(activeInventoryNode.getOxmModelLoader());
activeInventoryNode.setSelfLinkDeterminationPending(true);
assertTrue(activeInventoryNode.isSelfLinkDeterminationPending());
assertNotNull(activeInventoryNode.getState());
assertNotNull(activeInventoryNode.getComplexGroups());
assertNotNull(activeInventoryNode.getRelationshipLists());
activeInventoryNode.setOpResult(opResult);
assertNull(activeInventoryNode.getOpResult());
activeInventoryNode.setPrimaryKeyName("PrimaryKeyName");
assertNotNull(activeInventoryNode.getPrimaryKeyName());
activeInventoryNode.setNodeDepth(2);
assertEquals(2,activeInventoryNode.getNodeDepth());
activeInventoryNode.setvisualizationConfig(visualConfig);
assertNotNull(activeInventoryNode.getvisualizationConfigs());
activeInventoryNode.setNodeValidated(true);
assertTrue(activeInventoryNode.isNodeValidated());
activeInventoryNode.setPrimaryKeyValue("PrimaryKeyValue");
assertNotNull(activeInventoryNode.getPrimaryKeyValue());
activeInventoryNode.setIgnoredByFilter(true);
assertTrue(activeInventoryNode.isIgnoredByFilter());
activeInventoryNode.setNodeIssue(true);
assertTrue(activeInventoryNode.isNodeIssue());
activeInventoryNode.setProcessedNeighbors(true);
assertTrue(activeInventoryNode.hasProcessedNeighbors());
activeInventoryNode.setResolvedSelfLink(true);
assertTrue(activeInventoryNode.hasResolvedSelfLink());
activeInventoryNode.addInboundNeighbor("InBoundNodeID");
activeInventoryNode.addOutboundNeighbor("OutBoundNodeID");
assertTrue(activeInventoryNode.hasNeighbors());
activeInventoryNode.addInboundNeighbor(null);
activeInventoryNode.addOutboundNeighbor(null);
assertNotNull(activeInventoryNode.getInboundNeighbors());
assertNotNull(activeInventoryNode.getOutboundNeighbors());
assertTrue(activeInventoryNode.isAtMaxDepth());
activeInventoryNode.setSelfLinkPendingResolve(true);
assertTrue(activeInventoryNode.isSelfLinkPendingResolve());
activeInventoryNode.setRootNode(true);
assertTrue(activeInventoryNode.isRootNode());
activeInventoryNode.setSelflinkRetrievalFailure(true);
assertTrue(activeInventoryNode.isSelflinkRetrievalFailure());
activeInventoryNode.setSelfLinkProcessed(true);
assertTrue(activeInventoryNode.getSelfLinkProcessed());
activeInventoryNode.setNodeIntegrityProcessed(true);
assertTrue(activeInventoryNode.getNodeIntegrityProcessed());
assertFalse(activeInventoryNode.isDirectSelfLink());
activeInventoryNode.setProcessingErrorOccurred(true);
assertTrue(activeInventoryNode.isProcessingErrorOccurred());
activeInventoryNode.setNodeId("NodeId-1");
assertNotNull(activeInventoryNode.getNodeId());
activeInventoryNode.setSelfLink("selfLinkSet");
assertNotNull(activeInventoryNode.getSelfLink());
activeInventoryNode.setEntityType("EntityId-1");
assertNotNull(activeInventoryNode.getEntityType());
assertNotNull(activeInventoryNode.dumpNodeTree(true));
assertNotNull(activeInventoryNode.getProcessingErrorCauses());
assertNull(activeInventoryNode.calculateEditAttributeUri("Invalid-link"));
assertNull(activeInventoryNode.calculateEditAttributeUri("aai/v[\\d]/"));
activeInventoryNode.processPathedSelfLinkResponse("jsonResp","startNodeType","startNodeResourceKey");
activeInventoryNode.processPathedSelfLinkResponse(null,"startNodeType","startNodeResourceKey");
activeInventoryNode.processPathedSelfLinkResponse("","startNodeType","startNodeResourceKey");
}
}
|