[jboss-svn-commits] JBL Code SVN: r31589 - labs/jbossrules/branches/camel_jaxb_marshaller2-lucaz/drools-pipeline/drools-camel/src/test/java/org/drools/camel/component.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Feb 11 16:57:51 EST 2010
Author: baunax
Date: 2010-02-11 16:57:51 -0500 (Thu, 11 Feb 2010)
New Revision: 31589
Modified:
labs/jbossrules/branches/camel_jaxb_marshaller2-lucaz/drools-pipeline/drools-camel/src/test/java/org/drools/camel/component/CamelEndpointWithJaxbTest.java
Log:
updated testQuery
Modified: labs/jbossrules/branches/camel_jaxb_marshaller2-lucaz/drools-pipeline/drools-camel/src/test/java/org/drools/camel/component/CamelEndpointWithJaxbTest.java
===================================================================
--- labs/jbossrules/branches/camel_jaxb_marshaller2-lucaz/drools-pipeline/drools-camel/src/test/java/org/drools/camel/component/CamelEndpointWithJaxbTest.java 2010-02-11 21:57:12 UTC (rev 31588)
+++ labs/jbossrules/branches/camel_jaxb_marshaller2-lucaz/drools-pipeline/drools-camel/src/test/java/org/drools/camel/component/CamelEndpointWithJaxbTest.java 2010-02-11 21:57:51 UTC (rev 31589)
@@ -18,9 +18,10 @@
import org.drools.command.runtime.BatchExecutionCommand;
import org.drools.command.runtime.process.StartProcessCommand;
import org.drools.command.runtime.rule.FireAllRulesCommand;
+import org.drools.command.runtime.rule.GetObjectCommand;
import org.drools.command.runtime.rule.InsertElementsCommand;
-import org.drools.command.runtime.rule.GetObjectCommand;
import org.drools.command.runtime.rule.InsertObjectCommand;
+import org.drools.command.runtime.rule.QueryCommand;
import org.drools.common.DisconnectedFactHandle;
import org.drools.io.ResourceFactory;
import org.drools.pipeline.camel.Person;
@@ -213,22 +214,25 @@
}
public void testQuery() throws Exception {
-
- String cmd = "";
- cmd += "<batch-execution lookup='ksession1'>\n";
- cmd += " <query out-identifier='cheeses' name='cheeses'/>\n";
- cmd += " <query out-identifier='cheeses2' name='cheesesWithParams'>\n";
- cmd += " <java.lang.String>stilton</java.lang.String>\n";
- cmd += " <java.lang.String>cheddar</java.lang.String>\n";
- cmd += " </query>\n";
- cmd += "</batch-execution>\n";
-
- System.out.println(cmd);
-
- String outXml = new String((byte[])template.requestBodyAndHeader("direct:test-with-session", cmd, "jaxb-context", jaxbContext));
-
- System.out.println(outXml);
+ BatchExecutionCommand cmd = new BatchExecutionCommand();
+ cmd.setLookup("ksession1");
+ cmd.getCommands().add(new InsertObjectCommand(new Person("lucaz")));
+ cmd.getCommands().add(new InsertObjectCommand(new Person("hadrian")));
+ cmd.getCommands().add(new InsertObjectCommand(new Person("baunax")));
+ cmd.getCommands().add(new QueryCommand("persons", "persons", null));
+ cmd.getCommands().add(new QueryCommand("person", "personWithName", new String[] {"baunax"} ));
+ StringWriter xmlReq = new StringWriter();
+ Marshaller marshaller = jaxbContext.createMarshaller();
+ marshaller.setProperty("jaxb.formatted.output", true);
+ marshaller.marshal(cmd, xmlReq);
+
+ System.out.println(xmlReq.toString());
+
+ byte[] xmlResp = (byte[]) template.requestBodyAndHeader("direct:test-with-session", xmlReq.toString(), "jaxb-context", jaxbContext);
+ assertNotNull(xmlResp);
+ System.out.println(new String(xmlResp));
+
}
public void testProcess() throws Exception {
@@ -397,7 +401,7 @@
kbuilder.add(ResourceFactory.newByteArrayResource(process1.getBytes()), ResourceType.DRF);
if (kbuilder.hasErrors()) {
- LOG.info("Errors while adding process rule 1. ", kbuilder.getErrors());
+ System.out.println("Errors while adding process rule 1. " + kbuilder.getErrors());
}
assertFalse(kbuilder.hasErrors());
More information about the jboss-svn-commits
mailing list