use of org.apache.axiom.soap.RolePlayer in project webservices-axiom by apache.
the class TestGetHeadersToProcessWithParser method runTest.
@Override
protected void runTest(SOAPEnvelope envelope) throws Throwable {
SOAPHeader soapHeader = envelope.getHeader();
String[] roles = { "http://example.org/myCustomRole" };
RolePlayer rp = new MyRolePlayer(true, roles);
Iterator<SOAPHeaderBlock> headers = soapHeader.getHeadersToProcess(rp);
assertTrue("No headers!", headers.hasNext());
int numHeaders = 0;
while (headers.hasNext()) {
headers.next();
numHeaders++;
}
assertEquals("Didn't get right number of headers (with custom role)", 6, numHeaders);
rp = new MyRolePlayer(true);
headers = soapHeader.getHeadersToProcess(rp);
assertTrue(headers.hasNext());
numHeaders = 0;
while (headers.hasNext()) {
headers.next();
numHeaders++;
}
assertEquals("Didn't get right number of headers (no custom role)", 5, numHeaders);
// Intermediary test
rp = new MyRolePlayer(false);
headers = soapHeader.getHeadersToProcess(rp);
assertTrue(headers.hasNext());
numHeaders = 0;
while (headers.hasNext()) {
headers.next();
numHeaders++;
}
assertEquals("Didn't get right number of headers (no custom role)", 2, numHeaders);
}
Aggregations