Search in sources :

Example 6 with DeploymentBuilder

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

the class RepositoryServiceTest method testDeleteDeploymentSkipIoMappings.

public void testDeleteDeploymentSkipIoMappings() {
    DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().addClasspathResource("org/camunda/bpm/engine/test/api/repository/RepositoryServiceTest.testDeleteDeploymentSkipIoMappings.bpmn20.xml");
    String deploymentId = deploymentBuilder.deploy().getId();
    runtimeService.startProcessInstanceByKey("ioMappingProcess");
    // Try to delete the deployment
    try {
        repositoryService.deleteDeployment(deploymentId, true, false, true);
    } catch (Exception e) {
        throw new ProcessEngineException("Exception is not expected when deleting deployment with running process", e);
    }
}
Also used : DeploymentBuilder(org.camunda.bpm.engine.repository.DeploymentBuilder) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) NotValidException(org.camunda.bpm.engine.exception.NotValidException) BadUserRequestException(org.camunda.bpm.engine.BadUserRequestException) NotFoundException(org.camunda.bpm.engine.exception.NotFoundException) IOException(java.io.IOException) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 7 with DeploymentBuilder

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

the class RepositoryServiceTest method testDeleteDeploymentSkipCustomTaskListeners.

public void testDeleteDeploymentSkipCustomTaskListeners() {
    DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().addClasspathResource("org/camunda/bpm/engine/test/api/repository/RepositoryServiceTest.testDeleteProcessInstanceSkipCustomTaskListeners.bpmn20.xml");
    String deploymentId = deploymentBuilder.deploy().getId();
    runtimeService.startProcessInstanceByKey("testProcess");
    RecorderTaskListener.getRecordedEvents().clear();
    repositoryService.deleteDeployment(deploymentId, true, false);
    assertEquals(1, RecorderTaskListener.getRecordedEvents().size());
    RecorderTaskListener.clear();
    deploymentId = deploymentBuilder.deploy().getId();
    runtimeService.startProcessInstanceByKey("testProcess");
    repositoryService.deleteDeployment(deploymentId, true, true);
    assertTrue(RecorderTaskListener.getRecordedEvents().isEmpty());
    RecorderTaskListener.clear();
}
Also used : DeploymentBuilder(org.camunda.bpm.engine.repository.DeploymentBuilder)

Example 8 with DeploymentBuilder

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

the class ExternalTaskParseTest method testParseExternalTaskWithoutTopic.

public void testParseExternalTaskWithoutTopic() {
    DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().addClasspathResource("org/camunda/bpm/engine/test/bpmn/external/ExternalTaskParseTest.testParseExternalTaskWithoutTopic.bpmn20.xml");
    try {
        deploymentBuilder.deploy();
        fail("exception expected");
    } catch (ProcessEngineException e) {
        assertTextPresent("External tasks must specify a 'topic' attribute in the camunda namespace", e.getMessage());
    }
}
Also used : DeploymentBuilder(org.camunda.bpm.engine.repository.DeploymentBuilder) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 9 with DeploymentBuilder

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

the class JobDefinitionCreationAndDeletionWithParseListenerTest method testDeleteNonExistingAndCreateNewJobDefinitionWithParseListener.

@Test
public void testDeleteNonExistingAndCreateNewJobDefinitionWithParseListener() {
    // given
    String modelFileName = "jobCreationWithinParseListener.bpmn20.xml";
    InputStream in = JobDefinitionCreationWithParseListenerTest.class.getResourceAsStream(modelFileName);
    DeploymentBuilder builder = engineRule.getRepositoryService().createDeployment().addInputStream(modelFileName, in);
    // when the asyncBefore is set to false and the asyncAfter to true in the parse listener
    Deployment deployment = builder.deploy();
    engineRule.manageDeployment(deployment);
    // then there exists one job definition
    JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery();
    JobDefinition jobDef = query.singleResult();
    assertNotNull(jobDef);
    assertEquals(jobDef.getProcessDefinitionKey(), "oneTaskProcess");
    assertEquals(jobDef.getActivityId(), "servicetask1");
    assertEquals(jobDef.getJobConfiguration(), MessageJobDeclaration.ASYNC_AFTER);
}
Also used : JobDefinitionQuery(org.camunda.bpm.engine.management.JobDefinitionQuery) InputStream(java.io.InputStream) Deployment(org.camunda.bpm.engine.repository.Deployment) DeploymentBuilder(org.camunda.bpm.engine.repository.DeploymentBuilder) JobDefinition(org.camunda.bpm.engine.management.JobDefinition) Test(org.junit.Test)

