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);
}
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));
}
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());
}
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));
}
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());
}
Aggregations