本文整理汇总了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();