Search in sources :

Example 21 with Deployment

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

the class RedeployDeploymentAuthorizationTest method testRedeploy.

@Test
public void testRedeploy() {
    // given
    RepositoryService repositoryService = engineRule.getRepositoryService();
    BpmnModelInstance model1 = Bpmn.createExecutableProcess("process1").done();
    BpmnModelInstance model2 = Bpmn.createExecutableProcess("process2").done();
    // first deployment
    Deployment deployment1 = repositoryService.createDeployment().addModelInstance("process1.bpmn", model1).addModelInstance("process2.bpmn", model2).deploy();
    // when
    authRule.init(scenario).withUser("userId").bindResource("deploymentId", deployment1.getId()).start();
    Deployment deployment2 = repositoryService.createDeployment().addDeploymentResources(deployment1.getId()).deploy();
    // then
    if (authRule.assertScenario(scenario)) {
        Assert.assertEquals(2, repositoryService.createDeploymentQuery().count());
        deleteDeployments(deployment2);
        deleteAuthorizations();
    }
    deleteDeployments(deployment1);
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) RepositoryService(org.camunda.bpm.engine.RepositoryService) Test(org.junit.Test)

Example 22 with Deployment

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

the class NestedExecutionAPIInvocationTest method init.

@Before
public void init() {
    StartProcessOnAnotherEngineDelegate.engine = engine2BootstrapRule.getProcessEngine();
    NestedProcessStartDelegate.engine = engineRule1.getProcessEngine();
    // given
    Deployment deployment1 = engineRule1.getRepositoryService().createDeployment().addModelInstance("foo.bpmn", PROCESS_MODEL).deploy();
    Deployment deployment2 = engineRule1.getRepositoryService().createDeployment().addModelInstance("boo.bpmn", PROCESS_MODEL_2).deploy();
    engineRule1.manageDeployment(deployment1);
    engineRule1.manageDeployment(deployment2);
    Deployment deployment3 = engineRule2.getProcessEngine().getRepositoryService().createDeployment().addModelInstance("joo.bpmn", ONE_TASK_PROCESS_MODEL).deploy();
    engineRule2.manageDeployment(deployment3);
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment) Before(org.junit.Before)

Example 23 with Deployment

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

the class RedeploymentTest method testRedeployNewDeployment.

public void testRedeployNewDeployment() {
    // given
    BpmnModelInstance model = createProcessWithServiceTask(PROCESS_KEY);
    Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, model).deploy();
    DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentName(DEPLOYMENT_NAME);
    assertNotNull(deployment1.getId());
    verifyQueryResults(query, 1);
    // when
    Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
    // then
    assertNotNull(deployment2);
    assertNotNull(deployment2.getId());
    assertFalse(deployment1.getId().equals(deployment2.getId()));
    verifyQueryResults(query, 2);
    deleteDeployments(deployment1, deployment2);
}
Also used : DeploymentQuery(org.camunda.bpm.engine.repository.DeploymentQuery) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) Deployment(org.camunda.bpm.engine.repository.Deployment) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 24 with Deployment

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

the class RedeploymentTest method testRedeployUnexistingDeploymentResource.

public void testRedeployUnexistingDeploymentResource() {
    // given
    BpmnModelInstance model = createProcessWithServiceTask(PROCESS_KEY);
    Deployment deployment = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, model).deploy();
    try {
        // when
        repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourceByName(deployment.getId(), "not-existing-resource.bpmn").deploy();
        fail("It should not be possible to re-deploy a not existing deployment resource");
    } catch (NotFoundException e) {
    // then
    // expected
    }
    try {
        // when
        repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourcesByName(deployment.getId(), Arrays.asList("not-existing-resource.bpmn")).deploy();
        fail("It should not be possible to re-deploy a not existing deployment resource");
    } catch (NotFoundException e) {
    // then
    // expected
    }
    try {
        // when
        repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourceById(deployment.getId(), "not-existing-resource-id").deploy();
        fail("It should not be possible to re-deploy a not existing deployment resource");
    } catch (NotFoundException e) {
    // then
    // expected
    }
    try {
        // when
        repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourcesById(deployment.getId(), Arrays.asList("not-existing-resource-id")).deploy();
        fail("It should not be possible to re-deploy a not existing deployment resource");
    } catch (NotFoundException e) {
    // then
    // expected
    }
    deleteDeployments(deployment);
}
Also used : ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) Deployment(org.camunda.bpm.engine.repository.Deployment) NotFoundException(org.camunda.bpm.engine.exception.NotFoundException) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 25 with Deployment

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

the class RedeploymentTest method testRedeployFormDifferentDeploymentsById.

public void testRedeployFormDifferentDeploymentsById() {
    // 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());
    Resource resource2 = getResourceByName(deployment2.getId(), RESOURCE_2_NAME);
    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()).addDeploymentResourceById(deployment2.getId(), resource2.getId()).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)

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