Tm1WebContainer
import io.skipcheck.tm1.testcontainers.Tm1WebContainer; TM1 Web (IBM Planning Analytics Spreadsheet Services) in Docker, for tests, built on
the 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. 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
withEnv to change it.
Members
DEFAULT_IMAGE static | The tm1-web image, without a tag. |
WEB_IMAGE static | Overrides the tm1-web image (not used with PrivateImage), e.g. |
HTTP_PORT static | TM1 Web's HTTP port inside the container. |
Tm1WebContainer constructor | A container on the default tm1-web image (or TM1_WEB_IMAGE), getting TM1 Web from source. |
Tm1WebContainer constructor | A container on image, which must be tm1-web or built on it. |
shared static | The TM1 Web most tests share. |
withTm1Server | Points TM1 Web at tm1's Admin Server, and starts tm1 first if it isn't running. |
withAdminServer | Lists and logs on to the TM1 servers registered with a separate Admin Server (Tm1ServerContainer.withAdminServer), instead of one server's own. |
getAdminServer | The Admin Server set with withAdminServer. |
getSource | Where TM1 Web comes from. |
getTm1Server | The TM1 server set with withTm1Server. |
getUrl | TM1 Web's address as seen from the host, e.g. |
getAdminHost | The Admin Server host TM1 Web is configured with. |
DEFAULT_IMAGE
staticDockerImageName DEFAULT_IMAGEThe tm1-web image, without a tag.
WEB_IMAGE
staticString WEB_IMAGE Overrides the tm1-web image (not used with
PrivateImage), e.g. tm1-web:local for a local build.
Read as a system property, then an environment variable.
HTTP_PORT
staticint HTTP_PORTTM1 Web's HTTP port inside the container.
Tm1WebContainer
constructorTm1WebContainer(Tm1WebSource source) A container on the default tm1-web image (or TM1_WEB_IMAGE),
getting TM1 Web from source.
Parameters
source- where TM1 Web comes from
Tm1WebContainer
constructorTm1WebContainer(DockerImageName image, Tm1WebSource source) A container on image, which must be tm1-web or built on it.
Parameters
image- the image to run
source- where TM1 Web comes from
withTm1Server
Tm1WebContainer withTm1Server(Tm1ServerContainer tm1) Points TM1 Web at tm1's Admin Server, and starts tm1 first 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
Tm1WebContainer withAdminServer(Tm1AdminServerContainer admin) Lists and logs on to the TM1 servers registered with a separate Admin Server
(Tm1ServerContainer.withAdminServer), 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
Tm1AdminServerContainer getAdminServer() The Admin Server set with withAdminServer.
Returns
- the Admin Server, or
nullif none was set
getSource
Tm1WebSource getSource()Where TM1 Web comes from.
Returns
- the source
getTm1Server
Tm1ServerContainer getTm1Server() The TM1 server set with withTm1Server.
Returns
- the server, or
nullif none was set
getUrl
String getUrl() TM1 Web's address as seen from the host, e.g.
http://localhost:54321/tm1web/.
Returns
- the URL, ending in
/
getAdminHost
String getAdminHost() The Admin Server host TM1 Web is configured with: the TM1 server's address on the
network the two share. This is the AdminHost a 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
Also in the Javadoc.