@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 { if (connectionMode.isAllowReconnect() && isCubeRunning(cubeId)) { controlEvent.fire(new PreRunningCube(cubeId)); return null; } controlEvent.fire(new CreateCube(cubeId)); controlEvent.fire(new StartCube(cubeId)); if (connectionMode.isAllowReconnect() && !connectionMode.isStoppable()) { // If we allow reconnections and containers are none stoppable which means that they will be able to be // reused in next executions then at this point we can assume that the container is a prerunning container. controlEvent.fire(new PreRunningCube(cubeId)); } } catch (RuntimeException e) { return e; } return null; } }
public void startAutoContainers(@Observes(precedence = 99) BeforeSuite event, Configuration conf) { if (!(conf instanceof CubeOpenShiftConfiguration)) { return; } CubeOpenShiftConfiguration openshiftConfiguration = (CubeOpenShiftConfiguration) conf; for (String cubeId : openshiftConfiguration.getAutoStartContainers()) { controlEvent.fire(new CreateCube(cubeId)); controlEvent.fire(new StartCube(cubeId)); } }
@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionOnMisingCubeDuringDestroyCube() { fire(new DestroyCube(MISSING_CUBE_ID)); } }
@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionOnMisingCubeDuringStartCube() { fire(new StartCube(MISSING_CUBE_ID)); }
@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionOnMisingCubeDuringCreateCube() { fire(new CreateCube(MISSING_CUBE_ID)); }
@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionOnMisingCubeDuringStopCube() { fire(new StopCube(MISSING_CUBE_ID)); }
public void stop(@Observes StopCube event, CubeRegistry registry) { validateAndGet(registry, event.getCubeId()).stop(); }
public void create(@Observes CreateCube event, CubeRegistry registry) { validateAndGet(registry, event.getCubeId()).create(); }
public void changeToPreRunning(@Observes PreRunningCube event, CubeRegistry registry) { validateAndGet(registry, event.getCubeId()).changeToPreRunning(); }
public void destroy(@Observes DestroyCube event, CubeRegistry registry) { validateAndGet(registry, event.getCubeId()).destroy(); }
@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 { if (connectionMode.isAllowReconnect() && isCubeRunning(cubeId)) { controlEvent.fire(new PreRunningCube(cubeId)); return null; } controlEvent.fire(new CreateCube(cubeId)); controlEvent.fire(new StartCube(cubeId)); if (connectionMode.isAllowReconnect() && !connectionMode.isStoppable()) { // If we allow reconnections and containers are none stoppable which means that they will be able to be // reused in next executions then at this point we can assume that the container is a prerunning container. controlEvent.fire(new PreRunningCube(cubeId)); } } catch (RuntimeException e) { return e; } return null; } }
public void stop(@Observes StopCube event, CubeRegistry registry) { validateAndGet(registry, event.getCubeId()).stop(); }
public void create(@Observes CreateCube event, CubeRegistry registry) { validateAndGet(registry, event.getCubeId()).create(); }
public void changeToPreRunning(@Observes PreRunningCube event, CubeRegistry registry) { validateAndGet(registry, event.getCubeId()).changeToPreRunning(); }
@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)); } } }
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)); } }