use of org.camunda.bpm.engine.impl.pvm.ReadOnlyProcessDefinition in project camunda-bpm-platform by camunda.
the class BpmnDeploymentTest method testGetBpmnXmlFileThroughService.
@Deployment
public void testGetBpmnXmlFileThroughService() {
String deploymentId = repositoryService.createDeploymentQuery().singleResult().getId();
List<String> deploymentResources = repositoryService.getDeploymentResourceNames(deploymentId);
// verify bpmn file name
assertEquals(1, deploymentResources.size());
String bpmnResourceName = "org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testGetBpmnXmlFileThroughService.bpmn20.xml";
assertEquals(bpmnResourceName, deploymentResources.get(0));
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
assertEquals(bpmnResourceName, processDefinition.getResourceName());
assertNull(processDefinition.getDiagramResourceName());
assertFalse(processDefinition.hasStartFormKey());
ReadOnlyProcessDefinition readOnlyProcessDefinition = ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processDefinition.getId());
assertNull(readOnlyProcessDefinition.getDiagramResourceName());
// verify content
InputStream deploymentInputStream = repositoryService.getResourceAsStream(deploymentId, bpmnResourceName);
String contentFromDeployment = readInputStreamToString(deploymentInputStream);
assertTrue(contentFromDeployment.length() > 0);
assertTrue(contentFromDeployment.contains("process id=\"emptyProcess\""));
InputStream fileInputStream = ReflectUtil.getResourceAsStream("org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testGetBpmnXmlFileThroughService.bpmn20.xml");
String contentFromFile = readInputStreamToString(fileInputStream);
assertEquals(contentFromFile, contentFromDeployment);
}
use of org.camunda.bpm.engine.impl.pvm.ReadOnlyProcessDefinition in project camunda-bpm-platform by camunda.
the class RepositoryServiceTest method testProcessDefinitionIntrospection.
public void testProcessDefinitionIntrospection() {
String deploymentId = repositoryService.createDeployment().addClasspathResource("org/camunda/bpm/engine/test/api/repository/processOne.bpmn20.xml").deploy().getId();
String procDefId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
ReadOnlyProcessDefinition processDefinition = ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(procDefId);
assertEquals(procDefId, processDefinition.getId());
assertEquals("Process One", processDefinition.getName());
assertEquals("the first process", processDefinition.getProperty("documentation"));
PvmActivity start = processDefinition.findActivity("start");
assertNotNull(start);
assertEquals("start", start.getId());
assertEquals("S t a r t", start.getProperty("name"));
assertEquals("the start event", start.getProperty("documentation"));
assertEquals(Collections.EMPTY_LIST, start.getActivities());
List<PvmTransition> outgoingTransitions = start.getOutgoingTransitions();
assertEquals(1, outgoingTransitions.size());
assertEquals("${a == b}", outgoingTransitions.get(0).getProperty(BpmnParse.PROPERTYNAME_CONDITION_TEXT));
PvmActivity end = processDefinition.findActivity("end");
assertNotNull(end);
assertEquals("end", end.getId());
PvmTransition transition = outgoingTransitions.get(0);
assertEquals("flow1", transition.getId());
assertEquals("Flow One", transition.getProperty("name"));
assertEquals("The only transitions in the process", transition.getProperty("documentation"));
assertSame(start, transition.getSource());
assertSame(end, transition.getDestination());
repositoryService.deleteDeployment(deploymentId);
}
use of org.camunda.bpm.engine.impl.pvm.ReadOnlyProcessDefinition in project camunda-bpm-platform by camunda.
the class BpmnDeploymentTest method testProcessDefinitionDescription.
@Deployment
public void testProcessDefinitionDescription() {
String id = repositoryService.createProcessDefinitionQuery().singleResult().getId();
ReadOnlyProcessDefinition processDefinition = ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(id);
assertEquals("This is really good process documentation!", processDefinition.getDescription());
}
use of org.camunda.bpm.engine.impl.pvm.ReadOnlyProcessDefinition in project camunda-bpm-platform by camunda.
the class ProcessDefinitionAuthorizationTest method testGetDeployedProcessDefinition.
public void testGetDeployedProcessDefinition() {
// given
String processDefinitionId = selectProcessDefinitionByKey(ONE_TASK_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, ONE_TASK_PROCESS_KEY, userId, READ);
// when
ReadOnlyProcessDefinition definition = ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processDefinitionId);
// then
assertNotNull(definition);
}
Aggregations