@Test public void disconnectTwoOfTwoConnections() { SwitchReadWriteConnectMonitor subject = makeSubject(SWITCH_ALPHA); SwitchInfoData connectEvent = makeConnectNotification(SWITCH_ALPHA); subject.handleSwitchStatusNotification(connectEvent, REGION_A); subject.handleSwitchStatusNotification(connectEvent, REGION_B); Assert.assertTrue(subject.isAvailable()); SwitchInfoData disconnectEvent = makeDisconnectNotification(connectEvent.getSwitchId()); clock.adjust(Duration.ofSeconds(1)); subject.handleSwitchStatusNotification(disconnectEvent, REGION_A); verify(carrier).regionUpdateNotification( eq(new RegionMappingSet(disconnectEvent.getSwitchId(), REGION_B, subject.isReadWriteMode()))); reset(carrier); Instant failedAt = clock.adjust(Duration.ofSeconds(1)); subject.handleSwitchStatusNotification(disconnectEvent, REGION_B); Assert.assertFalse(subject.isAvailable()); Assert.assertEquals(failedAt, subject.getBecomeUnavailableAt()); verify(carrier).switchStatusUpdateNotification(eq(disconnectEvent.getSwitchId()), eq(disconnectEvent)); verify(carrier).regionUpdateNotification( eq(new RegionMappingRemove(disconnectEvent.getSwitchId(), null, subject.isReadWriteMode()))); verifyNoMoreInteractions(carrier); }
@Override protected boolean isReadWriteMode() { return true; }
SwitchReadWriteConnectMonitor extends SwitchConnectMonitor { @Override protected boolean isReadWriteMode() { return true; } }
SwitchReadWriteConnectMonitor extends SwitchConnectMonitor { @Override protected boolean isReadWriteMode() { return true; } SwitchReadWriteConnectMonitor(SwitchMonitorCarrier carrier, Clock clock, SwitchId switchId); }
SwitchReadWriteConnectMonitor extends SwitchConnectMonitor { @Override protected boolean isReadWriteMode() { return true; } SwitchReadWriteConnectMonitor(SwitchMonitorCarrier carrier, Clock clock, SwitchId switchId);  }
SwitchReadWriteConnectMonitor extends SwitchConnectMonitor { @Override protected boolean isReadWriteMode() { return true; } SwitchReadWriteConnectMonitor(SwitchMonitorCarrier carrier, Clock clock, SwitchId switchId);   }