@Test public void test_initialClusterState_rejected() { clusterStateManager.initialClusterState(FROZEN); clusterStateManager.initialClusterState(ACTIVE); assertEquals(FROZEN, clusterStateManager.getState()); }
public void initialClusterState(ClusterState clusterState) { if (node.joined()) { throw new IllegalStateException( "Cannot set initial state after node joined! -> " + clusterState); } clusterStateManager.initialClusterState(clusterState); }
@Test(expected = IllegalStateException.class) public void test_lockClusterState_forPassiveState_whenHasOnGoingMigration() throws Exception { when(partitionService.hasOnGoingMigrationLocal()).thenReturn(true); clusterStateManager.initialClusterState(FROZEN); Address initiator = newAddress(); final ClusterState newState = PASSIVE; clusterStateManager.lockClusterState(newState, initiator, TXN, 1000, 0); assertLockedBy(initiator); }
@Test public void changeLocalClusterState_shouldRemoveMembersDeadWhileFrozen_whenStateBecomes_ACTIVE() throws Exception { final ClusterState newState = ACTIVE; final Address initiator = newAddress(); clusterStateManager.initialClusterState(FROZEN); clusterStateManager.lockClusterState(newState, initiator, TXN, 10000, 0); clusterStateManager.commitClusterState(newState, initiator, TXN); assertEquals(newState, clusterStateManager.getState()); verify(clusterService, times(1)).removeMembersDeadWhileClusterIsNotActive(); }
@Test public void test_initialClusterState_PASSIVE() { clusterStateManager.initialClusterState(PASSIVE); assertEquals(PASSIVE, clusterStateManager.getState()); }
@Test public void test_initialClusterState_FROZEN() { clusterStateManager.initialClusterState(FROZEN); assertEquals(FROZEN, clusterStateManager.getState()); }