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=========================================================
21 package org.onap.aai.spike.event.outgoing;
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertNull;
25 import org.junit.Test;
27 public class SpikeGraphEventTest {
29 public void testGetObjectKey() {
32 SpikeGraphEvent spikeGraphEvent;
34 spikeGraphEvent = new SpikeGraphEvent();
35 SpikeVertex vertex = new SpikeVertex();
36 vertex.setId("addfff68");
37 spikeGraphEvent.setVertex(vertex);
38 objectKey = spikeGraphEvent.getObjectKey();
39 assertEquals("addfff68", objectKey);
41 spikeGraphEvent = new SpikeGraphEvent();
42 SpikeEdge relationship = new SpikeEdge();
43 relationship.setId("909d");
45 spikeGraphEvent.setRelationship(relationship);
46 objectKey = spikeGraphEvent.getObjectKey();
47 assertEquals("909d", objectKey);
49 spikeGraphEvent = new SpikeGraphEvent();
50 objectKey = spikeGraphEvent.getObjectKey();
51 assertNull(objectKey);
55 public void testGetObjectType() {
57 String type = "pserver";
58 SpikeGraphEvent spikeGraphEvent;
60 spikeGraphEvent = new SpikeGraphEvent();
61 SpikeVertex vertex = new SpikeVertex();
63 spikeGraphEvent.setVertex(vertex);
64 objectType = spikeGraphEvent.getObjectType();
65 assertEquals("Vertex->" + type, objectType);
67 spikeGraphEvent = new SpikeGraphEvent();
68 SpikeEdge relationship = new SpikeEdge();
69 relationship.setType(type);
71 spikeGraphEvent.setRelationship(relationship);
72 objectType = spikeGraphEvent.getObjectType();
73 assertEquals("Relationship->" + type, objectType);
75 spikeGraphEvent = new SpikeGraphEvent();
76 objectType = spikeGraphEvent.getObjectType();
77 assertNull(objectType);