use of org.camunda.bpm.engine.form.StartFormData in project camunda-bpm-platform by camunda.
the class MultiTenancyFormServiceCmdsTenantCheckTest method testGetStartFormWithAuthenticatedTenant.
// GetStartForm test
@Test
public void testGetStartFormWithAuthenticatedTenant() {
testRule.deployForTenant(TENANT_ONE, "org/camunda/bpm/engine/test/api/authorization/formKeyProcess.bpmn20.xml");
ProcessInstance instance = runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY);
identityService.setAuthentication("aUserId", null, Arrays.asList(TENANT_ONE));
StartFormData startFormData = formService.getStartFormData(instance.getProcessDefinitionId());
// then
assertNotNull(startFormData);
assertEquals("aStartFormKey", startFormData.getFormKey());
}
use of org.camunda.bpm.engine.form.StartFormData in project camunda-bpm-platform by camunda.
the class MultiTenancyFormServiceCmdsTenantCheckTest method testGetStartFormWithDisabledTenantCheck.
@Test
public void testGetStartFormWithDisabledTenantCheck() {
testRule.deployForTenant(TENANT_ONE, "org/camunda/bpm/engine/test/api/authorization/formKeyProcess.bpmn20.xml");
ProcessInstance instance = runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY);
identityService.setAuthentication("aUserId", null);
processEngineConfiguration.setTenantCheckEnabled(false);
StartFormData startFormData = formService.getStartFormData(instance.getProcessDefinitionId());
// then
assertNotNull(startFormData);
assertEquals("aStartFormKey", startFormData.getFormKey());
}
use of org.camunda.bpm.engine.form.StartFormData in project camunda-bpm-platform by camunda.
the class ElResolveStartFormDataTest method testStartFormDataWithLabelExpression.
@Test
public void testStartFormDataWithLabelExpression() {
String processDefinitionId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
StartFormData formData = formService.getStartFormData(processDefinitionId);
String label = formData.getFormFields().get(0).getLabel();
Assert.assertNotNull(label);
Assert.assertEquals("testString123", label);
}
use of org.camunda.bpm.engine.form.StartFormData in project camunda-bpm-platform by camunda.
the class ProcessDefinitionRestServiceInteractionTest method testGetStartForm_shouldReturnKeyContainingTaskId_ByKey.
@Test
public void testGetStartForm_shouldReturnKeyContainingTaskId_ByKey() {
ProcessDefinition mockDefinition = MockProvider.createMockDefinition();
StartFormData mockStartFormData = MockProvider.createMockStartFormDataUsingFormFieldsWithoutFormKey(mockDefinition);
when(formServiceMock.getStartFormData(mockDefinition.getId())).thenReturn(mockStartFormData);
given().pathParam("key", MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY).then().expect().statusCode(Status.OK.getStatusCode()).body("key", equalTo("embedded:engine://engine/:engine/process-definition/" + mockDefinition.getId() + "/rendered-form")).body("contextPath", equalTo(MockProvider.EXAMPLE_PROCESS_APPLICATION_CONTEXT_PATH)).when().get(START_FORM_BY_KEY_URL);
}
use of org.camunda.bpm.engine.form.StartFormData in project camunda-bpm-platform by camunda.
the class ProcessDefinitionRestServiceInteractionTest method setUpRuntimeDataForDefinition.
private void setUpRuntimeDataForDefinition(ProcessDefinition mockDefinition) {
mockInstance = MockProvider.createMockInstanceWithVariables();
// we replace this mock with every test in order to have a clean one (in terms of invocations) for verification
runtimeServiceMock = mock(RuntimeService.class);
when(processEngine.getRuntimeService()).thenReturn(runtimeServiceMock);
when(runtimeServiceMock.startProcessInstanceById(eq(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID), Matchers.<Map<String, Object>>any())).thenReturn(mockInstance);
when(runtimeServiceMock.startProcessInstanceById(eq(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID), anyString(), anyString(), Matchers.<Map<String, Object>>any())).thenReturn(mockInstance);
mockInstantiationBuilder = setUpMockInstantiationBuilder();
when(mockInstantiationBuilder.executeWithVariablesInReturn(anyBoolean(), anyBoolean())).thenReturn(mockInstance);
when(runtimeServiceMock.createProcessInstanceById(anyString())).thenReturn(mockInstantiationBuilder);
repositoryServiceMock = mock(RepositoryService.class);
when(processEngine.getRepositoryService()).thenReturn(repositoryServiceMock);
when(repositoryServiceMock.getProcessDefinition(eq(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID))).thenReturn(mockDefinition);
when(repositoryServiceMock.getProcessModel(eq(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID))).thenReturn(createMockProcessDefinionBpmn20Xml());
DeleteProcessDefinitionsSelectBuilder deleteProcessDefinitionsSelectBuilder = mock(DeleteProcessDefinitionsSelectBuilder.class, RETURNS_DEEP_STUBS);
when(repositoryServiceMock.deleteProcessDefinitions()).thenReturn(deleteProcessDefinitionsSelectBuilder);
setUpMockDefinitionQuery(mockDefinition);
StartFormData formDataMock = MockProvider.createMockStartFormData(mockDefinition);
formServiceMock = mock(FormService.class);
when(processEngine.getFormService()).thenReturn(formServiceMock);
when(formServiceMock.getStartFormData(eq(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID))).thenReturn(formDataMock);
when(formServiceMock.submitStartForm(eq(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID), Matchers.<Map<String, Object>>any())).thenReturn(mockInstance);
when(formServiceMock.submitStartForm(eq(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID), anyString(), Matchers.<Map<String, Object>>any())).thenReturn(mockInstance);
VariableMap startFormVariablesMock = MockProvider.createMockFormVariables();
when(formServiceMock.getStartFormVariables(eq(EXAMPLE_PROCESS_DEFINITION_ID), Matchers.<Collection<String>>any(), anyBoolean())).thenReturn(startFormVariablesMock);
}
Aggregations