Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 1 | package net.floodlightcontroller.core.internal; |
| 2 | |
| 3 | import static org.easymock.EasyMock.createMock; |
| 4 | import static org.easymock.EasyMock.expect; |
| 5 | import static org.easymock.EasyMock.replay; |
| 6 | import static org.easymock.EasyMock.verify; |
Jonathan Hart | a88fd24 | 2014-04-03 11:24:54 -0700 | [diff] [blame] | 7 | import static org.junit.Assert.assertEquals; |
| 8 | import static org.junit.Assert.assertNotSame; |
| 9 | import static org.junit.Assert.assertSame; |
| 10 | import static org.junit.Assert.assertTrue; |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 11 | |
| 12 | import java.io.IOException; |
| 13 | import java.util.Collection; |
| 14 | import java.util.LinkedList; |
Jonathan Hart | a88fd24 | 2014-04-03 11:24:54 -0700 | [diff] [blame] | 15 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 16 | import net.floodlightcontroller.core.IFloodlightProviderService.Role; |
Jonathan Hart | a88fd24 | 2014-04-03 11:24:54 -0700 | [diff] [blame] | 17 | import net.floodlightcontroller.core.IOFSwitch; |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 18 | import net.floodlightcontroller.core.internal.RoleChanger.RoleChangeTask; |
| 19 | |
| 20 | import org.easymock.EasyMock; |
| 21 | import org.jboss.netty.channel.Channel; |
| 22 | import org.junit.Before; |
HIGUCHI Yuta | 2f245d2 | 2013-06-28 10:24:34 -0700 | [diff] [blame] | 23 | import org.junit.Ignore; |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 24 | import org.junit.Test; |
| 25 | |
| 26 | public class RoleChangerTest { |
| 27 | public RoleChanger roleChanger; |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 28 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 29 | @Before |
| 30 | public void setUp() throws Exception { |
| 31 | roleChanger = new RoleChanger(); |
| 32 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 33 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 34 | /** |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 35 | * Send a role request for SLAVE to a switch that doesn't support it. |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 36 | * The connection should be closed. |
| 37 | */ |
| 38 | @Test |
| 39 | public void testSendRoleRequestSlaveNotSupported() { |
| 40 | LinkedList<OFSwitchImpl> switches = new LinkedList<OFSwitchImpl>(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 41 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 42 | // a switch that doesn't support role requests |
| 43 | OFSwitchImpl sw1 = EasyMock.createMock(OFSwitchImpl.class); |
| 44 | Channel channel1 = createMock(Channel.class); |
| 45 | expect(sw1.getChannel()).andReturn(channel1); |
| 46 | // No support for NX_ROLE |
| 47 | expect(sw1.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE)) |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 48 | .andReturn(false); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 49 | expect(channel1.close()).andReturn(null); |
| 50 | switches.add(sw1); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 51 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 52 | replay(sw1, channel1); |
| 53 | roleChanger.sendRoleRequest(switches, Role.SLAVE, 123456); |
| 54 | verify(sw1, channel1); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 55 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 56 | // sendRoleRequest needs to remove the switch from the list since |
| 57 | // it closed its connection |
| 58 | assertTrue(switches.isEmpty()); |
| 59 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 60 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 61 | /** |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 62 | * Send a role request for MASTER to a switch that doesn't support it. |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 63 | * The connection should be closed. |
| 64 | */ |
| 65 | @Test |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 66 | @Ignore |
| 67 | // FIXME: ONOS modified the behavior here to intentionally trigger OFS error. |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 68 | public void testSendRoleRequestMasterNotSupported() { |
| 69 | LinkedList<OFSwitchImpl> switches = new LinkedList<OFSwitchImpl>(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 70 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 71 | // a switch that doesn't support role requests |
| 72 | OFSwitchImpl sw1 = EasyMock.createMock(OFSwitchImpl.class); |
| 73 | // No support for NX_ROLE |
| 74 | expect(sw1.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE)) |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 75 | .andReturn(false); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 76 | switches.add(sw1); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 77 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 78 | replay(sw1); |
| 79 | roleChanger.sendRoleRequest(switches, Role.MASTER, 123456); |
| 80 | verify(sw1); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 81 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 82 | assertEquals(1, switches.size()); |
| 83 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 84 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 85 | /** |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 86 | * Send a role request a switch that supports it and one that |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 87 | * hasn't had a role request send to it yet |
| 88 | */ |
| 89 | @Test |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 90 | public void testSendRoleRequestErrorHandling() throws Exception { |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 91 | LinkedList<OFSwitchImpl> switches = new LinkedList<OFSwitchImpl>(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 92 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 93 | // a switch that supports role requests |
| 94 | OFSwitchImpl sw1 = EasyMock.createMock(OFSwitchImpl.class); |
| 95 | // No support for NX_ROLE |
| 96 | expect(sw1.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE)) |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 97 | .andReturn(true); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 98 | expect(sw1.sendNxRoleRequest(Role.MASTER, 123456)) |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 99 | .andThrow(new IOException()).once(); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 100 | Channel channel1 = createMock(Channel.class); |
| 101 | expect(sw1.getChannel()).andReturn(channel1); |
| 102 | expect(channel1.close()).andReturn(null); |
| 103 | switches.add(sw1); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 104 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 105 | replay(sw1); |
| 106 | roleChanger.sendRoleRequest(switches, Role.MASTER, 123456); |
| 107 | verify(sw1); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 108 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 109 | assertTrue(switches.isEmpty()); |
| 110 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 111 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 112 | /** |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 113 | * Check error handling |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 114 | * hasn't had a role request send to it yet |
| 115 | */ |
| 116 | @Test |
| 117 | public void testSendRoleRequestSupported() throws Exception { |
| 118 | LinkedList<OFSwitchImpl> switches = new LinkedList<OFSwitchImpl>(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 119 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 120 | // a switch that supports role requests |
| 121 | OFSwitchImpl sw1 = EasyMock.createMock(OFSwitchImpl.class); |
| 122 | // No support for NX_ROLE |
| 123 | expect(sw1.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE)) |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 124 | .andReturn(true); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 125 | expect(sw1.sendNxRoleRequest(Role.MASTER, 123456)).andReturn(1).once(); |
| 126 | switches.add(sw1); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 127 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 128 | // a switch for which we don't have SUPPORTS_NX_ROLE yet |
| 129 | OFSwitchImpl sw2 = EasyMock.createMock(OFSwitchImpl.class); |
| 130 | // No support for NX_ROLE |
| 131 | expect(sw2.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE)) |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 132 | .andReturn(null); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 133 | expect(sw2.sendNxRoleRequest(Role.MASTER, 123456)).andReturn(1).once(); |
| 134 | switches.add(sw2); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 135 | |
| 136 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 137 | replay(sw1, sw2); |
| 138 | roleChanger.sendRoleRequest(switches, Role.MASTER, 123456); |
| 139 | verify(sw1, sw2); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 140 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 141 | assertEquals(2, switches.size()); |
| 142 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 143 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 144 | @Test |
| 145 | public void testVerifyRoleReplyReceived() { |
| 146 | LinkedList<OFSwitchImpl> switches = new LinkedList<OFSwitchImpl>(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 147 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 148 | // Add a switch that has received a role reply |
| 149 | OFSwitchImpl sw1 = EasyMock.createMock(OFSwitchImpl.class); |
| 150 | expect(sw1.checkFirstPendingRoleRequestCookie(123456)) |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 151 | .andReturn(false).once(); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 152 | switches.add(sw1); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 153 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 154 | // Add a switch that has not yet received a role reply |
| 155 | OFSwitchImpl sw2 = EasyMock.createMock(OFSwitchImpl.class); |
| 156 | expect(sw2.checkFirstPendingRoleRequestCookie(123456)) |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 157 | .andReturn(true).once(); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 158 | Channel channel2 = createMock(Channel.class); |
| 159 | expect(sw2.getChannel()).andReturn(channel2); |
| 160 | expect(channel2.close()).andReturn(null); |
| 161 | switches.add(sw2); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 162 | |
| 163 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 164 | replay(sw1, sw2); |
| 165 | roleChanger.verifyRoleReplyReceived(switches, 123456); |
| 166 | verify(sw1, sw2); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 167 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 168 | assertEquals(2, switches.size()); |
| 169 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 170 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 171 | @Test |
| 172 | public void testRoleChangeTask() { |
| 173 | @SuppressWarnings("unchecked") |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 174 | Collection<OFSwitchImpl> switches = |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 175 | EasyMock.createMock(Collection.class); |
| 176 | long now = System.nanoTime(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 177 | long dt1 = 10 * 1000 * 1000 * 1000L; |
| 178 | long dt2 = 20 * 1000 * 1000 * 1000L; |
| 179 | long dt3 = 15 * 1000 * 1000 * 1000L; |
| 180 | RoleChangeTask t1 = new RoleChangeTask(switches, null, now + dt1); |
| 181 | RoleChangeTask t2 = new RoleChangeTask(switches, null, now + dt2); |
| 182 | RoleChangeTask t3 = new RoleChangeTask(switches, null, now + dt3); |
| 183 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 184 | // FIXME: cannot test comparison against self. grrr |
| 185 | //assertTrue( t1.compareTo(t1) <= 0 ); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 186 | assertTrue(t1.compareTo(t2) < 0); |
| 187 | assertTrue(t1.compareTo(t3) < 0); |
| 188 | |
| 189 | assertTrue(t2.compareTo(t1) > 0); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 190 | //assertTrue( t2.compareTo(t2) <= 0 ); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 191 | assertTrue(t2.compareTo(t3) > 0); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 192 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 193 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 194 | @Test |
| 195 | public void testSubmitRequest() throws Exception { |
| 196 | LinkedList<OFSwitchImpl> switches = new LinkedList<OFSwitchImpl>(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 197 | roleChanger.timeout = 500 * 1000 * 1000; // 500 ms |
| 198 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 199 | // a switch that supports role requests |
| 200 | OFSwitchImpl sw1 = EasyMock.createStrictMock(OFSwitchImpl.class); |
| 201 | // No support for NX_ROLE |
| 202 | expect(sw1.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE)) |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 203 | .andReturn(true); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 204 | expect(sw1.sendNxRoleRequest(EasyMock.same(Role.MASTER), EasyMock.anyLong())) |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 205 | .andReturn(1); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 206 | expect(sw1.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE)) |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 207 | .andReturn(true); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 208 | expect(sw1.sendNxRoleRequest(EasyMock.same(Role.SLAVE), EasyMock.anyLong())) |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 209 | .andReturn(1); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 210 | // The following calls happen for timeout handling: |
| 211 | expect(sw1.checkFirstPendingRoleRequestCookie(EasyMock.anyLong())) |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 212 | .andReturn(false); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 213 | expect(sw1.checkFirstPendingRoleRequestCookie(EasyMock.anyLong())) |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 214 | .andReturn(false); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 215 | switches.add(sw1); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 216 | |
| 217 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 218 | replay(sw1); |
| 219 | roleChanger.submitRequest(switches, Role.MASTER); |
| 220 | roleChanger.submitRequest(switches, Role.SLAVE); |
| 221 | // Wait until role request has been sent. |
| 222 | // TODO: need to get rid of this sleep somehow |
| 223 | Thread.sleep(100); |
| 224 | // Now there should be exactly one timeout task pending |
| 225 | assertEquals(2, roleChanger.pendingTasks.size()); |
| 226 | // Make sure it's indeed a timeout task |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 227 | assertSame(RoleChanger.RoleChangeTask.Type.TIMEOUT, |
| 228 | roleChanger.pendingTasks.peek().type); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 229 | // Check that RoleChanger indeed made a copy of switches collection |
| 230 | assertNotSame(switches, roleChanger.pendingTasks.peek().switches); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 231 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 232 | // Wait until the timeout triggers |
| 233 | // TODO: get rid of this sleep too. |
| 234 | Thread.sleep(500); |
| 235 | assertEquals(0, roleChanger.pendingTasks.size()); |
| 236 | verify(sw1); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 237 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 238 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 239 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 240 | } |