use of org.apache.cxf.ws.addressing.ReferenceParametersType in project cxf by apache.
the class MemoryResourceManagerTest method getUnknownReferenceParamsTest.
@Test(expected = UnknownResource.class)
public void getUnknownReferenceParamsTest() {
ReferenceParametersType refParams = new ReferenceParametersType();
Element uuid = DOMUtils.getEmptyDocument().createElementNS(MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
uuid.setTextContent("123456");
refParams.getAny().add(uuid);
resourceManager.get(refParams);
}
use of org.apache.cxf.ws.addressing.ReferenceParametersType in project cxf by apache.
the class MemoryResourceManagerTest method getEmptyRepresentationTest.
@Test
public void getEmptyRepresentationTest() {
ReferenceParametersType refParams = resourceManager.create(new Representation());
Representation returnedRepresentation = resourceManager.get(refParams);
Assert.assertNull(returnedRepresentation.getAny());
}
use of org.apache.cxf.ws.addressing.ReferenceParametersType in project cxf by apache.
the class MemoryResourceManagerTest method deleteUnknownReferenceParamsTest.
@Test(expected = UnknownResource.class)
public void deleteUnknownReferenceParamsTest() {
ReferenceParametersType refParams = new ReferenceParametersType();
Element uuid = DOMUtils.getEmptyDocument().createElementNS(MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
uuid.setTextContent("123456");
refParams.getAny().add(uuid);
resourceManager.delete(refParams);
}
use of org.apache.cxf.ws.addressing.ReferenceParametersType in project cxf by apache.
the class MemoryResourceManagerTest method putUnknownReferenceParamsTest.
@Test(expected = UnknownResource.class)
public void putUnknownReferenceParamsTest() {
ReferenceParametersType refParams = new ReferenceParametersType();
Element uuid = DOMUtils.getEmptyDocument().createElementNS(MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
uuid.setTextContent("123456");
refParams.getAny().add(uuid);
resourceManager.put(refParams, new Representation());
}
use of org.apache.cxf.ws.addressing.ReferenceParametersType in project cxf by apache.
the class MAPCodec method encodeReferenceParameters.
private void encodeReferenceParameters(AddressingProperties maps, SoapMessage msg, JAXBContext ctx) throws JAXBException {
Element header = null;
EndpointReferenceType toEpr = maps.getToEndpointReference();
if (null != toEpr) {
ReferenceParametersType params = toEpr.getReferenceParameters();
if (null != params) {
for (Object o : params.getAny()) {
if (o instanceof Element || o instanceof JAXBElement) {
if (header == null) {
header = getHeaderFactory().getHeader(msg.getVersion());
}
JAXBElement<?> jaxbEl = null;
if (o instanceof Element) {
Element e = (Element) o;
Node importedNode = header.getOwnerDocument().importNode(e, true);
header.appendChild(importedNode);
} else {
jaxbEl = (JAXBElement<?>) o;
ctx.createMarshaller().marshal(jaxbEl, header);
}
Element lastAdded = (Element) header.getLastChild();
header.removeChild(lastAdded);
addIsReferenceParameterMarkerAttribute(lastAdded, maps.getNamespaceURI());
Header holder = new Header(new QName(lastAdded.getNamespaceURI(), lastAdded.getLocalName()), lastAdded);
msg.getHeaders().add(holder);
} else {
LOG.log(Level.WARNING, "IGNORE_NON_ELEMENT_REF_PARAM_MSG", o);
}
}
}
}
}
Aggregations