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