Skip to content

Commit

Permalink
Merge pull request #43 from nmiyake/patch-1
Browse files Browse the repository at this point in the history
Update code examples in README
  • Loading branch information
joelea committed Apr 4, 2016
2 parents 7573f23 + d92bead commit ff3ae48
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ repositories {
maven {
url 'https://dl.bintray.com/palantir/releases' // docker-compose-rule is published on bintray
}
}
}
dependencies {
compile 'com.palantir.docker.compose:docker-compose-rule:<latest-tag-from-bintray>'
}
Expand All @@ -43,7 +43,7 @@ For the most basic use simply add a `DockerComposition` object as a `@ClassRule`
public class DockerCompositionTest {

@ClassRule
public DockerComposition composition = new DockerComposition("src/test/resources/docker-compose.yml");
public DockerComposition composition = DockerComposition.of("src/test/resources/docker-compose.yml").build();

@Test
public void testThatDependsOnDockerComposition() throws InterruptedException, IOException {
Expand Down Expand Up @@ -74,10 +74,11 @@ To wait for services to be available before executing tests use the following me
public class DockerCompositionTest {

@ClassRule
public DockerComposition composition = new DockerComposition("src/test/resources/docker-compose.yml")
.waitingForService("db", toHaveAllPortsOpen())
.waitingForService("web", toRespondOverHttp(8080, (port) -> "https://" + port.getIp() + ":" + port.getExternalPort()))
public DockerComposition composition = DockerComposition.of("src/test/resources/docker-compose.yml")
.waitingForService("db", HealthChecks.toHaveAllPortsOpen())
.waitingForService("web", HealthChecks.toRespondOverHttp(8080, (port) -> "https://" + port.getIp() + ":" + port.getExternalPort()))
.waitingForService("other", (container) -> customServiceCheck(container), Duration.standardMinutes(2))
.build();

@Test
public void testThatDependsServicesHavingStarted() throws InterruptedException, IOException {
Expand Down Expand Up @@ -117,8 +118,9 @@ To record the logs from your containers specify a location:
public class DockerCompositionTest {

@ClassRule
public DockerComposition composition = new DockerComposition("src/test/resources/docker-compose.yml")
.saveLogsTo("build/dockerLogs/dockerCompositionTest");
public DockerComposition composition = DockerComposition.of("src/test/resources/docker-compose.yml")
.saveLogsTo("build/dockerLogs/dockerCompositionTest")
.build();

@Test
public void testRecordsLogs() throws InterruptedException, IOException {
Expand Down

0 comments on commit ff3ae48

Please sign in to comment.