Search in sources :

Example 66 with Deployment

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

the class DeploymentResourceImpl method deleteDeployment.

@Override
public void deleteDeployment(String deploymentId, UriInfo uriInfo) {
    RepositoryService repositoryService = getProcessEngine().getRepositoryService();
    Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
    if (deployment == null) {
        throw new InvalidRequestException(Status.NOT_FOUND, "Deployment with id '" + deploymentId + "' do not exist");
    }
    boolean cascade = isQueryPropertyEnabled(uriInfo, CASCADE);
    boolean skipCustomListeners = isQueryPropertyEnabled(uriInfo, "skipCustomListeners");
    boolean skipIoMappings = isQueryPropertyEnabled(uriInfo, "skipIoMappings");
    repositoryService.deleteDeployment(deploymentId, cascade, skipCustomListeners, skipIoMappings);
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) RepositoryService(org.camunda.bpm.engine.RepositoryService)

Example 67 with Deployment

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

the class DeploymentResourceImpl method getDeployment.

public DeploymentDto getDeployment() {
    RepositoryService repositoryService = getProcessEngine().getRepositoryService();
    Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
    if (deployment == null) {
        throw new InvalidRequestException(Status.NOT_FOUND, "Deployment with id '" + deploymentId + "' does not exist");
    }
    return DeploymentDto.fromDeployment(deployment);
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) RepositoryService(org.camunda.bpm.engine.RepositoryService)

Example 68 with Deployment

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

the class SpringProcessApplicationTest method testPostDeployRegistrationPa.

@Test
public void testPostDeployRegistrationPa() {
    // this test verifies that a process application is able to register a deployment from the @PostDeploy callback:
    AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/camunda/bpm/engine/spring/test/application/PostDeployRegistrationPaTest-context.xml");
    applicationContext.start();
    ProcessEngine processEngine = BpmPlatform.getDefaultProcessEngine();
    // create a manual deployment:
    Deployment deployment = processEngine.getRepositoryService().createDeployment().addClasspathResource("org/camunda/bpm/engine/spring/test/application/process.bpmn20.xml").deploy();
    // lookup the process application spring bean:
    PostDeployRegistrationPa processApplication = applicationContext.getBean("customProcessApplicaiton", PostDeployRegistrationPa.class);
    Assert.assertFalse(processApplication.isPostDeployInvoked());
    processApplication.deploy();
    Assert.assertTrue(processApplication.isPostDeployInvoked());
    // the process application was not invoked
    Assert.assertFalse(processApplication.isInvoked());
    // start process instance:
    processEngine.getRuntimeService().startProcessInstanceByKey("startToEnd");
    // now the process application was invoked:
    Assert.assertTrue(processApplication.isInvoked());
    // undeploy PA
    Assert.assertFalse(processApplication.isPreUndeployInvoked());
    processApplication.undeploy();
    Assert.assertTrue(processApplication.isPreUndeployInvoked());
    // manually undeploy the process
    processEngine.getRepositoryService().deleteDeployment(deployment.getId(), true);
    applicationContext.close();
}
Also used : AbstractApplicationContext(org.springframework.context.support.AbstractApplicationContext) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) Deployment(org.camunda.bpm.engine.repository.Deployment) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) Test(org.junit.Test)

Example 69 with Deployment

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

the class ProcessInstanceModificationInTransactionTest method deployModelInstance.

private void deployModelInstance(BpmnModelInstance modelInstance) {
    DeploymentBuilder deploymentbuilder = repositoryService.createDeployment();
    deploymentbuilder.addModelInstance("process0.bpmn", modelInstance);
    Deployment deployment = deploymentbuilder.deploy();
    rule.manageDeployment(deployment);
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment) DeploymentBuilder(org.camunda.bpm.engine.repository.DeploymentBuilder)

Example 70 with Deployment

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

the class RegisterDeploymentCmd method execute.

public Void execute(CommandContext commandContext) {
    Deployment deployment = commandContext.getDeploymentManager().findDeploymentById(deploymentId);
    ensureNotNull("Deployment " + deploymentId + " does not exist", "deployment", deployment);
    commandContext.getAuthorizationManager().checkCamundaAdmin();
    Context.getProcessEngineConfiguration().getRegisteredDeployments().add(deploymentId);
    return null;
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment)

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