Class Tm1WebContainer
- All Implemented Interfaces:
AutoCloseable, org.testcontainers.containers.Container<Tm1WebContainer>, org.testcontainers.containers.ContainerState, org.testcontainers.containers.traits.LinkableContainer, org.testcontainers.containers.wait.strategy.WaitStrategyTarget, org.testcontainers.lifecycle.Startable
tm1-web image.
TM1 Web lists and logs on to the TM1 servers registered with an Admin Server, so it's
started against a Tm1ServerContainer with withTm1Server(Tm1ServerContainer). That
container's embedded Admin Server is the one TM1 Web uses. Most tests use
RequiresTm1Web, which starts one shared TM1 Web against
the shared TM1 server.
try (var tm1 = new Tm1ServerContainer(tm1Source).withSeed(Tm1Seed.SDATA);
var web = new Tm1WebContainer(webSource).withTm1Server(tm1)) {
web.start(); // starts tm1 first
return web.getUrl(); // http://localhost:54321/tm1web/
}
The image contains no IBM software, so every container needs a Tm1WebSource.
TM1 Web's default heap here is 1 GB; set the image's TM1_WEB_HEAP with
GenericContainer.withEnv(String, String) to change it.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.testcontainers.containers.Container
org.testcontainers.containers.Container.ExecResult -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.testcontainers.utility.DockerImageNameThetm1-webimage, without a tag.static final intTM1 Web's HTTP port inside the container.static final StringOverrides thetm1-webimage (not used withTm1WebSource.PrivateImage), e.g.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
ConstructorsConstructorDescriptionTm1WebContainer(Tm1WebSource source) A container on the defaulttm1-webimage (orTM1_WEB_IMAGE), getting TM1 Web fromsource.Tm1WebContainer(org.testcontainers.utility.DockerImageName image, Tm1WebSource source) A container onimage, which must betm1-webor built on it. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidcontainerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse info) The Admin Server host TM1 Web is configured with: the TM1 server's address on the network the two share.@Nullable Tm1AdminServerContainerThe Admin Server set withwithAdminServer(Tm1AdminServerContainer).Where TM1 Web comes from.@Nullable Tm1ServerContainerThe TM1 server set withwithTm1Server(Tm1ServerContainer).getUrl()TM1 Web's address as seen from the host, e.g.static Tm1WebContainershared()The TM1 Web most tests share: one per test JVM, started on first use with the sourceTm1WebSource.discover()finds, againstTm1ServerContainer.shared().Lists and logs on to the TM1 servers registered with a separate Admin Server (Tm1ServerContainer.withAdminServer(Tm1AdminServerContainer)), instead of one server's own.Points TM1 Web attm1's Admin Server, and startstm1first if it isn't running.Methods inherited from class org.testcontainers.containers.GenericContainer
addEnv, addExposedPort, addExposedPorts, addFileSystemBind, addFixedExposedPort, addFixedExposedPort, addLink, canBeReused, 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
-
DEFAULT_IMAGE
public static final org.testcontainers.utility.DockerImageName DEFAULT_IMAGEThetm1-webimage, without a tag. -
WEB_IMAGE
Overrides thetm1-webimage (not used withTm1WebSource.PrivateImage), e.g.tm1-web:localfor a local build. Read as a system property, then an environment variable.- See Also:
-
HTTP_PORT
public static final int HTTP_PORTTM1 Web's HTTP port inside the container.- See Also:
-
-
Constructor Details
-
Tm1WebContainer
A container on the defaulttm1-webimage (orTM1_WEB_IMAGE), getting TM1 Web fromsource.- Parameters:
source- where TM1 Web comes from
-
Tm1WebContainer
A container onimage, which must betm1-webor built on it.- Parameters:
image- the image to runsource- where TM1 Web comes from
-
-
Method Details
-
withTm1Server
Points TM1 Web attm1's Admin Server, and startstm1first if it isn't running.The two containers have to share a Docker network. A server that isn't started yet and has no network is given one of its own. A server that's already running (such as the shared one) is joined on the network it's on, including Docker's default bridge network.
- Parameters:
tm1- the TM1 server whose Admin Server TM1 Web lists servers from- Returns:
- this container
-
withAdminServer
Lists and logs on to the TM1 servers registered with a separate Admin Server (Tm1ServerContainer.withAdminServer(Tm1AdminServerContainer)), instead of one server's own. Takes precedence over the Admin Server of a TM1 server. The two containers share a Docker network, and starting TM1 Web starts the Admin Server first; start the TM1 servers before TM1 Web too, so they're listed.- Parameters:
admin- the Admin Server to list servers from- Returns:
- this container
-
getAdminServer
The Admin Server set withwithAdminServer(Tm1AdminServerContainer).- Returns:
- the Admin Server, or
nullif none was set
-
getSource
-
getTm1Server
The TM1 server set withwithTm1Server(Tm1ServerContainer).- Returns:
- the server, or
nullif none was set
-
getUrl
TM1 Web's address as seen from the host, e.g.http://localhost:54321/tm1web/.- Returns:
- the URL, ending in
/
-
getAdminHost
The Admin Server host TM1 Web is configured with: the TM1 server's address on the network the two share. This is theAdminHosta TM1 Web login, or a TM1 Web URL API link, names.- Returns:
- the Admin Server host
- Throws:
IllegalStateException- if no TM1 server was set or the container isn't started yet
-
configure
protected void configure()- Overrides:
configurein classorg.testcontainers.containers.GenericContainer<Tm1WebContainer>
-
containerIsStarted
protected void containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse info) - Overrides:
containerIsStartedin classorg.testcontainers.containers.GenericContainer<Tm1WebContainer>