Search in sources :

Example 1 with ObjectFactory

use of org.example.identity.ObjectFactory in project webservices-axiom by apache.

the class TestGetNameFromJAXBElement method runTest.

@Override
protected void runTest() throws Throwable {
    OMFactory omFactory = metaFactory.getOMFactory();
    ObjectFactory objectFactory = new ObjectFactory();
    JAXBContext context = JAXBContext.newInstance(ObjectFactory.class);
    JAXBElement<LinkIdentitiesType> jaxbElement = objectFactory.createLinkIdentities(new LinkIdentitiesType());
    OMSourcedElement element = omFactory.createOMElement(new JAXBOMDataSource(context, jaxbElement));
    assertEquals("http://www.example.org/identity", element.getNamespaceURI());
    assertEquals("LinkIdentities", element.getLocalName());
    assertFalse(element.isExpanded());
    // Force expansion so that OMSourcedElement compares the namespace URI and local name
    // provided by JAXBOMDataSource with the actual name of the element
    element.getFirstOMChild();
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) ObjectFactory(org.example.identity.ObjectFactory) JAXBContext(javax.xml.bind.JAXBContext) LinkIdentitiesType(org.example.identity.LinkIdentitiesType) OMSourcedElement(org.apache.axiom.om.OMSourcedElement) JAXBOMDataSource(org.apache.axiom.om.ds.jaxb.JAXBOMDataSource)

Aggregations

JAXBContext (javax.xml.bind.JAXBContext)1 OMFactory (org.apache.axiom.om.OMFactory)1 OMSourcedElement (org.apache.axiom.om.OMSourcedElement)1 JAXBOMDataSource (org.apache.axiom.om.ds.jaxb.JAXBOMDataSource)1 LinkIdentitiesType (org.example.identity.LinkIdentitiesType)1 ObjectFactory (org.example.identity.ObjectFactory)1