org.testcontainers.containers.wait.strategy.WaitAllStrategy.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(169)

本文整理了Java中org.testcontainers.containers.wait.strategy.WaitAllStrategy.<init>()方法的一些代码示例,展示了WaitAllStrategy.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WaitAllStrategy.<init>()方法的具体详情如下:
包路径:org.testcontainers.containers.wait.strategy.WaitAllStrategy
类名称:WaitAllStrategy
方法名:<init>

WaitAllStrategy.<init>介绍

暂无

代码示例

代码示例来源:origin: testcontainers/testcontainers-java

  1. private void addWaitStrategy(String serviceInstanceName, @NonNull WaitStrategy waitStrategy) {
  2. final WaitAllStrategy waitAllStrategy = waitStrategyMap.computeIfAbsent(serviceInstanceName, __ ->
  3. (WaitAllStrategy) new WaitAllStrategy().withStartupTimeout(Duration.ofMinutes(30)));
  4. waitAllStrategy.withStrategy(waitStrategy);
  5. }

代码示例来源:origin: testcontainers/testcontainers-java

  1. /**
  2. * Creates a Testcontainer using a specific docker image.
  3. *
  4. * @param dockerImageName The docker image to use.
  5. */
  6. public Neo4jContainer(String dockerImageName) {
  7. super(dockerImageName);
  8. WaitStrategy waitForBolt = new LogMessageWaitStrategy()
  9. .withRegEx(String.format(".*Bolt enabled on 0\\.0\\.0\\.0:%d\\.\n", DEFAULT_BOLT_PORT));
  10. WaitStrategy waitForHttp = new HttpWaitStrategy()
  11. .forPort(DEFAULT_HTTP_PORT)
  12. .forStatusCodeMatching(response -> response == HTTP_OK);
  13. this.waitStrategy = new WaitAllStrategy()
  14. .withStrategy(waitForBolt)
  15. .withStrategy(waitForHttp)
  16. .withStartupTimeout(Duration.ofMinutes(2));
  17. }

代码示例来源:origin: testcontainers/testcontainers-java

  1. public InfluxDBContainer(final String version) {
  2. super(IMAGE_NAME + ":" + version);
  3. waitStrategy = new WaitAllStrategy()
  4. .withStrategy(Wait.forHttp("/ping").withBasicCredentials(username, password).forStatusCode(204))
  5. .withStrategy(Wait.forListeningPort());
  6. }

代码示例来源:origin: org.testcontainers/testcontainers

  1. private void addWaitStrategy(String serviceInstanceName, @NonNull WaitStrategy waitStrategy) {
  2. if (waitStrategy == null) {
  3. throw new java.lang.NullPointerException("waitStrategy is marked @NonNull but is null");
  4. }
  5. final WaitAllStrategy waitAllStrategy = waitStrategyMap.computeIfAbsent(serviceInstanceName, __ -> (WaitAllStrategy) new WaitAllStrategy().withStartupTimeout(Duration.ofMinutes(30)));
  6. waitAllStrategy.withStrategy(waitStrategy);
  7. }

代码示例来源:origin: Playtika/testcontainers-spring-boot

  1. private static WaitStrategy getCompositeWaitStrategy(ElasticSearchProperties properties) {
  2. WaitAllStrategy strategy = new WaitAllStrategy()
  3. .withStrategy(new HostPortWaitStrategy());
  4. properties.indices.forEach(index -> strategy.withStrategy(new CreateIndex(properties, index)));
  5. return strategy
  6. .withStrategy(new WaitForGreenStatus(properties))
  7. .withStartupTimeout(DEFAULT_CONTAINER_WAIT_DURATION);
  8. }
  9. }

代码示例来源:origin: org.testcontainers/influxdb

  1. public InfluxDBContainer(final String version) {
  2. super(IMAGE_NAME + ":" + version);
  3. waitStrategy = new WaitAllStrategy()
  4. .withStrategy(Wait.forHttp("/ping").withBasicCredentials(username, password).forStatusCode(204))
  5. .withStrategy(Wait.forListeningPort());
  6. }

