RoleManager { @SuppressFBWarnings(value="UG_SYNC_SET_UNSYNC_GET", justification = "setter is synchronized for mutual exclusion, " + "currentRoleInfo is volatile, so no sync on getter needed") public synchronized HARole getRole() { return currentRoleInfo.getRole(); } RoleManager(@Nonnull Controller controller,
            @Nonnull IShutdownService shutdownService,
            @Nonnull HARole role,
            @Nonnull String roleChangeDescription); synchronized void reassertRole(OFSwitchHandshakeHandler ofSwitchHandshakeHandler, HARole role); synchronized void setRole(@Nonnull HARole role, @Nonnull String roleChangeDescription); @SuppressFBWarnings(value="UG_SYNC_SET_UNSYNC_GET", justification = "setter is synchronized for mutual exclusion, " + "currentRoleInfo is volatile, so no sync on getter needed") synchronized HARole getRole(); synchronized OFControllerRole getOFControllerRole(); RoleInfo getRoleInfo(); void notifyControllerConnectionUpdate(); RoleManagerCounters getCounters();  }
@Test public void testSetRoleStandbyToActive() throws Exception { doSetUp(HARole.STANDBY); this.setRoleAndMockController(HARole.ACTIVE); assertTrue(roleManager.getRole() == HARole.ACTIVE); }
@Test public void testSetRoleActiveToStandby() throws Exception { assertTrue(roleManager.getRole() == HARole.ACTIVE); this.setRoleAndMockController(HARole.STANDBY); assertTrue(roleManager.getRole() == HARole.STANDBY); }
@Test public void testSetRoleActiveToActive() throws Exception { assertTrue(roleManager.getRole() == HARole.ACTIVE); this.setRoleAndMockController(HARole.ACTIVE); assertTrue(roleManager.getRole() == HARole.ACTIVE); }
@Test public void testSetRoleStandbyToStandby() throws Exception { doSetUp(HARole.STANDBY); this.setRoleAndMockController(HARole.STANDBY); assertTrue(roleManager.getRole() == HARole.STANDBY); }