use of org.apache.cxf.ws.transfer.validationtransformation.ResourceTransformer in project cxf by apache.
the class XSLTResourceTransformerTest method transformTest.
@Test
public void transformTest() throws XMLStreamException {
ResourceTransformer transformer = new XSLTResourceTransformer(new StreamSource(getClass().getResourceAsStream("/xml/xsltresourcetransformer/stylesheet.xsl")));
Representation representation = loadRepresentation(getClass().getResourceAsStream("/xml/xsltresourcetransformer/representation.xml"));
transformer.transform(representation, null);
Element representationEl = (Element) representation.getAny();
Assert.assertEquals("Expected root element with name \"person\".", "person", representationEl.getLocalName());
Assert.assertTrue("Expected one element \"firstname\".", representationEl.getElementsByTagName("firstname").getLength() == 1);
Assert.assertTrue("Expected one element \"lastname\".", representationEl.getElementsByTagName("lastname").getLength() == 1);
}
Aggregations