代码示例来源:origin: Playtika/testcontainers-spring-boot

  1. @Bean(name = AEROSPIKE_BEAN_NAME, destroyMethod = "stop")
  2. public GenericContainer aerospike(AerospikeWaitStrategy aerospikeWaitStrategy,
  3. ConfigurableEnvironment environment,
  4. AerospikeProperties properties) {
  5. log.info("Starting aerospike server. Docker image: {}", properties.dockerImage);
  6. WaitStrategy waitStrategy = new WaitAllStrategy()
  7. .withStrategy(aerospikeWaitStrategy)
  8. .withStrategy(new HostPortWaitStrategy())
  9. .withStartupTimeout(Duration.of(60, SECONDS));
  10. GenericContainer aerospike =
  11. new GenericContainer<>(properties.dockerImage)
  12. .withExposedPorts(properties.port)
  13. .withLogConsumer(containerLogsConsumer(log))
  14. // see https://github.com/aerospike/aerospike-server.docker/blob/master/aerospike.template.conf
  15. .withEnv("NAMESPACE", properties.namespace)
  16. .withEnv("SERVICE_PORT", String.valueOf(properties.port))
  17. .withEnv("MEM_GB", String.valueOf(1))
  18. .withEnv("STORAGE_GB", String.valueOf(1))
  19. .withCreateContainerCmdModifier(cmd -> cmd.withCapAdd(Capability.NET_ADMIN))
  20. .waitingFor(waitStrategy)
  21. .withStartupTimeout(properties.getTimeoutDuration());
  22. aerospike.start();
  23. registerAerospikeEnvironment(aerospike, environment, properties);
  24. return aerospike;
  25. }

代码示例来源:origin: org.apache.james/apache-james-backends-rabbitmq

  1. private WaitStrategy waitStrategy() {
  2. return new WaitAllStrategy()
  3. .withStrategy(Wait.forHttp("").forPort(DEFAULT_RABBITMQ_ADMIN_PORT)
  4. .withRateLimiter(RateLimiters.TWENTIES_PER_SECOND)
  5. .withStartupTimeout(TEN_MINUTES_TIMEOUT))
  6. .withStrategy(new RabbitMQWaitStrategy(this, TEN_MINUTES_TIMEOUT))
  7. .withStartupTimeout(TEN_MINUTES_TIMEOUT);
  8. }

代码示例来源:origin: Playtika/testcontainers-spring-boot

  1. /**
  2. * https://developer.couchbase.com/documentation/server/current/rest-api/rest-node-provisioning.html
  3. */
  4. private static WaitStrategy getCompositeWaitStrategy(CouchbaseProperties properties) {
  5. return new WaitAllStrategy()
  6. .withStrategy(new SetupNodeStorage(properties))
  7. .withStrategy(new SetupRamQuotas(properties))
  8. .withStrategy(new SetupServices(properties))
  9. .withStrategy(new SetupIndexesType(properties))
  10. .withStrategy(new SetupAdminUserAndPassword(properties))
  11. .withStrategy(new CreateBucket(properties))
  12. .withStrategy(new CreatePrimaryIndex(properties))
  13. .withStrategy(new CreateBucketUser(properties))
  14. .withStartupTimeout(DEFAULT_CONTAINER_WAIT_DURATION);
  15. }
  16. }

代码示例来源:origin: org.apache.james/blob-objectstorage

  1. public DockerSwiftContainer() {
  2. this.swiftContainer = new GenericContainer<>(SWIFT_DOCKER_IMAGE);
  3. this.swiftContainer
  4. .withExposedPorts(KEYSTONE_ADMIN_PORT)
  5. .withExposedPorts(SWIFT_PORT)
  6. .withLogConsumer(DockerSwiftContainer::displayDockerLog)
  7. .waitingFor(
  8. new WaitAllStrategy()
  9. .withStrategy(
  10. forHttp("/v3")
  11. .forPort(KEYSTONE_ADMIN_PORT)
  12. .forStatusCode(200)
  13. .withRateLimiter(RateLimiters.TWENTIES_PER_SECOND)
  14. ).withStrategy(
  15. forHttp("/info")
  16. .forPort(SWIFT_PORT)
  17. .forStatusCode(200)
  18. .withRateLimiter(RateLimiters.TWENTIES_PER_SECOND)
  19. )
  20. );
  21. }

相关文章