Search in sources :

Example 11 with Resource

use of org.camunda.bpm.engine.repository.Resource 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 12 with Resource

use of org.camunda.bpm.engine.repository.Resource 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 13 with Resource

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

the class TestAdditionalResourceSuffixes method testDeployProcessArchive.

@Test
public void testDeployProcessArchive() {
    assertNotNull(processEngine);
    RepositoryService repositoryService = processEngine.getRepositoryService();
    ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery().processDefinitionKey("invoice-it");
    assertEquals(1, processDefinitionQuery.count());
    ProcessDefinition processDefinition = processDefinitionQuery.singleResult();
    String deploymentId = repositoryService.createDeploymentQuery().deploymentId(processDefinition.getDeploymentId()).singleResult().getId();
    List<Resource> deploymentResources = repositoryService.getDeploymentResources(deploymentId);
    assertEquals(3, deploymentResources.size());
}
Also used : Resource(org.camunda.bpm.engine.repository.Resource) ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) RepositoryService(org.camunda.bpm.engine.RepositoryService) Test(org.junit.Test) AbstractFoxPlatformIntegrationTest(org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)

Example 14 with Resource

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

the class RedeploymentTest method testRedeploySameDeploymentResourceById.

public void testRedeploySameDeploymentResourceById() {
    // given
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
    BpmnModelInstance model1 = createProcessWithServiceTask(PROCESS_1_KEY);
    BpmnModelInstance model2 = createProcessWithUserTask(PROCESS_2_KEY);
    // first deployment
    Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_1_NAME, model1).addModelInstance(RESOURCE_2_NAME, model2).deploy();
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 1);
    verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 1);
    Resource resource1 = getResourceByName(deployment1.getId(), RESOURCE_1_NAME);
    // second deployment
    model1 = createProcessWithScriptTask(PROCESS_1_KEY);
    model2 = createProcessWithReceiveTask(PROCESS_2_KEY);
    Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_1_NAME, model1).addModelInstance(RESOURCE_2_NAME, model2).deploy();
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 2);
    verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 2);
    // when
    Deployment deployment3 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourceById(deployment1.getId(), resource1.getId()).addDeploymentResourcesById(deployment1.getId(), Arrays.asList(resource1.getId())).deploy();
    // then
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 3);
    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 15 with Resource

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

the class RedeploymentTest method testRedeployOneAndMultipleDeploymentResourcesById.

public void testRedeployOneAndMultipleDeploymentResourcesById() {
    // given
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
    BpmnModelInstance model1 = createProcessWithServiceTask(PROCESS_1_KEY);
    BpmnModelInstance model2 = createProcessWithUserTask(PROCESS_2_KEY);
    BpmnModelInstance model3 = createProcessWithScriptTask(PROCESS_3_KEY);
    // first deployment
    Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_1_NAME, model1).addModelInstance(RESOURCE_2_NAME, model2).addModelInstance(RESOURCE_3_NAME, model3).deploy();
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 1);
    verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 1);
    verifyQueryResults(query.processDefinitionKey(PROCESS_3_KEY), 1);
    Resource resource1 = getResourceByName(deployment1.getId(), RESOURCE_1_NAME);
    Resource resource2 = getResourceByName(deployment1.getId(), RESOURCE_2_NAME);
    Resource resource3 = getResourceByName(deployment1.getId(), RESOURCE_3_NAME);
    // second deployment
    model1 = createProcessWithScriptTask(PROCESS_1_KEY);
    model2 = createProcessWithReceiveTask(PROCESS_2_KEY);
    model3 = createProcessWithUserTask(PROCESS_3_KEY);
    Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_1_NAME, model1).addModelInstance(RESOURCE_2_NAME, model2).addModelInstance(RESOURCE_3_NAME, model3).deploy();
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 2);
    verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 2);
    verifyQueryResults(query.processDefinitionKey(PROCESS_3_KEY), 2);
    // when
    Deployment deployment3 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourceById(deployment1.getId(), resource1.getId()).addDeploymentResourcesById(deployment1.getId(), Arrays.asList(resource2.getId(), resource3.getId())).deploy();
    // then
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 3);
    verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 3);
    verifyQueryResults(query.processDefinitionKey(PROCESS_3_KEY), 3);
    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)

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