Skip to content
Snippets Groups Projects
Commit 2438b516 authored by Gregor Maier's avatar Gregor Maier
Browse files

Fix broken unit tests after merge

parent 44a0cde0
No related branches found
No related tags found
No related merge requests found
......@@ -696,6 +696,8 @@ public class OFChannelHandlerTest {
// prepare mocks and inject the role reply message
reset(sw);
expect(sw.inputThrottled(anyObject(OFMessage.class)))
.andReturn(false).anyTimes();
sw.setAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, true);
expectLastCall().once();
sw.setHARole(Role.MASTER);
......@@ -739,6 +741,8 @@ public class OFChannelHandlerTest {
// prepare mocks and inject the role reply message
reset(sw);
expect(sw.inputThrottled(anyObject(OFMessage.class)))
.andReturn(false).anyTimes();
sw.setAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, true);
expectLastCall().once();
sw.setHARole(Role.SLAVE);
......@@ -783,6 +787,8 @@ public class OFChannelHandlerTest {
// prepare mocks and inject the role reply message
reset(sw);
expect(sw.inputThrottled(anyObject(OFMessage.class)))
.andReturn(false).anyTimes();
sw.setAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, false);
expectLastCall().once();
sw.setHARole(Role.MASTER);
......@@ -844,6 +850,8 @@ public class OFChannelHandlerTest {
// prepare mocks and inject the role reply message
reset(sw);
expect(sw.inputThrottled(anyObject(OFMessage.class)))
.andReturn(false).anyTimes();
sw.setAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, false);
expectLastCall().once();
sw.setHARole(Role.MASTER);
......@@ -893,6 +901,8 @@ public class OFChannelHandlerTest {
// prepare mocks and inject the role reply message
reset(sw);
expect(sw.inputThrottled(anyObject(OFMessage.class)))
.andReturn(false).anyTimes();
sw.setAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, false);
expectLastCall().once();
sw.setHARole(Role.SLAVE);
......@@ -950,6 +960,8 @@ public class OFChannelHandlerTest {
// prepare mocks and inject the role reply message
reset(sw);
expect(sw.inputThrottled(anyObject(OFMessage.class)))
.andReturn(false).anyTimes();
sw.setAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, false);
expectLastCall().once();
sw.setHARole(Role.SLAVE);
......@@ -1005,6 +1017,8 @@ public class OFChannelHandlerTest {
// prepare mocks and inject the role reply message
reset(sw);
expect(sw.inputThrottled(anyObject(OFMessage.class)))
.andReturn(false).anyTimes();
sw.setAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, true);
expectLastCall().once();
sw.setHARole(Role.MASTER);
......@@ -1038,6 +1052,8 @@ public class OFChannelHandlerTest {
// prepare mocks and inject the role reply message
reset(sw);
expect(sw.inputThrottled(anyObject(OFMessage.class)))
.andReturn(false).anyTimes();
sw.setAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, true);
expectLastCall().once();
sw.setHARole(Role.SLAVE);
......@@ -1103,6 +1119,11 @@ public class OFChannelHandlerTest {
OFMessage err = getErrorMessage(OFErrorType.OFPET_BAD_ACTION,
0,
xid);
verify(sw);
reset(sw);
expect(sw.inputThrottled(anyObject(OFMessage.class)))
.andReturn(false).anyTimes();
replay(sw);
sendMessageToHandlerWithControllerReset(Collections.singletonList(err));
verifyExceptionCaptured(SwitchStateException.class);
......
......@@ -84,6 +84,7 @@ public class OFSwitchBaseTest {
return null;
}
@Override
public void write(OFMessage msg, FloodlightContext cntx) {
blockMessage = msg;
}
......@@ -134,7 +135,7 @@ public class OFSwitchBaseTest {
sw = new OFSwitchTest(floodlightProvider);
switches = new ConcurrentHashMap<Long, IOFSwitch>();
switches.put(sw.getId(), sw);
expect(floodlightProvider.getSwitches()).andReturn(switches).anyTimes();
expect(floodlightProvider.getSwitch(sw.getId())).andReturn(sw).anyTimes();
expect(floodlightProvider.getOFMessageFactory())
.andReturn(BasicFactory.getInstance()).anyTimes();
replay(floodlightProvider);
......
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