use of com.twitter.heron.spi.statemgr.SchedulerStateManagerAdaptor in project incubator-heron by apache.
the class RuntimeManagerMainTest method testValidateRuntimeManageExecStateNotRequiredForKillCommand.
@Test
public void testValidateRuntimeManageExecStateNotRequiredForKillCommand() {
SchedulerStateManagerAdaptor adaptor = mock(SchedulerStateManagerAdaptor.class);
RuntimeManagerMain runtimeManagerMain = new RuntimeManagerMain(config, Command.KILL);
when(adaptor.isTopologyRunning(eq(TOPOLOGY_NAME))).thenReturn(true);
when(adaptor.getExecutionState(eq(TOPOLOGY_NAME))).thenReturn(null);
runtimeManagerMain.validateRuntimeManage(adaptor, TOPOLOGY_NAME);
}
use of com.twitter.heron.spi.statemgr.SchedulerStateManagerAdaptor in project incubator-heron by apache.
the class RuntimeManagerMainTest method testValidateRuntimeManageNoExecState.
@Test(expected = TopologyRuntimeManagementException.class)
public void testValidateRuntimeManageNoExecState() {
SchedulerStateManagerAdaptor adaptor = mock(SchedulerStateManagerAdaptor.class);
RuntimeManagerMain runtimeManagerMain = new RuntimeManagerMain(config, MOCK_COMMAND);
when(adaptor.isTopologyRunning(eq(TOPOLOGY_NAME))).thenReturn(true);
when(adaptor.getExecutionState(eq(TOPOLOGY_NAME))).thenReturn(null);
runtimeManagerMain.validateRuntimeManage(adaptor, TOPOLOGY_NAME);
}
use of com.twitter.heron.spi.statemgr.SchedulerStateManagerAdaptor in project incubator-heron by apache.
the class RuntimeManagerMainTest method testValidateRuntimeManageWrongStateForKillCommand.
@Test(expected = TopologyRuntimeManagementException.class)
public void testValidateRuntimeManageWrongStateForKillCommand() {
SchedulerStateManagerAdaptor adaptor = mock(SchedulerStateManagerAdaptor.class);
RuntimeManagerMain runtimeManagerMain = new RuntimeManagerMain(config, Command.KILL);
when(adaptor.isTopologyRunning(eq(TOPOLOGY_NAME))).thenReturn(true);
// Topology is running
ExecutionEnvironment.ExecutionState.Builder stateBuilder = ExecutionEnvironment.ExecutionState.newBuilder().setTopologyName(TOPOLOGY_NAME).setTopologyId(TOPOLOGY_ID).setCluster(CLUSTER).setEnviron(ENVIRON);
final String WRONG_ROLE = "wrong";
ExecutionEnvironment.ExecutionState wrongState = stateBuilder.setRole(WRONG_ROLE).build();
// cluster/role/environ not matched
when(adaptor.getExecutionState(eq(TOPOLOGY_NAME))).thenReturn(wrongState);
runtimeManagerMain.validateRuntimeManage(adaptor, TOPOLOGY_NAME);
}
use of com.twitter.heron.spi.statemgr.SchedulerStateManagerAdaptor in project incubator-heron by apache.
the class RuntimeManagerMainTest method testValidateRuntimeManageTopologyNotRunning.
@Test(expected = TopologyRuntimeManagementException.class)
public void testValidateRuntimeManageTopologyNotRunning() throws Exception {
SchedulerStateManagerAdaptor adaptor = mock(SchedulerStateManagerAdaptor.class);
RuntimeManagerMain runtimeManagerMain = new RuntimeManagerMain(config, MOCK_COMMAND);
when(adaptor.isTopologyRunning(eq(TOPOLOGY_NAME))).thenReturn(false);
runtimeManagerMain.validateRuntimeManage(adaptor, TOPOLOGY_NAME);
}
use of com.twitter.heron.spi.statemgr.SchedulerStateManagerAdaptor in project incubator-heron by apache.
the class RuntimeManagerMainTest method testValidateRuntimeManageWrongState.
@Test(expected = TopologyRuntimeManagementException.class)
public void testValidateRuntimeManageWrongState() {
SchedulerStateManagerAdaptor adaptor = mock(SchedulerStateManagerAdaptor.class);
RuntimeManagerMain runtimeManagerMain = new RuntimeManagerMain(config, MOCK_COMMAND);
when(adaptor.isTopologyRunning(eq(TOPOLOGY_NAME))).thenReturn(true);
// Topology is running
ExecutionEnvironment.ExecutionState.Builder stateBuilder = ExecutionEnvironment.ExecutionState.newBuilder().setTopologyName(TOPOLOGY_NAME).setTopologyId(TOPOLOGY_ID).setCluster(CLUSTER).setEnviron(ENVIRON);
final String WRONG_ROLE = "wrong";
ExecutionEnvironment.ExecutionState wrongState = stateBuilder.setRole(WRONG_ROLE).build();
// cluster/role/environ not matched
when(adaptor.getExecutionState(eq(TOPOLOGY_NAME))).thenReturn(wrongState);
runtimeManagerMain.validateRuntimeManage(adaptor, TOPOLOGY_NAME);
}
Aggregations