Package com.adobe.epubcheck.util

Examples of com.adobe.epubcheck.util.ValidationReport


    return testPropertyList(value, vocabs, false);
  }

  private Set<Property> testPropertyList(String value, Map<String, Vocab> vocabs, boolean verbose)
  {
    ValidationReport testReport = new ValidationReport(VocabTest.class.getSimpleName());

    Set<Property> props = VocabUtil.parsePropertyList(value, vocabs, testReport, loc);

    if (verbose)
    {
      outWriter.println(testReport);
    }

    assertEquals("The error results do not match", expectedErrors, testReport.getErrorIds());
    assertEquals("The warning results do not match", expectedWarnings, testReport.getWarningIds());
    assertEquals("The fatal error results do not match", expectedFatalErrors,
        testReport.getFatalErrorIds());

    return props;
  }
View Full Code Here


    return testProperty(value, vocabs, false);
  }

  private Optional<Property> testProperty(String value, Map<String, Vocab> vocabs, boolean verbose)
  {
    ValidationReport testReport = new ValidationReport(VocabTest.class.getSimpleName());

    Optional<Property> prop = VocabUtil.parseProperty(value, vocabs, testReport, loc);

    if (verbose)
    {
      outWriter.println(testReport);
    }

    assertEquals("The error results do not match", expectedErrors, testReport.getErrorIds());
    assertEquals("The warning results do not match", expectedWarnings, testReport.getWarningIds());
    assertEquals("The fatal error results do not match", expectedFatalErrors,
        testReport.getFatalErrorIds());

    return prop;
  }
View Full Code Here

    return testVocabs(value, false);
  }

  private Map<String, Vocab> testVocabs(String value, boolean verbose)
  {
    ValidationReport testReport = new ValidationReport(VocabTest.class.getSimpleName());

    Map<String, Vocab> result = VocabUtil.parsePrefixDeclaration(value, PREDEF_VOCABS,
        KNOWN_VOCABS, FORBIDDEN_URIS, testReport, loc);

    if (verbose)
    {
      outWriter.println(testReport);
    }

    assertEquals("The error results do not match", expectedErrors, testReport.getErrorIds());
    assertEquals("The warning results do not match", expectedWarnings, testReport.getWarningIds());
    assertEquals("The fatal error results do not match", expectedFatalErrors,
        testReport.getFatalErrorIds());

    return result;
  }
View Full Code Here

  }

  public void testValidateDocument(String fileName, List<MessageId> errors, List<MessageId> warnings, List<MessageId> fatalErrors,
                                   boolean verbose)
  {
    ValidationReport testReport = new ValidationReport(fileName, String.format(
        Messages.get("single_file"), "nav", "3.0"));

    GenericResourceProvider resourceProvider;
    if (fileName.startsWith("http://") || fileName.startsWith("https://"))
    {
      resourceProvider = new URLResourceProvider(fileName);
    }
    else
    {
      URL fileURL = this.getClass().getResource(basepath + fileName);
      String filePath = fileURL != null ? fileURL.getPath() : basepath + fileName;
      resourceProvider = new FileResourceProvider(filePath);
    }

    NavChecker navChecker = new NavChecker(resourceProvider, testReport, basepath
        + fileName, "application/xhtml+xml", EPUBVersion.VERSION_3);

    navChecker.validate();

    if (verbose)
    {
      outWriter.println(testReport);
    }

    assertEquals("The error results do not match", errors, testReport.getErrorIds());
    assertEquals("The warning results do not match", warnings, testReport.getWarningIds());
    assertEquals("The fatal error results do not match", fatalErrors, testReport.getFatalErrorIds());
  }
View Full Code Here

  */
  private void validate() throws Exception
  {
    Archive epub = new Archive(TEMP_DIR.getPath());
    epub.createArchive();
    ValidationReport report = new ValidationReport(TEMP_DIR.getName());
    EpubCheck epubCheck = new EpubCheck(epub.getEpubFile(), report);
    epubCheck.validate();
    assertTrue(report.getErrorCount() < 1);
    assertTrue(report.getWarningCount() < 1);
    epub.deleteEpubFile();
    // outWriter.println(report);
  }
View Full Code Here

    return test(value, false);
  }

  private Map<String, String> test(String value, boolean verbose)
  {
    ValidationReport testReport = new ValidationReport(PrefixParsingTest.class.getSimpleName());

    Map<String, String> result = PrefixDeclarationParser.parsePrefixMappings(value, testReport, loc);

    if (verbose)
    {
      outWriter.println(testReport);
    }

    assertEquals("The error results do not match", expectedErrors, testReport.getErrorIds());
    assertEquals("The warning results do not match", expectedWarnings, testReport.getWarningIds());
    assertEquals("The fatal error results do not match", expectedFatalErrors, testReport.getFatalErrorIds());

    return result;
  }
View Full Code Here

TOP

Related Classes of com.adobe.epubcheck.util.ValidationReport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.