use of org.jdbi.v3.jackson2.Jackson2Plugin in project baremaps by baremaps.
the class StudioResourceIntegrationTest method configure.
@Override
protected ResourceConfig configure() {
enable(TestProperties.LOG_TRAFFIC);
enable(TestProperties.DUMP_ENTITY);
// Create a connection to a throwaway postgres database
Connection connection;
try {
connection = DriverManager.getConnection("jdbc:tc:postgresql:13:///test");
} catch (SQLException throwables) {
throw new RuntimeException("Unable to connect to the database");
}
// Initialize the database
jdbi = Jdbi.create(connection).installPlugin(new Jackson2Plugin());
jdbi.useHandle(handle -> handle.execute("create schema studio"));
jdbi.useHandle(handle -> handle.execute("create table studio.entities (id uuid primary key, entity jsonb, kind text)"));
// Configure the service
return new ResourceConfig().register(StudioResource.class).register(new AbstractBinder() {
@Override
protected void configure() {
bind(jdbi).to(Jdbi.class);
}
});
}
Aggregations