org.eclipse.rdf4j.query.resultio

## Class AbstractQueryResultIOTest

- java.lang.Object
- - org.eclipse.rdf4j.query.resultio.AbstractQueryResultIOTest

- Direct Known Subclasses:
    AbstractQueryResultIOBooleanTest, AbstractQueryResultIOTupleTest

      public abstract class AbstractQueryResultIOTest
      extends Object

  Author:
    Peter Ansell

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractQueryResultIOTest()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `assertQueryResultsEqual(TupleQueryResult expected, TupleQueryResult output)`
    `protected TupleQueryResult` | `createTupleMultipleBindingSets()`
    `protected TupleQueryResult` | `createTupleNoBindingSets()`
    `protected TupleQueryResult` | `createTupleSingleVarMultipleBindingSets()`
    `protected void` | `doBooleanLinks(BooleanQueryResultFormat format, boolean input, List<String> links)`
    `protected void` | `doBooleanLinksAndStylesheet(BooleanQueryResultFormat format, boolean input, List<String> links, String stylesheetUrl)`
    `protected void` | `doBooleanLinksAndStylesheetAndNamespaces(BooleanQueryResultFormat format, boolean input, List<String> links, String stylesheetUrl, Map<String,String> namespaces)`
    `protected void` | `doBooleanLinksOnly(BooleanQueryResultFormat format, boolean input, List<String> links)`
    `protected void` | `doBooleanNoHandler(BooleanQueryResultFormat format, boolean input)` Tests that parsing a boolean without specifying a `BooleanQueryResultHandler` does not throw any exceptions.
    `protected void` | `doBooleanNoLinks(BooleanQueryResultFormat format, boolean input)`
    `protected void` | `doBooleanParseNoHandlerOnTupleResults(BooleanQueryResultFormat format, TupleQueryResult tqr, TupleQueryResultFormat matchingTupleFormat)` Tests that the parser returned for a BooleanQueryResultFormat is not able to parse a TupleQueryResultFormat using the deprecated `BooleanQueryResultParser.parse(java.io.InputStream)` method, and that it does indeed through an exception of type `QueryResultParseException`.
    `protected void` | `doBooleanStylesheet(BooleanQueryResultFormat format, boolean input, String stylesheetUrl)`
    `protected void` | `doInvalidBooleanAfterStartQueryResult(BooleanQueryResultFormat format, boolean input, List<String> links)`
    `protected void` | `doTupleJSONPCallback(TupleQueryResultFormat format, TupleQueryResult input, TupleQueryResult expected)` Test specifically for JSONP callback support.
    `protected void` | `doTupleLinks(TupleQueryResultFormat format, TupleQueryResult input, TupleQueryResult expected, List<String> links)`
    `protected void` | `doTupleLinksAndStylesheet(TupleQueryResultFormat format, TupleQueryResult input, TupleQueryResult expected, List<String> links, String stylesheetUrl)`
    `protected void` | `doTupleLinksAndStylesheetAndNamespaces(TupleQueryResultFormat format, TupleQueryResult input, TupleQueryResult expected, List<String> links, String stylesheetUrl, Map<String,String> namespaces)`
    `protected void` | `doTupleLinksAndStylesheetAndNamespacesQName(TupleQueryResultFormat format, TupleQueryResult input, TupleQueryResult expected, List<String> links, String stylesheetUrl, Map<String,String> namespaces)` Test specifically for QName support.
    `protected void` | `doTupleLinksAndStylesheetMultipleEndHeaders(TupleQueryResultFormat format, TupleQueryResult input, TupleQueryResult expected, List<String> links, String stylesheetUrl)`
    `protected void` | `doTupleLinksAndStylesheetNoStarts(TupleQueryResultFormat format, TupleQueryResult input, TupleQueryResult expected, List<String> links, String stylesheetUrl)`
    `protected void` | `doTupleMissingStartQueryResult(TupleQueryResultFormat format, TupleQueryResult input, TupleQueryResult expected, List<String> links, String stylesheetUrl)`
    `protected void` | `doTupleNoHandler(TupleQueryResultFormat format, TupleQueryResult input, TupleQueryResult expected)` Tests that parsing a tuple results set without specifying a `TupleQueryResultHandler` does not throw any exceptions.
    `protected void` | `doTupleNoLinks(TupleQueryResultFormat format, TupleQueryResult input, TupleQueryResult expected)`
    `protected void` | `doTupleParseNoHandlerOnBooleanResults(TupleQueryResultFormat format, boolean input, BooleanQueryResultFormat matchingBooleanFormat)` Tests that the parser returned for a TupleQueryResultFormat is not able to parse a BooleanQueryResultFormat using the deprecated `TupleQueryResultParser.parse(java.io.InputStream)` method, and that it does indeed through an exception of type `QueryResultParseException`.
    `protected void` | `doTupleStylesheet(TupleQueryResultFormat format, TupleQueryResult input, TupleQueryResult expected, String stylesheetUrl)`
    `protected abstract String` | `getFileName()`
    `protected abstract QueryResultFormat` | `getFormat()`
    `protected Map<String,String>` | `getNamespaces()`
    `protected Map<String,String>` | `getNamespacesWithEmpty()`
    `protected TupleQueryResult` | `parseTupleInternal(TupleQueryResultFormat format, InputStream in)` Override this to customise how the tuple parsing is performed, particularly to test background and other parsing strategies.
    `void` | `testGetParserFormatForFileNameString()` Test method for `QueryResultIO.getParserFormatForFileName(java.lang.String)` .

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractQueryResultIOTest

          public AbstractQueryResultIOTest()

  - ### Method Detail

    - #### getFileName

          protected abstract String getFileName()

      Returns:
        An example filename that will match the `QueryResultFormat` returned by `getFormat()`.

    - #### getFormat

          protected abstract QueryResultFormat getFormat()

    - #### parseTupleInternal

          protected TupleQueryResult parseTupleInternal(TupleQueryResultFormat format,
                                                        InputStream in)
                                                 throws IOException,
                                                        QueryResultParseException,
                                                        TupleQueryResultHandlerException,
                                                        UnsupportedQueryResultFormatException

      Override this to customise how the tuple parsing is performed, particularly to test background and other parsing strategies.
      Parameters:
        `format` - The `TupleQueryResultFormat` for the parser.
        `in` - The InputStream to parse
      Returns:
        A `TupleQueryResult` that can be parsed.
      Throws:
        `IOException`
        `QueryResultParseException`
        `TupleQueryResultHandlerException`
        `UnsupportedQueryResultFormatException`

    - #### testGetParserFormatForFileNameString

          @Test
          public final void testGetParserFormatForFileNameString()
                                                                throws Exception

      Test method for `QueryResultIO.getParserFormatForFileName(java.lang.String)` .
      Throws:
        `Exception`

    - #### createTupleSingleVarMultipleBindingSets

          protected TupleQueryResult createTupleSingleVarMultipleBindingSets()

    - #### createTupleMultipleBindingSets

          protected TupleQueryResult createTupleMultipleBindingSets()

    - #### getNamespaces

          protected Map<String,String> getNamespaces()

      Returns:
        A map of test namespaces for the writer to handle.

    - #### getNamespacesWithEmpty

          protected Map<String,String> getNamespacesWithEmpty()

      Returns:
        A map of test namespaces for the writer to handle, including an empty namespace.

    - #### createTupleNoBindingSets

          protected TupleQueryResult createTupleNoBindingSets()

    - #### doTupleLinks

          protected void doTupleLinks(TupleQueryResultFormat format,
                                      TupleQueryResult input,
                                      TupleQueryResult expected,
                                      List<String> links)
                               throws QueryResultHandlerException,
                                      QueryEvaluationException,
                                      QueryResultParseException,
                                      UnsupportedQueryResultFormatException,
                                      IOException

      Throws:
        `QueryResultHandlerException`
        `QueryEvaluationException`
        `QueryResultParseException`
        `UnsupportedQueryResultFormatException`
        `IOException`

    - #### doTupleLinksAndStylesheet

          protected void doTupleLinksAndStylesheet(TupleQueryResultFormat format,
                                                   TupleQueryResult input,
                                                   TupleQueryResult expected,
                                                   List<String> links,
                                                   String stylesheetUrl)
                                            throws QueryResultHandlerException,
                                                   QueryEvaluationException,
                                                   QueryResultParseException,
                                                   UnsupportedQueryResultFormatException,
                                                   IOException

      Throws:
        `QueryResultHandlerException`
        `QueryEvaluationException`
        `QueryResultParseException`
        `UnsupportedQueryResultFormatException`
        `IOException`

    - #### doTupleLinksAndStylesheetAndNamespaces

          protected void doTupleLinksAndStylesheetAndNamespaces(TupleQueryResultFormat format,
                                                                TupleQueryResult input,
                                                                TupleQueryResult expected,
                                                                List<String> links,
                                                                String stylesheetUrl,
                                                                Map<String,String> namespaces)
                                                         throws QueryResultHandlerException,
                                                                QueryEvaluationException,
                                                                QueryResultParseException,
                                                                UnsupportedQueryResultFormatException,
                                                                IOException

      Throws:
        `QueryResultHandlerException`
        `QueryEvaluationException`
        `QueryResultParseException`
        `UnsupportedQueryResultFormatException`
        `IOException`

    - #### doTupleLinksAndStylesheetAndNamespacesQName

          protected void doTupleLinksAndStylesheetAndNamespacesQName(TupleQueryResultFormat format,
                                                                     TupleQueryResult input,
                                                                     TupleQueryResult expected,
                                                                     List<String> links,
                                                                     String stylesheetUrl,
                                                                     Map<String,String> namespaces)
                                                              throws QueryResultHandlerException,
                                                                     QueryEvaluationException,
                                                                     QueryResultParseException,
                                                                     UnsupportedQueryResultFormatException,
                                                                     IOException

      Test specifically for QName support.
      Throws:
        `QueryResultHandlerException`
        `QueryEvaluationException`
        `QueryResultParseException`
        `UnsupportedQueryResultFormatException`
        `IOException`

    - #### doTupleJSONPCallback

          protected void doTupleJSONPCallback(TupleQueryResultFormat format,
                                              TupleQueryResult input,
                                              TupleQueryResult expected)
                                       throws QueryResultHandlerException,
                                              QueryEvaluationException,
                                              QueryResultParseException,
                                              UnsupportedQueryResultFormatException,
                                              IOException

      Test specifically for JSONP callback support.
      Throws:
        `QueryResultHandlerException`
        `QueryEvaluationException`
        `QueryResultParseException`
        `UnsupportedQueryResultFormatException`
        `IOException`

    - #### doTupleNoLinks

          protected void doTupleNoLinks(TupleQueryResultFormat format,
                                        TupleQueryResult input,
                                        TupleQueryResult expected)
                                 throws IOException,
                                        QueryResultParseException,
                                        UnsupportedQueryResultFormatException,
                                        QueryEvaluationException,
                                        QueryResultHandlerException

      Throws:
        `IOException`
        `QueryResultParseException`
        `UnsupportedQueryResultFormatException`
        `QueryEvaluationException`
        `QueryResultHandlerException`

    - #### doTupleStylesheet

          protected void doTupleStylesheet(TupleQueryResultFormat format,
                                           TupleQueryResult input,
                                           TupleQueryResult expected,
                                           String stylesheetUrl)
                                    throws QueryResultHandlerException,
                                           QueryEvaluationException,
                                           QueryResultParseException,
                                           UnsupportedQueryResultFormatException,
                                           IOException

      Throws:
        `QueryResultHandlerException`
        `QueryEvaluationException`
        `QueryResultParseException`
        `UnsupportedQueryResultFormatException`
        `IOException`

    - #### doTupleLinksAndStylesheetNoStarts

          protected void doTupleLinksAndStylesheetNoStarts(TupleQueryResultFormat format,
                                                           TupleQueryResult input,
                                                           TupleQueryResult expected,
                                                           List<String> links,
                                                           String stylesheetUrl)
                                                    throws QueryResultHandlerException,
                                                           QueryEvaluationException,
                                                           QueryResultParseException,
                                                           UnsupportedQueryResultFormatException,
                                                           IOException

      Throws:
        `QueryResultHandlerException`
        `QueryEvaluationException`
        `QueryResultParseException`
        `UnsupportedQueryResultFormatException`
        `IOException`

    - #### doTupleLinksAndStylesheetMultipleEndHeaders

          protected void doTupleLinksAndStylesheetMultipleEndHeaders(TupleQueryResultFormat format,
                                                                     TupleQueryResult input,
                                                                     TupleQueryResult expected,
                                                                     List<String> links,
                                                                     String stylesheetUrl)
                                                              throws QueryResultHandlerException,
                                                                     QueryEvaluationException,
                                                                     QueryResultParseException,
                                                                     UnsupportedQueryResultFormatException,
                                                                     IOException

      Throws:
        `QueryResultHandlerException`
        `QueryEvaluationException`
        `QueryResultParseException`
        `UnsupportedQueryResultFormatException`
        `IOException`

    - #### assertQueryResultsEqual

          protected void assertQueryResultsEqual(TupleQueryResult expected,
                                                 TupleQueryResult output)
                                          throws QueryEvaluationException,
                                                 TupleQueryResultHandlerException,
                                                 QueryResultHandlerException,
                                                 UnsupportedEncodingException

      Throws:
        `QueryEvaluationException`
        `TupleQueryResultHandlerException`
        `QueryResultHandlerException`
        `UnsupportedEncodingException`

    - #### doTupleMissingStartQueryResult

          protected void doTupleMissingStartQueryResult(TupleQueryResultFormat format,
                                                        TupleQueryResult input,
                                                        TupleQueryResult expected,
                                                        List<String> links,
                                                        String stylesheetUrl)
                                                 throws QueryResultHandlerException,
                                                        QueryEvaluationException,
                                                        QueryResultParseException,
                                                        UnsupportedQueryResultFormatException,
                                                        IOException

      Throws:
        `QueryResultHandlerException`
        `QueryEvaluationException`
        `QueryResultParseException`
        `UnsupportedQueryResultFormatException`
        `IOException`

    - #### doTupleNoHandler

          protected void doTupleNoHandler(TupleQueryResultFormat format,
                                          TupleQueryResult input,
                                          TupleQueryResult expected)
                                   throws QueryResultParseException,
                                          IOException,
                                          TupleQueryResultHandlerException,
                                          UnsupportedQueryResultFormatException,
                                          QueryEvaluationException

      Tests that parsing a tuple results set without specifying a `TupleQueryResultHandler` does not throw any exceptions.
      Parameters:
        `format` -
        `input` -
      Throws:
        `QueryResultParseException`
        `IOException`
        `TupleQueryResultHandlerException`
        `QueryEvaluationException`
        `UnsupportedQueryResultFormatException`

    - #### doTupleParseNoHandlerOnBooleanResults

          protected void doTupleParseNoHandlerOnBooleanResults(TupleQueryResultFormat format,
                                                               boolean input,
                                                               BooleanQueryResultFormat matchingBooleanFormat)
                                                        throws UnsupportedQueryResultFormatException,
                                                               QueryResultHandlerException,
                                                               IOException

      Tests that the parser returned for a TupleQueryResultFormat is not able to parse a BooleanQueryResultFormat using the deprecated `TupleQueryResultParser.parse(java.io.InputStream)` method, and that it does indeed through an exception of type `QueryResultParseException`.
      Parameters:
        `format` -
        `input` -
        `matchingBooleanFormat` - A BooleanQueryResultFormat that matches the given TupleQueryResultFormat .
      Throws:
        `IOException`
        `QueryEvaluationException`
        `UnsupportedQueryResultFormatException`
        `QueryResultHandlerException`
      See Also:
        SES-1860

    - #### doBooleanNoLinks

          protected void doBooleanNoLinks(BooleanQueryResultFormat format,
                                          boolean input)
                                   throws IOException,
                                          QueryResultHandlerException,
                                          QueryResultParseException,
                                          UnsupportedQueryResultFormatException,
                                          QueryEvaluationException

      Throws:
        `IOException`
        `QueryResultHandlerException`
        `QueryResultParseException`
        `UnsupportedQueryResultFormatException`
        `QueryEvaluationException`

    - #### doBooleanLinksOnly

          protected void doBooleanLinksOnly(BooleanQueryResultFormat format,
                                            boolean input,
                                            List<String> links)
                                     throws IOException,
                                            QueryResultHandlerException,
                                            QueryResultParseException,
                                            UnsupportedQueryResultFormatException,
                                            QueryEvaluationException

      Throws:
        `IOException`
        `QueryResultHandlerException`
        `QueryResultParseException`
        `UnsupportedQueryResultFormatException`
        `QueryEvaluationException`

    - #### doInvalidBooleanAfterStartQueryResult

          protected void doInvalidBooleanAfterStartQueryResult(BooleanQueryResultFormat format,
                                                               boolean input,
                                                               List<String> links)
                                                        throws IOException,
                                                               QueryResultHandlerException,
                                                               QueryResultParseException,
                                                               UnsupportedQueryResultFormatException,
                                                               QueryEvaluationException

      Throws:
        `IOException`
        `QueryResultHandlerException`
        `QueryResultParseException`
        `UnsupportedQueryResultFormatException`
        `QueryEvaluationException`

    - #### doBooleanLinks

          protected void doBooleanLinks(BooleanQueryResultFormat format,
                                        boolean input,
                                        List<String> links)
                                 throws IOException,
                                        QueryResultHandlerException,
                                        QueryResultParseException,
                                        UnsupportedQueryResultFormatException,
                                        QueryEvaluationException

      Throws:
        `IOException`
        `QueryResultHandlerException`
        `QueryResultParseException`
        `UnsupportedQueryResultFormatException`
        `QueryEvaluationException`

    - #### doBooleanLinksAndStylesheet

          protected void doBooleanLinksAndStylesheet(BooleanQueryResultFormat format,
                                                     boolean input,
                                                     List<String> links,
                                                     String stylesheetUrl)
                                              throws IOException,
                                                     QueryResultHandlerException,
                                                     QueryResultParseException,
                                                     UnsupportedQueryResultFormatException,
                                                     QueryEvaluationException

      Throws:
        `IOException`
        `QueryResultHandlerException`
        `QueryResultParseException`
        `UnsupportedQueryResultFormatException`
        `QueryEvaluationException`

    - #### doBooleanLinksAndStylesheetAndNamespaces

          protected void doBooleanLinksAndStylesheetAndNamespaces(BooleanQueryResultFormat format,
                                                                  boolean input,
                                                                  List<String> links,
                                                                  String stylesheetUrl,
                                                                  Map<String,String> namespaces)
                                                           throws IOException,
                                                                  QueryResultHandlerException,
                                                                  QueryResultParseException,
                                                                  UnsupportedQueryResultFormatException,
                                                                  QueryEvaluationException

      Throws:
        `IOException`
        `QueryResultHandlerException`
        `QueryResultParseException`
        `UnsupportedQueryResultFormatException`
        `QueryEvaluationException`

    - #### doBooleanStylesheet

          protected void doBooleanStylesheet(BooleanQueryResultFormat format,
                                             boolean input,
                                             String stylesheetUrl)
                                      throws IOException,
                                             QueryResultHandlerException,
                                             QueryResultParseException,
                                             UnsupportedQueryResultFormatException,
                                             QueryEvaluationException

      Throws:
        `IOException`
        `QueryResultHandlerException`
        `QueryResultParseException`
        `UnsupportedQueryResultFormatException`
        `QueryEvaluationException`

    - #### doBooleanNoHandler

          protected void doBooleanNoHandler(BooleanQueryResultFormat format,
                                            boolean input)
                                     throws QueryResultParseException,
                                            IOException

      Tests that parsing a boolean without specifying a `BooleanQueryResultHandler` does not throw any exceptions.
      Parameters:
        `format` -
        `input` -
      Throws:
        `QueryResultParseException`
        `IOException`

    - #### doBooleanParseNoHandlerOnTupleResults

          protected void doBooleanParseNoHandlerOnTupleResults(BooleanQueryResultFormat format,
                                                               TupleQueryResult tqr,
                                                               TupleQueryResultFormat matchingTupleFormat)
                                                        throws TupleQueryResultHandlerException,
                                                               UnsupportedQueryResultFormatException,
                                                               QueryEvaluationException,
                                                               IOException

      Tests that the parser returned for a BooleanQueryResultFormat is not able to parse a TupleQueryResultFormat using the deprecated `BooleanQueryResultParser.parse(java.io.InputStream)` method, and that it does indeed through an exception of type `QueryResultParseException`.
      Parameters:
        `format` -
        `tqr` -
        `matchingTupleFormat` - A TupleQueryResultFormat that matches the given BooleanQueryResultFormat.
      Throws:
        `IOException`
        `QueryEvaluationException`
        `UnsupportedQueryResultFormatException`
        `TupleQueryResultHandlerException`
      See Also:
        SES-1860

Copyright © 2015-2021 Eclipse Foundation. All Rights Reserved.