blob: db35b3394956a2c37920f18bb14f0d8737f9cb5f [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
19import org.junit.Test;
20import org.onlab.packet.IpAddress;
21import org.onosproject.cluster.ControllerNode;
22import org.onosproject.cluster.DefaultControllerNode;
23import org.onosproject.cluster.NodeId;
24import org.onosproject.ui.model.AbstractUiModelTest;
25
26import static org.junit.Assert.assertEquals;
27
28/**
29 * Unit tests for {@link UiClusterMember}.
30 */
31public class UiClusterMemberTest extends AbstractUiModelTest {
32
33 private static final NodeId NODE_ID = NodeId.nodeId("Node-1");
34 private static final IpAddress NODE_IP = IpAddress.valueOf("1.2.3.4");
35
36 private static final ControllerNode CNODE_1 =
37 new DefaultControllerNode(NODE_ID, NODE_IP);
38
39 private UiClusterMember member;
40
41 @Test
42 public void basic() {
43 title("basic");
44 member = new UiClusterMember(CNODE_1);
45 print(member);
46
47 assertEquals("wrong id", NODE_ID, member.id());
48 assertEquals("wrong IP", NODE_IP, member.ip());
49 assertEquals("unex. online", false, member.isOnline());
50 assertEquals("unex. ready", false, member.isReady());
51 assertEquals("unex. device count", 0, member.deviceCount());
52 }
53}