Skip to content

Commit

Permalink
#128 Implemented factory method for EventuateZookeeperContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
cer committed Dec 16, 2022
1 parent af9f531 commit e1cacf2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package io.eventuate.common.testcontainers;

import org.jetbrains.annotations.NotNull;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.images.builder.ImageFromDockerfile;

import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.util.function.BiConsumer;
import java.util.function.Supplier;
Expand All @@ -19,6 +21,11 @@ public EventuateZookeeperContainer(Path path) {
withConfiguration();
}

@NotNull
static EventuateZookeeperContainer makeFromDockerfile() {
return new EventuateZookeeperContainer(FileSystems.getDefault().getPath("../zookeeper/Dockerfile"));
}

private void withConfiguration() {
withExposedPorts(2181);
waitingFor(Wait.forHealthcheck());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
import org.junit.ClassRule;
import org.junit.Test;

import java.nio.file.FileSystems;

public class EventuateZookeeperContainerTest {

@ClassRule
public static EventuateZookeeperContainer container = new EventuateZookeeperContainer(FileSystems.getDefault().getPath("../zookeeper/Dockerfile"));
public static EventuateZookeeperContainer container = EventuateZookeeperContainer.makeFromDockerfile();

@Test
public void shouldStart() {
Expand Down

0 comments on commit e1cacf2

Please sign in to comment.