Search in sources :

Example 11 with CreateResponse

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

the class CreateStudentTest method createStudentPartialTest.

@Test
public void createStudentPartialTest() throws XMLStreamException {
    Document createStudentPartialXML = StaxUtils.read(getClass().getResourceAsStream("/xml/createStudentPartial.xml"));
    Create request = new Create();
    request.setRepresentation(new Representation());
    request.getRepresentation().setAny(createStudentPartialXML.getDocumentElement());
    ResourceFactory rf = TestUtils.createResourceFactoryClient(PORT);
    CreateResponse response = rf.create(request);
    Assert.assertEquals(RESOURCE_STUDENTS_URL, response.getResourceCreated().getAddress().getValue());
}
Also used : Create(org.apache.cxf.ws.transfer.Create) CreateResponse(org.apache.cxf.ws.transfer.CreateResponse) Representation(org.apache.cxf.ws.transfer.Representation) ResourceFactory(org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory) Document(org.w3c.dom.Document) Test(org.junit.Test)

Example 12 with CreateResponse

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

the class CreateTeacherTest method createTeacherPartialTest.

@Test
public void createTeacherPartialTest() throws XMLStreamException {
    Document createTeacherPartialXML = StaxUtils.read(getClass().getResourceAsStream("/xml/createTeacherPartial.xml"));
    Create request = new Create();
    request.setRepresentation(new Representation());
    request.getRepresentation().setAny(createTeacherPartialXML.getDocumentElement());
    ResourceFactory rf = TestUtils.createResourceFactoryClient(PORT);
    CreateResponse response = rf.create(request);
    Assert.assertEquals(RESOURCE_TEACHERS_URL, response.getResourceCreated().getAddress().getValue());
}
Also used : Create(org.apache.cxf.ws.transfer.Create) CreateResponse(org.apache.cxf.ws.transfer.CreateResponse) Representation(org.apache.cxf.ws.transfer.Representation) ResourceFactory(org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory) Document(org.w3c.dom.Document) Test(org.junit.Test)

Example 13 with CreateResponse

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

the class DeleteTest method deleteDeletedStudent.

@Test(expected = SOAPFaultException.class)
public void deleteDeletedStudent() throws XMLStreamException {
    CreateResponse response = createStudent();
    Resource client = TestUtils.createResourceClient(response.getResourceCreated());
    client.delete(new Delete());
    client.delete(new Delete());
}
Also used : Delete(org.apache.cxf.ws.transfer.Delete) CreateResponse(org.apache.cxf.ws.transfer.CreateResponse) Resource(org.apache.cxf.ws.transfer.resource.Resource) Test(org.junit.Test)

Example 14 with CreateResponse

use of org.apache.cxf.ws.transfer.CreateResponse 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 15 with CreateResponse

use of org.apache.cxf.ws.transfer.CreateResponse 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

CreateResponse (org.apache.cxf.ws.transfer.CreateResponse)19 Test (org.junit.Test)16 Representation (org.apache.cxf.ws.transfer.Representation)12 Resource (org.apache.cxf.ws.transfer.resource.Resource)10 Document (org.w3c.dom.Document)8 Create (org.apache.cxf.ws.transfer.Create)6 Delete (org.apache.cxf.ws.transfer.Delete)6 ResourceFactory (org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory)6 ReferenceParametersType (org.apache.cxf.ws.addressing.ReferenceParametersType)4 Put (org.apache.cxf.ws.transfer.Put)4 Server (org.apache.cxf.endpoint.Server)2 AttributedURIType (org.apache.cxf.ws.addressing.AttributedURIType)2 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)2 Get (org.apache.cxf.ws.transfer.Get)2 ResourceManager (org.apache.cxf.ws.transfer.manager.ResourceManager)2 Element (org.w3c.dom.Element)2 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)1