use of org.apache.cxf.ws.addressing.ReferenceParametersType in project cxf by apache.
the class MemoryResourceManagerTest method getTest.
@Test
public void getTest() {
Element representationEl = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
representationEl.setTextContent(ELEMENT_VALUE);
Representation representation = new Representation();
representation.setAny(representationEl);
ReferenceParametersType refParams = resourceManager.create(representation);
Representation returnedRepresentation = resourceManager.get(refParams);
Element returnedEl = (Element) returnedRepresentation.getAny();
Assert.assertEquals("Namespace is other than expected.", ELEMENT_NAMESPACE, returnedEl.getNamespaceURI());
Assert.assertEquals("Element name is other than expected", ELEMENT_NAME, returnedEl.getLocalName());
Assert.assertEquals("Value is other than expected.", ELEMENT_VALUE, returnedEl.getTextContent());
}
use of org.apache.cxf.ws.addressing.ReferenceParametersType in project cxf by apache.
the class MemoryResourceManagerTest method putEmptyRepresentationTest.
@Test
public void putEmptyRepresentationTest() {
Element representationEl = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
representationEl.setTextContent(ELEMENT_VALUE);
Representation representation = new Representation();
representation.setAny(representationEl);
ReferenceParametersType refParams = resourceManager.create(representation);
resourceManager.put(refParams, new Representation());
}
use of org.apache.cxf.ws.addressing.ReferenceParametersType in project cxf by apache.
the class MemoryResourceManagerTest method deleteTest.
@Test(expected = UnknownResource.class)
public void deleteTest() {
ReferenceParametersType refParams = resourceManager.create(new Representation());
resourceManager.delete(refParams);
resourceManager.get(refParams);
}
use of org.apache.cxf.ws.addressing.ReferenceParametersType in project cxf by apache.
the class MemoryResourceManagerTest method createTest.
@Test
public void createTest() {
Element representationEl = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
representationEl.setTextContent(ELEMENT_VALUE);
Representation representation = new Representation();
representation.setAny(representationEl);
ReferenceParametersType refParams = resourceManager.create(representation);
Assert.assertTrue("ResourceManager returned unexpected count of reference elements.", refParams.getAny().size() == 1);
}
use of org.apache.cxf.ws.addressing.ReferenceParametersType in project cxf by apache.
the class ResourceLocal method delete.
@Override
public DeleteResponse delete(Delete body) {
// Getting reference paramaters
AddressingProperties addrProps = (AddressingProperties) ((WrappedMessageContext) context.getMessageContext()).getWrappedMessage().getContextualProperty(JAXWSAConstants.ADDRESSING_PROPERTIES_INBOUND);
ReferenceParametersType refParams = addrProps.getToEndpointReference().getReferenceParameters();
boolean delete = true;
// Dialect processing
if (body.getDialect() != null && !body.getDialect().isEmpty()) {
if (dialects.containsKey(body.getDialect())) {
Dialect dialect = dialects.get(body.getDialect());
delete = dialect.processDelete(body, manager.get(refParams));
} else {
throw new UnknownDialect();
}
}
if (delete) {
manager.delete(refParams);
}
return new DeleteResponse();
}
Aggregations