Dhruv Dhody | b585012 | 2016-02-17 17:51:19 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Dhruv Dhody | b585012 | 2016-02-17 17:51:19 +0530 | [diff] [blame] | 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 | package org.onosproject.ospf.controller.impl; |
| 17 | |
| 18 | import org.junit.After; |
| 19 | import org.junit.Before; |
| 20 | import org.junit.Test; |
| 21 | import org.onlab.packet.Ip4Address; |
| 22 | import org.onlab.packet.Ip6Address; |
| 23 | |
Dhruv Dhody | b585012 | 2016-02-17 17:51:19 +0530 | [diff] [blame] | 24 | import java.util.ArrayList; |
| 25 | import java.util.List; |
| 26 | |
| 27 | import static org.hamcrest.CoreMatchers.is; |
| 28 | import static org.junit.Assert.assertThat; |
| 29 | |
| 30 | /** |
| 31 | * Unit test class for OspfDeviceTedImpl. |
| 32 | */ |
| 33 | public class OspfDeviceTedImplTest { |
| 34 | private OspfDeviceTedImpl ospfDeviceTed; |
| 35 | |
| 36 | @Before |
| 37 | public void setUp() throws Exception { |
| 38 | ospfDeviceTed = new OspfDeviceTedImpl(); |
| 39 | } |
| 40 | |
| 41 | @After |
| 42 | public void tearDown() throws Exception { |
| 43 | ospfDeviceTed = null; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Tests ipv4RouterIds() getter method. |
| 48 | */ |
| 49 | @Test |
| 50 | public void testIpv4RouterIds() throws Exception { |
| 51 | List list = new ArrayList(); |
| 52 | list.add(Ip4Address.valueOf("1.1.1.1")); |
| 53 | ospfDeviceTed.setIpv4RouterIds(list); |
| 54 | assertThat(ospfDeviceTed.ipv4RouterIds().size(), is(1)); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Tests ipv4RouterIds() setter method. |
| 59 | */ |
| 60 | @Test |
| 61 | public void testSetIpv4RouterIds() throws Exception { |
| 62 | List list = new ArrayList(); |
| 63 | list.add(Ip4Address.valueOf("1.1.1.1")); |
| 64 | ospfDeviceTed.setIpv4RouterIds(list); |
| 65 | assertThat(ospfDeviceTed.ipv4RouterIds().size(), is(1)); |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Tests abr() getter method. |
| 70 | */ |
| 71 | @Test |
| 72 | public void testAbr() throws Exception { |
| 73 | ospfDeviceTed.setAbr(true); |
| 74 | assertThat(ospfDeviceTed.abr(), is(true)); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Tests abr() setter method. |
| 79 | */ |
| 80 | @Test |
| 81 | public void testSetAbr() throws Exception { |
| 82 | ospfDeviceTed.setAbr(true); |
| 83 | assertThat(ospfDeviceTed.abr(), is(true)); |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Tests asbr() getter method. |
| 88 | */ |
| 89 | @Test |
| 90 | public void testAsbr() throws Exception { |
| 91 | ospfDeviceTed.setAsbr(true); |
| 92 | assertThat(ospfDeviceTed.asbr(), is(true)); |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Tests asbr() setter method. |
| 97 | */ |
| 98 | @Test |
| 99 | public void testSetAsbr() throws Exception { |
| 100 | ospfDeviceTed.setAsbr(true); |
| 101 | assertThat(ospfDeviceTed.asbr(), is(true)); |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * Tests topologyIds() getter method. |
| 106 | */ |
| 107 | @Test |
| 108 | public void testTopologyIds() throws Exception { |
| 109 | List list = new ArrayList(); |
| 110 | list.add(Ip4Address.valueOf("1.1.1.1")); |
| 111 | ospfDeviceTed.setTopologyIds(list); |
| 112 | assertThat(ospfDeviceTed.topologyIds().size(), is(1)); |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Tests topologyIds() setter method. |
| 117 | */ |
| 118 | @Test |
| 119 | public void testSetTopologyIds() throws Exception { |
| 120 | List list = new ArrayList(); |
| 121 | list.add(Ip4Address.valueOf("1.1.1.1")); |
| 122 | ospfDeviceTed.setTopologyIds(list); |
| 123 | assertThat(ospfDeviceTed.topologyIds().size(), is(1)); |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Tests ipv6RouterIds() getter method. |
| 128 | */ |
Jonathan Hart | bb6fb5c | 2016-08-09 17:05:54 -0700 | [diff] [blame^] | 129 | @Test |
Dhruv Dhody | b585012 | 2016-02-17 17:51:19 +0530 | [diff] [blame] | 130 | public void testIpv6RouterIds() throws Exception { |
| 131 | List list = new ArrayList(); |
Jonathan Hart | bb6fb5c | 2016-08-09 17:05:54 -0700 | [diff] [blame^] | 132 | list.add(Ip6Address.valueOf(1)); |
Dhruv Dhody | b585012 | 2016-02-17 17:51:19 +0530 | [diff] [blame] | 133 | ospfDeviceTed.setIpv6RouterIds(list); |
| 134 | assertThat(ospfDeviceTed.ipv6RouterIds().size(), is(1)); |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * Tests ipv6RouterIds() setter method. |
| 139 | */ |
Jonathan Hart | bb6fb5c | 2016-08-09 17:05:54 -0700 | [diff] [blame^] | 140 | @Test |
Dhruv Dhody | b585012 | 2016-02-17 17:51:19 +0530 | [diff] [blame] | 141 | public void testSetIpv6RouterIds() throws Exception { |
| 142 | List list = new ArrayList(); |
Jonathan Hart | bb6fb5c | 2016-08-09 17:05:54 -0700 | [diff] [blame^] | 143 | list.add(Ip6Address.valueOf(1)); |
Dhruv Dhody | b585012 | 2016-02-17 17:51:19 +0530 | [diff] [blame] | 144 | ospfDeviceTed.setIpv6RouterIds(list); |
| 145 | assertThat(ospfDeviceTed.ipv6RouterIds().size(), is(1)); |
| 146 | } |
Jonathan Hart | bb6fb5c | 2016-08-09 17:05:54 -0700 | [diff] [blame^] | 147 | } |