use of org.apache.axiom.soap.SOAPHeaderBlock in project webservices-axiom by apache.
the class TestClone method checkProcessed.
private void checkProcessed(SOAPHeader clonedHeader, SOAPHeaderBlock orgHeaderBlock) {
SOAPHeaderBlock clonedHeaderBlock = (SOAPHeaderBlock) clonedHeader.getFirstChildWithName(orgHeaderBlock.getQName());
assertThat(clonedHeaderBlock.isProcessed()).isEqualTo(processed == null ? orgHeaderBlock.isProcessed() : processed);
}
use of org.apache.axiom.soap.SOAPHeaderBlock in project webservices-axiom by apache.
the class TestClone method runTest.
@Override
protected void runTest() throws Throwable {
SOAPHeader header = soapFactory.createSOAPHeader();
OMNamespace ns = soapFactory.createOMNamespace("urn:test", "p");
SOAPHeaderBlock unprocessedHeaderBlock = header.addHeaderBlock("unprocessed", ns);
SOAPHeaderBlock processedHeaderBlock = header.addHeaderBlock("processed", ns);
processedHeaderBlock.setProcessed();
SOAPCloneOptions options = new SOAPCloneOptions();
options.setPreserveModel(true);
options.setProcessedFlag(processed);
SOAPHeader clonedHeader = (SOAPHeader) header.clone(options);
checkProcessed(clonedHeader, unprocessedHeaderBlock);
checkProcessed(clonedHeader, processedHeaderBlock);
}
use of org.apache.axiom.soap.SOAPHeaderBlock in project webservices-axiom by apache.
the class TestCloneProcessedWithoutPreservingModel method runTest.
@Override
protected void runTest() throws Throwable {
SOAPHeaderBlock headerBlock = soapFactory.createSOAPHeaderBlock("test", soapFactory.createOMNamespace("urn:test", "p"));
headerBlock.setProcessed();
OMElement clone = (OMElement) headerBlock.clone(new SOAPCloneOptions());
assertThat(clone).isNotInstanceOf(SOAPHeaderBlock.class);
}
use of org.apache.axiom.soap.SOAPHeaderBlock in project webservices-axiom by apache.
the class TestExamineHeaderBlocksWithParser method runTest.
@Override
protected void runTest(SOAPEnvelope envelope) throws Throwable {
String roleNextURI = spec.getNextRoleURI();
Iterator<SOAPHeaderBlock> it = envelope.getHeader().examineHeaderBlocks(roleNextURI);
assertThat(it.hasNext()).isTrue();
SOAPHeaderBlock headerBlock = it.next();
assertThat(headerBlock.getQName()).isEqualTo(new QName("http://example.org/RoleTest", "h2"));
assertThat(headerBlock.getRole()).isEqualTo(roleNextURI);
assertThat(it.hasNext()).isTrue();
headerBlock = it.next();
assertThat(headerBlock.getQName()).isEqualTo(new QName("http://example.org/RoleTest", "h7"));
assertThat(headerBlock.getRole()).isEqualTo(roleNextURI);
assertThat(it.hasNext()).isFalse();
}
use of org.apache.axiom.soap.SOAPHeaderBlock in project webservices-axiom by apache.
the class TestGetHeaderBlocksWithNSURI 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");
soapHeader.addHeaderBlock("echoOk1", namespace);
soapHeader.addHeaderBlock("echoOk2", soapFactory.createOMNamespace("http://www.test1.org", "test1"));
ArrayList<SOAPHeaderBlock> arrayList = soapHeader.getHeaderBlocksWithNSURI("http://www.test1.org");
assertEquals("SOAP Header Test : - getHeaderBlocksWithNSURI returns an arrayList of incorrect size", 1, arrayList.size());
assertEquals("SOAP Header Test : - headerBlock of given namespace uri mismatch", "http://www.test1.org", arrayList.get(0).getNamespace().getNamespaceURI());
}
Aggregations