Class Tm1AdminServerContainer
java.lang.Object
org.testcontainers.containers.GenericContainer<Tm1AdminServerContainer>
io.skipcheck.tm1.testcontainers.Tm1AdminServerContainer
- All Implemented Interfaces:
AutoCloseable, org.testcontainers.containers.Container<Tm1AdminServerContainer>, org.testcontainers.containers.ContainerState, org.testcontainers.containers.traits.LinkableContainer, org.testcontainers.containers.wait.strategy.WaitStrategyTarget, org.testcontainers.lifecycle.Startable
public class Tm1AdminServerContainer
extends org.testcontainers.containers.GenericContainer<Tm1AdminServerContainer>
A TM1 Admin Server on its own, for tests with several TM1 servers: the
tm1-server image in admin mode. TM1 servers register with it through
Tm1ServerContainer.withAdminServer(Tm1AdminServerContainer), and Tm1WebContainer and
PawContainer list them all from it.
try (var admin = new Tm1AdminServerContainer(tm1Source);
var planning = new Tm1ServerContainer(tm1Source).withEnv("TM1_SERVER_NAME", "planning")
.withAdminServer(admin);
var reporting = new Tm1ServerContainer(tm1Source).withEnv("TM1_SERVER_NAME", "reporting")
.withAdminServer(admin)) {
planning.start();
reporting.start();
return admin.getRestUrl() + "Servers"; // lists planning and reporting
}
The Admin Server is part of the TM1 install, so it takes the same Tm1Source.
Other containers reach it on their shared network as "tm1-admin".
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.testcontainers.containers.Container
org.testcontainers.containers.Container.ExecResult -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe container's name on its Docker network, which TM1 servers register with.static final intThe Admin Server's REST port inside the container.Fields inherited from class org.testcontainers.containers.GenericContainer
CONTAINER_RUNNING_TIMEOUT_SEC, dependencies, dockerClient, INTERNAL_HOST_HOSTNAME, waitStrategyFields inherited from interface org.testcontainers.containers.ContainerState
STATE_HEALTHY -
Constructor Summary
ConstructorsConstructorDescriptionTm1AdminServerContainer(Tm1Source source) An Admin Server on the defaulttm1-serverimage (orTM1_SERVER_IMAGE), fromsource's TM1 install.Tm1AdminServerContainer(org.testcontainers.utility.DockerImageName image, Tm1Source source) An Admin Server onimage, which must betm1-serveror built on it. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcontainerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse info) The Admin Server's REST API as seen from the host, e.g.Where TM1 comes from.Methods inherited from class org.testcontainers.containers.GenericContainer
addEnv, addExposedPort, addExposedPorts, addFileSystemBind, addFixedExposedPort, addFixedExposedPort, addLink, canBeReused, configure, containerIsCreated, containerIsStarted, containerIsStarting, containerIsStarting, containerIsStopped, containerIsStopping, copyFileFromContainer, createVolumeDirectory, dependsOn, dependsOn, dependsOn, doStart, equals, getBinds, getCommandParts, getContainerId, getContainerInfo, getContainerName, getCopyToFileContainerPathMap, getCreateContainerCmdModifiers, getDependencies, getDockerClient, getDockerImageName, getEnv, getEnvMap, getExposedPorts, getExtraHosts, getImage, getIpAddress, getLabels, getLinkedContainers, getLivenessCheckPort, getLivenessCheckPortNumbers, getLivenessCheckPorts, getLogConsumers, getNetwork, getNetworkAliases, getNetworkMode, getPortBindings, getShmSize, getStartupAttempts, getStartupCheckStrategy, getTestHostIpAddress, getTmpFsMapping, getVolumesFroms, getWaitStrategy, getWorkingDirectory, hashCode, isHostAccessible, isPrivilegedMode, isShouldBeReused, logger, setBinds, setCommand, setCommand, setCommandParts, setContainerDef, setCopyToFileContainerPathMap, setDockerImageName, setEnv, setExposedPorts, setExtraHosts, setHostAccessible, setImage, setLabels, setLinkedContainers, setLogConsumers, setNetwork, setNetworkAliases, setNetworkMode, setPortBindings, setPrivilegedMode, setShmSize, setStartupAttempts, setStartupCheckStrategy, setTmpFsMapping, setVolumesFroms, setWaitStrategy, setWorkingDirectory, start, stop, toString, waitingFor, waitUntilContainerStarted, withAccessToHost, withClasspathResourceMapping, withClasspathResourceMapping, withCommand, withCommand, withCopyFileToContainer, withCopyToContainer, withCreateContainerCmdModifier, withEnv, withEnv, withExposedPorts, withExtraHost, withFileSystemBind, withImagePullPolicy, withLabel, withLabels, withLogConsumer, withMinimumRunningDuration, withNetwork, withNetworkAliases, withNetworkMode, withPrivilegedMode, withReuse, withSharedMemorySize, withStartupAttempts, withStartupCheckStrategy, withStartupTimeout, withTmpFs, withVolumesFrom, withWorkingDirectoryMethods inherited from interface org.testcontainers.containers.Container
addFileSystemBind, followOutput, followOutput, self, withEnv, withFileSystemBindMethods inherited from interface org.testcontainers.containers.ContainerState
copyFileFromContainer, copyFileToContainer, copyFileToContainer, execInContainer, execInContainer, execInContainer, execInContainer, execInContainerWithUser, execInContainerWithUser, getBoundPortNumbers, getContainerIpAddress, getCurrentContainerInfo, getFirstMappedPort, getHost, getLogs, getLogs, getMappedPort, isCreated, isHealthy, isRunningMethods inherited from interface org.testcontainers.lifecycle.Startable
close
-
Field Details
-
REST_PORT
public static final int REST_PORTThe Admin Server's REST port inside the container.- See Also:
-
NETWORK_ALIAS
The container's name on its Docker network, which TM1 servers register with.- See Also:
-
-
Constructor Details
-
Tm1AdminServerContainer
An Admin Server on the defaulttm1-serverimage (orTM1_SERVER_IMAGE), fromsource's TM1 install.- Parameters:
source- where TM1 comes from
-
Tm1AdminServerContainer
An Admin Server onimage, which must betm1-serveror built on it.- Parameters:
image- the image to runsource- where TM1 comes from
-
-
Method Details
-
getSource
-
getRestUrl
The Admin Server's REST API as seen from the host, e.g.http://localhost:54321/api/v1/.Serverslists the registered TM1 servers.- Returns:
- the service root, ending in
/
-
containerIsStarted
protected void containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse info) - Overrides:
containerIsStartedin classorg.testcontainers.containers.GenericContainer<Tm1AdminServerContainer>
-