Bug 771209

Summary: Camel integration using jaxb, no facts were inserted by InsertElements command.
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Radovan Synek <rsynek>
Component: BRE (Expert, Fusion)Assignee: Nobody <nobody>
Status: VERIFIED --- QA Contact: Radovan Synek <rsynek>
Severity: medium Docs Contact:
Priority: unspecified    
Version: BRMS 5.3.0.GACC: lpetrovi, mproctor
Target Milestone: ---   
Target Release: BRMS 5.3.0.GA   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
insertElements command reproducer none

Description Radovan Synek 2012-01-02 13:56:46 UTC
Created attachment 550258 [details]
insertElements command reproducer

I have following camel-drools configuration:
camelContext.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {          
                JaxbDataFormat jdf = new JaxbDataFormat();
                jdf.setContextPath("com.redhat.jaxbinsertelements.domain");
                jdf.setPrettyPrint(true);

                from("direct:test-session").policy(new DroolsPolicy()).unmarshal(jdf).to("drools://testnode/ksession").marshal(jdf);
                from("direct:unmarshall").policy(new DroolsPolicy()).unmarshal(jdf);
                from("direct:marshall").policy(new DroolsPolicy()).marshal(jdf);
            }
        });

I am trying to insert multiple facts into a session using InsertElement command. XML is created manually from example in documentation (http://docs.jboss.org/drools/release/5.3.0.Final/droolsjbpm-integration-docs/). When I am executing the command no exception is thrown, bud also no facts are inserted into the session. Here is my XML:

<batch-execution>
  <insert-elements return-objects="true">
    <objects xsi:type="person" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <age>50</age>
      <id>0</id>
      <likes>nobody</likes>
      <name>John</name>
    </objects>
    <objects xsi:type="person" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <age>24</age>
      <id>0</id>
      <likes>himself</likes>
      <name>Peter</name>
    </objects>
  </insert-elements>
</batch-execution>

When I use marshaller to create XML from command instance contructed by API, this solution works, but the XML structure looks different:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <batch-execution>
            <insert-elements return-objects="true">
                <list>
                    <element xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="person">
                        <age>30</age>
                        <id>0</id>
                        <likes>spicy meals</likes>
                        <name>Alice</name>
                    </element>
                    <element xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="person">
                        <age>35</age>
                        <id>0</id>
                        <likes>Alice</likes>
                        <name>Carl</name>
                    </element>
                </list>
            </insert-elements>
        </batch-execution>

------------------------------------------------------------------------------

See an attachment for the details, it contains maven project, so build it and run.

Comment 2 Mark Proctor 2012-01-19 01:05:03 UTC
Camel isn't being productised yet. So check with prakash/johng before
progressing further on this one. If the bug seems genuine, please re-open a
jira for .org and we'll make sure it's fixed there.

Comment 3 Lukáš Petrovický 2012-01-19 07:38:17 UTC
ERD states that the Camel integration is being productized. (https://docspace.corp.redhat.com/docs/DOC-76523)

Comment 5 Geoffrey De Smet 2012-02-08 15:32:30 UTC
This reproduce code uses the drools-grid stuff too:

        GridImpl grid = new GridImpl();
        grid.addService(WhitePages.class, new WhitePagesImpl());
        GridNode node = grid.createGridNode("testnode");
	Context context = new JndiContext();
	context.bind("testnode", node);
        node.set("ksession", session);
        
        CamelContext camelContext = new DefaultCamelContext(context);

Please see the comments in this issue for more information:
  https://bugzilla.redhat.com/show_bug.cgi?id=771203

I am presuming it's also due to the drools-grid code breaking things. If not, please reopen.

Comment 6 Radovan Synek 2012-02-09 13:39:40 UTC
here is a pull request with reproducers for these 3 connected issues:
https://github.com/droolsjbpm/droolsjbpm-integration/pull/12

Comment 7 Geoffrey De Smet 2012-03-01 16:41:03 UTC
The documentation was wrong.
Fixed the documentation and applied the testcase on master and changed the testcase to test the correct way.

Here's the documentation fix on the branch:
https://github.com/droolsjbpm/droolsjbpm-integration/commit/fa1d136e877b5d0d334ee06fa50c2d886b5af894

Comment 8 Ryan Zhang 2012-03-21 09:55:14 UTC
Please verify this issue on ER5.