use of org.camunda.bpm.engine.RepositoryService in project camunda-bpm-platform by camunda.
the class TestDeploymentSource method testDeployProcessArchive.
@Test
public void testDeployProcessArchive() {
Assert.assertNotNull(processEngine);
RepositoryService repositoryService = processEngine.getRepositoryService();
org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeploymentQuery().singleResult();
Assert.assertNotNull(deployment);
Assert.assertEquals(ProcessApplicationDeployment.PROCESS_APPLICATION_DEPLOYMENT_SOURCE, deployment.getSource());
}
use of org.camunda.bpm.engine.RepositoryService in project camunda-bpm-platform by camunda.
the class MockedProcessEngineProvider method mockServices.
private void mockServices(ProcessEngine engine) {
RepositoryService repoService = mock(RepositoryService.class);
IdentityService identityService = mock(IdentityService.class);
TaskService taskService = mock(TaskService.class);
RuntimeService runtimeService = mock(RuntimeService.class);
FormService formService = mock(FormService.class);
HistoryService historyService = mock(HistoryService.class);
ManagementService managementService = mock(ManagementService.class);
CaseService caseService = mock(CaseService.class);
FilterService filterService = mock(FilterService.class);
ExternalTaskService externalTaskService = mock(ExternalTaskService.class);
when(engine.getRepositoryService()).thenReturn(repoService);
when(engine.getIdentityService()).thenReturn(identityService);
when(engine.getTaskService()).thenReturn(taskService);
when(engine.getRuntimeService()).thenReturn(runtimeService);
when(engine.getFormService()).thenReturn(formService);
when(engine.getHistoryService()).thenReturn(historyService);
when(engine.getManagementService()).thenReturn(managementService);
when(engine.getCaseService()).thenReturn(caseService);
when(engine.getFilterService()).thenReturn(filterService);
when(engine.getExternalTaskService()).thenReturn(externalTaskService);
}
use of org.camunda.bpm.engine.RepositoryService in project camunda-bpm-platform by camunda.
the class SpringTransactionsProcessEngineConfiguration method autoDeployResources.
protected void autoDeployResources(ProcessEngine processEngine) {
if (deploymentResources != null && deploymentResources.length > 0) {
RepositoryService repositoryService = processEngine.getRepositoryService();
DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().enableDuplicateFiltering(false).name(deploymentName).tenantId(deploymentTenantId);
for (Resource resource : deploymentResources) {
String resourceName = null;
if (resource instanceof ContextResource) {
resourceName = ((ContextResource) resource).getPathWithinContext();
} else if (resource instanceof ByteArrayResource) {
resourceName = resource.getDescription();
} else {
try {
resourceName = resource.getFile().getAbsolutePath();
} catch (IOException e) {
resourceName = resource.getFilename();
}
}
try {
if (resourceName.endsWith(".bar") || resourceName.endsWith(".zip") || resourceName.endsWith(".jar")) {
deploymentBuilder.addZipInputStream(new ZipInputStream(resource.getInputStream()));
} else {
deploymentBuilder.addInputStream(resourceName, resource.getInputStream());
}
} catch (IOException e) {
throw new ProcessEngineException("couldn't auto deploy resource '" + resource + "': " + e.getMessage(), e);
}
}
deploymentBuilder.deploy();
}
}
use of org.camunda.bpm.engine.RepositoryService in project camunda-bpm-platform by camunda.
the class AbstractEmptyBodyFilterTest method setUpHttpClientAndRuntimeData.
@Before
public void setUpHttpClientAndRuntimeData() {
client = HttpClients.createDefault();
reqConfig = RequestConfig.custom().setConnectTimeout(3 * 60 * 1000).setSocketTimeout(10 * 60 * 1000).build();
ProcessDefinition mockDefinition = MockProvider.createMockDefinition();
runtimeServiceMock = mock(RuntimeService.class);
when(processEngine.getRuntimeService()).thenReturn(runtimeServiceMock);
mockInstantiationBuilder = mock(ProcessInstantiationBuilder.class);
when(mockInstantiationBuilder.setVariables(any(Map.class))).thenReturn(mockInstantiationBuilder);
when(mockInstantiationBuilder.businessKey(anyString())).thenReturn(mockInstantiationBuilder);
when(mockInstantiationBuilder.caseInstanceId(anyString())).thenReturn(mockInstantiationBuilder);
when(runtimeServiceMock.createProcessInstanceById(anyString())).thenReturn(mockInstantiationBuilder);
ProcessInstanceWithVariables resultInstanceWithVariables = MockProvider.createMockInstanceWithVariables();
when(mockInstantiationBuilder.executeWithVariablesInReturn(anyBoolean(), anyBoolean())).thenReturn(resultInstanceWithVariables);
ProcessDefinitionQuery processDefinitionQueryMock = mock(ProcessDefinitionQuery.class);
when(processDefinitionQueryMock.processDefinitionKey(MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY)).thenReturn(processDefinitionQueryMock);
when(processDefinitionQueryMock.withoutTenantId()).thenReturn(processDefinitionQueryMock);
when(processDefinitionQueryMock.latestVersion()).thenReturn(processDefinitionQueryMock);
when(processDefinitionQueryMock.singleResult()).thenReturn(mockDefinition);
RepositoryService repositoryServiceMock = mock(RepositoryService.class);
when(processEngine.getRepositoryService()).thenReturn(repositoryServiceMock);
when(repositoryServiceMock.createProcessDefinitionQuery()).thenReturn(processDefinitionQueryMock);
}
use of org.camunda.bpm.engine.RepositoryService in project camunda-bpm-platform by camunda.
the class DecisionDefinitionResourceImpl method getDecisionDefinition.
@Override
public DecisionDefinitionDto getDecisionDefinition() {
RepositoryService repositoryService = engine.getRepositoryService();
DecisionDefinition definition = null;
try {
definition = repositoryService.getDecisionDefinition(decisionDefinitionId);
} catch (NotFoundException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e, e.getMessage());
} catch (NotValidException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e, e.getMessage());
} catch (ProcessEngineException e) {
throw new RestException(Status.INTERNAL_SERVER_ERROR, e);
}
return DecisionDefinitionDto.fromDecisionDefinition(definition);
}
Aggregations