Search in sources :

Example 11 with ProcessInstanceWithVariables

use of org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables in project camunda-bpm-platform by camunda.

the class ProcessInstantiationWithVariablesInReturnTest method testReturnVariablesFromExecution.

@Test
@Deployment(resources = SET_VARIABLE_IN_DELEGATE_PROCESS)
public void testReturnVariablesFromExecution() {
    // given executed process which sets variables in java delegate
    ProcessInstanceWithVariables procInstance = engineRule.getRuntimeService().createProcessInstanceByKey("variableProcess").executeWithVariablesInReturn();
    // when returned instance contains variables
    VariableMap map = procInstance.getVariables();
    assertNotNull(map);
    // then variables equal to variables which are accessible via query
    checkVariables(map, 8);
}
Also used : VariableMap(org.camunda.bpm.engine.variable.VariableMap) ProcessInstanceWithVariables(org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 12 with ProcessInstanceWithVariables

use of org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables in project camunda-bpm-platform by camunda.

the class ProcessInstantiationWithVariablesInReturnTest method testReturnVariablesFromStartWithWaitstateStartInSubProcess.

@Test
@Deployment(resources = SUBPROCESS_PROCESS)
public void testReturnVariablesFromStartWithWaitstateStartInSubProcess() {
    // given execute process with variables and wait state in sub process
    ProcessInstanceWithVariables procInstance = engineRule.getRuntimeService().createProcessInstanceByKey("subprocess").setVariable("aVariable1", "aValue1").setVariableLocal("aVariable2", "aValue2").setVariables(Variables.createVariables().putValue("aVariable3", "aValue3")).setVariablesLocal(Variables.createVariables().putValue("aVariable4", new byte[] { 127, 34, 64 })).startBeforeActivity("innerTask").executeWithVariablesInReturn(true, true);
    // when returned instance contains variables
    VariableMap map = procInstance.getVariables();
    assertNotNull(map);
    // then variables equal to variables which are accessible via query
    checkVariables(map, 4);
}
Also used : VariableMap(org.camunda.bpm.engine.variable.VariableMap) ProcessInstanceWithVariables(org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 13 with ProcessInstanceWithVariables

use of org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables in project camunda-bpm-platform by camunda.

the class ProcessInstantiationWithVariablesInReturnTest method testReturnVariablesFromStart.

@Test
@Deployment(resources = SIMPLE_PROCESS)
public void testReturnVariablesFromStart() {
    // given execute process with variables
    ProcessInstanceWithVariables procInstance = engineRule.getRuntimeService().createProcessInstanceByKey("simpleProcess").setVariable("aVariable1", "aValue1").setVariableLocal("aVariable2", "aValue2").setVariables(Variables.createVariables().putValue("aVariable3", "aValue3")).setVariablesLocal(Variables.createVariables().putValue("aVariable4", new byte[] { 127, 34, 64 })).executeWithVariablesInReturn(false, false);
    // when returned instance contains variables
    VariableMap map = procInstance.getVariables();
    assertNotNull(map);
    // then variables equal to variables which are accessible via query
    checkVariables(map, 4);
}
Also used : VariableMap(org.camunda.bpm.engine.variable.VariableMap) ProcessInstanceWithVariables(org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 14 with ProcessInstanceWithVariables

use of org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables in project camunda-bpm-platform by camunda.

the class ProcessInstantiationWithVariablesInReturnTest method testReturnVariablesFromExecutionWithWaitstate.

@Test
@Deployment(resources = SET_VARIABLE_IN_DELEGATE_WITH_WAIT_STATE_PROCESS)
public void testReturnVariablesFromExecutionWithWaitstate() {
    // given executed process which sets variables in java delegate
    ProcessInstanceWithVariables procInstance = engineRule.getRuntimeService().createProcessInstanceByKey("variableProcess").executeWithVariablesInReturn();
    // when returned instance contains variables
    VariableMap map = procInstance.getVariables();
    assertNotNull(map);
    // then variables equal to variables which are accessible via query
    checkVariables(map, 8);
}
Also used : VariableMap(org.camunda.bpm.engine.variable.VariableMap) ProcessInstanceWithVariables(org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 15 with ProcessInstanceWithVariables

use of org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables in project camunda-bpm-platform by camunda.

the class ProcessInstantiationWithVariablesInReturnTest method testReturnVariablesFromStartAndExecutionWithWaitstate.

@Test
@Deployment(resources = SET_VARIABLE_IN_DELEGATE_WITH_WAIT_STATE_PROCESS)
public void testReturnVariablesFromStartAndExecutionWithWaitstate() {
    // given executed process which overwrites these four variables in java delegate
    // and adds four additional variables
    ProcessInstanceWithVariables procInstance = engineRule.getRuntimeService().createProcessInstanceByKey("variableProcess").setVariable("stringVar", "aValue1").setVariableLocal("integerVar", 56789).setVariables(Variables.createVariables().putValue("longVar", 123L)).setVariablesLocal(Variables.createVariables().putValue("byteVar", new byte[] { 127, 34, 64 })).executeWithVariablesInReturn(false, false);
    // when returned instance contains variables
    VariableMap map = procInstance.getVariables();
    assertNotNull(map);
    // then variables equal to variables which are accessible via query
    checkVariables(map, 8);
}
Also used : VariableMap(org.camunda.bpm.engine.variable.VariableMap) ProcessInstanceWithVariables(org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

ProcessInstanceWithVariables (org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables)16 VariableMap (org.camunda.bpm.engine.variable.VariableMap)10 Test (org.junit.Test)10 Deployment (org.camunda.bpm.engine.test.Deployment)7 ProcessInstantiationBuilder (org.camunda.bpm.engine.runtime.ProcessInstantiationBuilder)4 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)2 Matchers.anyString (org.mockito.Matchers.anyString)2 Response (com.jayway.restassured.response.Response)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 URI (java.net.URI)1 Map (java.util.Map)1 AuthorizationException (org.camunda.bpm.engine.AuthorizationException)1 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 RepositoryService (org.camunda.bpm.engine.RepositoryService)1 RuntimeService (org.camunda.bpm.engine.RuntimeService)1 StartProcessInstanceAtActivitiesCmd (org.camunda.bpm.engine.impl.cmd.StartProcessInstanceAtActivitiesCmd)1 StartProcessInstanceCmd (org.camunda.bpm.engine.impl.cmd.StartProcessInstanceCmd)1 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)1 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)1