Exemplo n.º 1
0
 public void close_report() {
   if (report != null) {
     try {
       report.flush();
       report.close();
     } catch (Exception err) {
       System.out.println("Something is a miss... ");
       err.printStackTrace();
     }
   }
 }
Exemplo n.º 2
0
 @Override
 public void writeHeader(String[] headers) throws IOException {
   csvMapWriter.writeHeader(headers);
 }
Exemplo n.º 3
0
 @Override
 public void writeRow(Map<String, String> row, String[] headers) throws IOException {
   csvMapWriter.write(row, headers);
 }
Exemplo n.º 4
0
  /**
   * Coordinate Test/Eval format
   *
   * <p>Result ID, CCE family, pattern ID, status, message // Reason for failure Result ID, CCE
   * family, pattern ID, status, Match ID, matchtext, lat, lon etc. // Success implied by
   * match @TODO: use TestCase here or rely on truth evaluation in Python GeocoderEval?
   *
   * @param t
   * @param results
   * @throws IOException
   */
  public void save_result(TestCase t, TextMatchResultSet results) throws IOException {

    Map<String, Object> row = null;

    if (!results.matches.isEmpty()) {

      // List out true and false positives
      //
      for (TextMatch tm : results.matches) {
        GeocoordMatch m = (GeocoordMatch) tm;
        if (!full_report && (m.is_submatch | m.is_duplicate)) {
          // Ignore submatches and duplicates
          continue;
        }
        row = createTestCase(t);

        row.put(header[6], results.result_id);
        row.put(header[7], (full_report & m.is_submatch) ? "IGNORE" : "PASS");

        String msg = results.message;
        if (m.is_submatch) {
          msg += "; Is Submatch";
        }
        row.put(header[8], msg);

        row.put(header[9], XConstants.get_CCE_family(m.cce_family_id));
        row.put(header[10], m.pattern_id);
        row.put(header[11], m.getText());
        row.put(header[12], "" + m.formatLatitude());
        row.put(header[13], "" + m.formatLongitude());
        String mgrs = "";
        try {
          mgrs = m.toMGRS();
        } catch (Exception err) {
        }
        row.put(header[14], mgrs);

        row.put(header[15], m.formatPrecision());
        row.put(header[16], new Long(m.start));

        report.write(row, header, xcoordResultsSpec);
      }
    } else {
      row = createTestCase(t);

      row.put(header[6], results.result_id);

      boolean expected_failure = false;
      if (t != null) {
        expected_failure = !t.true_positive;
      } else {
        // If the match message contains a test payload from the test cases
        //
        String test_status = results.get_trace().toUpperCase();
        expected_failure = test_status.contains("FAIL");
      }

      row.put(
          header[7],
          expected_failure ? "PASS" : "FAIL"); // True Negative -- you ignored one correctly
      row.put(header[8], results.get_trace());

      report.write(row, header, xcoordResultsSpec);
    }
  }
Exemplo n.º 5
0
 /**
  * @param file
  * @throws IOException
  */
 public TestUtility(String file) throws IOException {
   report = open(file);
   report.writeHeader(header);
 }