use of org.camunda.bpm.engine.variable.value.StringValue in project camunda-bpm-platform by camunda.
the class StartProcessTest method testStartProcessByKey.
@Test
@Deployment(resources = "org/camunda/bpm/engine/cdi/test/api/annotation/StartProcessTest.bpmn20.xml")
public void testStartProcessByKey() {
assertNull(runtimeService.createProcessInstanceQuery().singleResult());
getBeanInstance(DeclarativeProcessController.class).startProcessByKey();
BusinessProcess businessProcess = getBeanInstance(BusinessProcess.class);
assertNotNull(runtimeService.createProcessInstanceQuery().singleResult());
assertEquals("camunda", businessProcess.getVariable("name"));
TypedValue nameTypedValue = businessProcess.getVariableTyped("name");
assertNotNull(nameTypedValue);
assertTrue(nameTypedValue instanceof StringValue);
assertEquals(ValueType.STRING, nameTypedValue.getType());
assertEquals("camunda", nameTypedValue.getValue());
assertEquals("untypedName", businessProcess.getVariable("untypedName"));
TypedValue untypedNameTypedValue = businessProcess.getVariableTyped("untypedName");
assertNotNull(untypedNameTypedValue);
assertTrue(untypedNameTypedValue instanceof StringValue);
assertEquals(ValueType.STRING, untypedNameTypedValue.getType());
assertEquals("untypedName", untypedNameTypedValue.getValue());
assertEquals("typedName", businessProcess.getVariable("typedName"));
TypedValue typedNameTypedValue = businessProcess.getVariableTyped("typedName");
assertNotNull(typedNameTypedValue);
assertTrue(typedNameTypedValue instanceof StringValue);
assertEquals(ValueType.STRING, typedNameTypedValue.getType());
assertEquals("typedName", typedNameTypedValue.getValue());
businessProcess.startTask(taskService.createTaskQuery().singleResult().getId());
businessProcess.completeTask();
}
use of org.camunda.bpm.engine.variable.value.StringValue in project camunda-bpm-platform by camunda.
the class MultiTenancyCaseInstanceCmdsTenantCheckTest method getVariableTypedWithAuthenticatedTenant.
@Test
public void getVariableTypedWithAuthenticatedTenant() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
StringValue variable = caseService.getVariableTyped(caseExecutionId, VARIABLE_NAME);
assertThat(variable.getValue(), is(VARIABLE_VALUE));
}
use of org.camunda.bpm.engine.variable.value.StringValue in project camunda-bpm-platform by camunda.
the class CaseServiceTest method testGetVariableTypedLocal.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testGetVariableTypedLocal() {
// given:
// a deployed case definition
String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
// an active case instance
caseService.withCaseDefinition(caseDefinitionId).create().getId();
String caseExecutionId = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult().getId();
caseService.withCaseExecution(caseExecutionId).setVariableLocal("aVariableName", "abc").setVariableLocal("anotherVariableName", 999).setVariableLocal("aSerializedObject", Variables.objectValue(Arrays.asList("1", "2")).create()).execute();
// when
StringValue stringValue = caseService.getVariableLocalTyped(caseExecutionId, "aVariableName");
ObjectValue objectValue = caseService.getVariableLocalTyped(caseExecutionId, "aSerializedObject");
ObjectValue serializedObjectValue = caseService.getVariableLocalTyped(caseExecutionId, "aSerializedObject", false);
// then
assertNotNull(stringValue.getValue());
assertNotNull(objectValue.getValue());
assertTrue(objectValue.isDeserialized());
assertEquals(Arrays.asList("1", "2"), objectValue.getValue());
assertFalse(serializedObjectValue.isDeserialized());
assertNotNull(serializedObjectValue.getValueSerialized());
}
use of org.camunda.bpm.engine.variable.value.StringValue in project camunda-bpm-platform by camunda.
the class CaseServiceTest method testGetVariableTyped.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testGetVariableTyped() {
// given:
// a deployed case definition
String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
// an active case instance
caseService.withCaseDefinition(caseDefinitionId).setVariable("aVariableName", "abc").setVariable("anotherVariableName", 999).setVariable("aSerializedObject", Variables.objectValue(Arrays.asList("1", "2")).create()).create().getId();
String caseExecutionId = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult().getId();
// when
StringValue stringValue = caseService.getVariableTyped(caseExecutionId, "aVariableName");
ObjectValue objectValue = caseService.getVariableTyped(caseExecutionId, "aSerializedObject");
ObjectValue serializedObjectValue = caseService.getVariableTyped(caseExecutionId, "aSerializedObject", false);
// then
assertNotNull(stringValue.getValue());
assertNotNull(objectValue.getValue());
assertTrue(objectValue.isDeserialized());
assertEquals(Arrays.asList("1", "2"), objectValue.getValue());
assertFalse(serializedObjectValue.isDeserialized());
assertNotNull(serializedObjectValue.getValueSerialized());
}
Aggregations