public HttpAwaitBuilder withIterations(int iterations) { await.setIterations(iterations); return this; }
public HttpAwaitBuilder withIterations(int iterations) { await.setIterations(iterations); return this; }
public HttpAwaitBuilder(URL url, String messageContent) { this.await = new Await(); await.setStrategy("http"); await.setMatch(messageContent); await.setUrl(url.toExternalForm()); await.setSleepPollingTime(DEFAULT_TIMEOUT + " s"); await.setIterations(10); }
public HttpAwaitBuilder(URL url, String messageContent) { this.await = new Await(); await.setStrategy("http"); await.setMatch(messageContent); await.setUrl(url.toExternalForm()); await.setSleepPollingTime(DEFAULT_TIMEOUT + " s"); await.setIterations(10); }
private void verifyAwait(String imageId, boolean status, String[] command, String timeout) { String containerId = dockerRun(imageId); containerIds.add(containerId); when(cube.getId()).thenReturn(containerId); when(dockerClientExecutor.getDockerClient()).thenReturn(dockerClient); Await params = new Await(); params.setIterations(2); params.setSleepPollingTime(timeout); params.setCommand(command); DockerHealthAwaitStrategy dockerHealthAwaitStrategy = new DockerHealthAwaitStrategy( cube, dockerClientExecutor, params ); Assert.assertEquals(status, dockerHealthAwaitStrategy.await()); } }
@Test public void should_create_static_await_strategy_without_defaults_and_units() { Await await = new Await(); await.setStrategy("static"); await.setIp("localhost"); await.setPorts(Arrays.asList(8080, 8089)); await.setSleepPollingTime("200 s"); await.setIterations(3); CubeContainer cubeContainer = new CubeContainer(); cubeContainer.setAwait(await); AwaitStrategy strategy = AwaitStrategyFactory.create(null, cube, cubeContainer); assertThat(strategy, instanceOf(StaticAwaitStrategy.class)); StaticAwaitStrategy staticAwaitStrategy = (StaticAwaitStrategy) strategy; assertThat(staticAwaitStrategy.getIp(), is("localhost")); assertThat(staticAwaitStrategy.getPorts().get(0), is(8080)); assertThat(staticAwaitStrategy.getPorts().get(1), is(8089)); assertThat(staticAwaitStrategy.getPollIterations(), is(3)); assertThat(staticAwaitStrategy.getSleepTime(), is(200)); assertThat(staticAwaitStrategy.getTimeUnit(), is(TimeUnit.SECONDS)); }
@Test public void should_create_polling_await_strategy_with_specific_times_and_unit() { Await await = new Await(); await.setStrategy("polling"); await.setSleepPollingTime("200 s"); await.setIterations(3); CubeContainer cubeContainer = new CubeContainer(); cubeContainer.setAwait(await); AwaitStrategy strategy = AwaitStrategyFactory.create(null, cube, cubeContainer); assertThat(strategy, instanceOf(PollingAwaitStrategy.class)); assertThat(((PollingAwaitStrategy) strategy).getPollIterations(), is(3)); assertThat(((PollingAwaitStrategy) strategy).getSleepTime(), is(200)); assertThat(((PollingAwaitStrategy) strategy).getTimeUnit(), is(TimeUnit.SECONDS)); assertThat(((PollingAwaitStrategy) strategy).getType(), is("sscommand")); }
@Test public void should_create_polling_await_strategy_with_specific_times() { Await await = new Await(); await.setStrategy("polling"); await.setSleepPollingTime(200); await.setIterations(3); CubeContainer cubeContainer = new CubeContainer(); cubeContainer.setAwait(await); AwaitStrategy strategy = AwaitStrategyFactory.create(null, cube, cubeContainer); assertThat(strategy, instanceOf(PollingAwaitStrategy.class)); assertThat(((PollingAwaitStrategy) strategy).getPollIterations(), is(3)); assertThat(((PollingAwaitStrategy) strategy).getSleepTime(), is(200)); }
@Test public void should_create_static_await_strategy_without_defaults() { Await await = new Await(); await.setStrategy("static"); await.setIp("localhost"); await.setPorts(Arrays.asList(8080, 8089)); await.setSleepPollingTime(200); await.setIterations(3); CubeContainer cubeContainer = new CubeContainer(); cubeContainer.setAwait(await); AwaitStrategy strategy = AwaitStrategyFactory.create(null, cube, cubeContainer); assertThat(strategy, instanceOf(StaticAwaitStrategy.class)); StaticAwaitStrategy staticAwaitStrategy = (StaticAwaitStrategy) strategy; assertThat(staticAwaitStrategy.getIp(), is("localhost")); assertThat(staticAwaitStrategy.getPorts().get(0), is(8080)); assertThat(staticAwaitStrategy.getPorts().get(1), is(8089)); assertThat(staticAwaitStrategy.getPollIterations(), is(3)); assertThat(staticAwaitStrategy.getSleepTime(), is(200)); }
@Test public void should_create_polling_await_strategy_with_specific_type() { Await await = new Await(); await.setStrategy("polling"); await.setType("sscommand"); await.setSleepPollingTime("200 s"); await.setIterations(3); CubeContainer cubeContainer = new CubeContainer(); cubeContainer.setAwait(await); AwaitStrategy strategy = AwaitStrategyFactory.create(null, cube, cubeContainer); assertThat(strategy, instanceOf(PollingAwaitStrategy.class)); assertThat(((PollingAwaitStrategy) strategy).getType(), is("sscommand")); }