public virtual void testGetUntypedXmlValue() { // given XmlValue xmlValue = xmlValue(xmlString).create(); VariableMap variables = Variables.createVariables().putValueTyped(variableName, xmlValue); string processInstanceId = runtimeService.startProcessInstanceByKey(ONE_TASK_PROCESS_KEY, variables).Id; // when SpinXmlElement value = (SpinXmlElement)runtimeService.getVariable(processInstanceId, variableName); // then assertTrue(value.hasAttr("attrName")); assertEquals("attrValue", value.attr("attrName").value()); assertTrue(value.childElements().Empty); assertEquals(xml().Name, value.DataFormatName); }
public virtual void testGetTypedXmlValue() { // given XmlValue xmlValue = xmlValue(xmlString).create(); VariableMap variables = Variables.createVariables().putValueTyped(variableName, xmlValue); string processInstanceId = runtimeService.startProcessInstanceByKey(ONE_TASK_PROCESS_KEY, variables).Id; // when XmlValue typedValue = runtimeService.getVariableTyped(processInstanceId, variableName); // then SpinXmlElement value = typedValue.Value; assertTrue(value.hasAttr("attrName")); assertEquals("attrValue", value.attr("attrName").value()); assertTrue(value.childElements().Empty); assertTrue(typedValue.Deserialized); assertEquals(XML, typedValue.Type); assertEquals(XML_FORMAT_NAME, typedValue.SerializationDataFormat); assertEquals(xmlString, typedValue.ValueSerialized); }