Skip to content

Commit

Permalink
[grid] DockerOptions formatting style [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
diemol committed Nov 13, 2020
1 parent 2d9832c commit 6a58c62
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions java/server/src/org/openqa/selenium/grid/docker/DockerOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,21 @@ public Map<Capabilities, Collection<SessionFactory>> getDockerSessionFactories(
Image image = docker.getImage(name);
for (int i = 0; i < maxContainerCount; i++) {
if (isVideoRecordingAvailable()) {
factories.put(caps,
new DockerSessionFactory(tracer, clientFactory, docker, getDockerUri(), image, caps, videoImage, getStoragePath()));
factories.put(
caps,
new DockerSessionFactory(
tracer,
clientFactory,
docker,
getDockerUri(),
image,
caps,
videoImage,
getStoragePath()));
} else {
factories.put(caps, new DockerSessionFactory(tracer, clientFactory, docker, getDockerUri(), image, caps));
factories.put(
caps,
new DockerSessionFactory(tracer, clientFactory, docker, getDockerUri(), image, caps));
}
}
LOG.info(String.format(
Expand All @@ -160,7 +171,8 @@ public Map<Capabilities, Collection<SessionFactory>> getDockerSessionFactories(
}

private boolean isVideoRecordingAvailable() {
return config.get(DOCKER_SECTION, "video-image").isPresent() && config.get(DOCKER_SECTION, "video-path").isPresent();
return config.get(DOCKER_SECTION, "video-image").isPresent()
&& config.get(DOCKER_SECTION, "video-path").isPresent();
}

private Image getVideoImage(Docker docker) {
Expand All @@ -175,7 +187,8 @@ private String getStoragePath() {
private void loadImages(Docker docker, String... imageNames) {
CompletableFuture<Void> cd = CompletableFuture.allOf(
Arrays.stream(imageNames)
.map(name -> CompletableFuture.supplyAsync(() -> docker.getImage(name))).toArray(CompletableFuture[]::new));
.map(name -> CompletableFuture.supplyAsync(() -> docker.getImage(name)))
.toArray(CompletableFuture[]::new));

try {
cd.get();
Expand Down

0 comments on commit 6a58c62

Please sign in to comment.