@Override public RuntimeException call() throws Exception { try { controlEvent.fire(new StopCube(cubeId)); controlEvent.fire(new DestroyCube(cubeId)); } catch (RuntimeException e) { return e; } return null; } }
@Override public RuntimeException call() throws Exception { try { controlEvent.fire(new StopCube(cubeId)); controlEvent.fire(new DestroyCube(cubeId)); } catch (RuntimeException e) { return e; } return null; } }
@Override public void destroy(String cubeId) { Cube<?> cube = cubeRegistry.get().getCube(cubeId); Validate.notNull(cube, "Cube with id '" + cubeId + "' to destroy does not exist."); controlEvent.fire(new DestroyCube(cubeId)); }
@Override public void destroy(String cubeId) { Cube<?> cube = cubeRegistry.get().getCube(cubeId); Validate.notNull(cube, "Cube with id '" + cubeId + "' to destroy does not exist."); controlEvent.fire(new DestroyCube(cubeId)); }
@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionOnMisingCubeDuringDestroyCube() { fire(new DestroyCube(MISSING_CUBE_ID)); } }
@Override public void undeploy(Archive<?> archive) throws DeploymentException { final CubeRegistry cubeRegistry = cubeRegistryInstance.get(); Cube<?> cube = resolveMainCube(cubeRegistry); if (cube != null) { controlEvent.fire(new StopCube(cube)); controlEvent.fire(new DestroyCube(cube)); } }
public void stopAutoContainers(@Observes(precedence = -99) AfterSuite event, Configuration conf) { if (!(conf instanceof CubeOpenShiftConfiguration)) { return; } CubeOpenShiftConfiguration openshiftConfiguration = (CubeOpenShiftConfiguration) conf; String[] autostart = openshiftConfiguration.getAutoStartContainers(); for (int i = autostart.length - 1; i > -1; i--) { String cubeId = autostart[i]; controlEvent.fire(new StopCube(cubeId)); controlEvent.fire(new DestroyCube(cubeId)); } } }
@Test public void shouldDestroyCube() { fire(new DestroyCube(CUBE_ID)); verify(cube).destroy(); }
public void stopCubeMappedContainer(@Observes AfterStop event, CubeRegistry cubeRegistry, ContainerRegistry containerRegistry) { Container container = ContainerUtil.getContainerByDeployableContainer(containerRegistry, event.getDeployableContainer()); if (container == null) { return; } Cube<?> cube = cubeRegistry.getCube(ContainerUtil.getCubeIDForContainer(container)); if (cube == null) { return; // No Cube found matching Container name, not managed by Cube } controlEvent.fire(new StopCube(cube)); controlEvent.fire(new DestroyCube(cube)); } }
public void stopCubeMappedContainer(@Observes AfterStop event, CubeRegistry cubeRegistry, ContainerRegistry containerRegistry) { Container container = ContainerUtil.getContainerByDeployableContainer(containerRegistry, event.getDeployableContainer()); if (container == null) { return; } Cube<?> cube = cubeRegistry.getCube(ContainerUtil.getCubeIDForContainer(container)); if (cube == null) { return; // No Cube found matching Container name, not managed by Cube } controlEvent.fire(new StopCube(cube)); controlEvent.fire(new DestroyCube(cube)); } }