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