Java Code Examples for org.camunda.bpm.model.bpmn.Bpmn#readModelFromStream()
The following examples show how to use
org.camunda.bpm.model.bpmn.Bpmn#readModelFromStream() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompatabilityTest.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@Test public void modifyingAttributeWithActivitiNsKeepsIt() { BpmnModelInstance modelInstance = Bpmn.readModelFromStream(CamundaExtensionsTest.class.getResourceAsStream("CamundaExtensionsCompatabilityTest.xml")); ProcessImpl process = modelInstance.getModelElementById(PROCESS_ID); String priority = "9000"; process.setCamundaJobPriority(priority); process.setCamundaTaskPriority(priority); Integer historyTimeToLive = 10; process.setCamundaHistoryTimeToLive(historyTimeToLive); process.setCamundaIsStartableInTasklist(false); process.setCamundaVersionTag("v1.0.0"); assertThat(process.getAttributeValueNs(BpmnModelConstants.ACTIVITI_NS, "jobPriority"), is(priority)); assertThat(process.getAttributeValueNs(BpmnModelConstants.ACTIVITI_NS, "taskPriority"), is(priority)); assertThat(process.getAttributeValueNs(BpmnModelConstants.ACTIVITI_NS, "historyTimeToLive"), is(historyTimeToLive.toString())); assertThat(process.isCamundaStartableInTasklist(), is(false)); assertThat(process.getCamundaVersionTag(), is("v1.0.0")); }
Example 2
Source File: ParseBpmnModelRule.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@Override protected void starting(Description description) { if(description.getAnnotation(BpmnModelResource.class) != null) { Class<?> testClass = description.getTestClass(); String methodName = description.getMethodName(); String resourceFolderName = testClass.getName().replaceAll("\\.", "/"); String bpmnResourceName = resourceFolderName + "." + methodName + ".bpmn"; InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream(bpmnResourceName); try { bpmnModelInstance = Bpmn.readModelFromStream(resourceAsStream); } finally { IoUtil.closeSilently(resourceAsStream); } } }
Example 3
Source File: CompatabilityTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void modifyingAttributeWithActivitiNsKeepsIt() { BpmnModelInstance modelInstance = Bpmn.readModelFromStream(CamundaExtensionsTest.class.getResourceAsStream("CamundaExtensionsCompatabilityTest.xml")); ProcessImpl process = modelInstance.getModelElementById(PROCESS_ID); String priority = "9000"; process.setCamundaJobPriority(priority); process.setCamundaTaskPriority(priority); Integer historyTimeToLive = 10; process.setCamundaHistoryTimeToLive(historyTimeToLive); process.setCamundaIsStartableInTasklist(false); process.setCamundaVersionTag("v1.0.0"); assertThat(process.getAttributeValueNs(BpmnModelConstants.ACTIVITI_NS, "jobPriority"), is(priority)); assertThat(process.getAttributeValueNs(BpmnModelConstants.ACTIVITI_NS, "taskPriority"), is(priority)); assertThat(process.getAttributeValueNs(BpmnModelConstants.ACTIVITI_NS, "historyTimeToLive"), is(historyTimeToLive.toString())); assertThat(process.isCamundaStartableInTasklist(), is(false)); assertThat(process.getCamundaVersionTag(), is("v1.0.0")); }
Example 4
Source File: ParseBpmnModelRule.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override protected void starting(Description description) { if(description.getAnnotation(BpmnModelResource.class) != null) { Class<?> testClass = description.getTestClass(); String methodName = description.getMethodName(); String resourceFolderName = testClass.getName().replaceAll("\\.", "/"); String bpmnResourceName = resourceFolderName + "." + methodName + ".bpmn"; InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream(bpmnResourceName); try { bpmnModelInstance = Bpmn.readModelFromStream(resourceAsStream); } finally { IoUtil.closeSilently(resourceAsStream); } } }
Example 5
Source File: ClientIT.java From camunda-external-task-client-java with Apache License 2.0 | 5 votes |
@Test public void shouldFailWithCorrectError() throws FileNotFoundException { BpmnModelInstance bpmnModelInstance = Bpmn.readModelFromStream(new FileInputStream("src/it/resources/failing-output-mapping-model.bpmn")); String processDefinitionKey = engineRule.deploy(bpmnModelInstance).get(0).getId(); ExternalTaskClient client = null; try { // given engineRule.startProcessInstance(processDefinitionKey); client = ExternalTaskClient.create() .baseUrl(BASE_URL) .defaultSerializationFormat("application/x-java-serialized-object") .build(); RecordingExternalTaskHandler handler = new RecordingExternalTaskHandler((t, s) -> s.complete(t)); client.subscribe(EXTERNAL_TASK_TOPIC_FOO) .handler(handler) .open(); // when clientRule.waitForFetchAndLockUntil(() -> handler.isFailed()); // then assertThat(handler.getException().getMessage()).containsIgnoringCase("ScriptEvaluationException"); } finally { if (client != null) { client.stop(); } } }
Example 6
Source File: VersionedDeploymentHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected Integer parseCamundaVersionTag(Resource resource) { BpmnModelInstance model = Bpmn .readModelFromStream(new ByteArrayInputStream(resource.getBytes())); Process process = model.getDefinitions().getChildElementsByType(Process.class) .iterator().next(); return process.getCamundaVersionTag() != null ? Integer.valueOf(process.getCamundaVersionTag()) : 0; }
Example 7
Source File: VersionedDeploymentHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected String parseProcessDefinitionKey(Resource resource) { BpmnModelInstance model = Bpmn .readModelFromStream(new ByteArrayInputStream(resource.getBytes())); Process process = model.getDefinitions().getChildElementsByType(Process.class) .iterator().next(); return process.getId(); }
Example 8
Source File: TextAnnotationTest.java From camunda-bpmn-model with Apache License 2.0 | 4 votes |
@BeforeClass public static void parseModel() { modelInstance = Bpmn.readModelFromStream(TextAnnotationTest.class .getResourceAsStream("TextAnnotationTest.bpmn")); }
Example 9
Source File: TextAnnotationTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@BeforeClass public static void parseModel() { modelInstance = Bpmn.readModelFromStream(TextAnnotationTest.class .getResourceAsStream("TextAnnotationTest.bpmn")); }
Example 10
Source File: BpmnModelInstanceCache.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Override protected BpmnModelInstance readModelFromStream(InputStream bpmnResourceInputStream) { return Bpmn.readModelFromStream(bpmnResourceInputStream); }