Search in sources :

Example 21 with Representation

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

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

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

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

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

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