[JBoss JIRA] (JBESB-3896) JBpmObjectMapper doesn't appear to handle missing variables properly
by RH Bugzilla Integration (JIRA)
[ https://issues.jboss.org/browse/JBESB-3896?page=com.atlassian.jira.plugin... ]
RH Bugzilla Integration commented on JBESB-3896:
------------------------------------------------
Rick Wagner <rwagner(a)redhat.com> made a comment on [bug 896640|https://bugzilla.redhat.com/show_bug.cgi?id=896640]
+++ This bug was initially created as a clone of Bug #896634 +++
Description of problem:
Customer has raised the point that JBpmObjectMapper doesn't make it to what appears to be the intended log statement when a jBPM-side variable is not present.
This can be validated by inserting the following method into JBpmObjectMapperUnitTest.java:
// Same as existing test, just commented out setting v1.
@Test
public void testMissingObject() throws Exception
// Things to look for:
// 1) If the variable does not exist in the jbpm variable map, the execution context is tested, but if not present there, an exception is thrown.
// It looks like the intention was to arrive at "log.warn("The object " + mapping.getBpm() + " is null and cannot not be set on the message")"
{
SAXReader reader = new SAXReader();
Document document = reader.read(this.getClass().getResourceAsStream("/" + PROCESS_DEF_XML));
Element element = document.getRootElement();
DefaultElement bpmToEsbVars = (DefaultElement) element.element("start-state").element("transition").element("action").element("bpmToEsbVars");
String helloWorldTokenScope = "Hello world token scope";
String helloWorldGlobalScope = "Hello world process-instance scope";
TestJBPMVariable objectTokenScope = new TestJBPMVariable("Object token scope") ;
TestJBPMVariable objectGlobalScope = new TestJBPMVariable("Object global scope") ;
Token token = processInstance.getRootToken();
// Don't set v1, see what happens
//processInstance.getContextInstance().setVariable("v1", helloWorldTokenScope, token);
processInstance.getContextInstance().setVariable("g2", helloWorldGlobalScope);
processInstance.getContextInstance().setVariable("h3", objectTokenScope, token);
processInstance.getContextInstance().setVariable("i4", objectGlobalScope);
ExecutionContext executionContext = new ExecutionContext(token);
JBpmObjectMapper mapper = new JBpmObjectMapper();
Message message = mapper.mapFromJBpmToEsbMessage(bpmToEsbVars, Boolean.FALSE, executionContext);
assertEquals(helloWorldTokenScope,String.valueOf(message.getBody().get("esbObj1")));
assertEquals(helloWorldGlobalScope,String.valueOf(message.getBody().get("esbObj2")));
assertEquals(objectTokenScope.getInternal(), String.valueOf(message.getBody().get("esbObj3")));
assertEquals(objectGlobalScope.getInternal(), String.valueOf(message.getBody().get("esbObj4")));
}
> JBpmObjectMapper doesn't appear to handle missing variables properly
> ---------------------------------------------------------------------
>
> Key: JBESB-3896
> URL: https://issues.jboss.org/browse/JBESB-3896
> Project: JBoss ESB
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Reporter: Rick Wagner
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira