use of org.camunda.bpm.engine.repository.DeleteProcessDefinitionsSelectBuilder 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