public class PersistenceUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ALLOW_LOCAL_TXS |
static String |
DATABASE_NAME |
static String |
DATASOURCE |
static String |
DATASOURCE_CLASS_NAME |
protected static String |
DATASOURCE_PROPERTIES |
static String |
DRIVER_CLASS_NAME |
static String |
DROOLS_LOCAL_PERSISTENCE_UNIT_NAME |
static String |
DROOLS_PERSISTENCE_UNIT_NAME |
static String |
JBPM_LOCAL_PERSISTENCE_UNIT_NAME |
static String |
JBPM_PERSISTENCE_UNIT_NAME |
static String |
JDBC_URL |
static String |
MAX_POOL_SIZE |
static String |
PASSWORD |
static String |
SERVER_NAME |
static String |
SERVER_PORT |
static String |
USER |
| Constructor and Description |
|---|
PersistenceUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
cleanUp(Map<String,Object> context)
This method should be called in the @After method of a test to clean up
the persistence unit and datasource.
|
static org.kie.api.runtime.Environment |
createEnvironment(Map<String,Object> context) |
static org.kie.api.runtime.KieSession |
createKieSessionFromKBase(org.kie.api.KieBase kbase,
Map<String,Object> context) |
static Properties |
getDatasourceProperties()
This reads in the (maven filtered) datasource properties from the test
resource directory.
|
static org.kie.test.util.db.PoolingDataSourceWrapper |
setupPoolingDataSource(Properties dsProps)
This method uses the "jdbc/testDS1" datasource, which is the default.
|
static org.kie.test.util.db.PoolingDataSourceWrapper |
setupPoolingDataSource(Properties dsProps,
String datasourceName)
This sets up a PoolingDataSourceWrapper.
|
static HashMap<String,Object> |
setupWithPoolingDataSource(String persistenceUnitName) |
static HashMap<String,Object> |
setupWithPoolingDataSource(String persistenceUnitName,
String dataSourceName)
This method does all of the setup for the test and returns a HashMap
containing the persistence objects that the test might need.
|
static void |
startH2TcpServer(Properties datasourceProperties)
This method starts H2 database server (tcp).
|
static void |
stopH2TcpServer()
This method stops H2 database server (tcp).
|
static boolean |
useTransactions()
This method returns whether or not transactions should be used when
dealing with the SessionInfo object (or any other persisted entity that
contains @Lob's )
|
public static final String DROOLS_PERSISTENCE_UNIT_NAME
public static final String DROOLS_LOCAL_PERSISTENCE_UNIT_NAME
public static final String JBPM_PERSISTENCE_UNIT_NAME
public static final String JBPM_LOCAL_PERSISTENCE_UNIT_NAME
protected static final String DATASOURCE_PROPERTIES
public static final String MAX_POOL_SIZE
public static final String ALLOW_LOCAL_TXS
public static final String SERVER_NAME
public static final String SERVER_PORT
public static final String DATABASE_NAME
public static final String DATASOURCE_CLASS_NAME
public static final String DRIVER_CLASS_NAME
public static final String USER
public static final String PASSWORD
public static final String JDBC_URL
public static final String DATASOURCE
public static HashMap<String,Object> setupWithPoolingDataSource(String persistenceUnitName)
persistenceUnitName - The name of the persistence unit to be used.setupWithPoolingDataSource(String, String)public static HashMap<String,Object> setupWithPoolingDataSource(String persistenceUnitName, String dataSourceName)
persistenceUnitName - The name of the persistence unit used by the test.public static void startH2TcpServer(Properties datasourceProperties)
datasourceProperties - The properties used to setup the data source.public static void stopH2TcpServer()
public static void cleanUp(Map<String,Object> context)
context - A HashMap generated by
setupWithPoolingDataSource(String)public static org.kie.test.util.db.PoolingDataSourceWrapper setupPoolingDataSource(Properties dsProps)
dsProps - The properties used to setup the data source.public static org.kie.test.util.db.PoolingDataSourceWrapper setupPoolingDataSource(Properties dsProps, String datasourceName)
public static Properties getDatasourceProperties()
public static boolean useTransactions()
public static org.kie.api.runtime.Environment createEnvironment(Map<String,Object> context)
Copyright © 2001–2021 JBoss by Red Hat. All rights reserved.