org.jbpm.test
public abstract class JbpmJUnitBaseTestCase extends AbstractBaseTest
EntityManagerFactory
, cleans up Singleton's session idEntityManagerFactory
and data source, disposes RuntimeEngine
's and RuntimeManager
RuntimeManager
for gives set of assets and selected strategy
RuntimeManager
currently active in the scope of test
RuntimeEngine
for given contextEntityManagerFactory
Modifier and Type | Class and Description |
---|---|
protected static class |
JbpmJUnitBaseTestCase.TestWorkItemHandler |
Constructor and Description |
---|
JbpmJUnitBaseTestCase()
The most simple test case configuration:
does NOT initialize data source
does NOT configure session persistence
This is usually used for in memory process management, without human task interaction.
|
JbpmJUnitBaseTestCase(boolean setupDataSource,
boolean sessionPersistence)
Allows to explicitly configure persistence and data source.
|
JbpmJUnitBaseTestCase(boolean setupDataSource,
boolean sessionPersistence,
String persistenceUnitName)
Same as
JbpmJUnitBaseTestCase(boolean, boolean) but allows to use another persistence unit name. |
Modifier and Type | Method and Description |
---|---|
void |
assertNodeActive(long processInstanceId,
org.kie.api.runtime.KieSession ksession,
String... name) |
void |
assertNodeExists(org.kie.api.runtime.process.ProcessInstance process,
String... nodeNames) |
void |
assertNodeTriggered(long processInstanceId,
String... nodeNames) |
void |
assertNumOfIncommingConnections(org.kie.api.runtime.process.ProcessInstance process,
String nodeName,
int num) |
void |
assertNumOfOutgoingConnections(org.kie.api.runtime.process.ProcessInstance process,
String nodeName,
int num) |
void |
assertPackageNameEquals(org.kie.api.runtime.process.ProcessInstance process,
String packageName) |
void |
assertProcessInstanceAborted(long processInstanceId,
org.kie.api.runtime.KieSession ksession) |
void |
assertProcessInstanceActive(long processInstanceId,
org.kie.api.runtime.KieSession ksession) |
void |
assertProcessInstanceCompleted(long processInstanceId,
org.kie.api.runtime.KieSession ksession) |
void |
assertProcessNameEquals(org.kie.api.runtime.process.ProcessInstance process,
String name) |
void |
assertProcessVarExists(org.kie.api.runtime.process.ProcessInstance process,
String... processVarNames) |
void |
assertVersionEquals(org.kie.api.runtime.process.ProcessInstance process,
String version) |
protected static void |
cleanupSingletonSessionId() |
protected void |
clearHistory() |
protected org.kie.api.runtime.manager.RuntimeManager |
createRuntimeManager(org.jbpm.test.JbpmJUnitBaseTestCase.Strategy strategy,
Map<String,org.kie.api.io.ResourceType> resources)
Creates default configuration of
RuntimeManager with given strategy and all
resources being added to knowledge base. |
protected org.kie.api.runtime.manager.RuntimeManager |
createRuntimeManager(org.jbpm.test.JbpmJUnitBaseTestCase.Strategy strategy,
Map<String,org.kie.api.io.ResourceType> resources,
org.kie.internal.runtime.manager.RuntimeEnvironment environment)
The lowest level of creation of
RuntimeManager that expects to get RuntimeEnvironment
to be given as argument. |
protected org.kie.api.runtime.manager.RuntimeManager |
createRuntimeManager(org.jbpm.test.JbpmJUnitBaseTestCase.Strategy strategy,
String... process)
Creates default configuration of
RuntimeManager with given strategy and all
processes being added to knowledge base. |
protected org.kie.api.runtime.manager.RuntimeManager |
createRuntimeManager(Map<String,org.kie.api.io.ResourceType> resources)
Creates default configuration of
RuntimeManager with SINGLETON strategy and all
resources being added to knowledge base. |
protected org.kie.api.runtime.manager.RuntimeManager |
createRuntimeManager(String... process)
Creates default configuration of
RuntimeManager with SINGLETON strategy and all
processes being added to knowledge base. |
protected void |
disposeRuntimeManager()
Disposes currently active (in scope of a test)
RuntimeManager together with all
active RuntimeEngine 's that were created (in scope of a test). |
protected DataSource |
getDs() |
protected javax.persistence.EntityManagerFactory |
getEmf() |
protected org.kie.api.runtime.manager.RuntimeEngine |
getRuntimeEngine()
Returns new
RuntimeEngine built from the manager of this test case. |
protected org.kie.api.runtime.manager.RuntimeEngine |
getRuntimeEngine(org.kie.api.runtime.manager.Context<?> context)
Returns new
RuntimeEngine built from the manager of this test case. |
protected JbpmJUnitBaseTestCase.TestWorkItemHandler |
getTestWorkItemHandler() |
Object |
getVariableValue(String name,
long processInstanceId,
org.kie.api.runtime.KieSession ksession)
Retrieves value of the variable given by
name from process instance given by processInstanceId
using given session. |
void |
setUp() |
protected bitronix.tm.resource.jdbc.PoolingDataSource |
setupPoolingDataSource() |
void |
tearDown() |
configure, reset
assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, fail
public JbpmJUnitBaseTestCase()
public JbpmJUnitBaseTestCase(boolean setupDataSource, boolean sessionPersistence)
super(true, false);
super(true, true);
org.jbpm.persistence.jpa
setupDataSource
- - true to configure data source under JNDI name: jdbc/jbpm-dssessionPersistence
- - configures RuntimeEngine to be with JPA persistence enabledpublic JbpmJUnitBaseTestCase(boolean setupDataSource, boolean sessionPersistence, String persistenceUnitName)
JbpmJUnitBaseTestCase(boolean, boolean)
but allows to use another persistence unit name.setupDataSource
- - true to configure data source under JNDI name: jdbc/jbpm-dssessionPersistence
- - configures RuntimeEngine to be with JPA persistence enabledpersistenceUnitName
- - custom persistence unit nameprotected org.kie.api.runtime.manager.RuntimeManager createRuntimeManager(String... process)
RuntimeManager
with SINGLETON strategy and all
processes
being added to knowledge base.
RuntimeManager
created during single test.process
- - processes that shall be added to knowledge baseprotected org.kie.api.runtime.manager.RuntimeManager createRuntimeManager(org.jbpm.test.JbpmJUnitBaseTestCase.Strategy strategy, String... process)
RuntimeManager
with given strategy
and all
processes
being added to knowledge base.
RuntimeManager
created during single test.strategy
- - selected strategy of those that are supportedprocess
- - processes that shall be added to knowledge baseprotected org.kie.api.runtime.manager.RuntimeManager createRuntimeManager(Map<String,org.kie.api.io.ResourceType> resources)
RuntimeManager
with SINGLETON strategy and all
resources
being added to knowledge base.
RuntimeManager
created during single test.resources
- - resources (processes, rules, etc) that shall be added to knowledge baseprotected org.kie.api.runtime.manager.RuntimeManager createRuntimeManager(org.jbpm.test.JbpmJUnitBaseTestCase.Strategy strategy, Map<String,org.kie.api.io.ResourceType> resources)
RuntimeManager
with given strategy
and all
resources
being added to knowledge base.
RuntimeManager
created during single test.strategy
- - selected strategy of those that are supportedresources
- - resources that shall be added to knowledge baseprotected org.kie.api.runtime.manager.RuntimeManager createRuntimeManager(org.jbpm.test.JbpmJUnitBaseTestCase.Strategy strategy, Map<String,org.kie.api.io.ResourceType> resources, org.kie.internal.runtime.manager.RuntimeEnvironment environment)
RuntimeManager
that expects to get RuntimeEnvironment
to be given as argument. It does not assume any particular configuration as it's considered manual creation
that allows to configure every single piece of RuntimeManager
. strategy
- - selected strategy of those that are supportedresources
- - resources that shall be added to knowledge baseenvironment
- - runtime environment used for RuntimeManager
creationprotected void disposeRuntimeManager()
RuntimeManager
together with all
active RuntimeEngine
's that were created (in scope of a test). Usual use case is
to simulate system shutdown.protected org.kie.api.runtime.manager.RuntimeEngine getRuntimeEngine()
RuntimeEngine
built from the manager of this test case.
It uses EmptyContext
that is suitable for following strategies:
getRuntimeEngine(Context)
protected org.kie.api.runtime.manager.RuntimeEngine getRuntimeEngine(org.kie.api.runtime.manager.Context<?> context)
RuntimeEngine
built from the manager of this test case. Common use case is to maintain
same session for process instance and thus ProcessInstanceIdContext
shall be used.context
- - instance of the context that shall be used to create RuntimeManager
public Object getVariableValue(String name, long processInstanceId, org.kie.api.runtime.KieSession ksession)
name
from process instance given by processInstanceId
using given session.name
- - name of the variableprocessInstanceId
- - id of process instanceksession
- - ksession used to retrieve the valuepublic void assertProcessInstanceCompleted(long processInstanceId, org.kie.api.runtime.KieSession ksession)
public void assertProcessInstanceAborted(long processInstanceId, org.kie.api.runtime.KieSession ksession)
public void assertProcessInstanceActive(long processInstanceId, org.kie.api.runtime.KieSession ksession)
public void assertNodeActive(long processInstanceId, org.kie.api.runtime.KieSession ksession, String... name)
public void assertNodeTriggered(long processInstanceId, String... nodeNames)
public void assertProcessVarExists(org.kie.api.runtime.process.ProcessInstance process, String... processVarNames)
public void assertNodeExists(org.kie.api.runtime.process.ProcessInstance process, String... nodeNames)
public void assertNumOfIncommingConnections(org.kie.api.runtime.process.ProcessInstance process, String nodeName, int num)
public void assertNumOfOutgoingConnections(org.kie.api.runtime.process.ProcessInstance process, String nodeName, int num)
public void assertVersionEquals(org.kie.api.runtime.process.ProcessInstance process, String version)
public void assertProcessNameEquals(org.kie.api.runtime.process.ProcessInstance process, String name)
public void assertPackageNameEquals(org.kie.api.runtime.process.ProcessInstance process, String packageName)
protected javax.persistence.EntityManagerFactory getEmf()
protected DataSource getDs()
protected bitronix.tm.resource.jdbc.PoolingDataSource setupPoolingDataSource()
protected void clearHistory()
protected JbpmJUnitBaseTestCase.TestWorkItemHandler getTestWorkItemHandler()
protected static void cleanupSingletonSessionId()
Copyright © 2001-2013 JBoss by Red Hat. All Rights Reserved.