-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathRedmineContainer.java
More file actions
33 lines (26 loc) · 963 Bytes
/
RedmineContainer.java
File metadata and controls
33 lines (26 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.example.linkedcontainer;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.traits.LinkableContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.utility.DockerImageName;
/**
* A Redmine container.
*/
public class RedmineContainer extends GenericContainer<RedmineContainer> {
private static final int REDMINE_PORT = 3000;
public RedmineContainer(DockerImageName dockerImageName) {
super(dockerImageName);
}
@Override
protected void configure() {
addExposedPort(REDMINE_PORT);
waitingFor(Wait.forHttp("/"));
}
public RedmineContainer withLinkToContainer(LinkableContainer otherContainer, String alias) {
addLink(otherContainer, alias);
return this;
}
public String getRedmineUrl() {
return String.format("http://%s:%d", this.getHost(), this.getMappedPort(REDMINE_PORT));
}
}