Search in sources :

Example 21 with Resource

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

the class RedeploymentTest method testRedeployFormDifferentDeploymentsByNameAndId.

public void testRedeployFormDifferentDeploymentsByNameAndId() {
    // given
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
    BpmnModelInstance model1 = createProcessWithServiceTask(PROCESS_1_KEY);
    // first deployment
    Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME + "-1").addModelInstance(RESOURCE_1_NAME, model1).deploy();
    assertEquals(1, repositoryService.getDeploymentResources(deployment1.getId()).size());
    Resource resource1 = getResourceByName(deployment1.getId(), RESOURCE_1_NAME);
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 1);
    // second deployment
    BpmnModelInstance model2 = createProcessWithReceiveTask(PROCESS_2_KEY);
    Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME + "-2").addModelInstance(RESOURCE_2_NAME, model2).deploy();
    assertEquals(1, repositoryService.getDeploymentResources(deployment2.getId()).size());
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 1);
    verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 1);
    // when
    Deployment deployment3 = repositoryService.createDeployment().name(DEPLOYMENT_NAME + "-3").addDeploymentResourceById(deployment1.getId(), resource1.getId()).addDeploymentResourceByName(deployment2.getId(), RESOURCE_2_NAME).deploy();
    assertEquals(2, repositoryService.getDeploymentResources(deployment3.getId()).size());
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 2);
    verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 2);
    deleteDeployments(deployment1, deployment2, deployment3);
}
Also used : Resource(org.camunda.bpm.engine.repository.Resource) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) Deployment(org.camunda.bpm.engine.repository.Deployment) ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 22 with Resource

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

the class MultiTenancyDeploymentCmdsTenantCheckTest method getDeploymentResourcesWithAuthenticatedTenant.

@Test
public void getDeploymentResourcesWithAuthenticatedTenant() {
    Deployment deployment = testRule.deployForTenant(TENANT_ONE, emptyProcess);
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
    List<Resource> deploymentResources = repositoryService.getDeploymentResources(deployment.getId());
    assertThat(deploymentResources, hasSize(1));
}
Also used : Resource(org.camunda.bpm.engine.repository.Resource) Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

Example 23 with Resource

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

the class MultiTenancyDeploymentCmdsTenantCheckTest method getResourceAsStreamDisabledTenantCheck.

@Test
public void getResourceAsStreamDisabledTenantCheck() {
    Deployment deploymentOne = testRule.deployForTenant(TENANT_ONE, emptyProcess);
    Deployment deploymentTwo = testRule.deployForTenant(TENANT_TWO, startEndProcess);
    Resource resourceOne = repositoryService.getDeploymentResources(deploymentOne.getId()).get(0);
    Resource resourceTwo = repositoryService.getDeploymentResources(deploymentTwo.getId()).get(0);
    processEngineConfiguration.setTenantCheckEnabled(false);
    identityService.setAuthentication("user", null, null);
    InputStream inputStream = repositoryService.getResourceAsStream(deploymentOne.getId(), resourceOne.getName());
    assertThat(inputStream, notNullValue());
    inputStream = repositoryService.getResourceAsStream(deploymentTwo.getId(), resourceTwo.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 24 with Resource

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

the class MultiTenancyDeploymentCmdsTenantCheckTest method getDeploymentResourcesDisabledTenantCheck.

@Test
public void getDeploymentResourcesDisabledTenantCheck() {
    Deployment deploymentOne = testRule.deployForTenant(TENANT_ONE, emptyProcess);
    Deployment deploymentTwo = testRule.deployForTenant(TENANT_TWO, startEndProcess);
    processEngineConfiguration.setTenantCheckEnabled(false);
    identityService.setAuthentication("user", null, null);
    List<Resource> deploymentResources = repositoryService.getDeploymentResources(deploymentOne.getId());
    assertThat(deploymentResources, hasSize(1));
    deploymentResources = repositoryService.getDeploymentResources(deploymentTwo.getId());
    assertThat(deploymentResources, hasSize(1));
}
Also used : Resource(org.camunda.bpm.engine.repository.Resource) Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

Example 25 with Resource

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

the class MultiTenancyDeploymentCmdsTenantCheckTest method getResourceAsStreamByIdDisabledTenantCheck.

@Test
public void getResourceAsStreamByIdDisabledTenantCheck() {
    Deployment deploymentOne = testRule.deployForTenant(TENANT_ONE, emptyProcess);
    Deployment deploymentTwo = testRule.deployForTenant(TENANT_TWO, startEndProcess);
    Resource resourceOne = repositoryService.getDeploymentResources(deploymentOne.getId()).get(0);
    Resource resourceTwo = repositoryService.getDeploymentResources(deploymentTwo.getId()).get(0);
    processEngineConfiguration.setTenantCheckEnabled(false);
    identityService.setAuthentication("user", null, null);
    InputStream inputStream = repositoryService.getResourceAsStreamById(deploymentOne.getId(), resourceOne.getId());
    assertThat(inputStream, notNullValue());
    inputStream = repositoryService.getResourceAsStreamById(deploymentTwo.getId(), resourceTwo.getId());
    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)

Aggregations

Resource (org.camunda.bpm.engine.repository.Resource)27 Deployment (org.camunda.bpm.engine.repository.Deployment)19 ProcessApplicationDeployment (org.camunda.bpm.engine.repository.ProcessApplicationDeployment)14 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)12 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)9 Test (org.junit.Test)9 InputStream (java.io.InputStream)6 ProcessApplicationRegistration (org.camunda.bpm.application.ProcessApplicationRegistration)3 EmbeddedProcessApplication (org.camunda.bpm.application.impl.EmbeddedProcessApplication)3 ArrayList (java.util.ArrayList)1 RepositoryService (org.camunda.bpm.engine.RepositoryService)1 ResourceEntity (org.camunda.bpm.engine.impl.persistence.entity.ResourceEntity)1 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)1 DeploymentResourceDto (org.camunda.bpm.engine.rest.dto.repository.DeploymentResourceDto)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1 DeploymentResourcesResource (org.camunda.bpm.engine.rest.sub.repository.DeploymentResourcesResource)1 Deployment (org.camunda.bpm.engine.test.Deployment)1 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)1