Esempio n. 1
0
  private void compareGraphResults(Model resultsActual, Query query) {
    if (results != null) {
      try {
        if (!results.isGraph()) fail("Expected results are not a graph: " + testItem.getName());

        Model resultsExpected = results.getModel();
        if (!resultsExpected.isIsomorphicWith(resultsActual)) {
          printFailedModelTest(query, resultsExpected, resultsActual);
          fail("Results do not match: " + testItem.getName());
        }
      } catch (Exception ex) {
        String typeName = (query.isConstructType() ? "construct" : "describe");
        fail("Exception in result testing (" + typeName + "): " + ex);
      }
    }
  }
Esempio n. 2
0
  @Override
  protected void runTestForReal() throws Throwable {
    Query query = null;
    try {
      try {
        query = queryFromTestItem(testItem);
      } catch (QueryException qEx) {
        query = null;
        qEx.printStackTrace(System.err);
        fail("Parse failure: " + qEx.getMessage());
        throw qEx;
      }

      Dataset dataset = setUpDataset(query, testItem);
      if (dataset == null && !doesQueryHaveDataset(query)) fail("No dataset for query");

      QueryExecution qe = null;

      if (dataset == null) qe = QueryExecutionFactory.create(query, queryFileManager);
      else qe = QueryExecutionFactory.create(query, dataset);

      try {
        if (query.isSelectType()) runTestSelect(query, qe);
        else if (query.isConstructType()) runTestConstruct(query, qe);
        else if (query.isDescribeType()) runTestDescribe(query, qe);
        else if (query.isAskType()) runTestAsk(query, qe);
      } finally {
        qe.close();
      }
    } catch (IOException ioEx) {
      // log.debug("IOException: ",ioEx) ;
      fail("IOException: " + ioEx.getMessage());
      throw ioEx;
    } catch (NullPointerException ex) {
      throw ex;
    } catch (Exception ex) {
      ex.printStackTrace(System.err);
      fail("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
    }
  }