skipcheck

TM1 Testcontainers · Docs · Containers

PawContainer

import { PawContainer } from "@skipcheck/tm1-testcontainers";

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

await using tm1 = new Tm1ServerContainer(tm1Source);
await using paw = new PawContainer(pawSource).withTm1Server(tm1).acceptLicense();
await 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 propertyAccepts IBM's license for PAW when true.
HOME_VOLUME propertyThe Docker volume holding the unpacked PAW Local zip and PAW's secrets, shared by every PAW started this way.
PAW_NETWORK propertyThe network IBM's compose files put PAW on.
ADMIN_PORT propertyThe Admin Server's REST port in a Tm1ServerContainer.
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 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.
licenseAcceptedWhether acceptLicense or PAW_ACCEPT_LICENSE=true accepted IBM's license.
settingsThe settings set with withSetting.
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, in milliseconds.
getSourceWhere PAW comes from.
getTm1ServerThe TM1 server set with withTm1Server, or undefined.
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.
scriptSettingspaw-local.sh's settings for PAW against the TM1 server, without the ports.
stopRemoves the PAW containers, keeping PAW's data.
[Symbol.asyncDispose]Stops it, for await using.
licenseAcceptedBySetting staticWhether IBM's PAW license is accepted by the PAW_ACCEPT_LICENSE setting.
script staticpaw-local.sh, as this package ships it (or, in this repository, docker/paw's).
toStringWhere PAW comes from, and its address once it runs, for logs.

ACCEPT_LICENSE

property
static ACCEPT_LICENSE

Accepts IBM's license for PAW when true.

HOME_VOLUME

property
static HOME_VOLUME

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

PAW_NETWORK

property
static PAW_NETWORK

The network IBM's compose files put PAW on.

ADMIN_PORT

property
static ADMIN_PORT

The Admin Server's REST port in a Tm1ServerContainer.

PawContainer

constructor
constructor(source: PawSource)

A PAW started from source's zip.

shared

static
static shared(): Promise<PawContainer>

The PAW most tests share: one per test run, started on first use with the source PawSource.discover finds, against Tm1ServerContainer.shared. If starting it fails, later calls in the same run 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

withTm1Server(tm1: Tm1ServerContainer): this

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

withAdminServer

withAdminServer(admin: Tm1AdminServerContainer): this

Lists servers from a separate Admin Server 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.

acceptLicense

acceptLicense(): this

Accepts IBM's license for Planning Analytics Workspace, which is in the PAW Local zip as licenses/LA_en.

licenseAccepted

licenseAccepted(): boolean

Whether acceptLicense or PAW_ACCEPT_LICENSE=true accepted IBM's license.

settings

settings(): ReadonlyMap<string, string>

The settings set with withSetting.

withSetting

withSetting(name: string, value: string): this

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.

Throws

IllegalArgumentException if name doesn't start with PAW_

withStartupTimeout

withStartupTimeout(timeout: number): this

How long start may take to load IBM's images and start PAW, in milliseconds. Default: 20 minutes.

getSource

getSource(): PawSource

Where PAW comes from.

getTm1Server

getTm1Server(): Tm1ServerContainer | undefined

The TM1 server set with withTm1Server, or undefined.

isRunning

isRunning(): boolean

Whether PAW is started: true between start and stop.

getUrl

getUrl(): string

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

Throws

IllegalStateException if PAW isn't started

start

start(): Promise<void>

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

scriptSettings

scriptSettings(tm1Address: string, adminAddress: string, cognosUrl: string | undefined): Record<string, string>

paw-local.sh's settings for PAW against the TM1 server, without the ports: the caller's own, then this class's wiring. With the server in CAM security, PAW logs users on through its Cognos and namespace.

Parameters

tm1Address
the TM1 server's address on its network
adminAddress
the Admin Server's address on that network
cognosUrl
Cognos as the host sees it (CognosContainer.getUrl()), where PAW sends browsers to log on; undefined unless the server is in CAM security

stop

stop(): Promise<void>

Removes the PAW containers, keeping PAW's data.

[Symbol.asyncDispose]

[Symbol.asyncDispose](): Promise<void>

Stops it, for await using: the same as stop.

licenseAcceptedBySetting

static
static licenseAcceptedBySetting(): boolean

Whether IBM's PAW license is accepted by the PAW_ACCEPT_LICENSE setting.

script

static
static script(): Buffer

paw-local.sh, as this package ships it (or, in this repository, docker/paw's).

toString

toString(): string

Where PAW comes from, and its address once it runs, for logs.