@Override protected Bpmn2UnMarshaller createBpmn2UnMarshaller(GraphObjectBuilderFactory elementBuilderFactory, DefinitionManager definitionManager, FactoryManager factoryManager, DefinitionsCacheRegistry definitionsCacheRegistry, RuleManager rulesManager, OryxManager oryxManager, GraphCommandManager commandManager, GraphCommandFactory commandFactory, GraphIndexBuilder<?> indexBuilder, Class<?> diagramDefinitionSetClass, Class<? extends BPMNDiagram> diagramDefinitionClass) { return new CaseManagementUnMarshaller(elementBuilderFactory, definitionManager, factoryManager, definitionsCacheRegistry, rulesManager, oryxManager, commandManager, commandFactory, indexBuilder, diagramDefinitionSetClass, diagramDefinitionClass); } }
@Override protected void marshallNode(FlowNode node, Map<String, Object> properties, String stencil, BPMNPlane plane, JsonGenerator generator, float xOffset, float yOffset) throws IOException { String trueStencil = stencil; if ("ReusableSubprocess".equals(stencil)) { trueStencil = isCase(node) ? "CaseReusableSubprocess" : "ProcessReusableSubprocess"; } doMarshallNode(node, properties, trueStencil, plane, generator, xOffset, yOffset); }
@Test public void testMarshallNode_AdHocSubprocess() throws Exception { expectedStencil = "AdHocSubprocess"; tested.marshallNode(mock(FlowNode.class), new HashMap<>(), "AdHocSubprocess", mock(BPMNPlane.class), mock(JsonGenerator.class), 0.0f, 0.0f); }
@Test public void testMarshallNode_CaseReusableSubprocess() throws Exception { expectedStencil = "CaseReusableSubprocess"; final MetaDataType metaDataType = mock(MetaDataType.class); when(metaDataType.getName()).thenReturn("case"); when(metaDataType.getMetaValue()).thenReturn("true"); final FeatureMap featureMap = mock(FeatureMap.class); when(featureMap.get(eq(DroolsPackage.Literals.DOCUMENT_ROOT__META_DATA), eq(true))) .thenReturn(Collections.singletonList(metaDataType)); final ExtensionAttributeValue extensionAttributeValue = mock(ExtensionAttributeValue.class); when(extensionAttributeValue.getValue()).thenReturn(featureMap); final CallActivity callActivity = mock(CallActivity.class); when(callActivity.getExtensionValues()).thenReturn(Collections.singletonList(extensionAttributeValue)); tested.marshallNode(callActivity, new HashMap<>(), "ReusableSubprocess", mock(BPMNPlane.class), mock(JsonGenerator.class), 0.0f, 0.0f); }
@Test public void testMarshallNode_ProcessReusableSubprocess() throws Exception { expectedStencil = "ProcessReusableSubprocess"; final MetaDataType metaDataType = mock(MetaDataType.class); when(metaDataType.getName()).thenReturn("case"); when(metaDataType.getMetaValue()).thenReturn("false"); final FeatureMap featureMap = mock(FeatureMap.class); when(featureMap.get(eq(DroolsPackage.Literals.DOCUMENT_ROOT__META_DATA), eq(true))) .thenReturn(Collections.singletonList(metaDataType)); final ExtensionAttributeValue extensionAttributeValue = mock(ExtensionAttributeValue.class); when(extensionAttributeValue.getValue()).thenReturn(featureMap); final CallActivity callActivity = mock(CallActivity.class); when(callActivity.getExtensionValues()).thenReturn(Collections.singletonList(extensionAttributeValue)); tested.marshallNode(callActivity, new HashMap<>(), "ReusableSubprocess", mock(BPMNPlane.class), mock(JsonGenerator.class), 0.0f, 0.0f); } }