@Test public void testExamineHeaderElementsToProcessActors() throws Exception { QName qName = new QName(NAMESPACE, "localName1", PREFIX); SoapHeaderElement headerElement = soapHeader.addHeaderElement(qName); headerElement.setActorOrRole("role1"); qName = new QName(NAMESPACE, "localName2", PREFIX); headerElement = soapHeader.addHeaderElement(qName); headerElement.setActorOrRole("role2"); qName = new QName(NAMESPACE, "localName3", PREFIX); headerElement = soapHeader.addHeaderElement(qName); headerElement.setActorOrRole(SoapVersion.SOAP_12.getNextActorOrRoleUri()); Iterator<SoapHeaderElement> iterator = ((Soap12Header) soapHeader).examineHeaderElementsToProcess(new String[] {"role1"}, false); assertNotNull("header element iterator is null", iterator); assertTrue("header element iterator has no elements", iterator.hasNext()); checkHeaderElement((SoapHeaderElement) iterator.next()); assertTrue("header element iterator has no elements", iterator.hasNext()); checkHeaderElement((SoapHeaderElement) iterator.next()); assertFalse("header element iterator has too many elements", iterator.hasNext()); }
@Test public void testExamineHeaderElementsToProcessUltimateDestination() throws Exception { QName qName = new QName(NAMESPACE, "localName", PREFIX); SoapHeaderElement headerElement = soapHeader.addHeaderElement(qName); headerElement.setActorOrRole(SoapVersion.SOAP_12.getUltimateReceiverRoleUri()); Iterator<SoapHeaderElement> iterator = ((Soap12Header) soapHeader).examineHeaderElementsToProcess(new String[] {"role"}, true); assertNotNull("header element iterator is null", iterator); headerElement = (SoapHeaderElement) iterator.next(); assertEquals( "Invalid name on header element", new QName(NAMESPACE, "localName", PREFIX), headerElement.getName()); assertFalse("header element iterator has too many elements", iterator.hasNext()); }