use of org.apache.axiom.om.OMAttribute in project webservices-axiom by apache.
the class TestGetAttribute method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMSourcedElement element = factory.createOMElement(new PullOMDataSource("<root attr='value'/>"), "root", null);
OMAttribute attr = element.getAttribute(new QName("attr"));
assertThat(attr).isNotNull();
assertThat(attr.getLocalName()).isEqualTo("attr");
}
use of org.apache.axiom.om.OMAttribute in project webservices-axiom by apache.
the class AxiomTraverser method getAttributes.
@Override
public Map<QName, String> getAttributes() {
Map<QName, String> attributes = null;
for (Iterator<OMAttribute> it = ((OMElement) node).getAllAttributes(); it.hasNext(); ) {
OMAttribute attr = it.next();
if (attributes == null) {
attributes = new HashMap<QName, String>();
}
attributes.put(attr.getQName(), attr.getAttributeValue());
}
return attributes;
}
use of org.apache.axiom.om.OMAttribute in project webservices-axiom by apache.
the class TestGetLangWithParser method runTest.
@Override
protected void runTest(SOAPEnvelope envelope) throws Throwable {
SOAPFaultText faultText = envelope.getBody().getFault().getReason().getFirstSOAPText();
assertTrue("SOAP 1.2 Fault Text Test With Parser : - getLang method returns incorrect string", faultText.getLang().equals("en"));
OMAttribute langAttribute = faultText.getAllAttributes().next();
assertTrue("SOAP 1.2 Fault Text Test With Parser : - Lang attribute local name mismaatch", langAttribute.getLocalName().equals(SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME));
assertTrue("SOAP 1.2 Fault Text Test With Parser : - Lang attribute namespace prefix mismatch", langAttribute.getNamespace().getPrefix().equals(SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX));
assertTrue("SOAP 1.2 Fault Text Test With Parser : - Lang attribute namespace uri mismatch", langAttribute.getNamespace().getNamespaceURI().equals(SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI));
}
use of org.apache.axiom.om.OMAttribute in project webservices-axiom by apache.
the class TestSetLocalName method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMAttribute attr = factory.createOMAttribute("test", factory.createOMNamespace("urn:test", "p"), "value");
attr.setLocalName("test2");
assertEquals("test2", attr.getLocalName());
QName qname = attr.getQName();
assertEquals("test2", qname.getLocalPart());
assertEquals("p", qname.getPrefix());
assertEquals("urn:test", qname.getNamespaceURI());
}
use of org.apache.axiom.om.OMAttribute in project webservices-axiom by apache.
the class TestGetPrefixWithoutNamespace method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMAttribute attr = factory.createOMAttribute("name", null, "value");
assertNull(attr.getPrefix());
}
Aggregations