use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class MultiTenancyDeploymentCmdsTenantCheckTest method failToGetResourceAsStreamNoAuthenticatedTenant.
@Test
public void failToGetResourceAsStreamNoAuthenticatedTenant() {
Deployment deployment = testRule.deployForTenant(TENANT_ONE, emptyProcess);
Resource resource = repositoryService.getDeploymentResources(deployment.getId()).get(0);
identityService.setAuthentication("user", null, null);
// declare expected exception
thrown.expect(ProcessEngineException.class);
thrown.expectMessage("Cannot get the deployment");
repositoryService.getResourceAsStream(deployment.getId(), resource.getName());
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessDefinitionCmdsTenantCheckTest method testDeleteProcessDefinitionDisabledTenantCheck.
@Test
public void testDeleteProcessDefinitionDisabledTenantCheck() {
// given deployment with two process definitions
Deployment deployment = testRule.deployForTenant(TENANT_ONE, "org/camunda/bpm/engine/test/repository/twoProcesses.bpmn20.xml");
// tenant check disabled
processEngineConfiguration.setTenantCheckEnabled(false);
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId());
List<ProcessDefinition> processDefinitions = processDefinitionQuery.list();
// user with no authentication
identityService.setAuthentication("user", null, null);
// when process definition should be deleted without tenant check
repositoryService.deleteProcessDefinition(processDefinitions.get(0).getId());
// then process definition is deleted
identityService.clearAuthentication();
assertThat(processDefinitionQuery.count(), is(1L));
assertThat(processDefinitionQuery.tenantIdIn(TENANT_ONE).count(), is(1L));
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class UpgradedDBDropper method cleanDatabase.
public void cleanDatabase(ProcessEngine engine) {
// delete all deployments
RepositoryService repositoryService = engine.getRepositoryService();
List<Deployment> deployments = repositoryService.createDeploymentQuery().list();
for (Deployment deployment : deployments) {
repositoryService.deleteDeployment(deployment.getId(), true);
}
// drop DB
((ProcessEngineImpl) engine).getProcessEngineConfiguration().getCommandExecutorTxRequired().execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
commandContext.getDbSqlSession().dbSchemaDrop();
return null;
}
});
engine.close();
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class UserOperationLogDeploymentTest method tearDown.
protected void tearDown() throws Exception {
super.tearDown();
List<Deployment> deployments = repositoryService.createDeploymentQuery().list();
for (Deployment deployment : deployments) {
repositoryService.deleteDeployment(deployment.getId(), true, true);
}
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class UserOperationLogDeploymentTest method testCreateDeployment.
public void testCreateDeployment() {
// when
Deployment deployment = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, createProcessWithServiceTask(PROCESS_KEY)).deploy();
// then
UserOperationLogEntry userOperationLogEntry = historyService.createUserOperationLogQuery().singleResult();
assertNotNull(userOperationLogEntry);
assertEquals(EntityTypes.DEPLOYMENT, userOperationLogEntry.getEntityType());
assertEquals(deployment.getId(), userOperationLogEntry.getDeploymentId());
assertEquals(UserOperationLogEntry.OPERATION_TYPE_CREATE, userOperationLogEntry.getOperationType());
assertEquals("duplicateFilterEnabled", userOperationLogEntry.getProperty());
assertNull(userOperationLogEntry.getOrgValue());
assertFalse(Boolean.valueOf(userOperationLogEntry.getNewValue()));
assertEquals(USER_ID, userOperationLogEntry.getUserId());
assertNull(userOperationLogEntry.getJobDefinitionId());
assertNull(userOperationLogEntry.getProcessInstanceId());
assertNull(userOperationLogEntry.getProcessDefinitionId());
assertNull(userOperationLogEntry.getProcessDefinitionKey());
assertNull(userOperationLogEntry.getCaseInstanceId());
assertNull(userOperationLogEntry.getCaseDefinitionId());
}
Aggregations