use of org.apache.axiom.soap.SOAPHeaderBlock in project webservices-axiom by apache.
the class TestAddHeaderBlock method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope soapEnvelope = soapFactory.createSOAPEnvelope();
SOAPHeader soapHeader = soapFactory.createSOAPHeader(soapEnvelope);
OMNamespace namespace = soapFactory.createOMNamespace("http://www.example.org", "test");
SOAPHeaderBlock headerBlock1 = soapHeader.addHeaderBlock("echoOk1", namespace);
SOAPHeaderBlock headerBlock2 = soapHeader.addHeaderBlock("echoOk2", namespace);
Iterator<OMNode> iterator = soapHeader.getChildren();
assertSame(headerBlock1, iterator.next());
assertSame(soapHeader, headerBlock1.getParent());
assertNotNull("SOAP Header Test : - After calling addHeaderBlock method twice, getChildren method returns empty iterator", headerBlock1);
assertEquals("SOAP Header Test : - HeaderBlock1 local name mismatch", "echoOk1", headerBlock1.getLocalName());
assertEquals("SOAP Header Test : - HeaderBlock1 namespace uri mismatch", "http://www.example.org", headerBlock1.getNamespace().getNamespaceURI());
assertSame(headerBlock2, iterator.next());
assertSame(soapHeader, headerBlock2.getParent());
assertNotNull("SOAP Header Test : - After calling addHeaderBlock method twice, getChildren method returns an iterator with only one object", headerBlock2);
assertEquals("SOAP Header Test : - HeaderBlock2 local name mismatch", "echoOk2", headerBlock2.getLocalName());
assertEquals("SOAP Header Test : - HeaderBlock2 namespace uri mismatch", "http://www.example.org", headerBlock2.getNamespace().getNamespaceURI());
assertFalse("SOAP Header Test : - After calling addHeaderBlock method twice, getChildren method returns an iterator with more than two elements", iterator.hasNext());
}
use of org.apache.axiom.soap.SOAPHeaderBlock in project webservices-axiom by apache.
the class TestAddHeaderBlockFromQName method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope env = soapFactory.getDefaultEnvelope();
SOAPHeader header = env.getOrCreateHeader();
SOAPHeaderBlock headerBlock = header.addHeaderBlock(new QName("urn:test", "test", "p"));
assertSame(headerBlock, header.getFirstOMChild());
assertEquals("test", headerBlock.getLocalName());
assertEquals("p", headerBlock.getPrefix());
assertEquals("urn:test", headerBlock.getNamespaceURI());
}
use of org.apache.axiom.soap.SOAPHeaderBlock in project webservices-axiom by apache.
the class TestGetRole method runTest.
@Override
protected void runTest() throws Throwable {
SOAPHeaderBlock soapHeaderBlock = createSOAPHeaderBlock();
assertNull("SOAP HeaderBlock Test : - After creating SOAPHeaderBlock, it has a role", soapHeaderBlock.getRole());
soapHeaderBlock.setRole("http://example.org/my-role");
assertEquals("SOAP HeaderBlock Test : - After calling setRole method, getRole method returns incorrect role value", "http://example.org/my-role", soapHeaderBlock.getRole());
}
use of org.apache.axiom.soap.SOAPHeaderBlock in project webservices-axiom by apache.
the class TestGetVersion method runTest.
@Override
protected void runTest() throws Throwable {
SOAPHeaderBlock h = soapFactory.createSOAPHeaderBlock("myHeader", soapFactory.createOMNamespace("urn:test", "p"));
assertSame(spec.getAdapter(SOAPVersion.class), h.getVersion());
}
use of org.apache.axiom.soap.SOAPHeaderBlock in project webservices-axiom by apache.
the class TestSetBooleanAttributeUnsupported method runTest.
@Override
protected void runTest() throws Throwable {
SOAPHeader header = soapFactory.getDefaultEnvelope().getOrCreateHeader();
SOAPHeaderBlock headerBlock = header.addHeaderBlock(new QName("urn:test", "test", "p"));
try {
attribute.getAdapter(BooleanAttributeAccessor.class).setValue(headerBlock, true);
fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException ex) {
// Expected
}
}
Aggregations