Simon Hunt | c13082f | 2016-08-03 21:20:23 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Simon Hunt | c13082f | 2016-08-03 21:20:23 -0700 | [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 | |
| 17 | package org.onosproject.ui.model.topo; |
| 18 | |
| 19 | import org.junit.Test; |
| 20 | import org.onosproject.net.DeviceId; |
| 21 | import org.onosproject.net.region.RegionId; |
| 22 | import org.onosproject.ui.model.AbstractUiModelTest; |
| 23 | |
| 24 | import static org.junit.Assert.assertEquals; |
| 25 | import static org.onosproject.net.DeviceId.deviceId; |
| 26 | import static org.onosproject.net.PortNumber.P0; |
| 27 | import static org.onosproject.net.region.RegionId.regionId; |
| 28 | |
| 29 | /** |
| 30 | * Unit tests for {@link UiRegionDeviceLink}. |
| 31 | */ |
| 32 | public class UiRegionDeviceLinkTest extends AbstractUiModelTest { |
| 33 | |
| 34 | private static final RegionId R1 = regionId("r1"); |
| 35 | private static final DeviceId DEV_X = deviceId("device-X"); |
| 36 | |
| 37 | @Test |
| 38 | public void basic() { |
| 39 | title("basic"); |
| 40 | UiLinkId id = UiLinkId.uiLinkId(R1, DEV_X, P0); |
| 41 | UiRegionDeviceLink link = new UiRegionDeviceLink(null, id); |
| 42 | print(link); |
| 43 | assertEquals("region", R1, link.region()); |
| 44 | assertEquals("device", DEV_X, link.device()); |
| 45 | assertEquals("port", P0, link.port()); |
| 46 | } |
| 47 | } |