use of org.apache.cxf.ws.transfer.Representation in project cxf by apache.
the class CreateTeacherTest method createTeacherTest.
@Test
public void createTeacherTest() 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);
CreateResponse response = rf.create(request);
Assert.assertEquals(RESOURCE_TEACHERS_URL, response.getResourceCreated().getAddress().getValue());
}
use of org.apache.cxf.ws.transfer.Representation in project cxf by apache.
the class DeleteTest 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);
}
use of org.apache.cxf.ws.transfer.Representation in project cxf by apache.
the class GetTest method beforeClass.
@BeforeClass
public static void beforeClass() throws XMLStreamException {
TestUtils.createStudentsServers(PORT, PORT2);
TestUtils.createTeachersServers(PORT2);
ResourceFactory rf = TestUtils.createResourceFactoryClient(PORT);
Document createStudentXML = StaxUtils.read(GetTest.class.getResourceAsStream("/xml/createStudent.xml"));
Create studentRequest = new Create();
studentRequest.setRepresentation(new Representation());
studentRequest.getRepresentation().setAny(createStudentXML.getDocumentElement());
studentRef = rf.create(studentRequest).getResourceCreated();
Document createTeacherXML = StaxUtils.read(GetTest.class.getResourceAsStream("/xml/createTeacher.xml"));
Create teacherRequest = new Create();
teacherRequest.setRepresentation(new Representation());
teacherRequest.getRepresentation().setAny(createTeacherXML.getDocumentElement());
teacherRef = rf.create(teacherRequest).getResourceCreated();
}
use of org.apache.cxf.ws.transfer.Representation in project cxf by apache.
the class PutTest method wrongStudentPutTest.
@Test(expected = SOAPFaultException.class)
public void wrongStudentPutTest() throws XMLStreamException {
createStudent();
CreateResponse createResponse = createStudent();
Document putStudentXML = StaxUtils.read(getClass().getResourceAsStream("/xml/putStudent.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.Representation in project cxf by apache.
the class CreateStudentTest method createStudentTest.
@Test
public void createStudentTest() 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);
CreateResponse response = rf.create(request);
Assert.assertEquals(RESOURCE_STUDENTS_URL, response.getResourceCreated().getAddress().getValue());
}
Aggregations