Search in sources :

Example 41 with Deployment

use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.

the class MultiTenancyDeploymentCmdsTenantCheckTest method redeployForDifferentAuthenticatedTenantsDisabledTenantCheck.

@Test
public void redeployForDifferentAuthenticatedTenantsDisabledTenantCheck() {
    Deployment deploymentOne = repositoryService.createDeployment().addModelInstance("emptyProcess.bpmn", emptyProcess).addModelInstance("startEndProcess.bpmn", startEndProcess).tenantId(TENANT_ONE).deploy();
    identityService.setAuthentication("user", null, null);
    processEngineConfiguration.setTenantCheckEnabled(false);
    repositoryService.createDeployment().addDeploymentResources(deploymentOne.getId()).tenantId(TENANT_TWO).deploy();
    DeploymentQuery query = repositoryService.createDeploymentQuery();
    assertThat(query.count(), is(2L));
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
    assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L));
}
Also used : DeploymentQuery(org.camunda.bpm.engine.repository.DeploymentQuery) Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

Example 42 with Deployment

use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.

the class MultiTenancyDeploymentCmdsTenantCheckTest method getResourceAsStreamWithAuthenticatedTenant.

@Test
public void getResourceAsStreamWithAuthenticatedTenant() {
    Deployment deployment = testRule.deployForTenant(TENANT_ONE, emptyProcess);
    Resource resource = repositoryService.getDeploymentResources(deployment.getId()).get(0);
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
    InputStream inputStream = repositoryService.getResourceAsStream(deployment.getId(), resource.getName());
    assertThat(inputStream, notNullValue());
}
Also used : InputStream(java.io.InputStream) Resource(org.camunda.bpm.engine.repository.Resource) Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

Example 43 with Deployment

use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.

the class MultiTenancyDeploymentCmdsTenantCheckTest method failToGetResourceAsStreamByIdNoAuthenticatedTenant.

@Test
public void failToGetResourceAsStreamByIdNoAuthenticatedTenant() {
    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.getResourceAsStreamById(deployment.getId(), resource.getId());
}
Also used : Resource(org.camunda.bpm.engine.repository.Resource) Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

Example 44 with Deployment

use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.

the class MultiTenancyDeploymentCmdsTenantCheckTest method redeployForTheSameAuthenticatedTenant.

@Test
public void redeployForTheSameAuthenticatedTenant() {
    Deployment deploymentOne = repositoryService.createDeployment().addModelInstance("emptyProcess.bpmn", emptyProcess).addModelInstance("startEndProcess.bpmn", startEndProcess).tenantId(TENANT_ONE).deploy();
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
    repositoryService.createDeployment().addDeploymentResources(deploymentOne.getId()).tenantId(TENANT_ONE).deploy();
    DeploymentQuery query = repositoryService.createDeploymentQuery();
    assertThat(query.count(), is(2L));
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(2L));
}
Also used : DeploymentQuery(org.camunda.bpm.engine.repository.DeploymentQuery) Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

Example 45 with Deployment

use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.

the class MultiTenancyDeploymentCmdsTenantCheckTest method redeployForDifferentAuthenticatedTenants.

@Test
public void redeployForDifferentAuthenticatedTenants() {
    Deployment deploymentOne = repositoryService.createDeployment().addModelInstance("emptyProcess.bpmn", emptyProcess).addModelInstance("startEndProcess.bpmn", startEndProcess).tenantId(TENANT_ONE).deploy();
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_TWO));
    thrown.expect(ProcessEngineException.class);
    thrown.expectMessage("Cannot get the deployment");
    repositoryService.createDeployment().addDeploymentResources(deploymentOne.getId()).tenantId(TENANT_TWO).deploy();
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

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