use of org.apache.axiom.om.OMText in project webservices-axiom by apache.
the class TestCreateOMText method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMNamespace namespace = factory.createOMNamespace("http://www.apache.org/~chinthaka", "myhome");
OMElement omElement = factory.createOMElement("chinthaka", namespace);
String text = "sampleText";
OMText omText = factory.createOMText(omElement, text);
assertTrue("Programatically created OMText should have done = true ", omText.isComplete());
assertTrue("Programatically created OMText should have correct text value ", text.equals(omText.getText()));
}
use of org.apache.axiom.om.OMText in project webservices-axiom by apache.
the class TestCreateOMTextFromDataHandlerProvider method runTest.
@Override
protected void runTest() throws Throwable {
TestDataHandlerProvider prov = new TestDataHandlerProvider();
OMFactory factory = metaFactory.getOMFactory();
String contentID = nullContentID ? null : UIDGenerator.generateContentId();
OMText text = factory.createOMText(contentID, prov, true);
assertFalse(prov.isDataHandlerCreated());
assertEquals(text.getDataHandler().getContent(), "Data");
assertTrue(prov.isDataHandlerCreated());
if (contentID == null) {
assertThat(text.getContentID()).isNotNull();
} else {
assertThat(text.getContentID()).isEqualTo(contentID);
}
}
use of org.apache.axiom.om.OMText in project webservices-axiom by apache.
the class TestCreateOMTextFromOMText method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMText orgText = factory.createOMText("text");
OMElement parent = factory.createOMElement("test", null);
OMText text = factory.createOMText(parent, orgText);
assertEquals("text", text.getText());
assertSame(parent, text.getParent());
}
use of org.apache.axiom.om.OMText in project webservices-axiom by apache.
the class TestCreateOMTextWithNullParent method runTest.
@Override
protected void runTest() throws Throwable {
OMText text = metaFactory.getOMFactory().createOMText(null, "text");
assertNull(text.getParent());
}
use of org.apache.axiom.om.OMText in project webservices-axiom by apache.
the class TestInsertSiblingAfterOnSelf method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMElement parent = factory.createOMElement("test", null);
OMText text = factory.createOMText("test");
parent.addChild(text);
try {
text.insertSiblingAfter(text);
fail("Expected OMException");
} catch (OMException ex) {
// Expected
}
}
Aggregations