Search in sources :

Example 6 with PostgresTesterContainer

use of org.folio.postgres.testing.PostgresTesterContainer in project raml-module-builder by folio-org.

the class PostgresClientITBase method setUpClass.

protected static void setUpClass(TestContext context) throws Exception {
    vertx = VertxUtils.getVertxWithExceptionHandler();
    PostgresClient.setPostgresTester(new PostgresTesterContainer());
    dropSchemaAndRole(context);
    executeSuperuser(context, "CREATE ROLE " + schema + " PASSWORD '" + tenant + "' NOSUPERUSER NOCREATEDB INHERIT LOGIN", "CREATE SCHEMA " + schema + " AUTHORIZATION " + schema, "GRANT ALL PRIVILEGES ON SCHEMA " + schema + " TO " + schema);
    LoadGeneralFunctions.loadFuncs(context, PostgresClient.getInstance(vertx), schema);
}
Also used : PostgresTesterContainer(org.folio.postgres.testing.PostgresTesterContainer)

Example 7 with PostgresTesterContainer

use of org.folio.postgres.testing.PostgresTesterContainer in project raml-module-builder by folio-org.

the class PgUtilIT method setUpClass.

@BeforeClass
public static void setUpClass(TestContext context) throws Exception {
    PostgresClient.setPostgresTester(new PostgresTesterContainer());
    vertx = VertxUtils.getVertxWithExceptionHandler();
    createUserTable(context);
}
Also used : PostgresTesterContainer(org.folio.postgres.testing.PostgresTesterContainer) BeforeClass(org.junit.BeforeClass)

Example 8 with PostgresTesterContainer

use of org.folio.postgres.testing.PostgresTesterContainer in project raml-module-builder by folio-org.

the class ConnIT method setUp.

@BeforeAll
static void setUp(Vertx vertx, VertxTestContext vtc) {
    PostgresClient.setPostgresTester(new PostgresTesterContainer());
    String sql = "DROP SCHEMA IF EXISTS tenant_raml_module_builder CASCADE;\n" + "DO $$\n" + "  BEGIN\n" + "    CREATE ROLE tenant_raml_module_builder PASSWORD 'tenant' NOSUPERUSER NOCREATEDB INHERIT LOGIN;\n" + "  EXCEPTION WHEN OTHERS THEN NULL;\n" + "  END $$;\n" + "CREATE SCHEMA tenant_raml_module_builder AUTHORIZATION tenant_raml_module_builder;\n" + "GRANT ALL PRIVILEGES ON SCHEMA tenant_raml_module_builder TO tenant_raml_module_builder;\n" + "CREATE TABLE tenant_raml_module_builder.t (id UUID PRIMARY KEY , jsonb JSONB NOT NULL);\n" + "GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA tenant_raml_module_builder TO tenant_raml_module_builder;\n";
    PostgresClient admin = PostgresClient.getInstance(vertx);
    admin.execute(sql).compose(x -> LoadGeneralFunctions.loadFuncs(admin, "tenant_raml_module_builder")).onSuccess(x -> postgresClient = PostgresClient.getInstance(vertx, "tenant")).onComplete(vtc.succeedingThenComplete());
}
Also used : VertxTestContext(io.vertx.junit5.VertxTestContext) BeforeEach(org.junit.jupiter.api.BeforeEach) CsvSource(org.junit.jupiter.params.provider.CsvSource) CQLWrapper(org.folio.rest.persist.cql.CQLWrapper) BiFunction(java.util.function.BiFunction) PostgresTesterContainer(org.folio.postgres.testing.PostgresTesterContainer) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) WithAssertions(org.assertj.core.api.WithAssertions) Function(java.util.function.Function) Supplier(java.util.function.Supplier) Timeout(io.vertx.junit5.Timeout) AfterAll(org.junit.jupiter.api.AfterAll) CQL2PgJSONException(org.folio.cql2pgjson.exception.CQL2PgJSONException) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) BeforeAll(org.junit.jupiter.api.BeforeAll) JsonObject(io.vertx.core.json.JsonObject) AsyncResult(io.vertx.core.AsyncResult) Vertx(io.vertx.core.Vertx) UUID(java.util.UUID) VertxExtension(io.vertx.junit5.VertxExtension) Future(io.vertx.core.Future) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.jupiter.api.Test) Mockito(org.mockito.Mockito) JsonArray(io.vertx.core.json.JsonArray) CQL2PgJSON(org.folio.cql2pgjson.CQL2PgJSON) PgConnection(io.vertx.pgclient.PgConnection) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Handler(io.vertx.core.Handler) Collections(java.util.Collections) PostgresTesterContainer(org.folio.postgres.testing.PostgresTesterContainer) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 9 with PostgresTesterContainer

use of org.folio.postgres.testing.PostgresTesterContainer in project raml-module-builder by folio-org.

the class PostgresClientIT method doesNotCompleteOnWindows.

@BeforeClass
public static void doesNotCompleteOnWindows() {
    final String os = System.getProperty("os.name").toLowerCase();
    PostgresClient.setPostgresTester(new PostgresTesterContainer());
    // RMB-261
    org.junit.Assume.assumeFalse(os.contains("win"));
}
Also used : PostgresTesterContainer(org.folio.postgres.testing.PostgresTesterContainer) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) BeforeClass(org.junit.BeforeClass)

Aggregations

PostgresTesterContainer (org.folio.postgres.testing.PostgresTesterContainer)9 BeforeClass (org.junit.BeforeClass)5 JsonObject (io.vertx.core.json.JsonObject)2 TenantAttributes (org.folio.rest.jaxrs.model.TenantAttributes)2 BeforeAll (org.junit.jupiter.api.BeforeAll)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 RequestSpecBuilder (io.restassured.builder.RequestSpecBuilder)1 ErrorLoggingFilter (io.restassured.filter.log.ErrorLoggingFilter)1 AsyncResult (io.vertx.core.AsyncResult)1 DeploymentOptions (io.vertx.core.DeploymentOptions)1 Future (io.vertx.core.Future)1 Handler (io.vertx.core.Handler)1 Vertx (io.vertx.core.Vertx)1 JsonArray (io.vertx.core.json.JsonArray)1 Timeout (io.vertx.junit5.Timeout)1 VertxExtension (io.vertx.junit5.VertxExtension)1 VertxTestContext (io.vertx.junit5.VertxTestContext)1 PgConnection (io.vertx.pgclient.PgConnection)1 Collections (java.util.Collections)1 LinkedList (java.util.LinkedList)1