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,
ScriptFilter scriptFilter)
Executes SQL scripts from specified root SQL scripts folder.
|
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, ScriptFilter scriptFilter) throws IOException, SQLException
scriptsRootFolder - Root folder containing folders with SQL scripts for all supported database systems.scriptFilter - indicates the filter to apply, including springboot or not scripts and create/drop scriptsIOExceptionSQLExceptionpublic 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–2021 JBoss by Red Hat. All rights reserved.