Search in sources :

Example 1 with OMEntityReference

use of org.apache.axiom.om.OMEntityReference in project webservices-axiom by apache.

the class TestSerialize method runTest.

@Override
protected void runTest() throws Throwable {
    OMEntityReference entref = metaFactory.getOMFactory().createOMEntityReference(null, "testref");
    XMLStreamWriter writer = mock(XMLStreamWriter.class);
    entref.serialize(writer);
    verify(writer).writeEntityRef(entref.getName());
    verify(writer, atMost(1)).flush();
    verifyNoMoreInteractions(writer);
}
Also used : OMEntityReference(org.apache.axiom.om.OMEntityReference) XMLStreamWriter(javax.xml.stream.XMLStreamWriter)

Example 2 with OMEntityReference

use of org.apache.axiom.om.OMEntityReference in project webservices-axiom by apache.

the class TestCreateOMEntityReferenceWithNullParent method runTest.

@Override
protected void runTest() throws Throwable {
    OMFactory factory = metaFactory.getOMFactory();
    OMEntityReference entref = factory.createOMEntityReference(null, "testref");
    assertNull(entref.getParent());
    assertEquals("testref", entref.getName());
    assertNull(entref.getReplacementText());
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) OMEntityReference(org.apache.axiom.om.OMEntityReference)

Example 3 with OMEntityReference

use of org.apache.axiom.om.OMEntityReference in project webservices-axiom by apache.

the class TestCreateOMEntityReference method runTest.

@Override
protected void runTest() throws Throwable {
    OMFactory factory = metaFactory.getOMFactory();
    OMElement parent = factory.createOMElement("test", null);
    OMEntityReference entref = factory.createOMEntityReference(parent, "testref");
    assertSame(parent, entref.getParent());
    assertEquals("testref", entref.getName());
    assertNull(entref.getReplacementText());
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) OMEntityReference(org.apache.axiom.om.OMEntityReference) OMElement(org.apache.axiom.om.OMElement)

Example 4 with OMEntityReference

use of org.apache.axiom.om.OMEntityReference in project webservices-axiom by apache.

the class WriteEntityRefScenario method validate.

@Override
public void validate(OMElement element, boolean dataHandlersPreserved) {
    OMNode child = element.getFirstOMChild();
    Assert.assertTrue(child instanceof OMEntityReference);
    OMEntityReference entref = (OMEntityReference) child;
    Assert.assertEquals("test", entref.getName());
    Assert.assertNull(entref.getReplacementText());
}
Also used : OMNode(org.apache.axiom.om.OMNode) OMEntityReference(org.apache.axiom.om.OMEntityReference)

Aggregations

OMEntityReference (org.apache.axiom.om.OMEntityReference)4 OMFactory (org.apache.axiom.om.OMFactory)2 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)1 OMElement (org.apache.axiom.om.OMElement)1 OMNode (org.apache.axiom.om.OMNode)1