|
jBPM distribution 6.2.0.CR1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.junit.Assert
org.jbpm.test.JbpmJUnitBaseTestCase
public abstract class JbpmJUnitBaseTestCase
Base test case class that shall be used for jBPM related tests. It provides four sections:
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
Nested Class Summary | |
---|---|
static class |
JbpmJUnitBaseTestCase.Strategy
Currently supported RuntimeEngine strategies |
protected static class |
JbpmJUnitBaseTestCase.TestWorkItemHandler
|
Field Summary | |
---|---|
protected Set<RuntimeEngine> |
activeEngines
|
protected RuntimeManager |
manager
|
protected boolean |
sessionPersistence
|
protected boolean |
setupDataSource
|
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
void |
assertNodeActive(long processInstanceId,
KieSession ksession,
String... name)
|
void |
assertNodeExists(ProcessInstance process,
String... nodeNames)
|
void |
assertNodeTriggered(long processInstanceId,
String... nodeNames)
|
void |
assertNumOfIncommingConnections(ProcessInstance process,
String nodeName,
int num)
|
void |
assertNumOfOutgoingConnections(ProcessInstance process,
String nodeName,
int num)
|
void |
assertPackageNameEquals(ProcessInstance process,
String packageName)
|
void |
assertProcessInstanceAborted(long processInstanceId,
KieSession ksession)
|
void |
assertProcessInstanceActive(long processInstanceId,
KieSession ksession)
|
void |
assertProcessInstanceCompleted(long processInstanceId,
KieSession ksession)
|
void |
assertProcessNameEquals(ProcessInstance process,
String name)
|
void |
assertProcessVarExists(ProcessInstance process,
String... processVarNames)
|
void |
assertVersionEquals(ProcessInstance process,
String version)
|
protected static void |
cleanupSingletonSessionId()
|
protected void |
clearHistory()
|
protected RuntimeManager |
createRuntimeManager(JbpmJUnitBaseTestCase.Strategy strategy,
Map<String,ResourceType> resources)
Creates default configuration of RuntimeManager with given strategy and all
resources being added to knowledge base. |
protected RuntimeManager |
createRuntimeManager(JbpmJUnitBaseTestCase.Strategy strategy,
Map<String,ResourceType> resources,
RuntimeEnvironment environment,
String identifier)
The lowest level of creation of RuntimeManager that expects to get RuntimeEnvironment
to be given as argument. |
protected RuntimeManager |
createRuntimeManager(JbpmJUnitBaseTestCase.Strategy strategy,
Map<String,ResourceType> resources,
String identifier)
Creates default configuration of RuntimeManager with given strategy and all
resources being added to knowledge base. |
protected RuntimeManager |
createRuntimeManager(JbpmJUnitBaseTestCase.Strategy strategy,
String identifier,
String... process)
Creates default configuration of RuntimeManager with given strategy and all
processes being added to knowledge base. |
protected RuntimeManager |
createRuntimeManager(Map<String,ResourceType> resources)
Creates default configuration of RuntimeManager with SINGLETON strategy and all
resources being added to knowledge base. |
protected RuntimeManager |
createRuntimeManager(Map<String,ResourceType> resources,
String identifier)
Creates default configuration of RuntimeManager with SINGLETON strategy and all
resources being added to knowledge base. |
protected 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.drools.core.audit.WorkingMemoryInMemoryLogger |
getInMemoryLogger()
|
protected AuditService |
getLogService()
|
protected RuntimeEngine |
getRuntimeEngine()
Returns new RuntimeEngine built from the manager of this test case. |
protected RuntimeEngine |
getRuntimeEngine(Context<?> context)
Returns new RuntimeEngine built from the manager of this test case. |
protected JbpmJUnitBaseTestCase.TestWorkItemHandler |
getTestWorkItemHandler()
|
Object |
getVariableValue(String name,
long processInstanceId,
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()
|
Methods inherited from class org.junit.Assert |
---|
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, assertEquals, assertEquals, assertFalse, assertFalse, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, fail |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean setupDataSource
protected boolean sessionPersistence
protected RuntimeManager manager
protected Set<RuntimeEngine> activeEngines
Constructor Detail |
---|
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 nameMethod Detail |
---|
public void setUp() throws Exception
Exception
public void tearDown() throws Exception
Exception
protected 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 base
protected RuntimeManager createRuntimeManager(JbpmJUnitBaseTestCase.Strategy strategy, String identifier, 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 supportedidentifier
- - identifies the runtime managerprocess
- - processes that shall be added to knowledge base
protected RuntimeManager createRuntimeManager(Map<String,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 base
protected RuntimeManager createRuntimeManager(Map<String,ResourceType> resources, String identifier)
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 baseidentifier
- - identifies the runtime manager
protected RuntimeManager createRuntimeManager(JbpmJUnitBaseTestCase.Strategy strategy, Map<String,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 base
protected RuntimeManager createRuntimeManager(JbpmJUnitBaseTestCase.Strategy strategy, Map<String,ResourceType> resources, String identifier)
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 baseidentifier
- - identifies the runtime manager
protected RuntimeManager createRuntimeManager(JbpmJUnitBaseTestCase.Strategy strategy, Map<String,ResourceType> resources, RuntimeEnvironment environment, String identifier)
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
creationidentifier
- - identifies the runtime manager
protected 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 RuntimeEngine getRuntimeEngine()
RuntimeEngine
built from the manager of this test case.
It uses EmptyContext
that is suitable for following strategies:
getRuntimeEngine(Context)
protected RuntimeEngine getRuntimeEngine(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, 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 value
public void assertProcessInstanceCompleted(long processInstanceId, KieSession ksession)
public void assertProcessInstanceAborted(long processInstanceId, KieSession ksession)
public void assertProcessInstanceActive(long processInstanceId, KieSession ksession)
public void assertNodeActive(long processInstanceId, KieSession ksession, String... name)
public void assertNodeTriggered(long processInstanceId, String... nodeNames)
public void assertProcessVarExists(ProcessInstance process, String... processVarNames)
public void assertNodeExists(ProcessInstance process, String... nodeNames)
public void assertNumOfIncommingConnections(ProcessInstance process, String nodeName, int num)
public void assertNumOfOutgoingConnections(ProcessInstance process, String nodeName, int num)
public void assertVersionEquals(ProcessInstance process, String version)
public void assertProcessNameEquals(ProcessInstance process, String name)
public void assertPackageNameEquals(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 AuditService getLogService()
protected org.drools.core.audit.WorkingMemoryInMemoryLogger getInMemoryLogger()
protected static void cleanupSingletonSessionId()
|
jBPM distribution 6.2.0.CR1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |