Search in sources :

Example 46 with Deployment

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());
}
Also used : Resource(org.camunda.bpm.engine.repository.Resource) Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

Example 47 with Deployment

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));
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment) ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Test(org.junit.Test)

Example 48 with Deployment

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();
}
Also used : CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) Deployment(org.camunda.bpm.engine.repository.Deployment) ProcessEngineImpl(org.camunda.bpm.engine.impl.ProcessEngineImpl) RepositoryService(org.camunda.bpm.engine.RepositoryService)

Example 49 with Deployment

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);
    }
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment)

Example 50 with Deployment

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());
}
Also used : UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) Deployment(org.camunda.bpm.engine.repository.Deployment)

Aggregations

Deployment (org.camunda.bpm.engine.repository.Deployment)137 Test (org.junit.Test)62 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)39 ProcessApplicationDeployment (org.camunda.bpm.engine.repository.ProcessApplicationDeployment)36 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)19 Resource (org.camunda.bpm.engine.repository.Resource)19 InputStream (java.io.InputStream)14 DeploymentBuilder (org.camunda.bpm.engine.repository.DeploymentBuilder)11 DeploymentQuery (org.camunda.bpm.engine.repository.DeploymentQuery)11 ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)10 UserOperationLogQuery (org.camunda.bpm.engine.history.UserOperationLogQuery)10 JobDefinitionQuery (org.camunda.bpm.engine.management.JobDefinitionQuery)10 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)9 UserOperationLogEntry (org.camunda.bpm.engine.history.UserOperationLogEntry)8 JobDefinition (org.camunda.bpm.engine.management.JobDefinition)8 RepositoryService (org.camunda.bpm.engine.RepositoryService)4 Job (org.camunda.bpm.engine.runtime.Job)4 Response (com.jayway.restassured.response.Response)3 HashMap (java.util.HashMap)2 Authorization (org.camunda.bpm.engine.authorization.Authorization)2