use of org.apache.axiom.om.NodeUnavailableException in project webservices-axiom by apache.
the class TestAddChildDiscarded method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMElement parent = OMXMLBuilderFactory.createOMBuilder(factory, new StringReader("<root><a/><b/></root>")).getDocumentElement();
// Partially build the parent
parent.getFirstOMChild();
parent.discard();
try {
parent.addChild(factory.createOMElement("c", null));
fail("Expected NodeUnavailableException");
} catch (NodeUnavailableException ex) {
// Expected
}
}
use of org.apache.axiom.om.NodeUnavailableException in project webservices-axiom by apache.
the class TestGetNextOMSiblingAfterDiscard method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMElement element = OMXMLBuilderFactory.createOMBuilder(factory, new StringReader("<element><!--comment--><a/><!--comment--></element>")).getDocumentElement();
OMNode child = element.getFirstOMChild();
element.discard();
try {
child.getNextOMSibling();
fail("Expected NodeUnavailableException");
} catch (NodeUnavailableException ex) {
// Expected
}
}
use of org.apache.axiom.om.NodeUnavailableException in project webservices-axiom by apache.
the class TestBuildDiscarded method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMElement parent = OMXMLBuilderFactory.createOMBuilder(factory, new StringReader("<root><a/><b/></root>")).getDocumentElement();
// Partially build the parent
parent.getFirstOMChild();
parent.discard();
try {
parent.build();
fail("Expected NodeUnavailableException");
} catch (NodeUnavailableException ex) {
// Expected
}
}
use of org.apache.axiom.om.NodeUnavailableException in project webservices-axiom by apache.
the class TestGetFirstOMChildAfterConsume method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMElement element = OMXMLBuilderFactory.createOMBuilder(factory, new StringReader("<element><!--comment--><a/><!--comment--></element>")).getDocumentElement();
XMLStreamReader reader = element.getXMLStreamReaderWithoutCaching();
while (reader.hasNext()) {
reader.next();
}
try {
element.getFirstOMChild();
fail("Expected NodeUnavailableException");
} catch (NodeUnavailableException ex) {
// Expected
}
}
use of org.apache.axiom.om.NodeUnavailableException in project webservices-axiom by apache.
the class TestGetFirstOMChildAfterDiscard method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMElement element = OMXMLBuilderFactory.createOMBuilder(factory, new StringReader("<element><!--comment--><a/><!--comment--></element>")).getDocumentElement();
element.discard();
try {
element.getFirstOMChild();
fail("Expected NodeUnavailableException");
} catch (NodeUnavailableException ex) {
// Expected
}
}
Aggregations