use of org.apache.cxf.ws.transfer.Representation in project cxf by apache.
the class MemoryResourceManagerTest method putTest.
@Test
public void putTest() {
Element representationEl = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
representationEl.setTextContent(ELEMENT_VALUE);
Representation representation = new Representation();
representation.setAny(representationEl);
Element representationElNew = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
representationElNew.setTextContent(ELEMENT_VALUE_NEW);
Representation representationNew = new Representation();
representationNew.setAny(representationElNew);
ReferenceParametersType refParams = resourceManager.create(representation);
resourceManager.put(refParams, representationNew);
Representation returnedRepresentation = resourceManager.get(refParams);
Element returnedEl = (Element) returnedRepresentation.getAny();
Assert.assertEquals("Namespace is other than expected.", ELEMENT_NAMESPACE, returnedEl.getNamespaceURI());
Assert.assertEquals("Element name is other than expected", ELEMENT_NAME, returnedEl.getLocalName());
Assert.assertEquals("Value is other than expected.", ELEMENT_VALUE_NEW, returnedEl.getTextContent());
}
use of org.apache.cxf.ws.transfer.Representation in project cxf by apache.
the class MemoryResourceManagerTest method createEmptyRepresentationTest.
@Test
public void createEmptyRepresentationTest() {
ReferenceParametersType refParams = resourceManager.create(new Representation());
Assert.assertTrue("ResourceManager returned unexpected count of reference elements.", refParams.getAny().size() == 1);
}
use of org.apache.cxf.ws.transfer.Representation in project cxf by apache.
the class MemoryResourceManagerTest method getEmptyRepresentationTest.
@Test
public void getEmptyRepresentationTest() {
ReferenceParametersType refParams = resourceManager.create(new Representation());
Representation returnedRepresentation = resourceManager.get(refParams);
Assert.assertNull(returnedRepresentation.getAny());
}
use of org.apache.cxf.ws.transfer.Representation in project cxf by apache.
the class MemoryResourceManagerTest method putUnknownReferenceParamsTest.
@Test(expected = UnknownResource.class)
public void putUnknownReferenceParamsTest() {
ReferenceParametersType refParams = new ReferenceParametersType();
Element uuid = DOMUtils.getEmptyDocument().createElementNS(MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
uuid.setTextContent("123456");
refParams.getAny().add(uuid);
resourceManager.put(refParams, new Representation());
}
use of org.apache.cxf.ws.transfer.Representation in project cxf by apache.
the class XSDResourceValidatorTest method loadRepresentation.
private Representation loadRepresentation(InputStream input) throws XMLStreamException {
Document doc = StaxUtils.read(input);
Representation representation = new Representation();
representation.setAny(doc.getDocumentElement());
return representation;
}
Aggregations