public CubeId create(String id) { Objects.requireNonNull(id, "Id must not be null."); final CubeId cubeId; if (id.matches(StarredCubeId.PATTERN)) { cubeId = new StarredCubeId(id); } else if (id.matches(ParallelizedCubeId.PATTERN)) { cubeId = new ParallelizedCubeId(id); } else { cubeId = new DefaultCubeId(id); } return cubeId; } }
public CubeId create(String id) { Objects.requireNonNull(id, "Id must not be null."); final CubeId cubeId; if (id.matches(StarredCubeId.PATTERN)) { cubeId = new StarredCubeId(id); } else if (id.matches(ParallelizedCubeId.PATTERN)) { cubeId = new ParallelizedCubeId(id); } else { cubeId = new DefaultCubeId(id); } return cubeId; } }
private void executeCustomBeforeStopAction(DockerClientExecutor dockerClientExecutor, String containerId, CustomBeforeStopAction customBeforeStopAction) { BeforeStopActionFactory.create(dockerClientExecutor, new DefaultCubeId(containerId), customBeforeStopAction) .doBeforeStop(); }
private void executeCustomBeforeStopAction(DockerClientExecutor dockerClientExecutor, String containerId, CustomBeforeStopAction customBeforeStopAction) { BeforeStopActionFactory.create(dockerClientExecutor, new DefaultCubeId(containerId), customBeforeStopAction) .doBeforeStop(); }
@Test public void should_be_able_to_create_custom_before_stop_actions() { BeforeStop beforeStop = new BeforeStop(); CustomBeforeStopAction customBeforeStopAction = new CustomBeforeStopAction(); customBeforeStopAction.setStrategy("org.arquillian.cube.docker.impl.beforeStop.CustomBeforeStopActionImpl"); beforeStop.setCustomBeforeStopAction(customBeforeStopAction); BeforeStopAction beforeStopAction = BeforeStopActionFactory.create(dockerClientExecutor, new DefaultCubeId(containerId), customBeforeStopAction); assertThat(beforeStopAction, instanceOf(CustomBeforeStopActionInstantiator.class)); CustomBeforeStopActionInstantiator customBeforeStopActionInstantiator = (CustomBeforeStopActionInstantiator) beforeStopAction; customBeforeStopActionInstantiator.doBeforeStop(); verify(dockerClientExecutor, times(1)).getDockerUri(); } }