Tm1Database
import { Tm1Database } from "@skipcheck/tm1-testcontainers"; A database of a Tm1EngineContainer: what a test of TM1 v12 uses.
An engine holds instances, and an instance holds databases. The REST API of one
database is at getRestUrl; a user logs in to its instance
(login), and the session serves every database there.
Members
Tm1Database constructor | The database name of instance in engine; get one from the engine. |
getEngine | The engine this database is in. |
getInstance | The instance this database is in; tm1 unless one was named. |
getName | The database's name. |
getRestUrl | The REST API's service root as seen from the host, ending in /, e.g. |
getVersion | The version of TM1 the engine runs. |
login | A login as user; as admin, the administrator every database has, when none is named. |
oauth2Login | A login through OAuth 2.0. |
passThroughLogin | A pass-through login as the TM1 11 server's own user (its getUsername()). |
passThroughLogin | A pass-through login as a user whose password the containers know. |
passThroughLogin | A pass-through login with a name and password of your own. |
passThroughLogin | |
passThroughLoginWith | A pass-through login with an Authorization header of your own, which TM1 v12 passes on as it is. |
equals | Whether other is the same database. |
toString | The instance and the name, for logs. |
Tm1Database
constructorconstructor(engine: Tm1EngineContainer, instance: string, name: string)The database name of instance in engine; get one from the engine.
getEngine
getEngine(): Tm1EngineContainerThe engine this database is in.
getInstance
getInstance(): stringThe instance this database is in; tm1 unless one was named.
getName
getName(): stringThe database's name.
getRestUrl
getRestUrl(): stringThe REST API's service root as seen from the host, ending in /, e.g. http://localhost:54321/tm1/api/v1/Databases('planning')/.
getVersion
getVersion(): Tm1VersionThe version of TM1 the engine runs. Only available once it has started.
login
login(user: string = "admin"): Tm1LoginA login as user; as admin, the administrator every database has, when none is named. TM1 makes a session for any name; a user who isn't in this database is then refused here (403).
Parameters
user- the user's name
oauth2Login
oauth2Login(user: string): Tm1LoginA login through OAuth 2.0: as a user the engine's Keycloak knows the password of (Tm1EngineContainer.withLogin). The login gets a token from Keycloak with that password and sends it to TM1, as a program acting for the user would.
Parameters
user- the user's name
Throws
- IllegalStateException if the engine has no
Tm1EngineContainer.withOAuth2 - IllegalArgumentException if the user has no password
passThroughLogin
passThroughLogin(): Tm1LoginA pass-through login as the TM1 11 server's own user (its getUsername()): the administrator of a server with its own users, or the first administrator of one in Cognos (CAM) security. The login sends TM1 v12 what that server takes, and TM1 v12 asks it who that is.
Throws
- IllegalStateException if the engine has no
Tm1EngineContainer.withPassThrough
passThroughLogin
passThroughLogin(user: string): Tm1LoginA pass-through login as a user whose password the containers know: one of Cognos's test users when the TM1 11 server is in CAM security, and otherwise that server's own user only.
Parameters
user- the user's name on the TM1 11 server, or in Cognos
Throws
- IllegalStateException if the engine has no
Tm1EngineContainer.withPassThrough - IllegalArgumentException if the user's password isn't known
passThroughLogin
passThroughLogin(user: string, password: string): Tm1LoginA pass-through login with a name and password of your own: a user you created on the TM1 11 server, or a wrong password to see refused. They go as Basic, or as CAMNamespace when the server is in CAM security.
Parameters
user- the user's name on the TM1 11 server, or in Cognos
password- the password
Throws
- IllegalStateException if the engine has no
Tm1EngineContainer.withPassThrough
passThroughLogin
passThroughLogin(user?: string, password?: string): Tm1LoginpassThroughLoginWith
passThroughLoginWith(authorization: string): Tm1LoginA pass-through login with an Authorization header of your own, which TM1 v12 passes on as it is: "CAMPassport " + passport from a Cognos logon, say.
Parameters
authorization- the header's value
Returns
- the login, with no user name or password
Throws
- IllegalStateException if the engine has no
Tm1EngineContainer.withPassThrough
equals
equals(other: unknown): booleanWhether other is the same database: this name, in this instance of this engine.
toString
toString(): stringThe instance and the name, for logs: Tm1Database[tm1/planning].