Search in sources :

Example 1 with XSLTEvaluator

use of org.sirix.saxon.evaluator.XSLTEvaluator in project sirix by sirixdb.

the class TestNodeWrapperS9ApiXSLT method testWithSerializer.

@Test
public void testWithSerializer() throws Exception {
    final Serializer serializer = new Serializer();
    serializer.setOutputProperty(Serializer.Property.METHOD, "xml");
    serializer.setOutputProperty(Serializer.Property.INDENT, "yes");
    final OutputStream out = new XSLTEvaluator(mHolder.getSession(), STYLESHEET, new ByteArrayOutputStream(), serializer).call();
    final StringBuilder sBuilder = readFile();
    final Diff diff = new Diff(sBuilder.toString(), out.toString());
    diff.overrideElementQualifier(new RecursiveElementNameAndTextQualifier());
    assertTrue(diff.toString(), diff.similar());
}
Also used : Diff(org.custommonkey.xmlunit.Diff) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStream(java.io.OutputStream) RecursiveElementNameAndTextQualifier(org.custommonkey.xmlunit.examples.RecursiveElementNameAndTextQualifier) XSLTEvaluator(org.sirix.saxon.evaluator.XSLTEvaluator) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Serializer(net.sf.saxon.s9api.Serializer) Test(org.junit.Test)

Example 2 with XSLTEvaluator

use of org.sirix.saxon.evaluator.XSLTEvaluator in project sirix by sirixdb.

the class TestNodeWrapperS9ApiXSLT method testWithoutSerializer.

@Test
public void testWithoutSerializer() throws Exception {
    final OutputStream out = new XSLTEvaluator(mHolder.getSession(), STYLESHEET, new ByteArrayOutputStream()).call();
    final StringBuilder sBuilder = readFile();
    final Diff diff = new Diff(sBuilder.toString(), out.toString());
    diff.overrideElementQualifier(new RecursiveElementNameAndTextQualifier());
    assertTrue(diff.toString(), diff.similar());
}
Also used : Diff(org.custommonkey.xmlunit.Diff) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStream(java.io.OutputStream) RecursiveElementNameAndTextQualifier(org.custommonkey.xmlunit.examples.RecursiveElementNameAndTextQualifier) XSLTEvaluator(org.sirix.saxon.evaluator.XSLTEvaluator) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Aggregations

ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 OutputStream (java.io.OutputStream)2 Diff (org.custommonkey.xmlunit.Diff)2 RecursiveElementNameAndTextQualifier (org.custommonkey.xmlunit.examples.RecursiveElementNameAndTextQualifier)2 Test (org.junit.Test)2 XSLTEvaluator (org.sirix.saxon.evaluator.XSLTEvaluator)2 Serializer (net.sf.saxon.s9api.Serializer)1