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());
}
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());
}
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());
}
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);
}
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);
}
Aggregations