tom | 3065d12 | 2014-09-03 21:56:43 -0700 | [diff] [blame^] | 1 | package org.onlab.onos.net.device; |
| 2 | |
| 3 | import org.junit.Test; |
| 4 | |
| 5 | import java.net.URI; |
| 6 | |
| 7 | import static org.junit.Assert.assertEquals; |
| 8 | import static org.junit.Assert.assertTrue; |
| 9 | import static org.onlab.onos.net.Device.Type.SWITCH; |
| 10 | |
| 11 | /** |
| 12 | * Test of the default device description. |
| 13 | */ |
| 14 | public class DefaultDeviceDescriptionTest { |
| 15 | |
| 16 | private static final URI DURI = URI.create("of:foo"); |
| 17 | private static final String MFR = "whitebox"; |
| 18 | private static final String HW = "1.1.x"; |
| 19 | private static final String SW = "3.9.1"; |
| 20 | private static final String SN = "43311-12345"; |
| 21 | |
| 22 | |
| 23 | @Test |
| 24 | public void basics() { |
| 25 | DeviceDescription device = |
| 26 | new DefaultDeviceDescription(DURI, SWITCH, MFR, HW, SW, SN); |
| 27 | assertEquals("incorrect uri", DURI, device.deviceURI()); |
| 28 | assertEquals("incorrect type", SWITCH, device.type()); |
| 29 | assertEquals("incorrect manufacturer", MFR, device.manufacturer()); |
| 30 | assertEquals("incorrect hw", HW, device.hwVersion()); |
| 31 | assertEquals("incorrect sw", SW, device.swVersion()); |
| 32 | assertEquals("incorrect serial", SN, device.serialNumber()); |
| 33 | assertTrue("incorrect toString", device.toString().contains("uri=of:foo")); |
| 34 | } |
| 35 | |
| 36 | } |