Search in sources :

Example 26 with Resource

use of org.apache.cxf.ws.transfer.resource.Resource in project cxf by apache.

the class FragmentGetXPath10Test method getNumberTest.

@Test
public void getNumberTest() throws XMLStreamException {
    String content = "<root><a><b>Text</b><b>Text2</b></a></root>";
    ResourceManager resourceManager = new MemoryResourceManager();
    ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
    Server resource = createLocalResource(resourceManager);
    Resource client = createClient(refParams);
    ObjectFactory objectFactory = new ObjectFactory();
    Get request = new Get();
    request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
    ExpressionType expression = new ExpressionType();
    expression.setLanguage(FragmentDialectConstants.XPATH10_LANGUAGE_IRI);
    expression.getContent().add("count(//b)");
    request.getAny().add(objectFactory.createExpression(expression));
    GetResponse response = client.get(request);
    ValueType value = getValue(response);
    Assert.assertEquals(1, value.getContent().size());
    Assert.assertEquals("2", value.getContent().get(0));
    resource.destroy();
}
Also used : Server(org.apache.cxf.endpoint.Server) ObjectFactory(org.apache.cxf.ws.transfer.dialect.fragment.ObjectFactory) ValueType(org.apache.cxf.ws.transfer.dialect.fragment.ValueType) Get(org.apache.cxf.ws.transfer.Get) Resource(org.apache.cxf.ws.transfer.resource.Resource) ReferenceParametersType(org.apache.cxf.ws.addressing.ReferenceParametersType) MemoryResourceManager(org.apache.cxf.ws.transfer.manager.MemoryResourceManager) ResourceManager(org.apache.cxf.ws.transfer.manager.ResourceManager) MemoryResourceManager(org.apache.cxf.ws.transfer.manager.MemoryResourceManager) ExpressionType(org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType) GetResponse(org.apache.cxf.ws.transfer.GetResponse) Test(org.junit.Test)

Example 27 with Resource

use of org.apache.cxf.ws.transfer.resource.Resource in project cxf by apache.

the class DeleteTest method deleteTeacher.

@Test
public void deleteTeacher() throws XMLStreamException {
    CreateResponse response = createTeacher();
    Resource client = TestUtils.createResourceClient(response.getResourceCreated());
    client.delete(new Delete());
}
Also used : Delete(org.apache.cxf.ws.transfer.Delete) CreateResponse(org.apache.cxf.ws.transfer.CreateResponse) Resource(org.apache.cxf.ws.transfer.resource.Resource) Test(org.junit.Test)

Example 28 with Resource

use of org.apache.cxf.ws.transfer.resource.Resource in project cxf by apache.

the class DeleteTest method deleteStudent.

@Test
public void deleteStudent() throws XMLStreamException {
    CreateResponse response = createStudent();
    Resource client = TestUtils.createResourceClient(response.getResourceCreated());
    client.delete(new Delete());
}
Also used : Delete(org.apache.cxf.ws.transfer.Delete) CreateResponse(org.apache.cxf.ws.transfer.CreateResponse) Resource(org.apache.cxf.ws.transfer.resource.Resource) Test(org.junit.Test)

Example 29 with Resource

use of org.apache.cxf.ws.transfer.resource.Resource in project cxf by apache.

the class DeleteTest method getDeletedTeacher.

@Test(expected = SOAPFaultException.class)
public void getDeletedTeacher() throws XMLStreamException {
    CreateResponse response = createTeacher();
    Resource client = TestUtils.createResourceClient(response.getResourceCreated());
    client.delete(new Delete());
    client.get(new Get());
}
Also used : Delete(org.apache.cxf.ws.transfer.Delete) CreateResponse(org.apache.cxf.ws.transfer.CreateResponse) Get(org.apache.cxf.ws.transfer.Get) Resource(org.apache.cxf.ws.transfer.resource.Resource) Test(org.junit.Test)

Example 30 with Resource

use of org.apache.cxf.ws.transfer.resource.Resource in project cxf by apache.

the class DeleteTest method deleteDeletedTeacher.

@Test(expected = SOAPFaultException.class)
public void deleteDeletedTeacher() throws XMLStreamException {
    CreateResponse response = createTeacher();
    Resource client = TestUtils.createResourceClient(response.getResourceCreated());
    client.delete(new Delete());
    client.delete(new Delete());
}
Also used : Delete(org.apache.cxf.ws.transfer.Delete) CreateResponse(org.apache.cxf.ws.transfer.CreateResponse) Resource(org.apache.cxf.ws.transfer.resource.Resource) Test(org.junit.Test)

Aggregations

Resource (org.apache.cxf.ws.transfer.resource.Resource)66 Test (org.junit.Test)63 ReferenceParametersType (org.apache.cxf.ws.addressing.ReferenceParametersType)51 MemoryResourceManager (org.apache.cxf.ws.transfer.manager.MemoryResourceManager)51 ResourceManager (org.apache.cxf.ws.transfer.manager.ResourceManager)51 Server (org.apache.cxf.endpoint.Server)50 ExpressionType (org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType)48 ValueType (org.apache.cxf.ws.transfer.dialect.fragment.ValueType)44 Element (org.w3c.dom.Element)39 Put (org.apache.cxf.ws.transfer.Put)37 Fragment (org.apache.cxf.ws.transfer.dialect.fragment.Fragment)32 PutResponse (org.apache.cxf.ws.transfer.PutResponse)25 Get (org.apache.cxf.ws.transfer.Get)21 GetResponse (org.apache.cxf.ws.transfer.GetResponse)18 ObjectFactory (org.apache.cxf.ws.transfer.dialect.fragment.ObjectFactory)16 Representation (org.apache.cxf.ws.transfer.Representation)11 CreateResponse (org.apache.cxf.ws.transfer.CreateResponse)10 Delete (org.apache.cxf.ws.transfer.Delete)7 Document (org.w3c.dom.Document)6 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)3