import java.util.Arrays;
import java.util.List;
-import java.util.Map;
-import java.util.Set;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortGrouping;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPort;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPortBuilder;
new DeviceStateImpl(null, nodeId);
}
- /**
- * Test method for {@link DeviceStateImpl#DeviceStateImpl(FeaturesReply, NodeId)}.
- */
- @Test(expected=IllegalArgumentException.class)
- public void testDeviceStateImplNullPhyPort(){
- final FeaturesReply emptyFeaturesReply = Mockito.mock(FeaturesReply.class);
- Mockito.when(emptyFeaturesReply.getPhyPort()).thenReturn(null);
- new DeviceStateImpl(emptyFeaturesReply, nodeId);
- }
-
/**
* Test method for {@link DeviceStateImpl#getNodeId()}.
*/
Assert.assertEquals(expetedResult.getPhyPort(), getFeatures.getPhyPort());
}
- /**
- * Test method for {@link DeviceStateImpl#getPhysicalPorts()}.
- */
- @Test
- public void testGetPhysicalPorts(){
- final Map<Long, PortGrouping> getPhysPort = deviceState.getPhysicalPorts();
- Assert.assertNotNull(getPhysPort);
- Assert.assertTrue(getPhysPort.values().contains(pPort.get(0)));
- }
-
- /**
- * Test method for {@link DeviceStateImpl#getPortsBandwidth()}.
- */
- @Test
- public void testGetPortsBandwidth(){
- final Map<Long, Long> portBandwidth = deviceState.getPortsBandwidth();
- Assert.assertNotNull(portBandwidth);
- Assert.assertTrue(portBandwidth.containsKey(portNr));
- Assert.assertEquals(this.portBandwidth, portBandwidth.get(portNr));
- }
-
- /**
- * Test method for {@link DeviceStateImpl#getPorts()}.
- */
- @Test
- public void testGetPorts(){
- final Set<Long> portNrs = deviceState.getPorts();
- Assert.assertTrue(portNrs.contains(portNr));
- }
-
- /**
- * Test method for {@link DeviceStateImpl#getPhysicalPort(java.lang.Long)}.
- */
- @Test
- public void testGetPhysicalPort(){
- Assert.assertEquals(pPort.get(0), deviceState.getPhysicalPort(portNr));
- }
-
- /**
- * Test method for {@link DeviceStateImpl#getPortBandwidth(java.lang.Long)}.
- */
- @Test
- public void testGetPortBandwidth(){
- Assert.assertEquals(portBandwidth, deviceState.getPortBandwidth((portNr)));
- }
-
- /**
- * Test method for {@link DeviceStateImpl#isPortEnabled(long)}.
- */
- @Test
- public void testIsPortEnabledLong(){
- Assert.assertTrue(deviceState.isPortEnabled(portNr));
- }
-
- /**
- * Test method for {@link DeviceStateImpl#isPortEnabled(PortGrouping)}.
- */
- @Test
- public void testIsPortEnabledPortGrouping(){
- Assert.assertTrue(deviceState.isPortEnabled(pPort.get(0)));
- }
-
- /**
- * Test method for {@link DeviceStateImpl#getEnabledPorts()}.
- */
- @Test
- public void testGetEnabledPorts(){
- final List<PortGrouping> getEnabledPort = deviceState.getEnabledPorts();
- Assert.assertNotNull(getEnabledPort);
- Assert.assertTrue(getEnabledPort.contains(pPort.get(0)));
- }
-
}