Package com.adobe.epubcheck.api

Examples of com.adobe.epubcheck.api.EpubCheck


    boolean hadError = false;
    for(File epubDir : parent.listFiles(dirFilter)) {
      Archive epub = new Archive(epubDir.getAbsolutePath(), false);
      epub.createArchive();
      Report report = new DefaultReportImpl(epub.getEpubName());
      EpubCheck check = new EpubCheck(epub.getEpubFile(), report);
      if (check.validate()) {
        System.out.println(Messages.NO_ERRORS__OR_WARNINGS);
        String name = epub.getEpubName();
        name = name.replace(".epub", "-"+now+".epub");
        epub.getEpubFile().renameTo(new File(buildDir,name));
      } else {
View Full Code Here


          return 1;
        }

        epub.createArchive();
        report.setEpubFileName(epub.getEpubFile().getAbsolutePath());
        EpubCheck check = new EpubCheck(epub.getEpubFile(), report);
        int validationResult = check.doValidate();
        if (validationResult == 0)
        {
          outWriter.println(Messages.get("no_errors__or_warnings"));
          result = 0;
        }
View Full Code Here

{
  @Test
  public void EpubCheck1_Test() throws Exception
  {
    File epub = getTestEpub();
    EpubCheck check = new EpubCheck(epub);
    Assert.assertEquals("The file should have generated errors.", 2, 2 & check.doValidate());
  }
View Full Code Here

    String outputPath = expectedUrl.getPath();
    File actualResults = new File(outputPath + "/PrintWriter_Actual.txt");
    File expectedResults = new File(outputPath + "/PrintWriter_Expected.txt");
    FileOutputStream outputStream = new FileOutputStream(actualResults);
    PrintWriter out = new PrintWriter(outputStream);
    EpubCheck check = new EpubCheck(epub, out);
    Assert.assertEquals("The file should have generated errors.", 2, 2 & check.doValidate());
    out.flush();
    outputStream.close();
    out.close();
    Assert.assertTrue("The resulting file doesn't exist.", actualResults.exists());
    Assert.assertTrue("The expected file doesn't exist.", expectedResults.exists());
View Full Code Here

    FileOutputStream outputStream = new FileOutputStream(actualResults);
    PrintWriter out = new PrintWriter(outputStream);

    FileInputStream epubStream = new FileInputStream(epub);
    Report report = new WriterReportImpl(out, "Testing 123");
    EpubCheck check = new EpubCheck(epubStream, report, epub.getPath());
    Assert.assertEquals("The file should have generated errors.", 2, 2 & check.doValidate());
    out.flush();
    outputStream.close();
    out.close();
    epubStream.close();
    Assert.assertTrue("The resulting file doesn't exist.", actualResults.exists());
View Full Code Here

    String inputPath = inputUrl.getPath();
    inputPath += "/blank.epub";
    ValidationReport report = new ValidationReport(inputPath);
    report.initialize();
    File inputEpub = new File(inputPath);
    EpubCheck check = new EpubCheck(inputEpub, report);
    Assert.assertEquals("The file should have generated warnings.", 6, check.doValidate());
    report.generate();
    List<MessageId> fatals = new ArrayList<MessageId>();
    fatals.add(MessageId.PKG_008);
    List<MessageId> errors = new ArrayList<MessageId>();
    errors.add(MessageId.PKG_003);
View Full Code Here

    String expectedOutputPath = inputPath + "/wrong_extension_expected_results.json";
    inputPath += "/wrong_extension.zip";
    CheckingReport report = new CheckingReport(inputPath, outputPath);
    report.initialize();
    File inputEpub = new File(inputPath);
    EpubCheck check = new EpubCheck(inputEpub, report);
    org.junit.Assert.assertEquals("The file should have generated warnings.", 1, check.doValidate());
    report.generate();
    File actualOutput = new File(outputPath);
    Assert.assertTrue("Output file is missing.", actualOutput.exists());
    File expectedOutput = new File(expectedOutputPath);
    Assert.assertTrue("Expected output file is missing.", expectedOutput.exists());
View Full Code Here

    String expectedOutputPath = inputPath + "/missing_file_expected_results.json";
    inputPath += "/no_existence.epub";
    CheckingReport report = new CheckingReport(inputPath, outputPath);
    report.initialize();
    File inputEpub = new File(inputPath);
    EpubCheck check = new EpubCheck(inputEpub, report);
    org.junit.Assert.assertEquals("The file should have generated warnings.", 2, check.doValidate());
    report.generate();
    File actualOutput = new File(outputPath);
    Assert.assertTrue("Output file is missing.", actualOutput.exists());
    File expectedOutput = new File(expectedOutputPath);
    Assert.assertTrue("Expected output file is missing.", expectedOutput.exists());
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

TOP

Related Classes of com.adobe.epubcheck.api.EpubCheck

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.