Search in sources :

Example 61 with ReferenceParametersType

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());
}
Also used : Element(org.w3c.dom.Element) Representation(org.apache.cxf.ws.transfer.Representation) ReferenceParametersType(org.apache.cxf.ws.addressing.ReferenceParametersType) Test(org.junit.Test)

Example 62 with ReferenceParametersType

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());
}
Also used : Element(org.w3c.dom.Element) Representation(org.apache.cxf.ws.transfer.Representation) ReferenceParametersType(org.apache.cxf.ws.addressing.ReferenceParametersType) Test(org.junit.Test)

Example 63 with ReferenceParametersType

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);
}
Also used : ReferenceParametersType(org.apache.cxf.ws.addressing.ReferenceParametersType) Representation(org.apache.cxf.ws.transfer.Representation) Test(org.junit.Test)

Example 64 with ReferenceParametersType

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);
}
Also used : Element(org.w3c.dom.Element) Representation(org.apache.cxf.ws.transfer.Representation) ReferenceParametersType(org.apache.cxf.ws.addressing.ReferenceParametersType) Test(org.junit.Test)

Example 65 with ReferenceParametersType

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();
}
Also used : UnknownDialect(org.apache.cxf.ws.transfer.shared.faults.UnknownDialect) DeleteResponse(org.apache.cxf.ws.transfer.DeleteResponse) WrappedMessageContext(org.apache.cxf.jaxws.context.WrappedMessageContext) FragmentDialect(org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialect) UnknownDialect(org.apache.cxf.ws.transfer.shared.faults.UnknownDialect) Dialect(org.apache.cxf.ws.transfer.dialect.Dialect) AddressingProperties(org.apache.cxf.ws.addressing.AddressingProperties) ReferenceParametersType(org.apache.cxf.ws.addressing.ReferenceParametersType)

Aggregations

ReferenceParametersType (org.apache.cxf.ws.addressing.ReferenceParametersType)76 Test (org.junit.Test)65 Server (org.apache.cxf.endpoint.Server)54 ResourceManager (org.apache.cxf.ws.transfer.manager.ResourceManager)53 MemoryResourceManager (org.apache.cxf.ws.transfer.manager.MemoryResourceManager)51 Resource (org.apache.cxf.ws.transfer.resource.Resource)51 Element (org.w3c.dom.Element)50 ExpressionType (org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType)48 ValueType (org.apache.cxf.ws.transfer.dialect.fragment.ValueType)44 Put (org.apache.cxf.ws.transfer.Put)33 Fragment (org.apache.cxf.ws.transfer.dialect.fragment.Fragment)32 PutResponse (org.apache.cxf.ws.transfer.PutResponse)26 Representation (org.apache.cxf.ws.transfer.Representation)21 Get (org.apache.cxf.ws.transfer.Get)17 GetResponse (org.apache.cxf.ws.transfer.GetResponse)17 ObjectFactory (org.apache.cxf.ws.transfer.dialect.fragment.ObjectFactory)16 JAXBElement (javax.xml.bind.JAXBElement)8 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)8 QName (javax.xml.namespace.QName)4 CreateResponse (org.apache.cxf.ws.transfer.CreateResponse)4