use of org.folio.postgres.testing.PostgresTesterContainer in project raml-module-builder by folio-org.
the class PostgresClientIT method setUpClass.
@BeforeClass
public static void setUpClass(TestContext context) throws Exception {
vertx = VertxUtils.getVertxWithExceptionHandler();
PostgresClient.setPostgresTester(new PostgresTesterContainer());
PostgresClient.setExplainQueryThreshold(0);
// fail the complete test class if the connection to postgres doesn't work
PostgresClient.getInstance(vertx).execute("SELECT 1", context.asyncAssertSuccess());
}
use of org.folio.postgres.testing.PostgresTesterContainer in project raml-module-builder by folio-org.
the class DemoRamlRestTest method setUp.
/**
* @param context the test context.
*/
@BeforeClass
public static void setUp(TestContext context) {
PostgresClient.setPostgresTester(new PostgresTesterContainer());
vertx = VertxUtils.getVertxWithExceptionHandler();
port = NetworkUtils.nextFreePort();
RestAssured.port = port;
RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
tenant = new RequestSpecBuilder().addHeader("x-okapi-tenant", TENANT).build();
try {
deployRestVerticle(context);
client = new TenantClient("http://localhost:" + port, TENANT, null);
TenantAttributes ta = new TenantAttributes().withModuleTo("raml-module-builder-1.0.0");
TenantInit.exec(client, ta, 60000).onComplete(context.asyncAssertSuccess());
} catch (Exception e) {
context.fail(e);
}
}
use of org.folio.postgres.testing.PostgresTesterContainer in project raml-module-builder by folio-org.
the class AdminAPIIT method setUpClass.
@BeforeClass
public static void setUpClass() {
vertx = VertxUtils.getVertxWithExceptionHandler();
PostgresClient.setPostgresTester(new PostgresTesterContainer());
}
use of org.folio.postgres.testing.PostgresTesterContainer in project raml-module-builder by folio-org.
the class TenantAPIIT method setUpClass.
@BeforeClass
public static void setUpClass() {
vertx = VertxUtils.getVertxWithExceptionHandler();
PostgresClient.setPostgresTester(new PostgresTesterContainer());
}
use of org.folio.postgres.testing.PostgresTesterContainer in project raml-module-builder by folio-org.
the class ApiTestBase method beforeAll.
@BeforeAll
static void beforeAll() {
RestAssured.port = 9230;
RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
vertx = VertxUtils.getVertxWithExceptionHandler();
// once for all test classes: starting and tenant initialization
if (deploymentFuture.isDone()) {
return;
}
PostgresClient.setPostgresTester(new PostgresTesterContainer());
DeploymentOptions deploymentOptions = new DeploymentOptions().setConfig(new JsonObject().put("http.port", RestAssured.port));
vertx.deployVerticle(RestVerticle.class, deploymentOptions, deploy -> {
if (deploy.failed()) {
deploymentFuture.completeExceptionally(deploy.cause());
return;
}
deploymentFuture.complete(deploy.result());
});
try {
deploymentFuture.get(10, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
throw new RuntimeException(e);
}
r = given().filter(new ErrorLoggingFilter()).header("x-okapi-tenant", "testlib").contentType(ContentType.JSON);
// delete tenant (schema, tables, ...) if it exists from previous tests
TenantAttributes ta = new TenantAttributes().withPurge(true);
given(r).header("x-okapi-url-to", "http://localhost:" + port).contentType(ContentType.JSON).body(Json.encode(ta)).when().post("/_/tenant").then().statusCode(204);
List<Parameter> list = new LinkedList<>();
list.add(new Parameter().withKey("loadReference").withValue("true"));
ta = new TenantAttributes().withModuleTo("mod-api-1.0.0").withParameters(list);
// create tenant (schema, tables, ...)
String location = given(r).header("x-okapi-url-to", "http://localhost:" + port).contentType(ContentType.JSON).body(Json.encode(ta)).when().post("/_/tenant").then().statusCode(201).extract().header("Location");
given(r).header("x-okapi-url-to", "http://localhost:" + port).when().get(location + "?wait=5000").then().statusCode(200).body("error", is(nullValue()));
}
Aggregations