blob: f29e8dd58e8689213b194a950848adcf6a4404d6 [file] [log] [blame]
Simon Hunt642bc452016-05-04 19:34:45 -07001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.ui.model.topo;
18
Simon Huntc0f20c12016-05-09 09:30:20 -070019import org.junit.Before;
Simon Hunt642bc452016-05-04 19:34:45 -070020import org.junit.Test;
21import org.onlab.packet.IpAddress;
22import org.onosproject.cluster.ControllerNode;
23import org.onosproject.cluster.DefaultControllerNode;
24import org.onosproject.cluster.NodeId;
25import org.onosproject.ui.model.AbstractUiModelTest;
26
27import static org.junit.Assert.assertEquals;
28
29/**
30 * Unit tests for {@link UiClusterMember}.
31 */
32public class UiClusterMemberTest extends AbstractUiModelTest {
33
34 private static final NodeId NODE_ID = NodeId.nodeId("Node-1");
35 private static final IpAddress NODE_IP = IpAddress.valueOf("1.2.3.4");
36
37 private static final ControllerNode CNODE_1 =
38 new DefaultControllerNode(NODE_ID, NODE_IP);
39
Simon Huntc0f20c12016-05-09 09:30:20 -070040 private UiTopology topo;
Simon Hunt642bc452016-05-04 19:34:45 -070041 private UiClusterMember member;
42
Simon Huntc0f20c12016-05-09 09:30:20 -070043 @Before
44 public void setUp() {
45 topo = new UiTopology();
46 }
47
Simon Hunt642bc452016-05-04 19:34:45 -070048 @Test
49 public void basic() {
50 title("basic");
Simon Huntc0f20c12016-05-09 09:30:20 -070051 member = new UiClusterMember(topo, CNODE_1);
Simon Hunt642bc452016-05-04 19:34:45 -070052 print(member);
53
54 assertEquals("wrong id", NODE_ID, member.id());
55 assertEquals("wrong IP", NODE_IP, member.ip());
56 assertEquals("unex. online", false, member.isOnline());
57 assertEquals("unex. ready", false, member.isReady());
Simon Hunt642bc452016-05-04 19:34:45 -070058 }
59}