use of org.apache.axiom.ts.soap.SOAPFaultChild in project webservices-axiom by apache.
the class TestChildOrder method runTest.
@Override
protected void runTest() throws Throwable {
SOAPFault fault = soapFactory.createSOAPFault();
// Add the elements in the specified order.
for (int i = 0; i < inputOrder.length; i++) {
SOAPElementTypeAdapter adapter = inputOrder[i].getAdapter(SOAPElementTypeAdapter.class);
adapter.getSetter().invoke(fault, adapter.create(soapFactory));
}
// Calculate the order in which we expect to see the children. Note that a given type
// may be added multiple times. Therefore we need to use a Set.
SortedSet<SOAPFaultChild> outputOrder = new TreeSet<>(new Comparator<SOAPFaultChild>() {
@Override
public int compare(SOAPFaultChild o1, SOAPFaultChild o2) {
return o1.getOrder() - o2.getOrder();
}
});
outputOrder.addAll(Arrays.asList(inputOrder));
// Check the result using the given serialization strategy
Document document = DOMImplementation.XERCES.parse(serializationStrategy.serialize(fault).getInputSource());
Element domFault = document.getDocumentElement();
Node child = domFault.getFirstChild();
for (SOAPFaultChild type : outputOrder) {
assertNotNull(child);
assertEquals(type.getQName(spec).getLocalPart(), child.getLocalName());
child = child.getNextSibling();
}
assertNull(child);
}
Aggregations