Created
February 7, 2012 11:04
-
-
Save Rikkola/1759140 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Test | |
| public void testSessionModify() throws Exception { | |
| String cmd = ""; | |
| cmd += "<batch-execution lookup='ksession1'>\n"; | |
| cmd += " <modify fact-handle='" + handle + "'>\n"; | |
| cmd += " <setters>"; | |
| cmd += " <item accessor='name' value='\"salaboy\"' />\n"; | |
| cmd += " </setters>\n"; | |
| cmd += " </modify>\n"; | |
| cmd += "</batch-execution>\n"; | |
| String outXml = new String( (byte[]) template.requestBody( "direct:test-with-session", | |
| cmd ) ); | |
| String expectedXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"; | |
| expectedXml += "<execution-results xmlns:ns2=\"http://drools.org/model\">\n"; | |
| expectedXml += " <results/>\n"; | |
| expectedXml += " <facts/>\n"; | |
| expectedXml += "</execution-results>\n"; | |
| assertXMLEqual( expectedXml, | |
| outXml ); | |
| cmd = "<batch-execution lookup='ksession1'>\n"; | |
| cmd += " <get-object out-identifier='rider' fact-handle='" + handle + "'/>\n"; | |
| cmd += "</batch-execution>\n"; | |
| byte[] xmlResp = (byte[]) template.requestBody( "direct:test-with-session", | |
| cmd.toString() ); | |
| assertNotNull( xmlResp ); | |
| ExecutionResults resp = (ExecutionResults) getJaxbContext().createUnmarshaller().unmarshal( new ByteArrayInputStream( xmlResp ) ); | |
| assertNotNull( resp ); | |
| Person person = (Person) resp.getValue( "rider" ); | |
| assertEquals( "salaboy", | |
| person.getName() ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment