public class TestPersistenceContextBase extends Object
Modifier and Type | Field and Description |
---|---|
protected HashMap<String,Object> |
context |
protected DatabaseType |
databaseType |
protected static String |
DATASOURCE_PROPERTIES |
protected Properties |
dataSourceProperties |
protected javax.persistence.EntityManagerFactory |
entityManagerFactory |
protected org.kie.api.runtime.Environment |
environment |
protected org.drools.persistence.jta.JtaTransactionManager |
transactionManager |
Constructor and Description |
---|
TestPersistenceContextBase() |
Modifier and Type | Method and Description |
---|---|
void |
clean()
Cleans up this persistence context.
|
static TestPersistenceContextBase |
createAndInitContext(PersistenceUnit persistenceUnit) |
void |
executeScripts(File scriptsRootFolder,
boolean createFiles)
Executes SQL scripts from specified root SQL scripts folder.
|
void |
executeScripts(File scriptsRootFolder,
boolean createFiles,
String type) |
DatabaseType |
getDatabaseType() |
int |
getStoredProcessesCount()
Reads stored processes count from database.
|
int |
getStoredSessionsCount()
Reads stored sessions count from database.
|
void |
init(PersistenceUnit persistenceUnit)
Initializes persistence context from specified persistence unit.
|
org.kie.internal.runtime.StatefulKnowledgeSession |
loadPersistedSession(Long sessionId,
String processIdForKieBase)
Loads persisted session from database.
|
void |
startAndPersistSomeProcess(String processId)
Starts and persists a basic simple process using current database entities.
|
protected void |
testIsInitialized()
Checks if this persistence context is initialized.
|
protected static final String DATASOURCE_PROPERTIES
protected javax.persistence.EntityManagerFactory entityManagerFactory
protected org.drools.persistence.jta.JtaTransactionManager transactionManager
protected org.kie.api.runtime.Environment environment
protected Properties dataSourceProperties
protected final DatabaseType databaseType
public static TestPersistenceContextBase createAndInitContext(PersistenceUnit persistenceUnit)
public DatabaseType getDatabaseType()
public void init(PersistenceUnit persistenceUnit)
persistenceUnit
- Persistence unit which is used to initialize this persistence context.public void clean()
public void executeScripts(File scriptsRootFolder, boolean createFiles) throws IOException, SQLException
scriptsRootFolder
- Root folder containing folders with SQL scripts for all supported database systems.createFiles
- indicates if files with create statements are included (true) or drop statements (false)IOException
SQLException
public void executeScripts(File scriptsRootFolder, boolean createFiles, String type) throws IOException, SQLException
IOException
SQLException
public void startAndPersistSomeProcess(String processId)
processId
- Process identifier. This identifier is also used to generate KieBase
(process with this identifier is part of generated KieBase).public org.kie.internal.runtime.StatefulKnowledgeSession loadPersistedSession(Long sessionId, String processIdForKieBase)
sessionId
- Unique identifier of the session.processIdForKieBase
- Process identifier for KieBase generation. A KieBase is generated for
loaded session and this KieBase contains process with this identifier.public int getStoredProcessesCount()
public int getStoredSessionsCount()
protected void testIsInitialized()
Copyright © 2001–2020 JBoss by Red Hat. All rights reserved.