Methods Summary |
---|
private javax.xml.soap.Text | assertContainsText(javax.xml.soap.SOAPElement soapElem)
assertTrue( soapElem.hasChildNodes() );
List childElems = toList( soapElem.getChildElements() );
assertTrue( childElems.size() == 1 );
Node node = (Node) childElems.get( 0 );
assertTrue( node instanceof Text );
return (Text) node;
|
protected void | setUp()
soapElem = SOAPFactory.newInstance().createElement( "Test", "test", "http://test.apache.org/" );
|
public void | testAddTextNode()Test for Axis impl of {@link SOAPElement#addTextNode(String)}.
assertNotNull( soapElem );
final String value = "foo";
soapElem.addTextNode( value );
assertEquals( value, soapElem.getValue() );
Text text = assertContainsText( soapElem );
assertEquals( value, text.getValue() );
|
public void | testGetElementsByTagName()
String soapMessageWithLeadingComment =
"<?xml version='1.0' encoding='UTF-8'?>" +
"<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
"<env:Body>" +
"<echo>" +
" <data>\n" +
" <tag name=\"First\" >\n" +
" <Line> One </Line>\n" +
" <Line> Two </Line>\n" +
" </tag>\n" +
" <tag name =\"Second\" >\n" +
" <Line> Three </Line>\n" +
" <Line> Four </Line>\n" +
" </tag>\n" +
" <tag name =\"Third\" >\n" +
" <Line> Five </Line>\n" +
" <Line> Six </Line>\n" +
" </tag>\n" +
"</data>" +
"</echo>" +
"</env:Body>" +
"</env:Envelope>";
MessageFactory factory = MessageFactory.newInstance();
SOAPMessage message =
factory.createMessage(new MimeHeaders(),
new ByteArrayInputStream(soapMessageWithLeadingComment.getBytes()));
SOAPPart part = message.getSOAPPart();
SOAPEnvelope envelope = (SOAPEnvelope) part.getEnvelope();
NodeList nodes = envelope.getElementsByTagName("tag");
assertEquals(nodes.getLength(), 3);
NodeList nodes2 = envelope.getElementsByTagName("Line");
assertEquals(nodes2.getLength(), 6);
NodeList nodes3 = part.getElementsByTagName("tag");
assertEquals(nodes3.getLength(), 3);
NodeList nodes4 = part.getElementsByTagName("Line");
assertEquals(nodes4.getLength(), 6);
|
private java.util.List | toList(java.util.Iterator iter)
List list = new ArrayList();
while ( iter.hasNext() )
{
list.add( iter.next() );
}
return list;
|