@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 testApplyCallActivityProperties() throws Exception { final CallActivity callActivity = mock(CallActivity.class); when(callActivity.getExtensionValues()).thenReturn(new ArrayList<>()); final String propertyName = "isCase"; final String propertyValue = "true"; final String resultName = "case"; final String resultValue = "<![CDATA[" + propertyValue + "]]>"; final Map<String, String> properties = new HashMap<>(); properties.put(propertyName, propertyValue); tested.applyCallActivityProperties(callActivity, properties); assertFalse(callActivity.getExtensionValues().isEmpty()); final ExtensionAttributeValue extenstionValue = callActivity.getExtensionValues().get(0); final Optional<String> value = extenstionValue.getValue().stream() .filter(v -> resultName.equals(((MetaDataType) v.getValue()).getName())) .map(v -> ((MetaDataType) v.getValue()).getMetaValue()).findAny(); assertTrue(value.isPresent() && resultValue.equals(value.get())); }
@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); } }
String customAsyncMetaData = Utils.getMetaDataValue(callActivity.getExtensionValues(), "customAsync"); String customAsync = (customAsyncMetaData != null && customAsyncMetaData.length() > 0) ? customAsyncMetaData : "false"; properties); ScriptTypeListValue onEntryActions = getOnEntryActions(callActivity.getExtensionValues()); ScriptTypeListValue onExitActions = getOnExitActions(callActivity.getExtensionValues()); if (!onEntryActions.isEmpty()) { properties.put(ONENTRYACTIONS,