1 17 package org.apache.servicemix.components.xslt; 18 19 import org.springframework.context.support.AbstractXmlApplicationContext; 20 import org.apache.xbean.spring.context.ClassPathXmlApplicationContext; 21 import org.apache.servicemix.tck.TestSupport; 22 import org.apache.servicemix.tck.MessageList; 23 24 import javax.xml.namespace.QName ; 25 26 27 public class OptionalAxisQueriesTest extends TestSupport { 28 29 public void testOptionalAxisQuery() throws Exception { 30 QName service = new QName ("http://servicemix.org/cheese/", "transformer"); 31 32 String message = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + 33 " <prod:resolveItemXrefResponse " + 34 " xmlns:prod=\"http://foo.org/prod\" " + 35 " xmlns:xsi=\"http://foo.org/msi\"" + 36 " xmlns:ms=\"http://foo.org/ms\">" + 37 " <prod:response xsi:type=\"wn4:HashMap\">" + 38 " <ms:Keys>" + 39 " <ms:Item xsi:type=\"d:string\">DESCR</ms:Item>" + 40 " <ms:Item xsi:type=\"d:string\">LIST</ms:Item>" + 41 " <ms:Item xsi:type=\"d:string\">XREF</ms:Item>" + 42 " <ms:Item xsi:type=\"d:string\">MSTR</ms:Item>" + 43 " </ms:Keys>" + 44 " <ms:Values>" + 45 " <ms:Item xsi:type=\"d:string\">PPR,CPY,20#,84B,LGL,WE</ms:Item>" + 46 " <ms:Item xsi:type=\"d:double\">17.25</ms:Item>" + 47 " <ms:Item xsi:type=\"d:string\">EXP8514</ms:Item>" + 48 " <ms:Item xsi:type=\"d:string\">10040300</ms:Item>" + 49 " </ms:Values>" + 50 " </prod:response>" + 51 " </prod:resolveItemXrefResponse>"; 52 53 sendMessages(service, 1, message); 55 assertMessagesReceived(1); 56 57 MessageList messageList1 = assertMessagesReceived("service1", 1); 58 MessageList messageList2 = assertMessagesReceived("service2", 1); 59 MessageList messageList3 = assertMessagesReceived("service3", 1); 60 MessageList messageList4 = assertMessagesReceived("service4", 1); 61 MessageList messageList5 = assertMessagesReceived("service5", 1); 62 MessageList messageList6 = assertMessagesReceived("service6", 1); 63 64 assertMessageHeader(messageList1, 0, "foo", "PPR,CPY,20#,84B,LGL,WE"); 65 assertMessageHeader(messageList2, 0, "foo", "17.25"); 66 assertMessageHeader(messageList3, 0, "foo", "EXP8514"); 67 assertMessageHeader(messageList4, 0, "foo", "10040300"); 68 assertMessageHeader(messageList5, 0, "foo", new Integer (4)); 69 assertMessageHeader(messageList6, 0, "foo", "PPR,CPY,20#,84B,LGL,WE"); 70 71 } 72 73 protected AbstractXmlApplicationContext createBeanFactory() { 74 return new ClassPathXmlApplicationContext("org/apache/servicemix/components/xslt/optional-axis-example.xml"); 75 } 76 77 } 78 | Popular Tags |