本文整理匯總了Java中org.testcontainers.containers.DockerComposeContainer類的典型用法代碼示例。如果您正苦於以下問題:Java DockerComposeContainer類的具體用法?Java DockerComposeContainer怎麽用?Java DockerComposeContainer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DockerComposeContainer類屬於org.testcontainers.containers包,在下文中一共展示了DockerComposeContainer類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: startPivioServerAndElasticsearchDockerContainers
import org.testcontainers.containers.DockerComposeContainer; //導入依賴的package包/類
private DockerComposeContainer startPivioServerAndElasticsearchDockerContainers() {
DockerComposeContainer dockerEnvironment = new DockerComposeContainer(new File("docker-compose.yml"))
.withLocalCompose(true)
.withExposedService(ELASTICSEARCH_SERVICE_NAME, ELASTICSEARCH_SERVICE_PORT) // needed for cleaning up persistent data - see TestHelper.cleanUpPersistentData(..)
.withTailChildContainers(true);
dockerEnvironment.starting(DOES_NOT_MATTER);
return dockerEnvironment;
}
示例2: simpleTest
import org.testcontainers.containers.DockerComposeContainer; //導入依賴的package包/類
@Test
public void simpleTest() {
DockerComposeContainer environment = new DockerComposeContainer(new File("src/test/resources/invalid-compose.yml"))
.withExposedService("something", 123);
VisibleAssertions.assertThrows("starting with an invalid docker-compose file throws an exception",
ContainerLaunchException.class,
() -> {
environment.starting(Description.createTestDescription(Object.class, "name"));
});
}
示例3: initialize
import org.testcontainers.containers.DockerComposeContainer; //導入依賴的package包/類
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
buildMainSourcesWhenRunningTestsWithoutGradle();
DockerComposeContainer dockerEnvironment = startPivioServerAndElasticsearchDockerContainers();
setSpringDataElasticsearchClusterNodesProperty(applicationContext, dockerEnvironment);
}
示例4: setSpringDataElasticsearchClusterNodesProperty
import org.testcontainers.containers.DockerComposeContainer; //導入依賴的package包/類
private void setSpringDataElasticsearchClusterNodesProperty(ConfigurableApplicationContext applicationContext, DockerComposeContainer dockerEnvironment) {
Integer elasticsearchAmbassadorPort = dockerEnvironment.getServicePort(ELASTICSEARCH_SERVICE_NAME, ELASTICSEARCH_SERVICE_PORT);
EnvironmentTestUtils.addEnvironment(applicationContext, "spring.data.elasticsearch.cluster-nodes=localhost:" + elasticsearchAmbassadorPort);
}
示例5: getEnvironment
import org.testcontainers.containers.DockerComposeContainer; //導入依賴的package包/類
@Override
protected DockerComposeContainer getEnvironment() {
return environment;
}
示例6: getEnvironment
import org.testcontainers.containers.DockerComposeContainer; //導入依賴的package包/類
protected abstract DockerComposeContainer getEnvironment();