本文整理了Java中org.testcontainers.containers.wait.strategy.Wait.forHttp()
方法的一些代码示例,展示了Wait.forHttp()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Wait.forHttp()
方法的具体详情如下:
包路径:org.testcontainers.containers.wait.strategy.Wait
类名称:Wait
方法名:forHttp
[英]Convenience method to return a WaitStrategy for an HTTP endpoint.
[中]
代码示例来源:origin: testcontainers/testcontainers-java
/**
* Convenience method to return a WaitStrategy for an HTTPS endpoint.
*
* @param path the path to check
* @return the WaitStrategy
* @see HttpWaitStrategy
*/
public static HttpWaitStrategy forHttps(String path) {
return forHttp(path)
.usingTls();
}
代码示例来源:origin: testcontainers/testcontainers-java
public InfluxDBContainer(final String version) {
super(IMAGE_NAME + ":" + version);
waitStrategy = new WaitAllStrategy()
.withStrategy(Wait.forHttp("/ping").withBasicCredentials(username, password).forStatusCode(204))
.withStrategy(Wait.forListeningPort());
}
代码示例来源:origin: testcontainers/testcontainers-java
public PulsarContainer(String pulsarVersion) {
super(TestcontainersConfiguration.getInstance().getPulsarImage() + ":" + pulsarVersion);
withExposedPorts(BROKER_PORT, BROKER_HTTP_PORT);
withCommand("/pulsar/bin/pulsar", "standalone", "--no-functions-worker", "-nss");
waitingFor(Wait.forHttp(METRICS_ENDPOINT).forStatusCode(200).forPort(BROKER_HTTP_PORT));
}
代码示例来源:origin: testcontainers/testcontainers-java
@Test
public void testWaitingFails() {
final DockerComposeContainer environment = new DockerComposeContainer(new File("src/test/resources/compose-test.yml"))
.withExposedService("redis_1", REDIS_PORT, Wait.forHttp("/test").withStartupTimeout(Duration.ofSeconds(10)));
VisibleAssertions.assertThrows("waiting on an invalid http path times out",
RuntimeException.class,
() -> environment.starting(Description.createTestDescription(Object.class, "name")));
}
代码示例来源:origin: org.testcontainers/testcontainers
/**
* Convenience method to return a WaitStrategy for an HTTPS endpoint.
*
* @param path the path to check
* @return the WaitStrategy
* @see HttpWaitStrategy
*/
public static HttpWaitStrategy forHttps(String path) {
return forHttp(path)
.usingTls();
}
代码示例来源:origin: hakdogan/ElasticSearch
@Profile("test")
@Bean(destroyMethod = "stop")
public FixedHostPortGenericContainer getFixedHostPortGenericContainer(){
String url = String.join(":", props.getElastic().getImageUrl(), props.getElastic().getVersion());
FixedHostPortGenericContainer fixed = new FixedHostPortGenericContainer(url);
fixed.withFixedExposedPort(props.getClients().getHttpPort(), props.getClients().getContainerPort());
fixed.waitingFor(Wait.forHttp("/"));
fixed.start();
return fixed;
}
代码示例来源:origin: org.testcontainers/influxdb
public InfluxDBContainer(final String version) {
super(IMAGE_NAME + ":" + version);
waitStrategy = new WaitAllStrategy()
.withStrategy(Wait.forHttp("/ping").withBasicCredentials(username, password).forStatusCode(204))
.withStrategy(Wait.forListeningPort());
}
代码示例来源:origin: org.apache.james/apache-james-mailbox-tika
public TikaContainer() {
tika = new SwarmGenericContainer(Images.TIKA)
.withExposedPorts(DEFAULT_TIKA_PORT)
.waitingFor(Wait.forHttp("/tika").withRateLimiter(RateLimiters.TWENTIES_PER_SECOND))
.withStartupTimeout(Duration.ofSeconds(30));
}
代码示例来源:origin: bozaro/git-as-svn
@BeforeClass
void before() throws Exception {
SvnTestHelper.skipTestIfDockerUnavailable();
String gitlabVersion = System.getenv("GITLAB_VERSION");
if (gitlabVersion == null) {
if (System.getenv("TRAVIS") != null)
throw new SkipException("Only run gitlab tests on Travis when explicitly asked");
gitlabVersion = "latest";
}
final int gitlabPort = 80;
gitlab = new GenericContainer<>("gitlab/gitlab-ce:" + gitlabVersion)
.withEnv("GITLAB_ROOT_PASSWORD", rootPassword)
.withExposedPorts(gitlabPort)
.waitingFor(Wait.forHttp("/users/sign_in")
.withStartupTimeout(Duration.of(10, ChronoUnit.MINUTES)));
gitlab.start();
gitlabUrl = "http://" + gitlab.getContainerIpAddress() + ":" + gitlab.getMappedPort(gitlabPort);
rootToken = createToken(root, rootPassword, true);
final GitlabAPI rootAPI = GitLabContext.connect(gitlabUrl, rootToken);
final GitlabUser gitlabUser = rootAPI.createUser(new CreateUserRequest(user, user, "git-as-svn@localhost").setPassword(userPassword));
Assert.assertNotNull(gitlabUser);
final GitlabGroup group = rootAPI.createGroup(new CreateGroupRequest("testGroup").setVisibility(GitlabVisibility.PUBLIC), null);
Assert.assertNotNull(group);
Assert.assertNotNull(rootAPI.addGroupMember(group.getId(), gitlabUser.getId(), GitlabAccessLevel.Developer));
gitlabProject = createGitlabProject(rootAPI, group, "test", GitlabVisibility.INTERNAL, Collections.singleton("git-as-svn"));
gitlabPublicProject = createGitlabProject(rootAPI, group, "publik", GitlabVisibility.PUBLIC, Collections.emptySet());
}
代码示例来源:origin: org.apache.james/apache-james-backends-rabbitmq
private WaitStrategy waitStrategy() {
return new WaitAllStrategy()
.withStrategy(Wait.forHttp("").forPort(DEFAULT_RABBITMQ_ADMIN_PORT)
.withRateLimiter(RateLimiters.TWENTIES_PER_SECOND)
.withStartupTimeout(TEN_MINUTES_TIMEOUT))
.withStrategy(new RabbitMQWaitStrategy(this, TEN_MINUTES_TIMEOUT))
.withStartupTimeout(TEN_MINUTES_TIMEOUT);
}
代码示例来源:origin: org.apache.james/blob-objectstorage
public DockerSwiftContainer() {
this.swiftContainer = new GenericContainer<>(SWIFT_DOCKER_IMAGE);
this.swiftContainer
.withExposedPorts(KEYSTONE_ADMIN_PORT)
.withExposedPorts(SWIFT_PORT)
.withLogConsumer(DockerSwiftContainer::displayDockerLog)
.waitingFor(
new WaitAllStrategy()
.withStrategy(
forHttp("/v3")
.forPort(KEYSTONE_ADMIN_PORT)
.forStatusCode(200)
.withRateLimiter(RateLimiters.TWENTIES_PER_SECOND)
).withStrategy(
forHttp("/info")
.forPort(SWIFT_PORT)
.forStatusCode(200)
.withRateLimiter(RateLimiters.TWENTIES_PER_SECOND)
)
);
}
代码示例来源:origin: bozaro/git-as-svn
.waitingFor(Wait.forHttp(path).forPort(giteaPort)
.withStartupTimeout(Duration.of(120, ChronoUnit.SECONDS)));
Slf4jLogConsumer logConsumer = new Slf4jLogConsumer(log);
内容来源于网络,如有侵权,请联系作者删除!