protected void doTupleNoLinks(TupleQueryResultFormat format, TupleQueryResult input, TupleQueryResult expected) throws IOException, QueryResultParseException, UnsupportedQueryResultFormatException, QueryEvaluationException, QueryResultHandlerException { ByteArrayOutputStream out = new ByteArrayOutputStream(4096); QueryResultIO.writeTuple(input, format, out); input.close(); // System.out.println("output: " + out.toString("UTF-8")); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); TupleQueryResult output = QueryResultIO.parseTuple(in, format); assertQueryResultsEqual(expected, output); }
/** * Tests that parsing a tuple results set without specifying a * {@link TupleQueryResultHandler} does not throw any exceptions. * * @param format * @param input * @throws QueryResultParseException * @throws IOException * @throws TupleQueryResultHandlerException * @throws QueryEvaluationException * @throws UnsupportedQueryResultFormatException */ protected void doTupleNoHandler(TupleQueryResultFormat format, TupleQueryResult input, TupleQueryResult expected) throws QueryResultParseException, IOException, TupleQueryResultHandlerException, UnsupportedQueryResultFormatException, QueryEvaluationException { ByteArrayOutputStream out = new ByteArrayOutputStream(4096); QueryResultIO.writeTuple(input, format, out); out.flush(); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); TupleQueryResultParser parser = QueryResultIO.createTupleParser(format); // This should perform a full parse to verify the document, even though // the handler is not set parser.parse(in); }
QueryResultIO.writeTuple(tqr, matchingTupleFormat, out); out.flush(); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());