Skip to content
Snippets Groups Projects
Commit 56015b37 authored by abat's avatar abat
Browse files

Merge into master from pull request #208:

Another controller unit test. (https://github.com/floodlight/floodlight/pull/208)
parents 77aa2981 285303c9
No related branches found
No related tags found
No related merge requests found
......@@ -76,7 +76,7 @@ public interface IFloodlightProviderService extends IFloodlightService {
public Map<OFType, List<IOFMessageListener>> getListeners();
/**
* Returns a list of all actively connected OpenFlow switches. This doesn't
* Returns an unmodifiable map of all actively connected OpenFlow switches. This doesn't
* contain switches that are connected but the controller's in the slave role.
* @return the set of actively connected switches
*/
......
......@@ -61,6 +61,7 @@ import net.floodlightcontroller.test.FloodlightTestCase;
import net.floodlightcontroller.threadpool.IThreadPoolService;
import org.easymock.Capture;
import org.easymock.EasyMock;
import org.jboss.netty.channel.Channel;
import org.junit.Test;
import org.openflow.protocol.OFError;
......@@ -1150,5 +1151,24 @@ public class ControllerTest extends FloodlightTestCase {
controller.activeSwitches.isEmpty());
}
/**
* Tests that you can't remove a switch from the active
* switch list.
* @throws Exception
*/
@Test
public void testRemoveActiveSwitch() {
IOFSwitch sw = EasyMock.createNiceMock(IOFSwitch.class);
boolean exceptionThrown = false;
expect(sw.getId()).andReturn(1L).anyTimes();
replay(sw);
getController().activeSwitches.put(sw.getId(), sw);
try {
getController().getSwitches().remove(1L);
} catch (UnsupportedOperationException e) {
exceptionThrown = true;
}
assertTrue(exceptionThrown);
verify(sw);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment