use of com.twitter.heron.spi.statemgr.SchedulerStateManagerAdaptor in project heron by twitter.
the class LaunchRunnerTest method doTestLaunch.
private void doTestLaunch(com.twitter.heron.api.Config topologyConfig) throws Exception {
Config runtime = createRunnerRuntime(topologyConfig);
Config config = createRunnerConfig();
ILauncher launcher = Runtime.launcherClassInstance(runtime);
SchedulerStateManagerAdaptor statemgr = createTestSchedulerStateManager(runtime);
LaunchRunner launchRunner = new LaunchRunner(config, runtime);
when(launcher.launch(any(PackingPlan.class))).thenReturn(true);
launchRunner.call();
// Verify set && clean
verify(statemgr).setTopology(any(TopologyAPI.Topology.class), eq(TOPOLOGY_NAME));
verify(statemgr).setExecutionState(any(ExecutionEnvironment.ExecutionState.class), eq(TOPOLOGY_NAME));
verify(statemgr, never()).deleteExecutionState(eq(TOPOLOGY_NAME));
verify(statemgr, never()).deleteTopology(eq(TOPOLOGY_NAME));
}
use of com.twitter.heron.spi.statemgr.SchedulerStateManagerAdaptor in project heron by twitter.
the class LaunchRunnerTest method createTestSchedulerStateManager.
private static SchedulerStateManagerAdaptor createTestSchedulerStateManager(Config runtime) {
SchedulerStateManagerAdaptor statemgr = Runtime.schedulerStateManagerAdaptor(runtime);
when(statemgr.setTopology(any(TopologyAPI.Topology.class), eq(TOPOLOGY_NAME))).thenReturn(true);
when(statemgr.setPackingPlan(any(PackingPlans.PackingPlan.class), eq(TOPOLOGY_NAME))).thenReturn(true);
when(statemgr.setExecutionState(any(ExecutionEnvironment.ExecutionState.class), eq(TOPOLOGY_NAME))).thenReturn(true);
return statemgr;
}
use of com.twitter.heron.spi.statemgr.SchedulerStateManagerAdaptor in project heron by twitter.
the class LaunchRunnerTest method testSetTopologyFail.
@Test(expected = LauncherException.class)
public void testSetTopologyFail() throws Exception {
Config runtime = createRunnerRuntime();
Config config = createRunnerConfig();
ILauncher launcher = Runtime.launcherClassInstance(runtime);
LaunchRunner launchRunner = new LaunchRunner(config, runtime);
SchedulerStateManagerAdaptor statemgr = Runtime.schedulerStateManagerAdaptor(runtime);
when(statemgr.setTopology(any(TopologyAPI.Topology.class), eq(TOPOLOGY_NAME))).thenReturn(false);
try {
launchRunner.call();
} finally {
verify(launcher, never()).launch(any(PackingPlan.class));
}
}
use of com.twitter.heron.spi.statemgr.SchedulerStateManagerAdaptor in project heron by twitter.
the class LaunchRunnerTest method testSetExecutionStateFail.
@Test(expected = LauncherException.class)
public void testSetExecutionStateFail() throws Exception {
Config runtime = createRunnerRuntime();
Config config = createRunnerConfig();
ILauncher launcher = Runtime.launcherClassInstance(runtime);
LaunchRunner launchRunner = new LaunchRunner(config, runtime);
SchedulerStateManagerAdaptor statemgr = Runtime.schedulerStateManagerAdaptor(runtime);
when(statemgr.setExecutionState(any(ExecutionEnvironment.ExecutionState.class), eq(TOPOLOGY_NAME))).thenReturn(false);
try {
launchRunner.call();
} finally {
verify(launcher, never()).launch(any(PackingPlan.class));
}
}
Aggregations