Example 10 with DeploymentBuilder

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

the class JobDefinitionCreationBothAsyncWithParseListenerTest method testCreateBothJobDefinitionWithParseListenerAndAsynBothInXml.

@Test
public void testCreateBothJobDefinitionWithParseListenerAndAsynBothInXml() {
    // given the asyncBefore AND asyncAfter is set in the xml
    String modelFileName = "jobAsyncBothCreationWithinParseListener.bpmn20.xml";
    InputStream in = JobDefinitionCreationWithParseListenerTest.class.getResourceAsStream(modelFileName);
    DeploymentBuilder builder = engineRule.getRepositoryService().createDeployment().addInputStream(modelFileName, in);
    // when the asyncBefore and asyncAfter is set to true in the parse listener
    Deployment deployment = builder.deploy();
    engineRule.manageDeployment(deployment);
    // then there exists two job definitions
    JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery();
    List<JobDefinition> definitions = query.orderByJobConfiguration().asc().list();
    assertEquals(definitions.size(), 2);
    // asyncAfter
    JobDefinition asyncAfterAfter = definitions.get(0);
    assertEquals(asyncAfterAfter.getProcessDefinitionKey(), "oneTaskProcess");
    assertEquals(asyncAfterAfter.getActivityId(), "servicetask1");
    assertEquals(asyncAfterAfter.getJobConfiguration(), MessageJobDeclaration.ASYNC_AFTER);
    // asyncBefore
    JobDefinition asyncAfterBefore = definitions.get(1);
    assertEquals(asyncAfterBefore.getProcessDefinitionKey(), "oneTaskProcess");
    assertEquals(asyncAfterBefore.getActivityId(), "servicetask1");
    assertEquals(asyncAfterBefore.getJobConfiguration(), MessageJobDeclaration.ASYNC_BEFORE);
}
Also used : JobDefinitionQuery(org.camunda.bpm.engine.management.JobDefinitionQuery) InputStream(java.io.InputStream) Deployment(org.camunda.bpm.engine.repository.Deployment) DeploymentBuilder(org.camunda.bpm.engine.repository.DeploymentBuilder) JobDefinition(org.camunda.bpm.engine.management.JobDefinition) Test(org.junit.Test)

Aggregations

DeploymentBuilder (org.camunda.bpm.engine.repository.DeploymentBuilder)26 Test (org.junit.Test)14 Deployment (org.camunda.bpm.engine.repository.Deployment)11 InputStream (java.io.InputStream)10 JobDefinitionQuery (org.camunda.bpm.engine.management.JobDefinitionQuery)10 JobDefinition (org.camunda.bpm.engine.management.JobDefinition)8 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)5 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)4 IdentityLink (org.camunda.bpm.engine.task.IdentityLink)4 IOException (java.io.IOException)3 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)2 RepositoryService (org.camunda.bpm.engine.RepositoryService)2 NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)2 NotValidException (org.camunda.bpm.engine.exception.NotValidException)2 Method (java.lang.reflect.Method)1 ZipInputStream (java.util.zip.ZipInputStream)1 Deployment (org.camunda.bpm.engine.test.Deployment)1 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)1 ByteArrayResource (org.springframework.core.io.ByteArrayResource)1 ContextResource (org.springframework.core.io.ContextResource)1