use of org.camunda.bpm.engine.form.TaskFormData in project camunda-bpm-platform by camunda.
the class FormDataTest method testGetFormFieldValidationConstraints.
@Deployment
public void testGetFormFieldValidationConstraints() {
runtimeService.startProcessInstanceByKey("FormDataTest.testGetFormFieldValidationConstraints");
Task task = taskService.createTaskQuery().singleResult();
TaskFormData taskFormData = formService.getTaskFormData(task.getId());
List<FormField> formFields = taskFormData.getFormFields();
FormField field1 = formFields.get(0);
List<FormFieldValidationConstraint> validationConstraints = field1.getValidationConstraints();
FormFieldValidationConstraint constraint1 = validationConstraints.get(0);
assertEquals("maxlength", constraint1.getName());
assertEquals("10", constraint1.getConfiguration());
FormFieldValidationConstraint constraint2 = validationConstraints.get(1);
assertEquals("minlength", constraint2.getName());
assertEquals("5", constraint2.getConfiguration());
}
use of org.camunda.bpm.engine.form.TaskFormData in project camunda-bpm-platform by camunda.
the class FormDataTest method testGetFormFieldProperties.
@Deployment
public void testGetFormFieldProperties() {
runtimeService.startProcessInstanceByKey("FormDataTest.testGetFormFieldProperties");
Task task = taskService.createTaskQuery().singleResult();
TaskFormData taskFormData = formService.getTaskFormData(task.getId());
List<FormField> formFields = taskFormData.getFormFields();
FormField stringField = formFields.get(0);
Map<String, String> properties = stringField.getProperties();
assertEquals("property1", properties.get("p1"));
assertEquals("property2", properties.get("p2"));
}
use of org.camunda.bpm.engine.form.TaskFormData in project camunda-bpm-platform by camunda.
the class MultiTenancyFormServiceCmdsTenantCheckTest method testGetTaskFormWithAuthenticatedTenant.
// GetTaskForm test
@Test
public void testGetTaskFormWithAuthenticatedTenant() {
testRule.deployForTenant(TENANT_ONE, "org/camunda/bpm/engine/test/api/authorization/formKeyProcess.bpmn20.xml");
runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY);
identityService.setAuthentication("aUserId", null, Arrays.asList(TENANT_ONE));
String taskId = taskService.createTaskQuery().singleResult().getId();
TaskFormData taskFormData = formService.getTaskFormData(taskId);
// then
assertNotNull(taskFormData);
assertEquals("aTaskFormKey", taskFormData.getFormKey());
}
use of org.camunda.bpm.engine.form.TaskFormData in project camunda-bpm-platform by camunda.
the class MultiTenancyFormServiceCmdsTenantCheckTest method testGetTaskFormWithDisabledTenantCheck.
@Test
public void testGetTaskFormWithDisabledTenantCheck() {
testRule.deployForTenant(TENANT_ONE, "org/camunda/bpm/engine/test/api/authorization/formKeyProcess.bpmn20.xml");
runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY);
String taskId = taskService.createTaskQuery().singleResult().getId();
identityService.setAuthentication("aUserId", null);
processEngineConfiguration.setTenantCheckEnabled(false);
TaskFormData taskFormData = formService.getTaskFormData(taskId);
// then
assertNotNull(taskFormData);
assertEquals("aTaskFormKey", taskFormData.getFormKey());
}
use of org.camunda.bpm.engine.form.TaskFormData in project camunda-bpm-platform by camunda.
the class MockProvider method createMockTaskFormData.
public static TaskFormData createMockTaskFormData() {
FormProperty mockFormProperty = mock(FormProperty.class);
when(mockFormProperty.getId()).thenReturn(EXAMPLE_FORM_PROPERTY_ID);
when(mockFormProperty.getName()).thenReturn(EXAMPLE_FORM_PROPERTY_NAME);
when(mockFormProperty.getValue()).thenReturn(EXAMPLE_FORM_PROPERTY_VALUE);
when(mockFormProperty.isReadable()).thenReturn(EXAMPLE_FORM_PROPERTY_READABLE);
when(mockFormProperty.isWritable()).thenReturn(EXAMPLE_FORM_PROPERTY_WRITABLE);
when(mockFormProperty.isRequired()).thenReturn(EXAMPLE_FORM_PROPERTY_REQUIRED);
FormType mockFormType = mock(FormType.class);
when(mockFormType.getName()).thenReturn(EXAMPLE_FORM_PROPERTY_TYPE_NAME);
when(mockFormProperty.getType()).thenReturn(mockFormType);
TaskFormData mockFormData = mock(TaskFormData.class);
when(mockFormData.getFormKey()).thenReturn(EXAMPLE_FORM_KEY);
when(mockFormData.getDeploymentId()).thenReturn(EXAMPLE_DEPLOYMENT_ID);
List<FormProperty> mockFormProperties = new ArrayList<FormProperty>();
mockFormProperties.add(mockFormProperty);
when(mockFormData.getFormProperties()).thenReturn(mockFormProperties);
return mockFormData;
}
Aggregations