Search in sources :

Example 26 with Representation

use of org.apache.cxf.ws.transfer.Representation in project cxf by apache.

the class DeleteTest method createStudent.

private CreateResponse createStudent() throws XMLStreamException {
    Document createStudentXML = StaxUtils.read(getClass().getResourceAsStream("/xml/createStudent.xml"));
    Create request = new Create();
    request.setRepresentation(new Representation());
    request.getRepresentation().setAny(createStudentXML.getDocumentElement());
    ResourceFactory rf = TestUtils.createResourceFactoryClient(PORT);
    return rf.create(request);
}
Also used : Create(org.apache.cxf.ws.transfer.Create) Representation(org.apache.cxf.ws.transfer.Representation) ResourceFactory(org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory) Document(org.w3c.dom.Document)

Example 27 with Representation

use of org.apache.cxf.ws.transfer.Representation in project cxf by apache.

the class PutTest method rightTeacherPutTest.

@Test
public void rightTeacherPutTest() throws XMLStreamException {
    CreateResponse createResponse = createTeacher();
    Document putStudentXML = StaxUtils.read(getClass().getResourceAsStream("/xml/putTeacher.xml"));
    Put request = new Put();
    request.setRepresentation(new Representation());
    request.getRepresentation().setAny(putStudentXML.getDocumentElement());
    Resource client = TestUtils.createResourceClient(createResponse.getResourceCreated());
    client.put(request);
}
Also used : CreateResponse(org.apache.cxf.ws.transfer.CreateResponse) Resource(org.apache.cxf.ws.transfer.resource.Resource) Representation(org.apache.cxf.ws.transfer.Representation) Document(org.w3c.dom.Document) Put(org.apache.cxf.ws.transfer.Put) Test(org.junit.Test)

Example 28 with Representation

use of org.apache.cxf.ws.transfer.Representation in project cxf by apache.

the class PutTest method createTeacher.

private CreateResponse createTeacher() throws XMLStreamException {
    Document createTeacherXML = StaxUtils.read(getClass().getResourceAsStream("/xml/createTeacher.xml"));
    Create request = new Create();
    request.setRepresentation(new Representation());
    request.getRepresentation().setAny(createTeacherXML.getDocumentElement());
    ResourceFactory rf = TestUtils.createResourceFactoryClient(PORT);
    return rf.create(request);
}
Also used : Create(org.apache.cxf.ws.transfer.Create) Representation(org.apache.cxf.ws.transfer.Representation) ResourceFactory(org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory) Document(org.w3c.dom.Document)

Example 29 with Representation

use of org.apache.cxf.ws.transfer.Representation in project cxf by apache.

the class PutTest method createStudent.

private CreateResponse createStudent() throws XMLStreamException {
    Document createStudentXML = StaxUtils.read(getClass().getResourceAsStream("/xml/createStudent.xml"));
    Create request = new Create();
    request.setRepresentation(new Representation());
    request.getRepresentation().setAny(createStudentXML.getDocumentElement());
    ResourceFactory rf = TestUtils.createResourceFactoryClient(PORT);
    return rf.create(request);
}
Also used : Create(org.apache.cxf.ws.transfer.Create) Representation(org.apache.cxf.ws.transfer.Representation) ResourceFactory(org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory) Document(org.w3c.dom.Document)

Example 30 with Representation

use of org.apache.cxf.ws.transfer.Representation in project cxf by apache.

the class PutTest method wrongTeacherPutTest.

@Test(expected = SOAPFaultException.class)
public void wrongTeacherPutTest() throws XMLStreamException {
    createStudent();
    CreateResponse createResponse = createTeacher();
    Document putStudentXML = StaxUtils.read(getClass().getResourceAsStream("/xml/putTeacher.xml"));
    Put request = new Put();
    request.setRepresentation(new Representation());
    request.getRepresentation().setAny(putStudentXML.getDocumentElement());
    Resource client = TestUtils.createResourceClient(createResponse.getResourceCreated());
    client.put(request);
}
Also used : CreateResponse(org.apache.cxf.ws.transfer.CreateResponse) Resource(org.apache.cxf.ws.transfer.resource.Resource) Representation(org.apache.cxf.ws.transfer.Representation) Document(org.w3c.dom.Document) Put(org.apache.cxf.ws.transfer.Put) Test(org.junit.Test)

Aggregations

Representation (org.apache.cxf.ws.transfer.Representation)48 Test (org.junit.Test)29 Document (org.w3c.dom.Document)25 ReferenceParametersType (org.apache.cxf.ws.addressing.ReferenceParametersType)21 Element (org.w3c.dom.Element)15 Create (org.apache.cxf.ws.transfer.Create)14 ResourceFactory (org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory)14 CreateResponse (org.apache.cxf.ws.transfer.CreateResponse)12 Resource (org.apache.cxf.ws.transfer.resource.Resource)11 Put (org.apache.cxf.ws.transfer.Put)10 Server (org.apache.cxf.endpoint.Server)9 ResourceManager (org.apache.cxf.ws.transfer.manager.ResourceManager)9 PutResponse (org.apache.cxf.ws.transfer.PutResponse)7 MemoryResourceManager (org.apache.cxf.ws.transfer.manager.MemoryResourceManager)7 ExpressionType (org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType)5 Fragment (org.apache.cxf.ws.transfer.dialect.fragment.Fragment)5 ValueType (org.apache.cxf.ws.transfer.dialect.fragment.ValueType)5 InvalidExpression (org.apache.cxf.ws.transfer.dialect.fragment.faults.InvalidExpression)5 InvalidRepresentation (org.apache.cxf.ws.transfer.shared.faults.InvalidRepresentation)5 Node (org.w3c.dom.Node)5