Search in sources :

Example 6 with Create

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

the class CreateStudentTest method createStudentWrongTest.

@Test(expected = SOAPFaultException.class)
public void createStudentWrongTest() throws XMLStreamException {
    Document createStudentWrongXML = StaxUtils.read(getClass().getResourceAsStream("/xml/createStudentWrong.xml"));
    Create request = new Create();
    request.setRepresentation(new Representation());
    request.getRepresentation().setAny(createStudentWrongXML.getDocumentElement());
    ResourceFactory rf = TestUtils.createResourceFactoryClient(PORT);
    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) Test(org.junit.Test)

Example 7 with Create

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

the class CreateStudentTest method createRandomTest.

@Test(expected = SOAPFaultException.class)
public void createRandomTest() throws XMLStreamException {
    Document randomXML = StaxUtils.read(getClass().getResourceAsStream("/xml/random.xml"));
    Create request = new Create();
    request.setRepresentation(new Representation());
    request.getRepresentation().setAny(randomXML.getDocumentElement());
    ResourceFactory rf = TestUtils.createResourceFactoryClient(PORT);
    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) Test(org.junit.Test)

Example 8 with Create

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

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

the class CreateTeacherTest method createTeacherWrongTest.

@Test(expected = SOAPFaultException.class)
public void createTeacherWrongTest() throws XMLStreamException {
    Document createTeacherWrongXML = StaxUtils.read(getClass().getResourceAsStream("/xml/createTeacherWrong.xml"));
    Create request = new Create();
    request.setRepresentation(new Representation());
    request.getRepresentation().setAny(createTeacherWrongXML.getDocumentElement());
    ResourceFactory rf = TestUtils.createResourceFactoryClient(PORT);
    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) Test(org.junit.Test)

Example 10 with Create

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

Aggregations

Create (org.apache.cxf.ws.transfer.Create)14 Representation (org.apache.cxf.ws.transfer.Representation)14 ResourceFactory (org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory)14 Document (org.w3c.dom.Document)12 Test (org.junit.Test)9 CreateResponse (org.apache.cxf.ws.transfer.CreateResponse)6 Server (org.apache.cxf.endpoint.Server)2 ReferenceParametersType (org.apache.cxf.ws.addressing.ReferenceParametersType)2 ResourceManager (org.apache.cxf.ws.transfer.manager.ResourceManager)2 Element (org.w3c.dom.Element)2 BeforeClass (org.junit.BeforeClass)1