Search in sources :

Example 16 with Representation

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());
}
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 17 with Representation

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);
}
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 18 with Representation

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();
}
Also used : Create(org.apache.cxf.ws.transfer.Create) ResourceFactory(org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory) Representation(org.apache.cxf.ws.transfer.Representation) Document(org.w3c.dom.Document) BeforeClass(org.junit.BeforeClass)

Example 19 with Representation

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);
}
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 20 with Representation

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

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