tm1-testcontainers 0.1.1 API
Run your tests against a real IBM Planning Analytics (TM1) server in Docker, with
Testcontainers. No IBM software is included: you supply
your own licensed TM1 Server for Linux, and tests that need TM1 are skipped without it.
Getting started
Add it to your tests. Gradle:
testImplementation("io.skipcheck:tm1-testcontainers:0.1.1")Maven:
<dependency> <groupId>io.skipcheck</groupId> <artifactId>tm1-testcontainers</artifactId> <version>0.1.1</version> <scope>test</scope> </dependency>Tell it where your TM1 is. The quickest way is the folder holding IBM's
tm1server-*-linuxi38664h_bundle.tar.gzdownload, with Docker running:TM1_BUNDLE_DIR=~/Downloads ./gradlew testTm1Sourcelists the other ways, such as an installed TM1 or a private image, which start in seconds.Write a test.
@RequiresTm1starts a TM1 server for the test run, shares it between test classes, and skips the tests when Docker or TM1 isn't available:@RequiresTm1 static class HelloTm1Test { @Test void connects(Tm1ServerContainer server) { Tm1Client tm1 = Tm1Client.builder() .baseUrl(server.getRestUrl()) .basicAuth(server.getUsername(), server.getPassword()) .build(); try { assertNotNull(tm1.session().version().block(Duration.ofSeconds(30))); } finally { tm1.close().block(Duration.ofSeconds(30)); } } }
Where next
RequiresTm1: test classes in full, and skipping by TM1 version.Tm1ServerContainer: a server of your own, with the sample data or your own database.PlanningAnalyticsEnvironment: several servers, TM1 Web, Workspace and Cognos security together.- tm1-client: the client the tests use.
Packages
Package
Description
A Testcontainers module for TM1, and the JUnit extension that runs tests against it.