skipcheck

TM1 Testcontainers · Docs · Containers

PawContainer

import io.skipcheck.tm1.testcontainers.PawContainer;

IBM Planning Analytics Workspace (PAW) Local in Docker, for tests, started from the user's own PAW Local zip against a Tm1ServerContainer.

try (var tm1 = new Tm1ServerContainer(tm1Source);
        var paw = new PawContainer(pawSource).withTm1Server(tm1).acceptLicense()) {
    paw.start(); // starts tm1 first
    return paw.getUrl(); // http://localhost:54321/
}

IBM ships PAW Local as about 30 Docker images, with compose files and a paw.sh that starts them, in ipa_workspace_local_<release>.<build>.zip. This class uses those as they are, never rebuilding or republishing them. It runs docker/paw/paw-local.sh, which unpacks the zip, loads the images when any is missing, writes PAW's configuration and runs IBM's paw.sh, inside a small Linux "runner" container that talks to the Docker daemon. So it works the same on Windows, macOS and Linux: the host needs only Docker. The unpacked zip and PAW's secrets live in the Docker volume tm1-paw-home, and IBM's compose files mount files from it by its path on the Docker host.

Users log on to PAW as users of the TM1 server (PAAuthMode=tm1). PAW is configured with the server's address on its network, and every PAW container is connected to that network too, because PAW calls TM1 at the address the Admin Server advertises.

When the TM1 server runs in Cognos (CAM) security (Tm1ServerContainer.withCamSecurity), PAW does too (PAAuthMode=cam), as pa-setup wires it: users log on through Cognos, in the TM1 server's namespace. PAW checks logons with Cognos's dispatcher on the network (http://cognos:9300), and sends browsers to Cognos's address on the host to log on. Tests log on with a Cognos test user's name and password, which PAW checks with Cognos. A browser that logs on through Cognos isn't sent back to PAW, though: Cognos hands logons back only to the addresses in IBM's pmhub.html, which CognosContainer doesn't install (pa-setup does, with COGNOS_PMHUB_URLS).

Things to know:

  • The license: starting fails unless IBM's PAW license is accepted, with acceptLicense or by setting PAW_ACCEPT_LICENSE=true.
  • One PAW per Docker daemon: IBM's compose files give every container a fixed name, under the compose project paw. Most tests share one, with RequiresPaw.
  • Heavy: PAW needs about 15 GB of memory. The first start loads about 8 GB of images, which takes a few minutes; later starts take about a minute.
  • Cleanup: stop removes the PAW containers and keeps PAW's data. IBM's containers carry no Testcontainers labels, so if the JVM dies they keep running, and the next start reuses them.
  • linux/amd64 only: on Apple Silicon, IBM's images run under Rosetta.

Members

ACCEPT_LICENSE staticAccepts IBM's license for PAW when true.
HOME_VOLUME staticThe Docker volume holding the unpacked PAW Local zip and PAW's secrets, shared by every PAW started this way.
PawContainer constructorA PAW started from source's zip.
shared staticThe PAW most tests share.
withTm1ServerLogs PAW users on to tm1, and lists servers from its Admin Server.
withAdminServerLists servers from a separate Admin Server (Tm1ServerContainer.withAdminServer) instead of the TM1 server's own.
acceptLicenseAccepts IBM's license for Planning Analytics Workspace, which is in the PAW Local zip as licenses/LA_en.
withSettingSets one of paw-local.sh's PAW_* settings, such as PAW_JVM_ARGS or PAW_TM1WEB_URL.
withStartupTimeoutHow long start may take to load IBM's images and start PAW.
getSourceWhere PAW comes from.
getTm1ServerThe TM1 server set with withTm1Server.
isRunningWhether PAW is started.
getUrlPAW's address as seen from the host, e.g.
startStarts the TM1 server if needed, then PAW, and waits until a TM1 call through PAW works.
stopRemoves the PAW containers, keeping PAW's data.
toString

ACCEPT_LICENSE

static
String ACCEPT_LICENSE

Accepts IBM's license for PAW when true. Read as a system property, then an environment variable.

HOME_VOLUME

static
String HOME_VOLUME

The Docker volume holding the unpacked PAW Local zip and PAW's secrets, shared by every PAW started this way.

PawContainer

constructor
PawContainer(PawSource source)

A PAW started from source's zip.

Parameters

source
the PAW Local zip

shared

static
static PawContainer shared()

The PAW most tests share: one per test JVM, started on first use with the source PawSource.discover finds, against Tm1ServerContainer.shared. It's never stopped, so the next test JVM finds it running and starts in seconds.

Returns

the started shared PAW

If starting it fails, later calls in the same JVM fail at once with the same error, rather than each waiting for PAW again.

Throws

IllegalStateException
if no PAW or TM1 source is configured, or the license isn't accepted

withTm1Server

PawContainer withTm1Server(Tm1ServerContainer tm1)

Logs PAW users on to tm1, and lists servers from its Admin Server. Starts tm1 first if it isn't running.

Parameters

tm1
the TM1 server

Returns

this container

withAdminServer

PawContainer withAdminServer(Tm1AdminServerContainer admin)

Lists servers from a separate Admin Server (Tm1ServerContainer.withAdminServer) instead of the TM1 server's own. Users still log on through that TM1 server, which must be registered with this Admin Server and on its network.

Parameters

admin
the Admin Server PAW lists servers from

Returns

this container

acceptLicense

PawContainer acceptLicense()

Accepts IBM's license for Planning Analytics Workspace, which is in the PAW Local zip as licenses/LA_en. IBM's own setup asks for this in its admin tool, which this class skips.

Returns

this container

withSetting

PawContainer withSetting(String name, String value)

Sets one of paw-local.sh's PAW_* settings, such as PAW_JVM_ARGS or PAW_TM1WEB_URL. The TM1 server, ports, network and paths are set by this class.

Parameters

name
the setting, starting with PAW_
value
its value

Returns

this container

withStartupTimeout

PawContainer withStartupTimeout(Duration timeout)

How long start may take to load IBM's images and start PAW. Default: 20 minutes, since the first start loads about 8 GB of images.

Parameters

timeout
the time allowed

Returns

this container

getSource

PawSource getSource()

Where PAW comes from.

Returns

the source

getTm1Server

Tm1ServerContainer getTm1Server()

The TM1 server set with withTm1Server.

Returns

the server, or null if none was set

isRunning

boolean isRunning()

Whether PAW is started.

Returns

true between start and stop

getUrl

String getUrl()

PAW's address as seen from the host, e.g. http://localhost:54321/.

Returns

the URL, ending in /

Throws

IllegalStateException
if PAW isn't started

start

void start()

Starts the TM1 server if needed, then PAW, and waits until a TM1 call through PAW works.

Throws

IllegalStateException
if the license isn't accepted or no TM1 server is set

stop

void stop()

Removes the PAW containers, keeping PAW's data.

toString

String toString()

Also in the Javadoc.