当前位置: 首页>>代码示例>>Java>>正文


Java Wait类代码示例

本文整理汇总了Java中org.testcontainers.containers.wait.Wait的典型用法代码示例。如果您正苦于以下问题:Java Wait类的具体用法?Java Wait怎么用?Java Wait使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Wait类属于org.testcontainers.containers.wait包,在下文中一共展示了Wait类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: before

import org.testcontainers.containers.wait.Wait; //导入依赖的package包/类
@BeforeClass
void before() throws Exception {
  String gitlabVersion = System.getenv("GITLAB_VERSION");
  if (gitlabVersion == null)
    gitlabVersion = "9.3.3-ce.0";

  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("[email protected]", userPassword, user, user, null, null, null, null, null, null, null, null, false, null, true);
  Assert.assertNotNull(gitlabUser);

  final GitlabGroup group = rootAPI.createGroup("testGroup");
  Assert.assertNotNull(group);

  Assert.assertNotNull(rootAPI.addGroupMember(group.getId(), gitlabUser.getId(), GitlabAccessLevel.Developer));

  gitlabProject = createGitlabProject(rootAPI, group, "test", false);
  gitlabPublicProject = createGitlabProject(rootAPI, group, "publik", true);
}
 
开发者ID:bozaro,项目名称:git-as-svn,代码行数:32,代码来源:GitLabIntegrationTest.java

示例2: configure

import org.testcontainers.containers.wait.Wait; //导入依赖的package包/类
@Override
protected void configure() {
    super.configure();

    withExposedPorts(MONGO_PORT);
    waitingFor(Wait.forListeningPort());
}
 
开发者ID:gAmUssA,项目名称:testcontainers-hazelcast,代码行数:8,代码来源:MongoMapLoaderTest.java

示例3: configure

import org.testcontainers.containers.wait.Wait; //导入依赖的package包/类
@Override
protected void configure() {
    super.configure();
    withLogConsumer(new Slf4jLogConsumer(log));
    withExposedPorts(5701);
    setWaitStrategy(Wait.forListeningPort());
}
 
开发者ID:gAmUssA,项目名称:testcontainers-hazelcast,代码行数:8,代码来源:HazelcastTestApp.java

示例4: beforeClass

import org.testcontainers.containers.wait.Wait; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() {
  network = Network.newNetwork();
  elasticsearch = new GenericContainer<>("docker.elastic.co/elasticsearch/elasticsearch:5.6.1")
      .withNetwork(network)
      .withNetworkAliases("elasticsearch")
      .waitingFor(Wait.forHttp("/"))
      .withExposedPorts(9200, 9300)
      .withEnv("xpack.security.enabled", "false")
      .withEnv("discovery.type", "single-node")
      .withEnv("network.bind_host", "elasticsearch")
      .withEnv("network.host", "_site_")
      .withEnv("network.publish_host", "_local_");
  elasticsearch.start();

  jaegerCollector = new GenericContainer<>("jaegertracing/jaeger-collector:latest")
      .withNetwork(network)
      .withEnv("SPAN_STORAGE_TYPE", "elasticsearch")
      .withEnv("ES_SERVER_URLS", "http://elasticsearch:9200")
      .withEnv("COLLECTOR_ZIPKIN_HTTP_PORT", "9411")
      .withEnv("COLLECTOR_QUEUE_SIZE", "100000")
      .waitingFor(Wait.forHttp("/").forStatusCode(204))
      // the first one is health check
      .withExposedPorts(14269, 14268, 9411);
  jaegerCollector.start();

  jaegerQuery = new GenericContainer<>("jaegertracing/jaeger-query:latest")
      .withEnv("SPAN_STORAGE_TYPE", "elasticsearch")
      .withEnv("ES_SERVER_URLS", "http://elasticsearch:9200")
      .withNetwork(network)
      .waitingFor(Wait.forHttp("/").forStatusCode(204))
      .withExposedPorts(16687, 16686);
  jaegerQuery.start();

  collectorUrl = String.format("http://%s:%d", jaegerCollector.getContainerIpAddress(), jaegerCollector.getMappedPort(14268));
  zipkinCollectorUrl = String.format("http://%s:%d", jaegerCollector.getContainerIpAddress(), jaegerCollector.getMappedPort(9411));
  queryUrl = String.format("http://%s:%d", jaegerQuery.getContainerIpAddress(), jaegerQuery.getMappedPort(16686));
}
 
开发者ID:jaegertracing,项目名称:spark-dependencies,代码行数:39,代码来源:ElasticsearchDependenciesJobTest.java

示例5: beforeClass

import org.testcontainers.containers.wait.Wait; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws TimeoutException {
  network = Network.newNetwork();
  cassandra = new CassandraContainer("cassandra:3.9")
      .withNetwork(network)
      .withNetworkAliases("cassandra")
      .withExposedPorts(9042);
  cassandra.start();
  cassandraPort = cassandra.getMappedPort(9042);

  jaegerCassandraSchema = new GenericContainer<>("jaegertracing/jaeger-cassandra-schema:latest")
      .withNetwork(network);
  jaegerCassandraSchema.start();
  /**
   * Wait until schema is created
   */
  await().until(() -> !jaegerCassandraSchema.isRunning());

  jaegerCollector = new GenericContainer<>("jaegertracing/jaeger-collector:latest")
      .withNetwork(network)
      .withEnv("CASSANDRA_SERVERS", "cassandra")
      .withEnv("CASSANDRA_KEYSPACE", "jaeger_v1_dc1")
      .withEnv("COLLECTOR_ZIPKIN_HTTP_PORT", "9411")
      .withEnv("COLLECTOR_QUEUE_SIZE", "100000")
      .waitingFor(Wait.forHttp("/").forStatusCode(204))
      // the first one is health check
      .withExposedPorts(14269, 14268, 9411);
  jaegerCollector.start();

  jaegerQuery = new GenericContainer<>("jaegertracing/jaeger-query:latest")
      .withNetwork(network)
      .withEnv("CASSANDRA_SERVERS", "cassandra")
      .withEnv("CASSANDRA_KEYSPACE", "jaeger_v1_dc1")
      .waitingFor(Wait.forHttp("/").forStatusCode(204))
      .withExposedPorts(16687, 16686);
  jaegerQuery.start();

  queryUrl = String.format("http://localhost:%d", jaegerQuery.getMappedPort(16686));
  collectorUrl = String.format("http://localhost:%d", jaegerCollector.getMappedPort(14268));
  zipkinCollectorUrl = String.format("http://localhost:%d", jaegerCollector.getMappedPort(9411));
}
 
开发者ID:jaegertracing,项目名称:spark-dependencies,代码行数:42,代码来源:CassandraDependenciesJobTest.java


注:本文中的org.testcontainers.containers.wait.Wait类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。