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

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The container's name on its Docker network, which TM1 servers register with.
    static final int
    The 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, waitStrategy

    Fields inherited from interface org.testcontainers.containers.ContainerState

    STATE_HEALTHY
  • Constructor Summary

    Constructors
    Constructor
    Description
    An Admin Server on the default tm1-server image (or TM1_SERVER_IMAGE), from source's TM1 install.
    Tm1AdminServerContainer(org.testcontainers.utility.DockerImageName image, Tm1Source source)
    An Admin Server on image, which must be tm1-server or built on it.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    containerIsStarted(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, withWorkingDirectory

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.testcontainers.containers.Container

    addFileSystemBind, followOutput, followOutput, self, withEnv, withFileSystemBind

    Methods 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, isRunning

    Methods inherited from interface org.testcontainers.lifecycle.Startable

    close
  • Field Details

    • REST_PORT

      public static final int REST_PORT
      The Admin Server's REST port inside the container.
      See Also:
    • NETWORK_ALIAS

      public static final String NETWORK_ALIAS
      The container's name on its Docker network, which TM1 servers register with.
      See Also:
  • Constructor Details

    • Tm1AdminServerContainer

      public Tm1AdminServerContainer(Tm1Source source)
      An Admin Server on the default tm1-server image (or TM1_SERVER_IMAGE), from source's TM1 install.
      Parameters:
      source - where TM1 comes from
    • Tm1AdminServerContainer

      public Tm1AdminServerContainer(org.testcontainers.utility.DockerImageName image, Tm1Source source)
      An Admin Server on image, which must be tm1-server or built on it.
      Parameters:
      image - the image to run
      source - where TM1 comes from
  • Method Details

    • getSource

      public Tm1Source getSource()
      Where TM1 comes from.
      Returns:
      the source
    • getRestUrl

      public String getRestUrl()
      The Admin Server's REST API as seen from the host, e.g. http://localhost:54321/api/v1/. Servers lists the registered TM1 servers.
      Returns:
      the service root, ending in /
    • containerIsStarted

      protected void containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse info)
      Overrides:
      containerIsStarted in class org.testcontainers.containers.GenericContainer<Tm1AdminServerContainer>