public abstract class JdbiRule
extends org.junit.rules.ExternalResource
@Rule to manage a Jdbi instance pointed to a managed database.| Constructor and Description |
|---|
JdbiRule() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
after() |
<T> T |
attach(Class<T> extension)
Attach an extension (such as a SqlObject) to the managed handle.
|
protected void |
before() |
protected abstract Jdbi |
createJdbi() |
static JdbiRule |
embeddedPostgres()
Create a JdbiRule with an embedded Postgres instance.
|
Handle |
getHandle()
Get the single Handle instance opened for the duration of this test case.
|
Jdbi |
getJdbi()
Get Jdbi, in case you want to open additional handles to the same data source.
|
static JdbiRule |
h2()
Create a JdbiRule with an in-memory H2 database instance.
|
JdbiRule |
withPlugin(JdbiPlugin plugin)
Install a plugin into JdbiRule.
|
JdbiRule |
withPlugins()
Discover and install plugins from the classpath.
|
protected abstract Jdbi createJdbi()
public static JdbiRule embeddedPostgres()
otj-pg-embedded artifact.public static JdbiRule h2()
h2 database artifact.public JdbiRule withPlugins()
public JdbiRule withPlugin(JdbiPlugin plugin)
protected void before()
throws Throwable
before in class org.junit.rules.ExternalResourceThrowableprotected void after()
after in class org.junit.rules.ExternalResourcepublic Jdbi getJdbi()
public Handle getHandle()
public <T> T attach(Class<T> extension)
Copyright © 2018. All rights reserved.