org.camunda.bpm.test
Class CamundaSupport

java.lang.Object
  extended by org.camunda.bpm.test.CamundaSupport
All Implemented Interfaces:
org.needle4j.injection.InjectionProvider<CamundaSupport>, org.needle4j.injection.InjectionVerifier

public class CamundaSupport
extends Object
implements org.needle4j.injection.InjectionProvider<CamundaSupport>

Helper for Camunda access.

Author:
Simon Zambrovski, Holisticon AG

Constructor Summary
CamundaSupport()
          Create support component with default process engine.
CamundaSupport(org.camunda.bpm.engine.ProcessEngine processEngine)
          Create support component.
 
Method Summary
 void deploy(String... processModelResources)
          Checks deployment of the process definition.
 CamundaSupport getInjectedObject(Class<?> injectionPointType)
           
 Object getKey(org.needle4j.injection.InjectionTargetInformation injectionTargetInformation)
           
 org.camunda.bpm.engine.ProcessEngine getProcessEngine()
          Retrieves process engine.
 org.camunda.bpm.engine.runtime.ProcessInstance getProcessInstance()
          Retrieves the process instance.
 Date getStartTime()
          Retrieves start time.
 boolean hasRunningProcessInstance()
          Checks whether current process instance is still running.
static boolean parseStatement(String negation, String value, boolean defaultValue)
          Parses the verb and maps it to a boolean decision.
 void resetClock()
          Resets process engine clock.
 void setCurrentTime(Date currentTime)
          Sets time.
 org.camunda.bpm.engine.runtime.ProcessInstance startProcessInstanceByKey(String processDefinitionKey)
          Starts process by process definition key.
 org.camunda.bpm.engine.runtime.ProcessInstance startProcessInstanceByKey(String processDefinitionKey, Map<String,Object> variables)
          Starts process by process definition key with given payload.
 void undeploy()
          Cleans up resources.
 boolean verify(org.needle4j.injection.InjectionTargetInformation injectionTargetInformation)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CamundaSupport

public CamundaSupport()
Create support component with default process engine.


CamundaSupport

public CamundaSupport(org.camunda.bpm.engine.ProcessEngine processEngine)
Create support component.

Parameters:
processEngine - process engine.
Method Detail

deploy

public void deploy(String... processModelResources)
Checks deployment of the process definition.

Parameters:
processModelResources - process definition file (BPMN)

undeploy

public void undeploy()
Cleans up resources.


startProcessInstanceByKey

public org.camunda.bpm.engine.runtime.ProcessInstance startProcessInstanceByKey(String processDefinitionKey,
                                                                                Map<String,Object> variables)
Starts process by process definition key with given payload.

Parameters:
processDefinitionKey - process definition keys.
variables - maps of initial payload variables.
Returns:
process instance id
See Also:
RuntimeService.startProcessInstanceByKey(String, Map)

startProcessInstanceByKey

public org.camunda.bpm.engine.runtime.ProcessInstance startProcessInstanceByKey(String processDefinitionKey)
Starts process by process definition key.

Parameters:
processDefinitionKey - process definition keys.
Returns:
process instance id

getProcessInstance

public org.camunda.bpm.engine.runtime.ProcessInstance getProcessInstance()
Retrieves the process instance.

Returns:
running process instance.

setCurrentTime

public void setCurrentTime(Date currentTime)
Sets time.

Parameters:
currentTime - sets current time in the engine

resetClock

public void resetClock()
Resets process engine clock.


getProcessEngine

public org.camunda.bpm.engine.ProcessEngine getProcessEngine()
Retrieves process engine.

Returns:
process engine.

getStartTime

public Date getStartTime()
Retrieves start time.

Returns:
time of deployment.

parseStatement

public static boolean parseStatement(String negation,
                                     String value,
                                     boolean defaultValue)
Parses the verb and maps it to a boolean decision.

Parameters:
negation - a way how the verb is negated. (e.G. not)
value - part of text containing the verb in regular or negated form.
defaultValue - default value, if parsing fails.
Returns:
true, if negation not found.

hasRunningProcessInstance

public boolean hasRunningProcessInstance()
Checks whether current process instance is still running.

Returns:
true, if process instance is running

getInjectedObject

public CamundaSupport getInjectedObject(Class<?> injectionPointType)
Specified by:
getInjectedObject in interface org.needle4j.injection.InjectionProvider<CamundaSupport>

getKey

public Object getKey(org.needle4j.injection.InjectionTargetInformation injectionTargetInformation)
Specified by:
getKey in interface org.needle4j.injection.InjectionProvider<CamundaSupport>

verify

public boolean verify(org.needle4j.injection.InjectionTargetInformation injectionTargetInformation)
Specified by:
verify in interface org.needle4j.injection.InjectionVerifier


Copyright © 2014 camunda services GmbH. All rights reserved.