Search in sources :

Example 6 with SpinXmlElement

use of org.camunda.spin.xml.SpinXmlElement in project camunda-bpm-platform by camunda.

the class XmlValueTest method testGetUntypedXmlValue.

@Deployment(resources = ONE_TASK_PROCESS)
public void testGetUntypedXmlValue() {
    // given
    XmlValue xmlValue = xmlValue(xmlString).create();
    VariableMap variables = Variables.createVariables().putValueTyped(variableName, xmlValue);
    String processInstanceId = runtimeService.startProcessInstanceByKey(ONE_TASK_PROCESS_KEY, variables).getId();
    // when
    SpinXmlElement value = (SpinXmlElement) runtimeService.getVariable(processInstanceId, variableName);
    // then
    assertTrue(value.hasAttr("attrName"));
    assertEquals("attrValue", value.attr("attrName").value());
    assertTrue(value.childElements().isEmpty());
    assertEquals(xml().getName(), value.getDataFormatName());
}
Also used : VariableMap(org.camunda.bpm.engine.variable.VariableMap) XmlValue(org.camunda.spin.plugin.variable.value.XmlValue) SpinXmlElement(org.camunda.spin.xml.SpinXmlElement) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

SpinXmlElement (org.camunda.spin.xml.SpinXmlElement)6 Deployment (org.camunda.bpm.engine.test.Deployment)4 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)2 VariableMap (org.camunda.bpm.engine.variable.VariableMap)2 Variables.serializedObjectValue (org.camunda.bpm.engine.variable.Variables.serializedObjectValue)2 ObjectValue (org.camunda.bpm.engine.variable.value.ObjectValue)2 XmlValue (org.camunda.spin.plugin.variable.value.XmlValue)2