Exemple #1
0
  @SuppressWarnings("unchecked")
  @Test(
      groups = {"validation"},
      description = "test")
  public void verifyValidation() throws ChouetteException {
    INeptuneManager<Line> lineManager;
    lineManager = (INeptuneManager<Line>) applicationContext.getBean("lineManager");
    List<ParameterValue> values = new ArrayList<ParameterValue>();
    SimpleParameterValue file = new SimpleParameterValue("inputFile");
    file.setFilepathValue("src/test/data/test_neptune.zip");
    values.add(file);
    SimpleParameterValue validate = new SimpleParameterValue("validate");
    validate.setBooleanValue(Boolean.TRUE);
    values.add(validate);
    ReportHolder reportHolder = new ReportHolder();
    List<Line> lines = lineManager.doImport(null, "NEPTUNE", values, reportHolder);

    Report importReport = reportHolder.getReport();
    printItems("", importReport.getItems());

    List<ParameterValue> parameters = new ArrayList<ParameterValue>();
    SimpleParameterValue outputFile = new SimpleParameterValue("outputFile");
    outputFile.setFilepathValue("target/test/gtfs.zip");
    parameters.add(outputFile);
    SimpleParameterValue timeZone = new SimpleParameterValue("timeZone");
    timeZone.setStringValue("Europe/Paris");
    parameters.add(timeZone);

    ReportHolder exportReport = new ReportHolder();
    lineManager.doExport(null, lines, "GTFS", parameters, exportReport);

    // printItems("",exportReport.getReport().getItems());

  }
 private void printReport(Report report) {
   if (report == null) {
     Reporter.log("no report");
   } else {
     Reporter.log(report.getStatus().name() + " : " + report.getLocalizedMessage());
     printItems("   ", report.getItems());
   }
 }