From 76f2ceb444ca4ebfa6a25ad31904ce4f191542df Mon Sep 17 00:00:00 2001 From: Carl Wilson Date: Thu, 23 Feb 2023 15:52:16 +0000 Subject: [PATCH 01/24] FEAT: Unit test fails for corpus files - used a collector rule in the unit test class to gather test failures from corpus files; - corpus failures now added via a collector check; and - added dependency for Hamcrest matchers. TODO: Filter expected failures from test assertions. --- pom.xml | 8 + .../org/verapdf/pdfa/qa/CorpusItemId.java | 2 +- .../java/org/verapdf/pdfa/qa/ResultSet.java | 376 +++++++++--------- .../verapdf/integration/tests/CorpusTest.java | 310 ++++++++------- 4 files changed, 367 insertions(+), 329 deletions(-) diff --git a/pom.xml b/pom.xml index 9c7a2db..7154740 100644 --- a/pom.xml +++ b/pom.xml @@ -141,6 +141,14 @@ 2.3.0.1 + + + org.hamcrest + hamcrest + 2.2 + test + + diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/CorpusItemId.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/CorpusItemId.java index c248a97..4dd5496 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/CorpusItemId.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/CorpusItemId.java @@ -83,7 +83,7 @@ public String getId() { return this.id; } - public final static TestType fromId(final String id) { + public static final TestType fromId(final String id) { for (TestType type : TestType.values()) { if (id.equalsIgnoreCase(type.id)) { return type; diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ResultSet.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ResultSet.java index e7e3141..13e513f 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ResultSet.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ResultSet.java @@ -38,219 +38,219 @@ */ @XmlJavaTypeAdapter(ResultSetImpl.Adapter.class) public interface ResultSet { - /** - * @return the {@link ResultSetDetails} for the instance - */ - public ResultSetDetails getDetails(); + /** + * @return the {@link ResultSetDetails} for the instance + */ + public ResultSetDetails getDetails(); - /** - * @return the {@link CorpusDetails} for the instance - */ - public CorpusDetails getCorpusDetails(); + /** + * @return the {@link CorpusDetails} for the instance + */ + public CorpusDetails getCorpusDetails(); - /** - * @return the {@link ValidationProfile} used to generate the result set - */ - public ValidationProfile getValidationProfile(); + /** + * @return the {@link ValidationProfile} used to generate the result set + */ + public ValidationProfile getValidationProfile(); - /** - * @return the {@link ResultSetSummary} for the result set - */ - public ResultSetSummary getSummary(); + /** + * @return the {@link ResultSetSummary} for the result set + */ + public ResultSetSummary getSummary(); - /** - * @return the {@code Set} of {@link Result}s - */ - public Set getResults(); + /** + * @return the {@code Set} of {@link Result}s + */ + public Set getResults(); - /** - * @return - */ - public Set getExceptions(); + /** + * @return + */ + public Set getExceptions(); - /** - * @author Carl Wilson - */ - public static final class Result { - private final CorpusItemId corpusItemId; - private final ValidationResult result; - private final AuditDuration duration; - private final long memoryUsed; + /** + * @author Carl Wilson + */ + public static final class Result { + private final CorpusItemId corpusItemId; + private final ValidationResult result; + private final AuditDuration duration; + private final long memoryUsed; - Result(final CorpusItemId corpusItemId, final ValidationResult result, final AuditDuration duration, - long memoryUsed) { - this.corpusItemId = corpusItemId; - this.result = result; - this.duration = duration; - this.memoryUsed = memoryUsed; - } + Result(final CorpusItemId corpusItemId, final ValidationResult result, final AuditDuration duration, + long memoryUsed) { + this.corpusItemId = corpusItemId; + this.result = result; + this.duration = duration; + this.memoryUsed = memoryUsed; + } - /** - * @return the corpusItem - */ - public CorpusItemId getCorpusItemId() { - return this.corpusItemId; - } + /** + * @return the corpusItem + */ + public CorpusItemId getCorpusItemId() { + return this.corpusItemId; + } - /** - * @return the result - */ - public ValidationResult getResult() { - return this.result; - } + /** + * @return the result + */ + public ValidationResult getResult() { + return this.result; + } - public boolean isExpectedResult() { - return this.corpusItemId.getExpectedResult() == this.result.isCompliant(); - } + public boolean isExpectedResult() { + return this.corpusItemId.getExpectedResult() == this.result.isCompliant(); + } - public String getTestType() { - if ((this.corpusItemId.getTestType() == TestType.PASS) - || (this.corpusItemId.getTestType() == TestType.FAIL)) { - return this.isExpectedResult() ? "pass" : "fail"; - } - return this.corpusItemId.getTestType().getId(); - } + public String getTestType() { + if ((this.corpusItemId.getTestType() == TestType.PASS) + || (this.corpusItemId.getTestType() == TestType.FAIL)) { + return this.isExpectedResult() ? "pass" : "fail"; + } + return this.corpusItemId.getTestType().getId(); + } - public String getCorpusItemName() { - return this.corpusItemId.getName(); - } + public String getCorpusItemName() { + return this.corpusItemId.getName(); + } - public String getDuration() { - return this.duration.getDuration(); - } + public String getDuration() { + return this.duration.getDuration(); + } - public long getMemoryUsed() { - return this.memoryUsed; - } + public long getMemoryUsed() { + return this.memoryUsed; + } - /** - * { @inheritDoc } - */ - @Override - public int hashCode() { - final int prime = 31; - int hashResult = 1; - hashResult = prime * hashResult + ((this.corpusItemId == null) ? 0 : this.corpusItemId.hashCode()); - hashResult = prime * hashResult + ((this.result == null) ? 0 : this.result.hashCode()); - return hashResult; - } + /** + * { @inheritDoc } + */ + @Override + public int hashCode() { + final int prime = 31; + int hashResult = 1; + hashResult = prime * hashResult + ((this.corpusItemId == null) ? 0 : this.corpusItemId.hashCode()); + hashResult = prime * hashResult + ((this.result == null) ? 0 : this.result.hashCode()); + return hashResult; + } - /** - * { @inheritDoc } - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Result other = (Result) obj; - if (this.corpusItemId == null) { - if (other.corpusItemId != null) - return false; - } else if (!this.corpusItemId.equals(other.corpusItemId)) - return false; - if (this.result == null) { - if (other.result != null) - return false; - } else if (!this.result.equals(other.result)) - return false; - return true; - } + /** + * { @inheritDoc } + */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Result other = (Result) obj; + if (this.corpusItemId == null) { + if (other.corpusItemId != null) + return false; + } else if (!this.corpusItemId.equals(other.corpusItemId)) + return false; + if (this.result == null) { + if (other.result != null) + return false; + } else if (!this.result.equals(other.result)) + return false; + return true; + } - /** - * { @inheritDoc } - */ - @Override - public String toString() { - return "Result [corpusItemid=" + this.corpusItemId + ", result=" + this.result + "]"; - } + /** + * { @inheritDoc } + */ + @Override + public String toString() { + return "Result [corpusItemid=" + this.corpusItemId + ", result=" + this.result + "]"; + } - } + } - /** - * @author Carl Wilson - */ - public static class Incomplete { - private final CorpusItemId corpusItemId; - private final Throwable cause; + /** + * @author Carl Wilson + */ + public static class Incomplete { + private final CorpusItemId corpusItemId; + private final Throwable cause; - /** - * @param corpusItem - * @param cause - */ - public Incomplete(final CorpusItemId corpusItemId, final Throwable cause) { - this.corpusItemId = corpusItemId; - this.cause = cause; - } + /** + * @param corpusItem + * @param cause + */ + public Incomplete(final CorpusItemId corpusItemId, final Throwable cause) { + this.corpusItemId = corpusItemId; + this.cause = cause; + } - /** - * @return the corpusItem - */ - public CorpusItemId getCorpusItemId() { - return this.corpusItemId; - } + /** + * @return the corpusItem + */ + public CorpusItemId getCorpusItemId() { + return this.corpusItemId; + } - /** - * @return the cause - */ - public Throwable getCause() { - return this.cause; - } + /** + * @return the cause + */ + public Throwable getCause() { + return this.cause; + } - /** - * { @inheritDoc } - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((this.cause == null) ? 0 : this.cause.hashCode()); - result = prime * result + ((this.corpusItemId == null) ? 0 : this.corpusItemId.hashCode()); - return result; - } + /** + * { @inheritDoc } + */ + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.cause == null) ? 0 : this.cause.hashCode()); + result = prime * result + ((this.corpusItemId == null) ? 0 : this.corpusItemId.hashCode()); + return result; + } - /** - * { @inheritDoc } - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Incomplete other = (Incomplete) obj; - if (this.cause == null) { - if (other.cause != null) - return false; - } else if (!this.cause.equals(other.cause)) - return false; - if (this.corpusItemId == null) { - if (other.corpusItemId != null) - return false; - } else if (!this.corpusItemId.equals(other.corpusItemId)) - return false; - return true; - } + /** + * { @inheritDoc } + */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Incomplete other = (Incomplete) obj; + if (this.cause == null) { + if (other.cause != null) + return false; + } else if (!this.cause.equals(other.cause)) + return false; + if (this.corpusItemId == null) { + if (other.corpusItemId != null) + return false; + } else if (!this.corpusItemId.equals(other.corpusItemId)) + return false; + return true; + } - /** - * { @inheritDoc } - */ - @Override - public String toString() { - return "Incomplete [corpusItemId=" + this.corpusItemId + ", cause=" + this.cause + "]"; - } - } + /** + * { @inheritDoc } + */ + @Override + public String toString() { + return "Incomplete [corpusItemId=" + this.corpusItemId + ", cause=" + this.cause + "]"; + } + } - public static class ResultComparator implements Comparator { - @Override - public int compare(Result firstResult, Result secondResult) { - return new CorpusItemIdComparator().compare(firstResult.getCorpusItemId(), secondResult.getCorpusItemId()); - } - } + public static class ResultComparator implements Comparator { + @Override + public int compare(Result firstResult, Result secondResult) { + return new CorpusItemIdComparator().compare(firstResult.getCorpusItemId(), secondResult.getCorpusItemId()); + } + } } diff --git a/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java b/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java index 205c6a2..e31f1b9 100644 --- a/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java +++ b/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java @@ -14,155 +14,185 @@ */ package org.verapdf.integration.tests; -import com.github.mustachejava.DefaultMustacheFactory; -import com.github.mustachejava.Mustache; -import com.github.mustachejava.MustacheFactory; +import static org.hamcrest.Matchers.equalTo; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.Writer; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.junit.AfterClass; import org.junit.BeforeClass; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.ErrorCollector; import org.verapdf.component.ComponentDetails; +import org.verapdf.gf.foundry.VeraGreenfieldFoundryProvider; import org.verapdf.pdfa.Foundries; import org.verapdf.pdfa.PDFAValidator; -import org.verapdf.pdfbox.foundry.PdfBoxFoundryProvider; -import org.verapdf.gf.foundry.VeraGreenfieldFoundryProvider; import org.verapdf.pdfa.flavours.PDFAFlavour; -import org.verapdf.pdfa.qa.*; - -import java.io.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import org.verapdf.pdfa.qa.CorpusManager; +import org.verapdf.pdfa.qa.ResultSet; +import org.verapdf.pdfa.qa.ResultSetDetailsImpl; +import org.verapdf.pdfa.qa.ResultSetImpl; +import org.verapdf.pdfa.qa.TestCorpus; +import org.verapdf.pdfbox.foundry.PdfBoxFoundryProvider; -import static org.junit.Assert.assertFalse; +import com.github.mustachejava.DefaultMustacheFactory; +import com.github.mustachejava.Mustache; +import com.github.mustachejava.MustacheFactory; @SuppressWarnings({ "javadoc" }) public class CorpusTest { - private static ComponentDetails gfDetails; - private static ComponentDetails pdfBoxDetails; - private static final List gfResults = new ArrayList<>(); - private static final List pdfBoxResults = new ArrayList<>(); - private static final MustacheFactory MF = new DefaultMustacheFactory("org/verapdf/integration/templates"); - private static final Mustache RESULTS_MUSTACHE = MF.compile("corpus-results.mustache"); - private static final Mustache SUMMARY_MUSTACHE = MF.compile("test-summary.mustache"); - - @BeforeClass - public static final void SetUp() throws IOException { - try { - CorpusManager.initialise(); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - throw e; - } - } - - @AfterClass - public static void outputResults() throws IOException { - writeResults(); - } - - @Test - public void testPdfBox() { - PdfBoxFoundryProvider.initialise(); - pdfBoxDetails = Foundries.defaultInstance().getDetails(); - testCorpora(pdfBoxResults); - assertFalse(countExceptions(pdfBoxResults) > 0); - } - - @Test - public void testGreenfield() { - VeraGreenfieldFoundryProvider.initialise(); - gfDetails = Foundries.defaultInstance().getDetails(); - testCorpora(gfResults); - assertFalse(countExceptions(gfResults) > 0); - } - - private static int countExceptions(final List resultSets) { - int exceptionCount = 0; - for (ResultSet set : resultSets) { - exceptionCount += set.getExceptions().size(); - } - return exceptionCount; - } - - private static void testCorpora(final List resultSets) { - for (PDFAFlavour flavour : CorpusManager.testableFlavours()) { - for (TestCorpus corpus : CorpusManager.corporaForFlavour(flavour)) { - if (flavour != PDFAFlavour.NO_FLAVOUR) { - try (PDFAValidator validator = Foundries.defaultInstance().createValidator(flavour, false)) { - ResultSet results = ResultSetImpl.validateCorpus(corpus, validator); - resultSets.add(results); - } catch (IOException excep) { - // Just exception closing validator - excep.printStackTrace(); - } - } else { - ResultSet results = ResultSetImpl.validateCorpus(corpus); - resultSets.add(results); - } - } - } - } - - /** - * Tests the passed String {@code parseForMatches} and returns true if - * {@link PDFAFlavour#fromString(String)} returns one of the flavours in - * {@code filters}. - * - * @param parseForMatches - * string to test for flavour matches - * @param filters - * {@code List} of {@link PDFAFlavour}s to test against for - * matches - * @return true of {@code PDFAFlavour} parsed from {@code parseForMatches} - * is contained in {@code filters}. - */ - @SuppressWarnings("unused") - private static boolean matchesFlavourFilter(final String parseForMatches, final List filters) { - PDFAFlavour flavour = PDFAFlavour.fromString(parseForMatches); - return filters.contains(flavour); - } - - private static void writeResults() throws IOException { - File rootDir = new File("target/test-results"); - if (!rootDir.exists()) - rootDir.mkdirs(); - writeSummaries(rootDir); - int index = 0; - for (ResultSet pdfBoxResult : pdfBoxResults) { - ResultSet gfResult = gfResults.get(index++); - Map scopes = new HashMap<>(); - scopes.put("pdfBoxResult", pdfBoxResult); - scopes.put("gfResult", gfResult); - if (rootDir.isDirectory() && rootDir.canWrite()) { - String dirName = pdfBoxResult.getCorpusDetails().getName() + "-" - + pdfBoxResult.getValidationProfile().getPDFAFlavour().getId(); - outputResultsToFile(scopes, new File(rootDir, dirName)); - } else { - RESULTS_MUSTACHE.execute(new PrintWriter(System.out), scopes).flush(); - } - } - } - - private static void writeSummaries(final File outputDir) throws FileNotFoundException, IOException { - Map scopes = new HashMap<>(); - scopes.put("pdfBoxDetails", ResultSetDetailsImpl.getNewInstance(pdfBoxDetails)); - scopes.put("gfDetails", ResultSetDetailsImpl.getNewInstance(gfDetails)); - scopes.put("pdfBoxResults", pdfBoxResults); - scopes.put("gfResults", gfResults); - try (Writer writer = new PrintWriter(new File(outputDir, "index.html"))) { - SUMMARY_MUSTACHE.execute(writer, scopes); - } - } - - private static void outputResultsToFile(Map scopes, final File outputDir) - throws FileNotFoundException, IOException { - if (!outputDir.exists()) { - outputDir.mkdirs(); - } - try (Writer writer = new PrintWriter(new File(outputDir, "index.html"))) { - RESULTS_MUSTACHE.execute(writer, scopes).flush(); - } - } + private static ComponentDetails gfDetails; + private static ComponentDetails pdfBoxDetails; + private static final List gfResults = new ArrayList<>(); + private static final List pdfBoxResults = new ArrayList<>(); + private static final MustacheFactory MF = new DefaultMustacheFactory("org/verapdf/integration/templates"); + private static final Mustache RESULTS_MUSTACHE = MF.compile("corpus-results.mustache"); + private static final Mustache SUMMARY_MUSTACHE = MF.compile("test-summary.mustache"); + + @BeforeClass + public static final void SetUp() throws IOException { + try { + CorpusManager.initialise(); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @AfterClass + public static void outputResults() throws IOException { + writeResults(); + } + + @Rule + public ErrorCollector collector = new ErrorCollector(); + + @Test + public void testPdfBox() { + PdfBoxFoundryProvider.initialise(); + pdfBoxDetails = Foundries.defaultInstance().getDetails(); + testCorpora(pdfBoxResults); + for (ResultSet set : pdfBoxResults) { + testResults(set); + } + collector.checkThat("Exceptions thrown during PDF Box testing.", countExceptions(pdfBoxResults), equalTo(0)); + } + + @Test + public void testGreenfield() { + VeraGreenfieldFoundryProvider.initialise(); + gfDetails = Foundries.defaultInstance().getDetails(); + testCorpora(gfResults); + for (ResultSet set : gfResults) { + testResults(set); + } + collector.checkThat("Exceptions thrown during greenfield testing.", countExceptions(gfResults), equalTo(0)); + } + + private static int countExceptions(final List resultSets) { + int exceptionCount = 0; + for (ResultSet set : resultSets) { + exceptionCount += set.getExceptions().size(); + } + return exceptionCount; + } + + private static void testCorpora(final List resultSets) { + for (PDFAFlavour flavour : CorpusManager.testableFlavours()) { + for (TestCorpus corpus : CorpusManager.corporaForFlavour(flavour)) { + if (flavour != PDFAFlavour.NO_FLAVOUR) { + try (PDFAValidator validator = Foundries.defaultInstance().createValidator(flavour, false)) { + ResultSet results = ResultSetImpl.validateCorpus(corpus, validator); + resultSets.add(results); + } catch (IOException excep) { + // Just exception closing validator + excep.printStackTrace(); + } + } else { + ResultSet results = ResultSetImpl.validateCorpus(corpus); + resultSets.add(results); + } + } + } + } + + private void testResults(final ResultSet results) { + for (ResultSet.Result result : results.getResults()) { + collector + .checkThat( + String.format("Unexpected result for corpus %s, item %s", + results.getCorpusDetails().getName(), result.getCorpusItemName()), + result.isExpectedResult(), equalTo(true)); + } + } + + /** + * Tests the passed String {@code parseForMatches} and returns true if + * {@link PDFAFlavour#fromString(String)} returns one of the flavours in + * {@code filters}. + * + * @param parseForMatches + * string to test for flavour matches + * @param filters + * {@code List} of {@link PDFAFlavour}s to test against + * for + * matches + * @return true of {@code PDFAFlavour} parsed from {@code parseForMatches} + * is contained in {@code filters}. + */ + @SuppressWarnings("unused") + private static boolean matchesFlavourFilter(final String parseForMatches, final List filters) { + PDFAFlavour flavour = PDFAFlavour.fromString(parseForMatches); + return filters.contains(flavour); + } + + private static void writeResults() throws IOException { + File rootDir = new File("target/test-results"); + if (!rootDir.exists()) + rootDir.mkdirs(); + writeSummaries(rootDir); + int index = 0; + for (ResultSet pdfBoxResult : pdfBoxResults) { + ResultSet gfResult = gfResults.get(index++); + Map scopes = new HashMap<>(); + scopes.put("pdfBoxResult", pdfBoxResult); + scopes.put("gfResult", gfResult); + if (rootDir.isDirectory() && rootDir.canWrite()) { + String dirName = pdfBoxResult.getCorpusDetails().getName() + "-" + + pdfBoxResult.getValidationProfile().getPDFAFlavour().getId(); + outputResultsToFile(scopes, new File(rootDir, dirName)); + } else { + RESULTS_MUSTACHE.execute(new PrintWriter(System.out), scopes).flush(); + } + } + } + + private static void writeSummaries(final File outputDir) throws FileNotFoundException, IOException { + Map scopes = new HashMap<>(); + scopes.put("pdfBoxDetails", ResultSetDetailsImpl.getNewInstance(pdfBoxDetails)); + scopes.put("gfDetails", ResultSetDetailsImpl.getNewInstance(gfDetails)); + scopes.put("pdfBoxResults", pdfBoxResults); + scopes.put("gfResults", gfResults); + try (Writer writer = new PrintWriter(new File(outputDir, "index.html"))) { + SUMMARY_MUSTACHE.execute(writer, scopes); + } + } + + private static void outputResultsToFile(Map scopes, final File outputDir) + throws FileNotFoundException, IOException { + if (!outputDir.exists()) { + outputDir.mkdirs(); + } + try (Writer writer = new PrintWriter(new File(outputDir, "index.html"))) { + RESULTS_MUSTACHE.execute(writer, scopes).flush(); + } + } } From 0ff2140e145d6fc580588757e0284005188359b2 Mon Sep 17 00:00:00 2001 From: irinamavrina Date: Tue, 2 May 2023 16:01:44 +0300 Subject: [PATCH 02/24] Add workflow for updating jakarta branch --- .github/workflows/update-jakarta-workflow.yml | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 .github/workflows/update-jakarta-workflow.yml diff --git a/.github/workflows/update-jakarta-workflow.yml b/.github/workflows/update-jakarta-workflow.yml new file mode 100644 index 0000000..fb87747 --- /dev/null +++ b/.github/workflows/update-jakarta-workflow.yml @@ -0,0 +1,90 @@ +name: Update jakarta branch + +on: + push: + branches: + - integration + +jobs: + checkout-and-build: + runs-on: ubuntu-latest + + strategy: + matrix: + java-version: [11, 16, 17] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: integration + - name: JDK setup + uses: actions/setup-java@v3 + with: + java-version: ${{ matrix.java-version }} + distribution: 'temurin' + cache: maven + - name: Fetch jakarta branch and checkout + run: | + git fetch origin jakarta:jakarta + git checkout -b test-branch jakarta + - name: Configure user name + run: | + git config user.name "Git User" + git config user.email "user@test.com" + - name: Add commit to the test branch + run: git cherry-pick -m 1 ${{ github.sha }} + - name: Build project with Maven + if: success() + run: mvn --batch-mode --update-snapshots verify + + merge: + runs-on: ubuntu-latest + needs: checkout-and-build + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: integration + - name: Generate new branch name + id: new-branch-name + run: echo "branch_name=new-branch-$(date +%s)" >> "$GITHUB_OUTPUT" + - name: Fetch jakarta branch and checkout + run: | + git fetch origin jakarta:jakarta + git checkout -b ${{ steps.new-branch-name.outputs.branch_name }} jakarta + - name: Configure user name + run: | + git config user.name "Git User" + git config user.email "user@temp.com" + - name: Add commit to new branch + run: git cherry-pick -m 1 ${{ github.sha }} + - name: Merge branch into jakarta + if: success() + run: | + git push origin ${{ steps.new-branch-name.outputs.branch_name }} + git checkout jakarta + git merge ${{ steps.new-branch-name.outputs.branch_name }} + git push origin jakarta + - name: Delete new branch + run: git push origin --delete ${{ steps.new-branch-name.outputs.branch_name }} + + send-notification: + runs-on: ubuntu-latest + needs: [checkout-and-build, merge] + if: | + always() && + (contains(needs.*.result, 'failure') || + contains(needs.*.result, 'skipped') || + contains(needs.*.result, 'cancelled')) + steps: + - name: Send notification if build or merge failed + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }} + uses: voxmedia/github-action-slack-notify-build@v1 + with: + channel_id: C03E3JJGLQL + status: FAILED + color: danger From 891f27ed9718a1306239664c0659d40f69446551 Mon Sep 17 00:00:00 2001 From: MaximPlusov Date: Fri, 23 Jun 2023 17:31:35 +0300 Subject: [PATCH 03/24] DEV: v1.25 - bumped version -> 1.25 - updated maven dependency - updated readme --- README.md | 2 +- pom.xml | 10 +++++----- veraPDF-integration/pom.xml | 2 +- veraPDF-pdf-regression-tests/pom.xml | 2 +- veraPDF-wcag-regression-tests/pom.xml | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 17137ff..008b43f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ veraPDF-integration-tests ========================= -[![Build Status](https://jenkins.openpreservation.org/job/veraPDF/job/1.23/job/integration-tests/badge/icon)](https://jenkins.openpreservation.org/job/veraPDF/job/1.23/job/integration-tests/ "OPF Jenkins") +[![Build Status](https://jenkins.openpreservation.org/job/veraPDF/job/1.25/job/integration-tests/badge/icon)](https://jenkins.openpreservation.org/job/veraPDF/job/1.25/job/integration-tests/ "OPF Jenkins") [![CodeCov Coverage](https://img.shields.io/codecov/c/github/veraPDF/veraPDF-integration-tests.svg)](https://codecov.io/gh/veraPDF/veraPDF-integration-tests/ "CodeCov coverage") [![Codacy Badge](https://app.codacy.com/project/badge/Grade/8d54ee7467f14bf5844b91081981f6ee)](https://app.codacy.com/gh/veraPDF/veraPDF-integration-tests/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade "Codacy coverage") diff --git a/pom.xml b/pom.xml index 9c7a2db..810f3db 100644 --- a/pom.xml +++ b/pom.xml @@ -27,11 +27,11 @@ verapdf-parent org.verapdf - 1.23.1 + 1.25.1 verapdf-integration-tests - 1.23.0-SNAPSHOT + 1.25.0-SNAPSHOT pom veraPDF Quality Assurance @@ -72,9 +72,9 @@ 0.8.1 - [1.23.0,1.24.0-RC) - [1.23.0,1.24.0-RC) - [1.23.0,1.24.0-RC) + [1.25.0,1.26.0-RC) + [1.25.0,1.26.0-RC) + [1.25.0,1.26.0-RC) 1.67 diff --git a/veraPDF-integration/pom.xml b/veraPDF-integration/pom.xml index 498f488..117b1ac 100644 --- a/veraPDF-integration/pom.xml +++ b/veraPDF-integration/pom.xml @@ -28,7 +28,7 @@ verapdf-integration-tests org.verapdf - 1.23.0-SNAPSHOT + 1.25.0-SNAPSHOT veraPDF-integration diff --git a/veraPDF-pdf-regression-tests/pom.xml b/veraPDF-pdf-regression-tests/pom.xml index 7f1bd11..b1df6f3 100644 --- a/veraPDF-pdf-regression-tests/pom.xml +++ b/veraPDF-pdf-regression-tests/pom.xml @@ -26,7 +26,7 @@ verapdf-integration-tests org.verapdf - 1.23.0-SNAPSHOT + 1.25.0-SNAPSHOT 4.0.0 diff --git a/veraPDF-wcag-regression-tests/pom.xml b/veraPDF-wcag-regression-tests/pom.xml index bf88bac..091ae96 100644 --- a/veraPDF-wcag-regression-tests/pom.xml +++ b/veraPDF-wcag-regression-tests/pom.xml @@ -26,12 +26,12 @@ verapdf-integration-tests org.verapdf - 1.23.0-SNAPSHOT + 1.25.0-SNAPSHOT 4.0.0 veraPDF-wcag-regression-tests - 1.23.0-SNAPSHOT + 1.25.0-SNAPSHOT veraPDF WCAG Regression Tests From 5d52465f6a85bb9e2c0d0a78a7f6f7179f7054fa Mon Sep 17 00:00:00 2001 From: MaximPlusov Date: Fri, 23 Jun 2023 20:25:38 +0300 Subject: [PATCH 04/24] Add workflow for updating arlington branch --- .../workflows/update-arlington-workflow.yml | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 .github/workflows/update-arlington-workflow.yml diff --git a/.github/workflows/update-arlington-workflow.yml b/.github/workflows/update-arlington-workflow.yml new file mode 100644 index 0000000..e812c8e --- /dev/null +++ b/.github/workflows/update-arlington-workflow.yml @@ -0,0 +1,90 @@ +name: Update arlington branch + +on: + push: + branches: + - integration + +jobs: + checkout-and-build: + runs-on: ubuntu-latest + + strategy: + matrix: + java-version: [11, 16, 17] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: integration + - name: JDK setup + uses: actions/setup-java@v3 + with: + java-version: ${{ matrix.java-version }} + distribution: 'temurin' + cache: maven + - name: Fetch arlington branch and checkout + run: | + git fetch origin arlington:arlington + git checkout -b test-branch arlington + - name: Configure user nameF + run: | + git config user.name "Git User" + git config user.email "user@test.com" + - name: Add commit to the test branch + run: git cherry-pick -m 1 ${{ github.sha }} + - name: Build project with Maven + if: success() + run: mvn --batch-mode --update-snapshots verify + + merge: + runs-on: ubuntu-latest + needs: checkout-and-build + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: integration + - name: Generate new branch name + id: new-branch-name + run: echo "branch_name=new-branch-$(date +%s)" >> "$GITHUB_OUTPUT" + - name: Fetch arlington branch and checkout + run: | + git fetch origin arlington:arlington + git checkout -b ${{ steps.new-branch-name.outputs.branch_name }} arlington + - name: Configure user name + run: | + git config user.name "Git User" + git config user.email "user@temp.com" + - name: Add commit to new branch + run: git cherry-pick -m 1 ${{ github.sha }} + - name: Merge branch into arlington + if: success() + run: | + git push origin ${{ steps.new-branch-name.outputs.branch_name }} + git checkout arlington + git merge ${{ steps.new-branch-name.outputs.branch_name }} + git push origin arlington + - name: Delete new branch + run: git push origin --delete ${{ steps.new-branch-name.outputs.branch_name }} + + send-notification: + runs-on: ubuntu-latest + needs: [checkout-and-build, merge] + if: | + always() && + (contains(needs.*.result, 'failure') || + contains(needs.*.result, 'skipped') || + contains(needs.*.result, 'cancelled')) + steps: + - name: Send notification if build or merge failed + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }} + uses: voxmedia/github-action-slack-notify-build@v1 + with: + channel_id: C03E3JJGLQL + status: FAILED + color: danger From 53152ae736d50ccef36a8f5e3e14a09517a40cb2 Mon Sep 17 00:00:00 2001 From: Carl Wilson Date: Fri, 14 Jul 2023 14:14:04 +0100 Subject: [PATCH 05/24] FIX: Minor formatting bugs: - added "catch-all" tests for the correct foundries to CorpusTest class; - better heading for results page; - fixed the display of profile ID on the results pages; and - fixed minor compiler warnings. --- .../test/java/org/verapdf/integration/tests/CorpusTest.java | 5 +++++ .../pdfa/validation/validators/test/ValidatorTest.java | 2 +- .../verapdf/integration/templates/corpus-results.mustache | 3 +-- .../org/verapdf/integration/templates/test-summary.mustache | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java b/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java index e31f1b9..1e1f3b0 100644 --- a/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java +++ b/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java @@ -15,6 +15,8 @@ package org.verapdf.integration.tests; import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.io.File; import java.io.FileNotFoundException; @@ -78,6 +80,7 @@ public static void outputResults() throws IOException { @Test public void testPdfBox() { PdfBoxFoundryProvider.initialise(); + assertTrue(Foundries.defaultParserIsPDFBox()); pdfBoxDetails = Foundries.defaultInstance().getDetails(); testCorpora(pdfBoxResults); for (ResultSet set : pdfBoxResults) { @@ -89,6 +92,7 @@ public void testPdfBox() { @Test public void testGreenfield() { VeraGreenfieldFoundryProvider.initialise(); + assertFalse(Foundries.defaultParserIsPDFBox()); gfDetails = Foundries.defaultInstance().getDetails(); testCorpora(gfResults); for (ResultSet set : gfResults) { @@ -165,6 +169,7 @@ private static void writeResults() throws IOException { Map scopes = new HashMap<>(); scopes.put("pdfBoxResult", pdfBoxResult); scopes.put("gfResult", gfResult); + scopes.put("profile", pdfBoxResult.getValidationProfile().getPDFAFlavour().getId()); if (rootDir.isDirectory() && rootDir.canWrite()) { String dirName = pdfBoxResult.getCorpusDetails().getName() + "-" + pdfBoxResult.getValidationProfile().getPDFAFlavour().getId(); diff --git a/veraPDF-integration/src/test/java/org/verapdf/pdfa/validation/validators/test/ValidatorTest.java b/veraPDF-integration/src/test/java/org/verapdf/pdfa/validation/validators/test/ValidatorTest.java index 2e7afae..37656a7 100644 --- a/veraPDF-integration/src/test/java/org/verapdf/pdfa/validation/validators/test/ValidatorTest.java +++ b/veraPDF-integration/src/test/java/org/verapdf/pdfa/validation/validators/test/ValidatorTest.java @@ -75,7 +75,7 @@ public static final void SetUp() { public final void testGetProfile() { for (ValidationProfile profile : PROFILES.getValidationProfiles()) { PDFAValidator validator = Foundries.defaultInstance().createValidator(profile, false); - assertTrue(profile.equals(validator.getProfile())); + assertEquals(validator.getProfile(), profile); } } diff --git a/veraPDF-integration/src/test/resources/org/verapdf/integration/templates/corpus-results.mustache b/veraPDF-integration/src/test/resources/org/verapdf/integration/templates/corpus-results.mustache index bd3d52f..137b14c 100644 --- a/veraPDF-integration/src/test/resources/org/verapdf/integration/templates/corpus-results.mustache +++ b/veraPDF-integration/src/test/resources/org/verapdf/integration/templates/corpus-results.mustache @@ -36,8 +36,7 @@
-

veraPDF Corpus Test Results : {{pdfBoxResult.details.dateCreated}}

-

{{pdfBoxResult.corpusDetails.name}} - {{pdfBoxResult.valdiationProfile.details.name}}

+

{{pdfBoxResult.corpusDetails.name}}-{{profile}} Corpus Results : {{pdfBoxResult.details.dateCreated}}

diff --git a/veraPDF-integration/src/test/resources/org/verapdf/integration/templates/test-summary.mustache b/veraPDF-integration/src/test/resources/org/verapdf/integration/templates/test-summary.mustache index 3abc07a..cdd1715 100644 --- a/veraPDF-integration/src/test/resources/org/verapdf/integration/templates/test-summary.mustache +++ b/veraPDF-integration/src/test/resources/org/verapdf/integration/templates/test-summary.mustache @@ -30,7 +30,7 @@
-

verPDF Integration Corpus Tests : {{pdfBoxDetails.dateCreated}}

+

verPDF Corpus Integration Tests : {{pdfBoxDetails.dateCreated}}

From 5dfbb13b753b6c20d3f38a70678a0c299d02015f Mon Sep 17 00:00:00 2001 From: Carl Wilson Date: Sat, 15 Jul 2023 14:10:15 +0100 Subject: [PATCH 06/24] FEAT: Atomic unit failure for integration tests - added integration test failures as unit tests and exclusion files (as resources) to define the expected failures; - added 2x resource files that describe current failures; - added `snakeyaml` to `pom.xml` for test file exclusion parsing; - updated `bouncy-castle` to `1.70`; and - added `.vscode` folder to `.gitignore`. --- .gitignore | 3 + pom.xml | 8 +- .../verapdf/pdfa/qa/AbstractTestCorpus.java | 442 +++++++++--------- .../org/verapdf/pdfa/qa/CorpusManager.java | 74 +-- .../java/org/verapdf/pdfa/qa/ResultSet.java | 15 +- .../org/verapdf/pdfa/qa/ResultSetImpl.java | 17 +- .../verapdf/integration/tests/CorpusTest.java | 74 ++- .../integration/tests/rules/corpus-gf.yml | 44 ++ .../integration/tests/rules/corpus-pdfbox.yml | 260 +++++++++++ 9 files changed, 664 insertions(+), 273 deletions(-) create mode 100644 veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-gf.yml create mode 100644 veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml diff --git a/.gitignore b/.gitignore index 19940c7..2b18cdc 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,6 @@ hs_err_pid* **/pom.xml.versionsBackup /target/ /bin/ + +# VS Code +.vscode diff --git a/pom.xml b/pom.xml index 05f7ee3..9ffc464 100644 --- a/pom.xml +++ b/pom.xml @@ -75,7 +75,7 @@ [1.25.0,1.26.0-RC) [1.25.0,1.26.0-RC) [1.25.0,1.26.0-RC) - 1.67 + 1.70 @@ -149,6 +149,12 @@ test + + org.yaml + snakeyaml + 2.0 + + diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java index 6e18412..e6d2ffe 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java @@ -41,223 +41,227 @@ */ @XmlRootElement(namespace = "http://www.verapdf.org/corpus", name = "corpus") public abstract class AbstractTestCorpus implements TestCorpus { - private static final String veraUrl = "https://github.com/veraPDF/veraPDF-corpus/archive/staging.zip"; - private static final String isartorUrl = "https://corpora.openpreservation.org/veraPDF/isartor-pdfa-2008-08-13.zip"; - private static final String bfoUrl = "https://github.com/bfosupport/pdfa-testsuite/archive/master.zip"; - - @XmlElement(name = "details") - private final CorpusDetails details; - @XmlElementWrapper - @XmlElement(name = "item") - private final Map itemMap; - protected final Corpus type; - - protected AbstractTestCorpus(final CorpusDetails details, final Corpus type, final Map itemMap) { - this.details = details; - this.type = type; - this.itemMap = new HashMap<>(itemMap); - } - - @Override - public Corpus getType() { - return this.type; - } - - /** - * { @inheritDoc } - */ - @Override - public CorpusDetails getDetails() { - return this.details; - } - - /** - * { @inheritDoc } - */ - @Override - public int getItemCount() { - return this.itemMap.size(); - } - - /** - * { @inheritDoc } - */ - @Override - public Set getItemNames() { - return Collections.unmodifiableSet(this.itemMap.keySet()); - } - - /** - * { @inheritDoc } - */ - @Override - public Set getItemNamesForFlavour(PDFAFlavour flavour) { - // TODO Look at implementing filtering by flavour - return Collections.unmodifiableSet(this.itemMap.keySet()); - } - - /** - * { @inheritDoc } - */ - @Override - public InputStream getItemStream(String itemName) throws IOException { - if (!this.itemMap.containsKey(itemName)) - throw new IOException("No element found for name=" + itemName); - return getStreamFromReference(this.itemMap.get(itemName)); - } - - abstract protected InputStream getStreamFromReference(final L reference) throws IOException; - - /** - * { @inheritDoc } - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((this.details == null) ? 0 : this.details.hashCode()); - result = prime * result + ((this.getItemNames() == null) ? 0 : this.getItemNames().hashCode()); - return result; - } - - /** - * { @inheritDoc } - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (!(obj instanceof TestCorpus)) - return false; - TestCorpus other = (TestCorpus) obj; - if (this.details == null) { - if (other.getDetails() != null) - return false; - } else if (!this.details.equals(other.getDetails())) - return false; - if (this.getItemNames() == null) { - if (other.getItemNames() != null) - return false; - } else if (!this.getItemNames().equals(other.getItemNames())) - return false; - return true; - } - - public static enum Corpus { - VERA("veraPDF", - EnumSet.of(PDFAFlavour.PDFA_1_A, PDFAFlavour.PDFA_1_B, PDFAFlavour.PDFA_2_A, PDFAFlavour.PDFA_2_B, PDFAFlavour.PDFA_2_U, - PDFAFlavour.PDFA_3_B, PDFAFlavour.PDFA_4, PDFAFlavour.PDFA_4_F, PDFAFlavour.PDFA_4_E, - PDFAFlavour.PDFUA_1), - URI.create(veraUrl), "veraCorp-"), - ISARTOR("Isartor", EnumSet.of(PDFAFlavour.PDFA_1_B), URI.create(isartorUrl), "isartCorp-"), - BFO("BFO", EnumSet.of(PDFAFlavour.PDFA_2_B), URI.create(bfoUrl), "bfoCorp-"), - TWG("TWG", EnumSet.of(PDFAFlavour.NO_FLAVOUR), VERA.getZipFile().toURI(), "twgCorp-"); - private static final String desc = "Synthetic test files for PDF/A validation."; - - private final String id; - private final EnumSet flavours; - private final File zipFile; - - private Corpus(final String id, final EnumSet flavours, final URI downloadUri, - final String prefix) { - this.id = id; - this.flavours = EnumSet.copyOf(flavours); - try { - this.zipFile = createTempFileFromCorpus(downloadUri.toURL(), prefix); - } catch (IOException excep) { - throw new IllegalStateException(excep); - } - } - - private Corpus(final String id, final EnumSet flavours, final String name) { - this.id = id; - this.flavours = EnumSet.copyOf(flavours); - this.zipFile = new File(name); - } - - - public String getId() { - return this.id; - } - - @SuppressWarnings("static-method") - public String getDescription() { - return desc; - } - - public File getZipFile() { - return this.zipFile; - } - - public EnumSet getFlavours() { - return this.flavours; - } - } - - public static File createTempFileFromCorpus(final URL downloadLoc, final String prefix) throws IOException { - File tempFile = File.createTempFile(prefix, ".zip"); - System.out.println("Downloading: " + downloadLoc + ", to temp:" + tempFile); - int totalBytes = 0; - try (OutputStream output = new FileOutputStream(tempFile); - InputStream corpusInput = handleRedirects(downloadLoc);) { - byte[] buffer = new byte[8 * 1024]; - int bytesRead; - while ((bytesRead = corpusInput.read(buffer)) != -1) { - output.write(buffer, 0, bytesRead); - totalBytes += bytesRead; - } - } - System.out.println("Downloaded: " + totalBytes + " bytes"); - tempFile.deleteOnExit(); - return tempFile; - } - - static InputStream handleRedirects(URL url) throws IOException { - if (!url.getProtocol().startsWith("http")) { - return url.openStream(); - } - System.err.println("Prot:" + url.getProtocol()); - URL resourceUrl; - URL base; - URL next; - Map visited; - HttpURLConnection conn; - String location; - String urlString = url.toExternalForm(); - int times; - - visited = new HashMap<>(); - - while (true) { - times = visited.compute(urlString, (key, count) -> count == null ? 1 : count + 1); - - if (times > 3) - throw new IOException("Stuck in redirect loop"); - - resourceUrl = new URL(urlString); - conn = (HttpURLConnection) resourceUrl.openConnection(); - - conn.setConnectTimeout(15000); - conn.setReadTimeout(15000); - conn.setInstanceFollowRedirects(false); // Make the logic below easier to detect redirections - conn.setRequestProperty("User-Agent", "Mozilla/5.0..."); - - switch (conn.getResponseCode()) { - case HttpURLConnection.HTTP_MOVED_PERM: - case HttpURLConnection.HTTP_MOVED_TEMP: - location = conn.getHeaderField("Location"); - location = URLDecoder.decode(location, "UTF-8"); - base = new URL(urlString); - next = new URL(base, location); // Deal with relative URLs - urlString = next.toExternalForm(); - continue; - } - - break; - } - - return conn.getInputStream(); - } + private static final String veraUrl = "https://github.com/veraPDF/veraPDF-corpus/archive/staging.zip"; + private static final String isartorUrl = "https://corpora.openpreservation.org/veraPDF/isartor-pdfa-2008-08-13.zip"; + private static final String bfoUrl = "https://github.com/bfosupport/pdfa-testsuite/archive/master.zip"; + + @XmlElement(name = "details") + private final CorpusDetails details; + @XmlElementWrapper + @XmlElement(name = "item") + private final Map itemMap; + protected final Corpus type; + + protected AbstractTestCorpus(final CorpusDetails details, final Corpus type, final Map itemMap) { + this.details = details; + this.type = type; + this.itemMap = new HashMap<>(itemMap); + } + + @Override + public Corpus getType() { + return this.type; + } + + /** + * { @inheritDoc } + */ + @Override + public CorpusDetails getDetails() { + return this.details; + } + + /** + * { @inheritDoc } + */ + @Override + public int getItemCount() { + return this.itemMap.size(); + } + + /** + * { @inheritDoc } + */ + @Override + public Set getItemNames() { + return Collections.unmodifiableSet(this.itemMap.keySet()); + } + + /** + * { @inheritDoc } + */ + @Override + public Set getItemNamesForFlavour(PDFAFlavour flavour) { + // TODO Look at implementing filtering by flavour + return Collections.unmodifiableSet(this.itemMap.keySet()); + } + + /** + * { @inheritDoc } + */ + @Override + public InputStream getItemStream(String itemName) throws IOException { + if (!this.itemMap.containsKey(itemName)) + throw new IOException("No element found for name=" + itemName); + return getStreamFromReference(this.itemMap.get(itemName)); + } + + abstract protected InputStream getStreamFromReference(final L reference) throws IOException; + + /** + * { @inheritDoc } + */ + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.details == null) ? 0 : this.details.hashCode()); + result = prime * result + ((this.getItemNames() == null) ? 0 : this.getItemNames().hashCode()); + return result; + } + + /** + * { @inheritDoc } + */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof TestCorpus)) + return false; + TestCorpus other = (TestCorpus) obj; + if (this.details == null) { + if (other.getDetails() != null) + return false; + } else if (!this.details.equals(other.getDetails())) + return false; + if (this.getItemNames() == null) { + if (other.getItemNames() != null) + return false; + } else if (!this.getItemNames().equals(other.getItemNames())) + return false; + return true; + } + + public static enum Corpus { + VERA("veraPDF", + EnumSet.of(PDFAFlavour.PDFA_1_A, PDFAFlavour.PDFA_1_B, PDFAFlavour.PDFA_2_A, PDFAFlavour.PDFA_2_B, + PDFAFlavour.PDFA_2_U, + PDFAFlavour.PDFA_3_B, PDFAFlavour.PDFA_4, PDFAFlavour.PDFA_4_F, PDFAFlavour.PDFA_4_E, + PDFAFlavour.PDFUA_1), + URI.create(veraUrl), "veraCorp-"), + ISARTOR("Isartor", EnumSet.of(PDFAFlavour.PDFA_1_B), URI.create(isartorUrl), "isartCorp-"), + BFO("BFO", EnumSet.of(PDFAFlavour.PDFA_2_B), URI.create(bfoUrl), "bfoCorp-"), + TWG("TWG", EnumSet.of(PDFAFlavour.NO_FLAVOUR), VERA.getZipFile().toURI(), "twgCorp-"); + + private static final String desc = "Synthetic test files for PDF/A validation."; + private static final Map ID_LOOKUP = new HashMap<>(); + static { + for (Corpus corpus : Corpus.values()) { + ID_LOOKUP.put(corpus.id, corpus); + } + } + + private final String id; + private final EnumSet flavours; + private final File zipFile; + + private Corpus(final String id, final EnumSet flavours, final URI downloadUri, + final String prefix) { + this.id = id; + this.flavours = EnumSet.copyOf(flavours); + try { + this.zipFile = createTempFileFromCorpus(downloadUri.toURL(), prefix); + } catch (IOException excep) { + throw new IllegalStateException(excep); + } + } + + public String getId() { + return this.id; + } + + @SuppressWarnings("static-method") + public String getDescription() { + return desc; + } + + public File getZipFile() { + return this.zipFile; + } + + public Set getFlavours() { + return this.flavours; + } + + public static Corpus fromId(final String id) { + return ID_LOOKUP.get(id); + } + } + + public static File createTempFileFromCorpus(final URL downloadLoc, final String prefix) throws IOException { + File tempFile = File.createTempFile(prefix, ".zip"); + System.out.println("Downloading: " + downloadLoc + ", to temp:" + tempFile); + int totalBytes = 0; + try (OutputStream output = new FileOutputStream(tempFile); + InputStream corpusInput = handleRedirects(downloadLoc);) { + byte[] buffer = new byte[8 * 1024]; + int bytesRead; + while ((bytesRead = corpusInput.read(buffer)) != -1) { + output.write(buffer, 0, bytesRead); + totalBytes += bytesRead; + } + } + System.out.println("Downloaded: " + totalBytes + " bytes"); + tempFile.deleteOnExit(); + return tempFile; + } + + static InputStream handleRedirects(URL url) throws IOException { + if (!url.getProtocol().startsWith("http")) { + return url.openStream(); + } + URL resourceUrl; + URL base; + URL next; + Map visited; + HttpURLConnection conn; + String location; + String urlString = url.toExternalForm(); + int times; + + visited = new HashMap<>(); + + while (true) { + times = visited.compute(urlString, (key, count) -> count == null ? 1 : count + 1); + + if (times > 3) + throw new IOException("Stuck in redirect loop"); + + resourceUrl = new URL(urlString); + conn = (HttpURLConnection) resourceUrl.openConnection(); + + conn.setConnectTimeout(15000); + conn.setReadTimeout(15000); + conn.setInstanceFollowRedirects(false); // Make the logic below easier to detect redirections + conn.setRequestProperty("User-Agent", "Mozilla/5.0..."); + + switch (conn.getResponseCode()) { + case HttpURLConnection.HTTP_MOVED_PERM: + case HttpURLConnection.HTTP_MOVED_TEMP: + location = conn.getHeaderField("Location"); + location = URLDecoder.decode(location, "UTF-8"); + base = new URL(urlString); + next = new URL(base, location); // Deal with relative URLs + urlString = next.toExternalForm(); + continue; + } + + break; + } + + return conn.getInputStream(); + } } diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/CorpusManager.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/CorpusManager.java index efdb655..00d62c2 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/CorpusManager.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/CorpusManager.java @@ -23,54 +23,58 @@ */ package org.verapdf.pdfa.qa; -import org.verapdf.pdfa.flavours.PDFAFlavour; -import org.verapdf.pdfa.qa.AbstractTestCorpus.Corpus; - import java.io.IOException; +import java.io.InputStream; +import java.util.Arrays; import java.util.Collections; import java.util.EnumMap; import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.Set; +import org.verapdf.pdfa.flavours.PDFAFlavour; +import org.verapdf.pdfa.qa.AbstractTestCorpus.Corpus; +import org.yaml.snakeyaml.Yaml; + /** * @author Carl Wilson */ public final class CorpusManager { - // Reference to corpus zip temp file - private static final EnumMap> corporaByFlavour = new EnumMap<>(PDFAFlavour.class); + // Reference to corpus zip temp file + private static final EnumMap> corporaByFlavour = new EnumMap<>(PDFAFlavour.class); - private CorpusManager() { - assert (false); - } + private CorpusManager() { + assert (false); + } - public static void initialise() throws IOException { - if (!corporaByFlavour.isEmpty()) - return; - for (Corpus corpus : Corpus.values()) { - for (PDFAFlavour flavour : corpus.getFlavours()) { - TestCorpus toAdd = ZipBackedTestCorpus.fromZipSource(corpus.getId(), corpus, corpus.getDescription(), flavour); - if (!corporaByFlavour.containsKey(flavour)) { - corporaByFlavour.put(flavour, new HashSet()); - } - corporaByFlavour.get(flavour).add(toAdd); - } - } - } + public static void initialise() throws IOException { + if (!corporaByFlavour.isEmpty()) + return; + for (Corpus corpus : Corpus.values()) { + for (PDFAFlavour flavour : corpus.getFlavours()) { + TestCorpus toAdd = ZipBackedTestCorpus.fromZipSource(corpus.getId(), corpus, corpus.getDescription(), + flavour); + corporaByFlavour.computeIfAbsent(flavour, k -> new HashSet<>()); + corporaByFlavour.get(flavour).add(toAdd); + } + } + } - public static Set testableFlavours() { - return Collections.unmodifiableSet(corporaByFlavour.keySet()); - } + public static Set testableFlavours() { + return Collections.unmodifiableSet(corporaByFlavour.keySet()); + } - public static Set corporaForFlavour(final PDFAFlavour key) { - return Collections.unmodifiableSet(corporaByFlavour.get(key)); - } + public static Set corporaForFlavour(final PDFAFlavour key) { + return Collections.unmodifiableSet(corporaByFlavour.get(key)); + } - public static TestCorpus corpusByFlavourAndType(final PDFAFlavour key, final Corpus type) { - for (TestCorpus corpus : corporaByFlavour.get(key)) { - if (corpus.getType() == type) { - return corpus; - } - } - return null; - } + public static TestCorpus corpusByFlavourAndType(final PDFAFlavour key, final Corpus type) { + for (TestCorpus corpus : corporaByFlavour.get(key)) { + if (corpus.getType() == type) { + return corpus; + } + } + return null; + } } diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ResultSet.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ResultSet.java index 13e513f..78674d5 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ResultSet.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ResultSet.java @@ -23,16 +23,18 @@ */ package org.verapdf.pdfa.qa; +import java.util.Comparator; +import java.util.Set; + +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + import org.verapdf.component.AuditDuration; +import org.verapdf.pdfa.qa.AbstractTestCorpus.Corpus; import org.verapdf.pdfa.qa.CorpusItemId.TestType; import org.verapdf.pdfa.qa.CorpusItemIdImpl.CorpusItemIdComparator; import org.verapdf.pdfa.results.ValidationResult; import org.verapdf.pdfa.validation.profiles.ValidationProfile; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import java.util.Comparator; -import java.util.Set; - /** * @author Carl Wilson */ @@ -48,6 +50,11 @@ public interface ResultSet { */ public CorpusDetails getCorpusDetails(); + /** + * @return the Corpus ID for the result set + */ + public String getCorpusId(); + /** * @return the {@link ValidationProfile} used to generate the result set */ diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ResultSetImpl.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ResultSetImpl.java index 509de6c..04100c9 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ResultSetImpl.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ResultSetImpl.java @@ -49,6 +49,8 @@ public class ResultSetImpl implements ResultSet { .getNewInstance(Foundries.defaultInstance().getDetails()); @XmlElement(name = "corpusDetails") private final CorpusDetails corpusDetails; + @XmlElement(name = "corpusId") + private final String corpusId; @XmlElement(name = "profile") private final ValidationProfile profile; @XmlElement(name = "summary") @@ -60,9 +62,10 @@ public class ResultSetImpl implements ResultSet { @XmlElement(name = "exception") private final Set exceptions; - private ResultSetImpl(final CorpusDetails corpusDetails, final ValidationProfile profile, final Set results, + private ResultSetImpl(final CorpusDetails corpusDetails, final String corpusId, final ValidationProfile profile, final Set results, final Set exceptions, final AuditDuration duration, final long memoryUsed) { this.corpusDetails = corpusDetails; + this.corpusId = corpusId; this.profile = profile; this.results = new TreeSet<>(new ResultComparator()); this.results.addAll(results); @@ -86,6 +89,14 @@ public CorpusDetails getCorpusDetails() { return this.corpusDetails; } + /** + * { @inheritDoc } + */ + @Override + public String getCorpusId() { + return this.corpusId; + } + /** * { @inheritDoc } */ @@ -216,7 +227,7 @@ public static ResultSet validateCorpus(final TestCorpus corpus, final PDFAValida } } } - return new ResultSetImpl(corpus.getDetails(), validator.getProfile(), results, exceptions, batchTimer.stop(), + return new ResultSetImpl(corpus.getDetails(), corpus.getType().getId(), validator.getProfile(), results, exceptions, batchTimer.stop(), maxMemUse); } @@ -245,7 +256,7 @@ public static ResultSet validateCorpus(final TestCorpus corpus) { exceptions.add(new Incomplete(id, e)); } } - return new ResultSetImpl(corpus.getDetails(), Profiles.defaultProfile(), results, exceptions, batchTimer.stop(), + return new ResultSetImpl(corpus.getDetails(), corpus.getType().getId(), Profiles.defaultProfile(), results, exceptions, batchTimer.stop(), maxMemUse); } diff --git a/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java b/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java index 1e1f3b0..1aae82f 100644 --- a/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java +++ b/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java @@ -16,17 +16,24 @@ import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import java.io.InputStream; import java.io.PrintWriter; import java.io.Writer; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.EnumMap; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -43,7 +50,9 @@ import org.verapdf.pdfa.qa.ResultSetDetailsImpl; import org.verapdf.pdfa.qa.ResultSetImpl; import org.verapdf.pdfa.qa.TestCorpus; +import org.verapdf.pdfa.qa.AbstractTestCorpus.Corpus; import org.verapdf.pdfbox.foundry.PdfBoxFoundryProvider; +import org.yaml.snakeyaml.Yaml; import com.github.mustachejava.DefaultMustacheFactory; import com.github.mustachejava.Mustache; @@ -61,12 +70,15 @@ public class CorpusTest { @BeforeClass public static final void SetUp() throws IOException { - try { - CorpusManager.initialise(); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } + CorpusManager.initialise(); + } + + private static Set expectedForCorpus(final Corpus corpus, final PDFAFlavour flavour, + final EnumMap>> expectedFailureSets) { + EnumMap> expectedByFlavour = expectedFailureSets.get(corpus); + if (expectedByFlavour == null) + return Collections.emptySet(); + return Collections.unmodifiableSet(expectedByFlavour.get(flavour)); } @AfterClass @@ -78,25 +90,33 @@ public static void outputResults() throws IOException { public ErrorCollector collector = new ErrorCollector(); @Test - public void testPdfBox() { + public void testPdfBox() throws Exception { PdfBoxFoundryProvider.initialise(); assertTrue(Foundries.defaultParserIsPDFBox()); pdfBoxDetails = Foundries.defaultInstance().getDetails(); testCorpora(pdfBoxResults); + final EnumMap>> failures = createExpectedFailures( + "org/verapdf/integration/tests/rules/corpus-pdfbox.yml"); for (ResultSet set : pdfBoxResults) { - testResults(set); + Set expected = expectedForCorpus(Corpus.fromId(set.getCorpusId()), set + .getValidationProfile().getPDFAFlavour(), failures); + testResults(set, expected); } collector.checkThat("Exceptions thrown during PDF Box testing.", countExceptions(pdfBoxResults), equalTo(0)); } @Test - public void testGreenfield() { + public void testGreenfield() throws Exception { VeraGreenfieldFoundryProvider.initialise(); assertFalse(Foundries.defaultParserIsPDFBox()); gfDetails = Foundries.defaultInstance().getDetails(); testCorpora(gfResults); + final EnumMap>> failures = createExpectedFailures( + "org/verapdf/integration/tests/rules/corpus-gf.yml"); for (ResultSet set : gfResults) { - testResults(set); + Set expected = expectedForCorpus(Corpus.fromId(set.getCorpusId()), set + .getValidationProfile().getPDFAFlavour(), failures); + testResults(set, expected); } collector.checkThat("Exceptions thrown during greenfield testing.", countExceptions(gfResults), equalTo(0)); } @@ -128,8 +148,10 @@ private static void testCorpora(final List resultSets) { } } - private void testResults(final ResultSet results) { + private void testResults(final ResultSet results, final Set expected) { for (ResultSet.Result result : results.getResults()) { + if (expected != null && expected.contains(result.getCorpusItemName())) + continue; collector .checkThat( String.format("Unexpected result for corpus %s, item %s", @@ -200,4 +222,34 @@ private static void outputResultsToFile(Map scopes, final File o RESULTS_MUSTACHE.execute(writer, scopes).flush(); } } + + private static final EnumMap>> createExpectedFailures( + final String rulesFile) throws Exception { + final EnumMap>> expectedFailureSets = new EnumMap<>( + Corpus.class); + try (InputStream rulesStream = CorpusTest.class.getClassLoader() + .getResourceAsStream(rulesFile)) { + assertNotNull("No resource found for rulesFile: " + rulesFile, rulesStream); + + Yaml yaml = new Yaml(); + Map data = yaml.load(rulesStream); + for (Corpus corpus : Corpus.values()) { + Map corpusData = (Map) data.get(corpus.getId()); + if (corpusData == null) + continue; + for (PDFAFlavour flavour : corpus.getFlavours()) { + List expected = (List) corpusData.get(flavour.getId()); + if (expected == null) + continue; + expectedFailureSets.computeIfAbsent(corpus, + k -> new EnumMap>(PDFAFlavour.class)); + expectedFailureSets.get(corpus).computeIfAbsent(flavour, k -> new HashSet(expected)); + } + } + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + return expectedFailureSets; + } } diff --git a/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-gf.yml b/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-gf.yml new file mode 100644 index 0000000..dd4d40c --- /dev/null +++ b/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-gf.yml @@ -0,0 +1,44 @@ +"TWG": + "0": + [ + ] +"veraPDF": + "1a": + [ + ] + "1b": + [ + ] + "2a": + [ + ] + "2b": + [ + ] + "2u": + [ + ] + "4": + [ + ] + "3b": + [ + ] + "4f": + [ + ] + "4e": + [ + ] + "ua1": + [ + ] +"BFO": + "2b": + [ + "6.5.3-t1-pass-a", + ] +"Isartor": + "1b": + [ + ] diff --git a/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml b/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml new file mode 100644 index 0000000..19be139 --- /dev/null +++ b/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml @@ -0,0 +1,260 @@ +"TWG": + "0": + [ + "A029.pdfa2-t0-pass-a", + "A025.pdfa2-t0-fail-a", + "A029.pdfa2-t0-pass-b", + "A029.pdfa2-t0-pass-c", + "A029.pdfa2-t0-pass-d", + ] +"veraPDF": + "1a": + [ + "6.3.8-t1-pass-f", + "6.3.8-t1-pass-g", + "6.3.8-t1-pass-h", + "6.3.8-t1-pass-i", + "6.3.8-t1-pass-j", + ] + "1b": + [ + "6.1.3-t2-pass-a", + "6.1.5-t2-pass-a", + "6.1.5-t2-pass-b", + "6.1.5-t2-pass-c", + "6.1.5-t2-pass-d", + "6.1.12-t2-pass-k", + "6.3.5-t2-pass-a", + "6.3.5-t2-fail-b", + "6.3.5-t2-fail-c", + "6.3.5-t3-fail-b", + "6.3.5-t3-fail-c", + "6.7.3-t1-pass-a", + "6.7.3-t2-pass-a", + "6.7.3-t3-pass-a", + "6.7.3-t4-pass-a", + "6.7.3-t5-pass-a", + "6.7.3-t6-pass-a", + "6.7.3-t7-pass-a", + "6.7.3-t8-pass-a", + ] + "2a": + [ + "6.2.11.7.3-t1-pass-a", + "6.2.11.7.3-t1-pass-b", + "6.2.11.7.3-t1-pass-c", + "6.2.11.7.3-t1-pass-d", + "6.2.11.7.3-t1-pass-e", + ] + "2b": + [ + "6.1.3-t1-pass-a", + "6.1.5-t1-pass-a", + "6.1.6-t1-pass-a", + "6.1.12-t2-pass-a", + ] + "2u": + [ + "6.2.11.7.2-t1-pass-f", + "6.2.11.7.2-t1-pass-h", + "6.2.11.7.2-t1-pass-i", + "6.2.11.7.2-t1-pass-j", + "6.2.11.7.2-t2-fail-b", + ] + "4": + [ + "6.1.3-t4-pass-a", + "6.1.9-t1-fail-c", + "6.2.2-t2-fail-d", + "6.2.2-t3-fail-a", + "6.2.4.2-t3-fail-a", + "6.2.4.2-t3-fail-b", + "6.2.4.2-t3-fail-c", + "6.2.4.2-t3-fail-d", + "6.2.4.2-t3-fail-e", + "6.2.4.2-t3-fail-f", + "6.2.4.3-t2-pass-g", + "6.2.4.3-t4-pass-a", + "6.2.4.3-t4-pass-b", + "6.2.4.3-t4-pass-d", + "6.2.4.3-t4-pass-e", + "6.2.4.3-t4-pass-f", + "6.2.4.3-t4-pass-g", + "6.2.4.3-t4-pass-h", + "6.2.4.3-t4-pass-i", + "6.2.4.4-t1-pass-g", + "6.2.4.4-t1-fail-i", + "6.2.4.4-t1-fail-j", + "6.2.9-t2-pass-c", + "6.2.10.7-t1-fail-b", + "6.6.3-t1-fail-a", + "6.6.3-t1-fail-b", + "6.6.3-t1-fail-c", + ] + "3b": + [ + ] + "4f": + [ + ] + "4e": + [ + ] + "ua1": + [ + "5-t1-pass-a", + "5-t2-pass-a", + "7.1-t1-pass-a", + "7.1-t1-pass-b", + "7.1-t2-pass-a", + "7.1-t2-pass-b", + "7.1-t3-pass-a", + "7.1-t3-pass-b", + "7.1-t4-pass-a", + "7.1-t5-pass-a", + "7.1-t5-pass-b", + "7.1-t6-pass-a", + "7.1-t7-pass-a", + "7.1-t8-pass-a", + "7.1-t9-pass-a", + "7.1-t10-pass-a", + "7.2-t2-pass-a", + "7.2-t3-pass-a", + "7.2-t3-pass-b", + "7.2-t3-pass-c", + "7.2-t15-pass-a", + "7.2-t15-pass-b", + "7.2-t17-pass-a", + "7.2-t17-pass-b", + "7.2-t17-pass-c", + "7.2-t17-pass-d", + "7.2-t17-pass-e", + "7.2-t17-pass-f", + "7.2-t17-pass-g", + "7.2-t21-pass-a", + "7.2-t21-pass-b", + "7.2-t21-pass-c", + "7.2-t22-pass-a", + "7.2-t22-pass-b", + "7.2-t22-pass-c", + "7.2-t23-pass-a", + "7.2-t23-pass-b", + "7.2-t23-pass-c", + "7.2-t24-pass-a", + "7.2-t24-pass-b", + "7.2-t25-pass-a", + "7.2-t25-pass-b", + "7.2-t26-pass-a", + "7.2-t27-pass-a", + "7.2-t29-pass-a", + "7.2-t29-pass-b", + "7.2-t29-pass-c", + "7.2-t29-pass-d", + "7.2-t29-pass-e", + "7.2-t29-pass-f", + "7.2-t29-pass-g", + "7.2-t29-pass-h", + "7.2-t29-pass-i", + "7.2-t29-pass-j", + "7.2-t30-pass-a", + "7.2-t30-pass-b", + "7.2-t31-pass-a", + "7.2-t31-pass-b", + "7.2-t32-pass-a", + "7.2-t32-pass-b", + "7.2-t33-pass-a", + "7.2-t33-pass-b", + "7.2-t34-pass-a", + "7.2-t34-pass-b", + "7.2-t34-pass-c", + "7.2-t34-pass-d", + "7.3-t1-pass-a", + "7.3-t1-pass-b", + "7.3-t1-pass-c", + "7.4.2-t1-pass-a", + "7.4.2-t1-pass-b", + "7.4.2-t1-pass-c", + "7.4.2-t1-pass-d", + "7.4.4-t1-pass-a", + "7.4.4-t2-pass-a", + "7.4.4-t2-pass-b", + "7.5-t1-pass-a", + "7.5-t1-pass-b", + "7.5-t1-pass-c", + "7.5-t1-pass-d", + "7.5-t1-pass-e", + "7.7-t1-pass-a", + "7.7-t1-pass-b", + "7.7-t1-pass-c", + "7.9-t1-pass-a", + "7.9-t2-pass-a", + "7.10-t1-pass-a", + "7.10-t2-pass-a", + "7.11-t1-pass-a", + "7.16-t1-pass-a", + "7.18.1-t1-pass-a", + "7.18.1-t1-pass-b", + "7.18.1-t1-pass-c", + "7.18.1-t2-pass-a", + "7.18.1-t2-pass-b", + "7.18.1-t2-pass-c", + "7.18.1-t2-pass-d", + "7.18.1-t2-pass-e", + "7.18.1-t2-pass-f", + "7.18.1-t2-pass-g", + "7.18.1-t2-pass-h", + "7.18.1-t3-pass-a", + "7.18.1-t3-pass-b", + "7.18.1-t3-pass-c", + "7.18.1-t3-pass-d", + "7.18.1-t3-pass-e", + "7.18.1-t3-pass-f", + "7.18.3-t1-pass-a", + "7.18.4-t1-pass-a", + "7.18.5-t1-pass-a", + "7.18.5-t2-pass-a", + "7.18.6.2-t1-pass-a", + "7.18.6.2-t2-pass-a", + "7.18.7-t1-pass-a", + "7.20-t1-pass-a", + "7.20-t2-pass-a", + "7.21.3.1-t1-pass-a", + "7.21.3.1-t1-pass-b", + "7.21.3.1-t1-pass-c", + "7.21.3.1-t1-pass-d", + "7.21.3.2-t1-pass-a", + "7.21.3.3-t1-pass-a", + "7.21.3.3-t2-pass-a", + "7.21.3.3-t3-pass-a", + "7.21.4.1-t1-pass-a", + "7.21.4.2-t1-pass-a", + "7.21.4.2-t2-pass-a", + "7.21.5-t1-pass-a", + "7.21.6-t2-pass-a", + "7.21.6-t2-pass-b", + "7.21.6-t2-pass-c", + "7.21.6-t2-pass-d", + "7.21.6-t3-pass-a", + "7.21.7-t1-pass-a", + "7.21.7-t1-pass-b", + "7.21.7-t1-pass-c", + "7.21.7-t2-pass-a", + ] +"BFO": + "2b": + [ + "6.1.5-t1-pass-a", + "6.1.13-t6-pass-a", + "6.1.13-t7-pass-a", + "6.1.13-t8-pass-a", + "6.2.11.6-t1-pass-a", + "6.3.2-t1-pass-a", + "6.3.3-t2-pass-a", + "6.5.3-t1-pass-a", + "6.8-t1-pass-a", + "6.8-t2-pass-a", + ] +"Isartor": + "1b": + [ + ] From 110b610dd160ec9cb6f16c298371992d5664fcc5 Mon Sep 17 00:00:00 2001 From: Carl Wilson Date: Sat, 15 Jul 2023 14:22:35 +0100 Subject: [PATCH 07/24] FIX: Some compiler/style stuff. --- .../verapdf/pdfa/qa/AbstractTestCorpus.java | 14 +-- .../org/verapdf/pdfa/qa/CorpusManager.java | 5 - .../pdfa/qa/RegressionTestingHelper.java | 93 ++++++++++++------- .../java/org/verapdf/pdfa/qa/ResultSet.java | 1 - .../verapdf/integration/tests/CorpusTest.java | 3 +- 5 files changed, 66 insertions(+), 50 deletions(-) diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java index e6d2ffe..d2895e6 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java @@ -41,9 +41,9 @@ */ @XmlRootElement(namespace = "http://www.verapdf.org/corpus", name = "corpus") public abstract class AbstractTestCorpus implements TestCorpus { - private static final String veraUrl = "https://github.com/veraPDF/veraPDF-corpus/archive/staging.zip"; - private static final String isartorUrl = "https://corpora.openpreservation.org/veraPDF/isartor-pdfa-2008-08-13.zip"; - private static final String bfoUrl = "https://github.com/bfosupport/pdfa-testsuite/archive/master.zip"; + private static final String VERA_URL = "https://github.com/veraPDF/veraPDF-corpus/archive/staging.zip"; + private static final String ISARTOR_URL = "https://corpora.openpreservation.org/veraPDF/isartor-pdfa-2008-08-13.zip"; + private static final String BFO_URL = "https://github.com/bfosupport/pdfa-testsuite/archive/master.zip"; @XmlElement(name = "details") private final CorpusDetails details; @@ -145,15 +145,15 @@ public boolean equals(Object obj) { return true; } - public static enum Corpus { + public enum Corpus { VERA("veraPDF", EnumSet.of(PDFAFlavour.PDFA_1_A, PDFAFlavour.PDFA_1_B, PDFAFlavour.PDFA_2_A, PDFAFlavour.PDFA_2_B, PDFAFlavour.PDFA_2_U, PDFAFlavour.PDFA_3_B, PDFAFlavour.PDFA_4, PDFAFlavour.PDFA_4_F, PDFAFlavour.PDFA_4_E, PDFAFlavour.PDFUA_1), - URI.create(veraUrl), "veraCorp-"), - ISARTOR("Isartor", EnumSet.of(PDFAFlavour.PDFA_1_B), URI.create(isartorUrl), "isartCorp-"), - BFO("BFO", EnumSet.of(PDFAFlavour.PDFA_2_B), URI.create(bfoUrl), "bfoCorp-"), + URI.create(VERA_URL), "veraCorp-"), + ISARTOR("Isartor", EnumSet.of(PDFAFlavour.PDFA_1_B), URI.create(ISARTOR_URL), "isartCorp-"), + BFO("BFO", EnumSet.of(PDFAFlavour.PDFA_2_B), URI.create(BFO_URL), "bfoCorp-"), TWG("TWG", EnumSet.of(PDFAFlavour.NO_FLAVOUR), VERA.getZipFile().toURI(), "twgCorp-"); private static final String desc = "Synthetic test files for PDF/A validation."; diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/CorpusManager.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/CorpusManager.java index 00d62c2..b49a2df 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/CorpusManager.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/CorpusManager.java @@ -24,18 +24,13 @@ package org.verapdf.pdfa.qa; import java.io.IOException; -import java.io.InputStream; -import java.util.Arrays; import java.util.Collections; import java.util.EnumMap; import java.util.HashSet; -import java.util.List; -import java.util.Map; import java.util.Set; import org.verapdf.pdfa.flavours.PDFAFlavour; import org.verapdf.pdfa.qa.AbstractTestCorpus.Corpus; -import org.yaml.snakeyaml.Yaml; /** * @author Carl Wilson diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java index 4f551b7..ebc2ddb 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java @@ -1,35 +1,52 @@ package org.verapdf.pdfa.qa; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumSet; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +import javax.xml.bind.JAXBException; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; + import org.verapdf.core.VeraPDFException; +import org.verapdf.gf.foundry.VeraGreenfieldFoundryProvider; import org.verapdf.metadata.fixer.FixerFactory; import org.verapdf.metadata.fixer.MetadataFixerConfig; -import org.verapdf.gf.foundry.VeraGreenfieldFoundryProvider; import org.verapdf.pdfa.flavours.PDFAFlavour; import org.verapdf.pdfa.validation.profiles.ValidationProfile; import org.verapdf.pdfa.validation.validators.ValidatorConfigBuilder; import org.verapdf.policy.PolicyChecker; -import org.verapdf.processor.*; +import org.verapdf.processor.BatchProcessor; +import org.verapdf.processor.FormatOption; +import org.verapdf.processor.ProcessorConfig; +import org.verapdf.processor.ProcessorFactory; +import org.verapdf.processor.TaskType; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; -import javax.xml.bind.JAXBException; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; -import java.io.*; -import java.net.URL; -import java.util.*; -import java.util.logging.Level; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - public class RegressionTestingHelper { private static final String testFilesZipUrl = "https://github.com/veraPDF/veraPDF-regression-tests/archive/refs/heads/integration.zip"; @@ -55,16 +72,17 @@ public Set getPdfFileNames() { return pdfMap.keySet(); } - public void getFailedPolicyComplianceFiles(Map> failedFiles, PDFAFlavour flavour, ValidationProfile customProfile, Set fileNames) throws JAXBException, IOException { + public void getFailedPolicyComplianceFiles(Map> failedFiles, PDFAFlavour flavour, + ValidationProfile customProfile, Set fileNames) throws JAXBException, IOException { MetadataFixerConfig fixConf = FixerFactory.configFromValues("test", true); - ProcessorConfig processorConfig = customProfile == null ? - ProcessorFactory.fromValues(new ValidatorConfigBuilder().flavour(flavour) - .defaultFlavour(PDFAFlavour.NO_FLAVOUR).recordPasses(true).maxFails(0) - .isLogsEnabled(true).showErrorMessages(false).build(), - null, null, fixConf, EnumSet.of(TaskType.VALIDATE), (String) null) : - ProcessorFactory.fromValues(new ValidatorConfigBuilder() - .defaultFlavour(PDFAFlavour.NO_FLAVOUR).recordPasses(true).maxFails(0) - .isLogsEnabled(true).showErrorMessages(false).build(), + ProcessorConfig processorConfig = customProfile == null + ? ProcessorFactory.fromValues(new ValidatorConfigBuilder().flavour(flavour) + .defaultFlavour(PDFAFlavour.NO_FLAVOUR).recordPasses(true).maxFails(0) + .isLogsEnabled(true).showErrorMessages(false).build(), + null, null, fixConf, EnumSet.of(TaskType.VALIDATE), (String) null) + : ProcessorFactory.fromValues(new ValidatorConfigBuilder() + .defaultFlavour(PDFAFlavour.NO_FLAVOUR).recordPasses(true).maxFails(0) + .isLogsEnabled(true).showErrorMessages(false).build(), null, null, fixConf, EnumSet.of(TaskType.VALIDATE), customProfile, null); BatchProcessor processor = ProcessorFactory.fileBatchProcessor(processorConfig); @@ -159,33 +177,38 @@ public static void copyInputStreamToFile(InputStream inputStream, File file) thr } } - public static int countFailedPolicyJobs(File xmlReport) throws IOException, SAXException, ParserConfigurationException, XPathExpressionException { + public static int countFailedPolicyJobs(File xmlReport) + throws IOException, SAXException, ParserConfigurationException, XPathExpressionException { DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = documentBuilder.parse(xmlReport); XPath path = XPathFactory.newInstance().newXPath(); - return ((Number) path.evaluate("count(//policyReport[@failedChecks > 0])", document, XPathConstants.NUMBER)).intValue(); + return ((Number) path.evaluate("count(//policyReport[@failedChecks > 0])", document, XPathConstants.NUMBER)) + .intValue(); } - public static List getFailedChecks(File xmlReport) throws IOException, SAXException, ParserConfigurationException, XPathExpressionException { + public static List getFailedChecks(File xmlReport) + throws IOException, SAXException, ParserConfigurationException, XPathExpressionException { DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = documentBuilder.parse(xmlReport); XPath path = XPathFactory.newInstance().newXPath(); List failedChecks = new LinkedList<>(); - NodeList list = ((NodeList)path.evaluate("//policyReport/failedChecks/check", document, XPathConstants.NODESET)); + NodeList list = ((NodeList) path.evaluate("//policyReport/failedChecks/check", document, + XPathConstants.NODESET)); for (int i = 0; i < list.getLength(); i++) { - Element check = (Element)list.item(i); + Element check = (Element) list.item(i); String test = check.getAttribute("test"); String messageValue = getProperty(check, "message").getTextContent(); - Element node = (Element)path.evaluate(check.getAttribute("location"), document, XPathConstants.NODE); + Element node = (Element) path.evaluate(check.getAttribute("location"), document, XPathConstants.NODE); failedChecks.add(new FailedPolicyCheck(node, messageValue, test)); } return failedChecks; } - public static void applyPolicy(File policyFile, File tempMrrFile, File tempResultFile) throws IOException, VeraPDFException { + public static void applyPolicy(File policyFile, File tempMrrFile, File tempResultFile) + throws IOException, VeraPDFException { File tempPolicyResult = File.createTempFile("policyResult", "veraPDF"); try (InputStream mrrIs = new FileInputStream(tempMrrFile); - OutputStream policyResultOs = new FileOutputStream(tempPolicyResult)) { + OutputStream policyResultOs = new FileOutputStream(tempPolicyResult)) { PolicyChecker.applyPolicy(policyFile, mrrIs, policyResultOs); } try (OutputStream mrrReport = new FileOutputStream(tempResultFile)) { @@ -204,7 +227,7 @@ private static Node getProperty(Node parent, String propertyName) { NodeList childNodes = parent.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node item = childNodes.item(i); - if (propertyName.equals(item.getNodeName())){ + if (propertyName.equals(item.getNodeName())) { return item; } } diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ResultSet.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ResultSet.java index 78674d5..090a696 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ResultSet.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ResultSet.java @@ -29,7 +29,6 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.verapdf.component.AuditDuration; -import org.verapdf.pdfa.qa.AbstractTestCorpus.Corpus; import org.verapdf.pdfa.qa.CorpusItemId.TestType; import org.verapdf.pdfa.qa.CorpusItemIdImpl.CorpusItemIdComparator; import org.verapdf.pdfa.results.ValidationResult; diff --git a/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java b/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java index 1aae82f..6eff442 100644 --- a/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java +++ b/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java @@ -26,7 +26,6 @@ import java.io.PrintWriter; import java.io.Writer; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.EnumMap; import java.util.HashMap; @@ -45,12 +44,12 @@ import org.verapdf.pdfa.Foundries; import org.verapdf.pdfa.PDFAValidator; import org.verapdf.pdfa.flavours.PDFAFlavour; +import org.verapdf.pdfa.qa.AbstractTestCorpus.Corpus; import org.verapdf.pdfa.qa.CorpusManager; import org.verapdf.pdfa.qa.ResultSet; import org.verapdf.pdfa.qa.ResultSetDetailsImpl; import org.verapdf.pdfa.qa.ResultSetImpl; import org.verapdf.pdfa.qa.TestCorpus; -import org.verapdf.pdfa.qa.AbstractTestCorpus.Corpus; import org.verapdf.pdfbox.foundry.PdfBoxFoundryProvider; import org.yaml.snakeyaml.Yaml; From e35d13e170acd7c214e45555e4697a2bd2c3068d Mon Sep 17 00:00:00 2001 From: Carl Wilson Date: Sat, 15 Jul 2023 14:27:11 +0100 Subject: [PATCH 08/24] FIX: Some compiler/style stuff. --- .../test/java/org/verapdf/integration/tests/CorpusTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java b/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java index 6eff442..5f7fb79 100644 --- a/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java +++ b/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java @@ -67,6 +67,9 @@ public class CorpusTest { private static final Mustache RESULTS_MUSTACHE = MF.compile("corpus-results.mustache"); private static final Mustache SUMMARY_MUSTACHE = MF.compile("test-summary.mustache"); + @Rule + public ErrorCollector collector = new ErrorCollector(); + @BeforeClass public static final void SetUp() throws IOException { CorpusManager.initialise(); @@ -85,9 +88,6 @@ public static void outputResults() throws IOException { writeResults(); } - @Rule - public ErrorCollector collector = new ErrorCollector(); - @Test public void testPdfBox() throws Exception { PdfBoxFoundryProvider.initialise(); From 27e6f2bc451f29b885e6fd325cc01cb6d3d802a5 Mon Sep 17 00:00:00 2001 From: Maxim Date: Tue, 18 Jul 2023 13:43:27 +0300 Subject: [PATCH 09/24] Update checking test results --- .../pdfa/qa/RegressionTestingHelper.java | 17 +++++---- .../verapdf/integration/tests/CorpusTest.java | 36 +++++++++---------- .../integration/tests/rules/corpus-pdfbox.yml | 2 -- 3 files changed, 25 insertions(+), 30 deletions(-) diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java index ebc2ddb..74c836d 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java @@ -33,7 +33,9 @@ import org.verapdf.metadata.fixer.FixerFactory; import org.verapdf.metadata.fixer.MetadataFixerConfig; import org.verapdf.pdfa.flavours.PDFAFlavour; +import org.verapdf.pdfa.validation.profiles.Profiles; import org.verapdf.pdfa.validation.profiles.ValidationProfile; +import org.verapdf.pdfa.validation.validators.ValidatorConfig; import org.verapdf.pdfa.validation.validators.ValidatorConfigBuilder; import org.verapdf.policy.PolicyChecker; import org.verapdf.processor.BatchProcessor; @@ -75,15 +77,12 @@ public Set getPdfFileNames() { public void getFailedPolicyComplianceFiles(Map> failedFiles, PDFAFlavour flavour, ValidationProfile customProfile, Set fileNames) throws JAXBException, IOException { MetadataFixerConfig fixConf = FixerFactory.configFromValues("test", true); - ProcessorConfig processorConfig = customProfile == null - ? ProcessorFactory.fromValues(new ValidatorConfigBuilder().flavour(flavour) - .defaultFlavour(PDFAFlavour.NO_FLAVOUR).recordPasses(true).maxFails(0) - .isLogsEnabled(true).showErrorMessages(false).build(), - null, null, fixConf, EnumSet.of(TaskType.VALIDATE), (String) null) - : ProcessorFactory.fromValues(new ValidatorConfigBuilder() - .defaultFlavour(PDFAFlavour.NO_FLAVOUR).recordPasses(true).maxFails(0) - .isLogsEnabled(true).showErrorMessages(false).build(), - null, null, fixConf, EnumSet.of(TaskType.VALIDATE), customProfile, null); + ValidatorConfig validatorConfig = new ValidatorConfigBuilder().flavour(flavour) + .defaultFlavour(PDFAFlavour.NO_FLAVOUR).recordPasses(true).maxFails(0) + .isLogsEnabled(true).showErrorMessages(false).build(); + ProcessorConfig processorConfig = ProcessorFactory.fromValues(validatorConfig, null, + null, fixConf, EnumSet.of(TaskType.VALIDATE), + customProfile == null ? Profiles.defaultProfile() : customProfile, null); BatchProcessor processor = ProcessorFactory.fileBatchProcessor(processorConfig); File tempSchFile = File.createTempFile("veraPDF", ".sch"); diff --git a/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java b/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java index 5f7fb79..730e9d2 100644 --- a/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java +++ b/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java @@ -93,15 +93,8 @@ public void testPdfBox() throws Exception { PdfBoxFoundryProvider.initialise(); assertTrue(Foundries.defaultParserIsPDFBox()); pdfBoxDetails = Foundries.defaultInstance().getDetails(); - testCorpora(pdfBoxResults); - final EnumMap>> failures = createExpectedFailures( - "org/verapdf/integration/tests/rules/corpus-pdfbox.yml"); - for (ResultSet set : pdfBoxResults) { - Set expected = expectedForCorpus(Corpus.fromId(set.getCorpusId()), set - .getValidationProfile().getPDFAFlavour(), failures); - testResults(set, expected); - } - collector.checkThat("Exceptions thrown during PDF Box testing.", countExceptions(pdfBoxResults), equalTo(0)); + test(pdfBoxResults, "org/verapdf/integration/tests/rules/corpus-pdfbox.yml"); + collector.checkThat("Exceptions thrown during PDFBox testing.", countExceptions(pdfBoxResults), equalTo(0)); } @Test @@ -109,15 +102,18 @@ public void testGreenfield() throws Exception { VeraGreenfieldFoundryProvider.initialise(); assertFalse(Foundries.defaultParserIsPDFBox()); gfDetails = Foundries.defaultInstance().getDetails(); - testCorpora(gfResults); - final EnumMap>> failures = createExpectedFailures( - "org/verapdf/integration/tests/rules/corpus-gf.yml"); - for (ResultSet set : gfResults) { + test(gfResults, "org/verapdf/integration/tests/rules/corpus-gf.yml"); + collector.checkThat("Exceptions thrown during Greenfield testing.", countExceptions(gfResults), equalTo(0)); + } + + private void test(List results, String ymlPath) throws Exception { + testCorpora(results); + final EnumMap>> failures = createExpectedFailures(ymlPath); + for (ResultSet set : results) { Set expected = expectedForCorpus(Corpus.fromId(set.getCorpusId()), set .getValidationProfile().getPDFAFlavour(), failures); testResults(set, expected); } - collector.checkThat("Exceptions thrown during greenfield testing.", countExceptions(gfResults), equalTo(0)); } private static int countExceptions(final List resultSets) { @@ -148,14 +144,16 @@ private static void testCorpora(final List resultSets) { } private void testResults(final ResultSet results, final Set expected) { + if (expected == null) { + return; + } for (ResultSet.Result result : results.getResults()) { - if (expected != null && expected.contains(result.getCorpusItemName())) - continue; collector .checkThat( - String.format("Unexpected result for corpus %s, item %s", - results.getCorpusDetails().getName(), result.getCorpusItemName()), - result.isExpectedResult(), equalTo(true)); + String.format("Unexpected result for corpus %s-%s, item %s", + results.getCorpusDetails().getName(), results.getValidationProfile().getPDFAFlavour(), + result.getCorpusItemName()), + result.isExpectedResult(), equalTo(!expected.contains(result.getCorpusItemName()))); } } diff --git a/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml b/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml index 19be139..58dfec3 100644 --- a/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml +++ b/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml @@ -59,7 +59,6 @@ "6.2.11.7.2-t1-pass-h", "6.2.11.7.2-t1-pass-i", "6.2.11.7.2-t1-pass-j", - "6.2.11.7.2-t2-fail-b", ] "4": [ @@ -86,7 +85,6 @@ "6.2.4.4-t1-fail-i", "6.2.4.4-t1-fail-j", "6.2.9-t2-pass-c", - "6.2.10.7-t1-fail-b", "6.6.3-t1-fail-a", "6.6.3-t1-fail-b", "6.6.3-t1-fail-c", From 202da4befb74df808bcbaf9381633d00561030bc Mon Sep 17 00:00:00 2001 From: Maxim Date: Mon, 21 Aug 2023 14:23:19 +0300 Subject: [PATCH 10/24] Add tags for rules --- .../src/main/java/org/verapdf/pdfa/qa/ProfilesMerger.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ProfilesMerger.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ProfilesMerger.java index 4e9bf8a..499a198 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ProfilesMerger.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ProfilesMerger.java @@ -84,7 +84,8 @@ private static Set updateSpecification(final Collection rules, final Set res = new HashSet<>(rules.size()); for (Rule r : rules) { RuleId id = Profiles.ruleIdFromValues(flavour.getPart(), r.getRuleId().getClause(), r.getRuleId().getTestNumber()); - res.add(Profiles.ruleFromValues(id, r.getObject(), r.getDeferred(), r.getDescription(), r.getTest(), r.getError(), r.getReferences())); + res.add(Profiles.ruleFromValues(id, r.getObject(), r.getDeferred(), r.getTags(), r.getDescription(), r.getTest(), + r.getError(), r.getReferences())); } return res; } From a34c92f817b5a5e8da83faa17b6f068a01587079 Mon Sep 17 00:00:00 2001 From: Maxim Date: Mon, 21 Aug 2023 19:21:47 +0300 Subject: [PATCH 11/24] Regression and corpus tests. Print dependencies --- .../verapdf/pdfa/qa/RegressionTestingHelper.java | 13 +++++++++++++ .../org/verapdf/integration/tests/CorpusTest.java | 8 +++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java index 74c836d..5fb02a8 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java @@ -28,10 +28,12 @@ import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; +import org.verapdf.ReleaseDetails; import org.verapdf.core.VeraPDFException; import org.verapdf.gf.foundry.VeraGreenfieldFoundryProvider; import org.verapdf.metadata.fixer.FixerFactory; import org.verapdf.metadata.fixer.MetadataFixerConfig; +import org.verapdf.pdfa.Foundries; import org.verapdf.pdfa.flavours.PDFAFlavour; import org.verapdf.pdfa.validation.profiles.Profiles; import org.verapdf.pdfa.validation.profiles.ValidationProfile; @@ -58,6 +60,7 @@ public class RegressionTestingHelper { public RegressionTestingHelper(boolean isWcag) throws IOException { VeraGreenfieldFoundryProvider.initialise(); + printDependencies(); File zipFile; try { zipFile = AbstractTestCorpus.createTempFileFromCorpus(new URL(testFilesZipUrl), "regression"); @@ -232,4 +235,14 @@ private static Node getProperty(Node parent, String propertyName) { } return null; } + + public static void printDependencies() { + System.out.println("Dependencies"); + Foundries.defaultInstance().getDetails(); + for (ReleaseDetails details : ReleaseDetails.getDetails()) { + System.out.println(details.getId() + " " + details.getVersion() + " " + details.getBuildDate()); + } + System.out.println(); + } + } diff --git a/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java b/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java index 730e9d2..bd86f81 100644 --- a/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java +++ b/veraPDF-integration/src/test/java/org/verapdf/integration/tests/CorpusTest.java @@ -44,12 +44,8 @@ import org.verapdf.pdfa.Foundries; import org.verapdf.pdfa.PDFAValidator; import org.verapdf.pdfa.flavours.PDFAFlavour; +import org.verapdf.pdfa.qa.*; import org.verapdf.pdfa.qa.AbstractTestCorpus.Corpus; -import org.verapdf.pdfa.qa.CorpusManager; -import org.verapdf.pdfa.qa.ResultSet; -import org.verapdf.pdfa.qa.ResultSetDetailsImpl; -import org.verapdf.pdfa.qa.ResultSetImpl; -import org.verapdf.pdfa.qa.TestCorpus; import org.verapdf.pdfbox.foundry.PdfBoxFoundryProvider; import org.yaml.snakeyaml.Yaml; @@ -91,6 +87,7 @@ public static void outputResults() throws IOException { @Test public void testPdfBox() throws Exception { PdfBoxFoundryProvider.initialise(); + RegressionTestingHelper.printDependencies(); assertTrue(Foundries.defaultParserIsPDFBox()); pdfBoxDetails = Foundries.defaultInstance().getDetails(); test(pdfBoxResults, "org/verapdf/integration/tests/rules/corpus-pdfbox.yml"); @@ -100,6 +97,7 @@ public void testPdfBox() throws Exception { @Test public void testGreenfield() throws Exception { VeraGreenfieldFoundryProvider.initialise(); + RegressionTestingHelper.printDependencies(); assertFalse(Foundries.defaultParserIsPDFBox()); gfDetails = Foundries.defaultInstance().getDetails(); test(gfResults, "org/verapdf/integration/tests/rules/corpus-gf.yml"); From 4a11442e6db8223cbcd64405b9fbafe1b769c1a0 Mon Sep 17 00:00:00 2001 From: Maxim Date: Thu, 28 Sep 2023 14:06:53 +0300 Subject: [PATCH 12/24] Remove fixId from FixerConfig --- .../main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java index 5fb02a8..59a3205 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java @@ -79,7 +79,7 @@ public Set getPdfFileNames() { public void getFailedPolicyComplianceFiles(Map> failedFiles, PDFAFlavour flavour, ValidationProfile customProfile, Set fileNames) throws JAXBException, IOException { - MetadataFixerConfig fixConf = FixerFactory.configFromValues("test", true); + MetadataFixerConfig fixConf = FixerFactory.configFromValues("test"); ValidatorConfig validatorConfig = new ValidatorConfigBuilder().flavour(flavour) .defaultFlavour(PDFAFlavour.NO_FLAVOUR).recordPasses(true).maxFails(0) .isLogsEnabled(true).showErrorMessages(false).build(); From 49ad312fc1e536a03e023cda81631a26b80147c7 Mon Sep 17 00:00:00 2001 From: Maxim Date: Sun, 1 Oct 2023 23:57:47 +0300 Subject: [PATCH 13/24] Update RegressionTestingHelper --- .../pdfa/qa/RegressionTestingHelper.java | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java index 59a3205..371385a 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java @@ -111,7 +111,7 @@ public void getFailedPolicyComplianceFiles(Map> applyPolicy(tempSchFile, tempMrrFile, tempResultFile); int failedPolicyJobsCount = countFailedPolicyJobs(tempResultFile); if (failedPolicyJobsCount > 0) { - failedFiles.put(pdfName, getFailedChecks(tempResultFile)); + failedFiles.put(pdfName, getFailedChecks(tempResultFile, tempMrrFile)); } } catch (Exception e) { failedFiles.put(pdfName, Collections.singletonList(new FailedPolicyCheck(e.getMessage()))); @@ -183,24 +183,22 @@ public static int countFailedPolicyJobs(File xmlReport) throws IOException, SAXException, ParserConfigurationException, XPathExpressionException { DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = documentBuilder.parse(xmlReport); - XPath path = XPathFactory.newInstance().newXPath(); - return ((Number) path.evaluate("count(//policyReport[@failedChecks > 0])", document, XPathConstants.NUMBER)) - .intValue(); + return document.getElementsByTagName("svrl:failed-assert").getLength(); } - public static List getFailedChecks(File xmlReport) + public static List getFailedChecks(File xmlReport, File tempMrrFile) throws IOException, SAXException, ParserConfigurationException, XPathExpressionException { DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = documentBuilder.parse(xmlReport); + Document mrrDocument = documentBuilder.parse(tempMrrFile); XPath path = XPathFactory.newInstance().newXPath(); List failedChecks = new LinkedList<>(); - NodeList list = ((NodeList) path.evaluate("//policyReport/failedChecks/check", document, - XPathConstants.NODESET)); + NodeList list = document.getElementsByTagName("svrl:failed-assert"); for (int i = 0; i < list.getLength(); i++) { Element check = (Element) list.item(i); String test = check.getAttribute("test"); - String messageValue = getProperty(check, "message").getTextContent(); - Element node = (Element) path.evaluate(check.getAttribute("location"), document, XPathConstants.NODE); + String messageValue = getProperty(check, "svrl:text").getTextContent(); + Element node = (Element) path.evaluate(check.getAttribute("location"), mrrDocument, XPathConstants.NODE); failedChecks.add(new FailedPolicyCheck(node, messageValue, test)); } return failedChecks; @@ -208,18 +206,10 @@ public static List getFailedChecks(File xmlReport) public static void applyPolicy(File policyFile, File tempMrrFile, File tempResultFile) throws IOException, VeraPDFException { - File tempPolicyResult = File.createTempFile("policyResult", "veraPDF"); try (InputStream mrrIs = new FileInputStream(tempMrrFile); - OutputStream policyResultOs = new FileOutputStream(tempPolicyResult)) { + OutputStream policyResultOs = new FileOutputStream(tempResultFile)) { PolicyChecker.applyPolicy(policyFile, mrrIs, policyResultOs); } - try (OutputStream mrrReport = new FileOutputStream(tempResultFile)) { - PolicyChecker.insertPolicyReport(tempPolicyResult, tempMrrFile, mrrReport); - } - - if (!tempPolicyResult.delete()) { - tempPolicyResult.deleteOnExit(); - } } private static Node getProperty(Node parent, String propertyName) { From ba74917e08485d52109c6171cb5e51692f04a3a3 Mon Sep 17 00:00:00 2001 From: Maxim Date: Wed, 8 Nov 2023 11:28:48 +0300 Subject: [PATCH 14/24] Update corpus-pdfbox.yml --- .../org/verapdf/integration/tests/rules/corpus-pdfbox.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml b/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml index 58dfec3..56eead6 100644 --- a/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml +++ b/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml @@ -102,6 +102,9 @@ [ "5-t1-pass-a", "5-t2-pass-a", + "5-t3-pass-a", + "5-t4-pass-a", + "5-t5-pass-a", "7.1-t1-pass-a", "7.1-t1-pass-b", "7.1-t2-pass-a", From cc8fec9cb0c4e18d5bb2b687e2f39d9de0de29c5 Mon Sep 17 00:00:00 2001 From: Maxim Date: Thu, 9 Nov 2023 17:48:08 +0300 Subject: [PATCH 15/24] Update corpus-pdfbox.yml --- .../org/verapdf/integration/tests/rules/corpus-pdfbox.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml b/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml index 56eead6..fae5d77 100644 --- a/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml +++ b/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml @@ -213,6 +213,7 @@ "7.18.3-t1-pass-a", "7.18.4-t1-pass-a", "7.18.5-t1-pass-a", + "7.18.5-t1-pass-b", "7.18.5-t2-pass-a", "7.18.6.2-t1-pass-a", "7.18.6.2-t2-pass-a", From dd9aedfbf5f0ea095e5412553b3d9457b7d69d54 Mon Sep 17 00:00:00 2001 From: Maxim Date: Thu, 23 Nov 2023 14:08:07 +0300 Subject: [PATCH 16/24] Fix ProfilesMerger --- .../src/main/java/org/verapdf/pdfa/qa/ProfilesMerger.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ProfilesMerger.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ProfilesMerger.java index 499a198..6546dcc 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ProfilesMerger.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ProfilesMerger.java @@ -63,7 +63,7 @@ public static void mergeAtomicProfiles(OutputStream out, final String description, final String creator) throws IOException, JAXBException { SortedSet rules = new TreeSet<>(new RuleComparator()); - Set variables = new HashSet<>(); + SortedSet variables = new TreeSet<>(Comparator.comparing(Variable::getName)); PDFAFlavour flavour = null; for (File dir : root) { From e909066ca44ca16a2b711fd0befba4ce89bd9513 Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 15 Dec 2023 17:09:53 +0300 Subject: [PATCH 17/24] Support WCAG 2.2 and PDF/UA-2 --- .../src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java | 2 +- .../org/verapdf/pdfa/qa/GitHubBackedProfileDirectory.java | 4 ++-- .../java/org/verapdf/pdfa/qa/RegressionTestingHelper.java | 2 +- .../main/java/org/verapdf/pdfa/qa/ZipBackedTestCorpus.java | 3 +++ .../org/verapdf/integration/tests/rules/corpus-gf.yml | 3 +++ .../org/verapdf/integration/tests/rules/corpus-pdfbox.yml | 3 +++ .../verapdf/pdf/regression/tests/PDFRegressionTestUtils.java | 2 +- .../wcag/regression/tests/WCAGRegressionTestUtils.java | 2 +- 8 files changed, 15 insertions(+), 6 deletions(-) diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java index d2895e6..6f2342d 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java @@ -150,7 +150,7 @@ public enum Corpus { EnumSet.of(PDFAFlavour.PDFA_1_A, PDFAFlavour.PDFA_1_B, PDFAFlavour.PDFA_2_A, PDFAFlavour.PDFA_2_B, PDFAFlavour.PDFA_2_U, PDFAFlavour.PDFA_3_B, PDFAFlavour.PDFA_4, PDFAFlavour.PDFA_4_F, PDFAFlavour.PDFA_4_E, - PDFAFlavour.PDFUA_1), + PDFAFlavour.PDFUA_1, PDFAFlavour.PDFUA_2), URI.create(VERA_URL), "veraCorp-"), ISARTOR("Isartor", EnumSet.of(PDFAFlavour.PDFA_1_B), URI.create(ISARTOR_URL), "isartCorp-"), BFO("BFO", EnumSet.of(PDFAFlavour.PDFA_2_B), URI.create(BFO_URL), "bfoCorp-"), diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/GitHubBackedProfileDirectory.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/GitHubBackedProfileDirectory.java index 54af420..15b9694 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/GitHubBackedProfileDirectory.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/GitHubBackedProfileDirectory.java @@ -115,10 +115,10 @@ private static Set fromGitHubBranch(final String branchName) String PDFUApathPrefix = GITHUB_ROOT + branchName + PDFUA_PROFILE_PATH_PART + PDFUA_PROFILE_PREFIX; Set profileSet = new HashSet<>(); for (PDFAFlavour flavour : PDFAFlavour.values()) { - if (flavour == PDFAFlavour.NO_FLAVOUR || flavour == PDFAFlavour.WCAG2_1) { + if (flavour == PDFAFlavour.NO_FLAVOUR || flavour.getPart().getFamily() == PDFAFlavour.SpecificationFamily.WCAG) { continue; } - String profileURLString = (flavour != PDFAFlavour.PDFUA_1 ? PDFApathPrefix : PDFUApathPrefix) + String profileURLString = (flavour.getPart().getFamily() != PDFAFlavour.SpecificationFamily.PDF_UA ? PDFApathPrefix : PDFUApathPrefix) + flavour.getPart().getPartNumber() + flavour.getLevel().getCode().toUpperCase() + XML_SUFFIX; try { URL profileURL = new URL(profileURLString); diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java index 371385a..054f510 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java @@ -146,7 +146,7 @@ private void itemsMapFromZipSource(File zipFile, boolean isWcag) throws IOExcept while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); String entryName = entry.getName(); - if ((isWcag == entryName.contains("WCAG-21")) && !entry.isDirectory()) { + if ((isWcag == entryName.contains("WCAG_2_2")) && !entry.isDirectory()) { if (entryName.endsWith(".pdf")) { this.pdfMap.put(entryName, entry); } else if (entryName.endsWith(".sch")) { diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ZipBackedTestCorpus.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ZipBackedTestCorpus.java index 581bdf0..2464162 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ZipBackedTestCorpus.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/ZipBackedTestCorpus.java @@ -118,6 +118,9 @@ public static boolean checkFlavour(final String item, final PDFAFlavour flavour) if (flavour == PDFAFlavour.PDFUA_1) { return item.contains("PDF_UA-1"); } + if (flavour == PDFAFlavour.PDFUA_2) { + return item.contains("PDF_UA-2"); + } if (flavour == PDFAFlavour.PDFA_4) { return item.contains("PDF_A-4") && !matchFlavour(item, PDFAFlavour.PDFA_4_E) && !matchFlavour(item, PDFAFlavour.PDFA_4_F); } diff --git a/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-gf.yml b/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-gf.yml index dd4d40c..7ca2798 100644 --- a/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-gf.yml +++ b/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-gf.yml @@ -33,6 +33,9 @@ "ua1": [ ] + "ua2": + [ + ] "BFO": "2b": [ diff --git a/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml b/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml index fae5d77..772ec67 100644 --- a/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml +++ b/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml @@ -242,6 +242,9 @@ "7.21.7-t1-pass-c", "7.21.7-t2-pass-a", ] + "ua2": + [ + ] "BFO": "2b": [ diff --git a/veraPDF-pdf-regression-tests/src/main/java/org/verapdf/pdf/regression/tests/PDFRegressionTestUtils.java b/veraPDF-pdf-regression-tests/src/main/java/org/verapdf/pdf/regression/tests/PDFRegressionTestUtils.java index ecf742c..70a5164 100644 --- a/veraPDF-pdf-regression-tests/src/main/java/org/verapdf/pdf/regression/tests/PDFRegressionTestUtils.java +++ b/veraPDF-pdf-regression-tests/src/main/java/org/verapdf/pdf/regression/tests/PDFRegressionTestUtils.java @@ -17,7 +17,7 @@ public class PDFRegressionTestUtils { PDFAFlavour.PDFA_2_A, PDFAFlavour.PDFA_2_B, PDFAFlavour.PDFA_2_U, PDFAFlavour.PDFA_3_A, PDFAFlavour.PDFA_3_B, PDFAFlavour.PDFA_3_U, PDFAFlavour.PDFA_4, PDFAFlavour.PDFA_4_F, PDFAFlavour.PDFA_4_E, - PDFAFlavour.PDFUA_1); + PDFAFlavour.PDFUA_1, PDFAFlavour.PDFUA_2); private static final EnumMap> filesByFlavour = new EnumMap<>(PDFAFlavour.class); public static void main(String[] args) { diff --git a/veraPDF-wcag-regression-tests/src/main/java/org/verapdf/wcag/regression/tests/WCAGRegressionTestUtils.java b/veraPDF-wcag-regression-tests/src/main/java/org/verapdf/wcag/regression/tests/WCAGRegressionTestUtils.java index 2d8a35b..f46a893 100644 --- a/veraPDF-wcag-regression-tests/src/main/java/org/verapdf/wcag/regression/tests/WCAGRegressionTestUtils.java +++ b/veraPDF-wcag-regression-tests/src/main/java/org/verapdf/wcag/regression/tests/WCAGRegressionTestUtils.java @@ -15,7 +15,7 @@ import java.util.Map; public class WCAGRegressionTestUtils { - private static final String wcagProfileUrl = "https://github.com/veraPDF/veraPDF-validation-profiles/raw/integration/PDF_UA/WCAG-21-Complete.xml"; + private static final String wcagProfileUrl = "https://github.com/veraPDF/veraPDF-validation-profiles/raw/integration/PDF_UA/WCAG-2-2-Complete.xml"; public static void main(String[] args) { test(); From d314ff92430973059011f31b9f478bb27a4b04ac Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 22 Dec 2023 17:27:32 +0300 Subject: [PATCH 18/24] Update corpus-pdfbox.yml --- .../org/verapdf/integration/tests/rules/corpus-pdfbox.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml b/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml index 772ec67..ebc2e33 100644 --- a/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml +++ b/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml @@ -15,6 +15,7 @@ "6.3.8-t1-pass-h", "6.3.8-t1-pass-i", "6.3.8-t1-pass-j", + "6.8.4-t1-pass-f" ] "1b": [ @@ -244,6 +245,7 @@ ] "ua2": [ + "5-t2-pass-a" ] "BFO": "2b": From 56c50c3d597ec7363a7af61f74cb4757c3c5e043 Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 9 Feb 2024 15:56:33 +0300 Subject: [PATCH 19/24] RC - v1.26 --- README.md | 2 +- pom.xml | 10 +++++----- veraPDF-integration/pom.xml | 2 +- .../org/verapdf/pdfa/qa/RegressionTestingHelper.java | 2 +- .../pdfa/validation/validators/test/ValidatorTest.java | 2 +- .../org/verapdf/pdfa/validators/test/ProfilesTest.java | 2 +- veraPDF-pdf-regression-tests/pom.xml | 2 +- veraPDF-wcag-regression-tests/pom.xml | 4 ++-- .../wcag/regression/tests/WCAGRegressionTestUtils.java | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 008b43f..2090be7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ veraPDF-integration-tests ========================= -[![Build Status](https://jenkins.openpreservation.org/job/veraPDF/job/1.25/job/integration-tests/badge/icon)](https://jenkins.openpreservation.org/job/veraPDF/job/1.25/job/integration-tests/ "OPF Jenkins") +[![Build Status](https://jenkins.openpreservation.org/job/veraPDF/job/1.26rc/job/integration-tests/badge/icon)](https://jenkins.openpreservation.org/job/veraPDF/job/1.26rc/job/integration-tests/ "OPF Jenkins") [![CodeCov Coverage](https://img.shields.io/codecov/c/github/veraPDF/veraPDF-integration-tests.svg)](https://codecov.io/gh/veraPDF/veraPDF-integration-tests/ "CodeCov coverage") [![Codacy Badge](https://app.codacy.com/project/badge/Grade/8d54ee7467f14bf5844b91081981f6ee)](https://app.codacy.com/gh/veraPDF/veraPDF-integration-tests/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade "Codacy coverage") diff --git a/pom.xml b/pom.xml index 9ffc464..6064d93 100644 --- a/pom.xml +++ b/pom.xml @@ -27,11 +27,11 @@ verapdf-parent org.verapdf - 1.25.1 + 1.26.1 verapdf-integration-tests - 1.25.0-SNAPSHOT + 1.26.0-RC1 pom veraPDF Quality Assurance @@ -72,9 +72,9 @@ 0.8.1 - [1.25.0,1.26.0-RC) - [1.25.0,1.26.0-RC) - [1.25.0,1.26.0-RC) + [1.26.0-RC,1.27.0) + [1.26.0-RC,1.27.0) + [1.26.0-RC,1.27.0) 1.70 diff --git a/veraPDF-integration/pom.xml b/veraPDF-integration/pom.xml index 117b1ac..49a870c 100644 --- a/veraPDF-integration/pom.xml +++ b/veraPDF-integration/pom.xml @@ -28,7 +28,7 @@ verapdf-integration-tests org.verapdf - 1.25.0-SNAPSHOT + 1.26.0-RC1 veraPDF-integration diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java index 054f510..5897ce4 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java @@ -52,7 +52,7 @@ import org.xml.sax.SAXException; public class RegressionTestingHelper { - private static final String testFilesZipUrl = "https://github.com/veraPDF/veraPDF-regression-tests/archive/refs/heads/integration.zip"; + private static final String testFilesZipUrl = "https://github.com/veraPDF/veraPDF-regression-tests/archive/refs/heads/rc/1.26.zip"; private final ZipFile zipSource; private final Map pdfMap; diff --git a/veraPDF-integration/src/test/java/org/verapdf/pdfa/validation/validators/test/ValidatorTest.java b/veraPDF-integration/src/test/java/org/verapdf/pdfa/validation/validators/test/ValidatorTest.java index 37656a7..ff5ab1e 100644 --- a/veraPDF-integration/src/test/java/org/verapdf/pdfa/validation/validators/test/ValidatorTest.java +++ b/veraPDF-integration/src/test/java/org/verapdf/pdfa/validation/validators/test/ValidatorTest.java @@ -61,7 +61,7 @@ */ @SuppressWarnings("static-method") public class ValidatorTest { - private static final ProfileDirectory PROFILES = GitHubBackedProfileDirectory.fromBranch("integration"); + private static final ProfileDirectory PROFILES = GitHubBackedProfileDirectory.fromBranch("rc/1.26"); @BeforeClass public static final void SetUp() { diff --git a/veraPDF-integration/src/test/java/org/verapdf/pdfa/validators/test/ProfilesTest.java b/veraPDF-integration/src/test/java/org/verapdf/pdfa/validators/test/ProfilesTest.java index 1894390..9c67dbb 100644 --- a/veraPDF-integration/src/test/java/org/verapdf/pdfa/validators/test/ProfilesTest.java +++ b/veraPDF-integration/src/test/java/org/verapdf/pdfa/validators/test/ProfilesTest.java @@ -36,7 +36,7 @@ */ @SuppressWarnings("static-method") public class ProfilesTest { - private static final org.verapdf.pdfa.validation.profiles.ProfileDirectory INTEGRATION_PROFILES = GitHubBackedProfileDirectory.fromBranch("integration"); + private static final org.verapdf.pdfa.validation.profiles.ProfileDirectory INTEGRATION_PROFILES = GitHubBackedProfileDirectory.fromBranch("rc/1.26"); /** * Test method for {@link org.verapdf.pdfa.validation.profiles.ValidationProfileImpl#getPDFAFlavour()}. diff --git a/veraPDF-pdf-regression-tests/pom.xml b/veraPDF-pdf-regression-tests/pom.xml index b1df6f3..dc280ea 100644 --- a/veraPDF-pdf-regression-tests/pom.xml +++ b/veraPDF-pdf-regression-tests/pom.xml @@ -26,7 +26,7 @@ verapdf-integration-tests org.verapdf - 1.25.0-SNAPSHOT + 1.26.0-RC1 4.0.0 diff --git a/veraPDF-wcag-regression-tests/pom.xml b/veraPDF-wcag-regression-tests/pom.xml index 091ae96..102047a 100644 --- a/veraPDF-wcag-regression-tests/pom.xml +++ b/veraPDF-wcag-regression-tests/pom.xml @@ -26,12 +26,12 @@ verapdf-integration-tests org.verapdf - 1.25.0-SNAPSHOT + 1.26.0-RC1 4.0.0 veraPDF-wcag-regression-tests - 1.25.0-SNAPSHOT + 1.26.0-RC1 veraPDF WCAG Regression Tests diff --git a/veraPDF-wcag-regression-tests/src/main/java/org/verapdf/wcag/regression/tests/WCAGRegressionTestUtils.java b/veraPDF-wcag-regression-tests/src/main/java/org/verapdf/wcag/regression/tests/WCAGRegressionTestUtils.java index f46a893..d0ba37b 100644 --- a/veraPDF-wcag-regression-tests/src/main/java/org/verapdf/wcag/regression/tests/WCAGRegressionTestUtils.java +++ b/veraPDF-wcag-regression-tests/src/main/java/org/verapdf/wcag/regression/tests/WCAGRegressionTestUtils.java @@ -15,7 +15,7 @@ import java.util.Map; public class WCAGRegressionTestUtils { - private static final String wcagProfileUrl = "https://github.com/veraPDF/veraPDF-validation-profiles/raw/integration/PDF_UA/WCAG-2-2-Complete.xml"; + private static final String wcagProfileUrl = "https://github.com/veraPDF/veraPDF-validation-profiles/raw/rc/1.26/PDF_UA/WCAG-2-2-Complete.xml"; public static void main(String[] args) { test(); From 6a1d6a11047ec6c05b0ff0afe43b443c2f0269bb Mon Sep 17 00:00:00 2001 From: MaximPlusov Date: Mon, 18 Mar 2024 12:29:12 +0300 Subject: [PATCH 20/24] Fix corpus branch --- .../src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java index 6f2342d..12d02cd 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java @@ -41,7 +41,7 @@ */ @XmlRootElement(namespace = "http://www.verapdf.org/corpus", name = "corpus") public abstract class AbstractTestCorpus implements TestCorpus { - private static final String VERA_URL = "https://github.com/veraPDF/veraPDF-corpus/archive/staging.zip"; + private static final String VERA_URL = "https://github.com/veraPDF/veraPDF-corpus/archive/rc/1.26.zip"; private static final String ISARTOR_URL = "https://corpora.openpreservation.org/veraPDF/isartor-pdfa-2008-08-13.zip"; private static final String BFO_URL = "https://github.com/bfosupport/pdfa-testsuite/archive/master.zip"; From 402627e976c60f68b4d2237124c806baee8d6ffb Mon Sep 17 00:00:00 2001 From: Vadim <69987865+ProxyNexus@users.noreply.github.com> Date: Wed, 21 Feb 2024 13:43:56 +0300 Subject: [PATCH 21/24] Workflow update (#147) * Updated action dependencies * Updated arlington/jakarta workflow --- .github/workflows/run-pdfa-tests-workflow.yml | 5 +++-- .github/workflows/run-tests-workflow.yml | 5 +++-- .github/workflows/test-pr.yml | 11 +++++++---- .../workflows/update-arlington-workflow.yml | 11 +++++++---- .github/workflows/update-jakarta-workflow.yml | 11 +++++++---- .travis.yml | 18 ------------------ README.md | 2 +- 7 files changed, 28 insertions(+), 35 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/run-pdfa-tests-workflow.yml b/.github/workflows/run-pdfa-tests-workflow.yml index 5775f30..35a23e2 100644 --- a/.github/workflows/run-pdfa-tests-workflow.yml +++ b/.github/workflows/run-pdfa-tests-workflow.yml @@ -7,13 +7,14 @@ jobs: run_tests: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true - name: Set up JDK 1.11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: 1.11 + distribution: 'temurin' - name: Set up run: mvn -B -DskipTests=true clean package --file pom.xml - name: Run pdf/a and pdf/ua regression tests diff --git a/.github/workflows/run-tests-workflow.yml b/.github/workflows/run-tests-workflow.yml index 3442877..6ff3aef 100644 --- a/.github/workflows/run-tests-workflow.yml +++ b/.github/workflows/run-tests-workflow.yml @@ -7,13 +7,14 @@ jobs: run_tests: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true - name: Set up JDK 1.11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: 1.11 + distribution: 'temurin' - name: Set up run: mvn -B -DskipTests=true clean package --file pom.xml - name: Run wcag regression tests diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index 3b30365..e8abce4 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -7,16 +7,19 @@ on: jobs: build: name: Checkout and Build - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest + + continue-on-error: true strategy: + fail-fast: false matrix: - java-version: [8, 11, 16, 17] + java-version: [8, 11, 16, 17, 21] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: JDK setup - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: java-version: ${{ matrix.java-version }} distribution: 'temurin' diff --git a/.github/workflows/update-arlington-workflow.yml b/.github/workflows/update-arlington-workflow.yml index e812c8e..d60400d 100644 --- a/.github/workflows/update-arlington-workflow.yml +++ b/.github/workflows/update-arlington-workflow.yml @@ -9,18 +9,21 @@ jobs: checkout-and-build: runs-on: ubuntu-latest + continue-on-error: true + strategy: + fail-fast: false matrix: - java-version: [11, 16, 17] + java-version: [11, 16, 17, 21] steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 ref: integration - name: JDK setup - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: ${{ matrix.java-version }} distribution: 'temurin' @@ -44,7 +47,7 @@ jobs: needs: checkout-and-build steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 ref: integration diff --git a/.github/workflows/update-jakarta-workflow.yml b/.github/workflows/update-jakarta-workflow.yml index fb87747..8e05273 100644 --- a/.github/workflows/update-jakarta-workflow.yml +++ b/.github/workflows/update-jakarta-workflow.yml @@ -9,18 +9,21 @@ jobs: checkout-and-build: runs-on: ubuntu-latest + continue-on-error: true + strategy: + fail-fast: false matrix: - java-version: [11, 16, 17] + java-version: [11, 16, 17, 21] steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 ref: integration - name: JDK setup - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: ${{ matrix.java-version }} distribution: 'temurin' @@ -44,7 +47,7 @@ jobs: needs: checkout-and-build steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 ref: integration diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3d59eff..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: java -sudo: required -dist: trusty - -jdk: - - openjdk8 - - oraclejdk8 - - openjdk11 - -branches: - except: - - /^v|d\d+\.\d+\.\d+$/ - -install: - - mvn clean install -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2 -Dmaven.wagon.http.pool=false - -script: - - cat target/test-results/index.html diff --git a/README.md b/README.md index 2090be7..1ef528e 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Quick Start In order to build the library you'll need: - * Java 8 - 17, which can be downloaded [from Oracle](https://www.oracle.com/technetwork/java/javase/downloads/index.html), or for Linux users [OpenJDK](https://openjdk.java.net/install/index.html). + * Java 8 - 21, which can be downloaded [from Oracle](https://www.oracle.com/technetwork/java/javase/downloads/index.html), or for Linux users [OpenJDK](https://openjdk.java.net/install/index.html). * [Maven v3+](https://maven.apache.org/) Life will be easier if you also use [Git](https://git-scm.com/) to obtain and manage the source. From 148d0a508a96b74eb451cd7cedc1a08bacc20ed7 Mon Sep 17 00:00:00 2001 From: Maxim Date: Wed, 21 Feb 2024 14:12:29 +0300 Subject: [PATCH 22/24] Update regression tests workflows --- .github/workflows/run-pdfa-tests-workflow.yml | 6 +++--- .github/workflows/run-tests-workflow.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/run-pdfa-tests-workflow.yml b/.github/workflows/run-pdfa-tests-workflow.yml index 35a23e2..2614dc2 100644 --- a/.github/workflows/run-pdfa-tests-workflow.yml +++ b/.github/workflows/run-pdfa-tests-workflow.yml @@ -10,17 +10,17 @@ jobs: - uses: actions/checkout@v4 with: submodules: true - - name: Set up JDK 1.11 + - name: Set up JDK 11 uses: actions/setup-java@v4 with: - java-version: 1.11 + java-version: 11 distribution: 'temurin' - name: Set up run: mvn -B -DskipTests=true clean package --file pom.xml - name: Run pdf/a and pdf/ua regression tests run: java -Djdk.xml.xpathTotalOpLimit=0 -Djdk.xml.xpathExprOpLimit=0 -Djdk.xml.xpathExprGrpLimit=0 -cp "/home/runner/work/veraPDF-integration-tests/veraPDF-integration-tests/veraPDF-pdf-regression-tests/target"/'*' org.verapdf.pdf.regression.tests.PDFRegressionTestUtils - - name: Notify slack tests succeded + - name: Notify slack tests succeeded if: success() env: SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }} diff --git a/.github/workflows/run-tests-workflow.yml b/.github/workflows/run-tests-workflow.yml index 6ff3aef..27c5562 100644 --- a/.github/workflows/run-tests-workflow.yml +++ b/.github/workflows/run-tests-workflow.yml @@ -10,17 +10,17 @@ jobs: - uses: actions/checkout@v4 with: submodules: true - - name: Set up JDK 1.11 + - name: Set up JDK 11 uses: actions/setup-java@v4 with: - java-version: 1.11 + java-version: 11 distribution: 'temurin' - name: Set up run: mvn -B -DskipTests=true clean package --file pom.xml - name: Run wcag regression tests run: java -Djdk.xml.xpathTotalOpLimit=0 -Djdk.xml.xpathExprOpLimit=0 -Djdk.xml.xpathExprGrpLimit=0 -cp "/home/runner/work/veraPDF-integration-tests/veraPDF-integration-tests/veraPDF-wcag-regression-tests/target"/'*' org.verapdf.wcag.regression.tests.WCAGRegressionTestUtils - - name: Notify slack tests succeded + - name: Notify slack tests succeeded if: success() env: SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }} From d112a1af41de75624aa3f30b036cca0f74fa36b6 Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 17 May 2024 11:37:46 +0300 Subject: [PATCH 23/24] REL - Release v1.26 - bumped minor version to 1.26 - updated Maven dependencies - changed test files branch to rel/1.26 - updated parent version to 1.26.2 --- README.md | 2 +- pom.xml | 10 +++++----- veraPDF-integration/pom.xml | 2 +- .../java/org/verapdf/pdfa/qa/AbstractTestCorpus.java | 2 +- .../org/verapdf/pdfa/qa/RegressionTestingHelper.java | 2 +- .../pdfa/validation/validators/test/ValidatorTest.java | 2 +- .../org/verapdf/pdfa/validators/test/ProfilesTest.java | 2 +- veraPDF-pdf-regression-tests/pom.xml | 2 +- veraPDF-wcag-regression-tests/pom.xml | 4 ++-- .../wcag/regression/tests/WCAGRegressionTestUtils.java | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 1ef528e..d5bb44b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ veraPDF-integration-tests ========================= -[![Build Status](https://jenkins.openpreservation.org/job/veraPDF/job/1.26rc/job/integration-tests/badge/icon)](https://jenkins.openpreservation.org/job/veraPDF/job/1.26rc/job/integration-tests/ "OPF Jenkins") +[![Build Status](https://jenkins.openpreservation.org/job/veraPDF/job/1.26/job/integration-tests/badge/icon)](https://jenkins.openpreservation.org/job/veraPDF/job/1.26/job/integration-tests/ "OPF Jenkins") [![CodeCov Coverage](https://img.shields.io/codecov/c/github/veraPDF/veraPDF-integration-tests.svg)](https://codecov.io/gh/veraPDF/veraPDF-integration-tests/ "CodeCov coverage") [![Codacy Badge](https://app.codacy.com/project/badge/Grade/8d54ee7467f14bf5844b91081981f6ee)](https://app.codacy.com/gh/veraPDF/veraPDF-integration-tests/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade "Codacy coverage") diff --git a/pom.xml b/pom.xml index 6064d93..37f80e9 100644 --- a/pom.xml +++ b/pom.xml @@ -27,11 +27,11 @@ verapdf-parent org.verapdf - 1.26.1 + 1.26.2 verapdf-integration-tests - 1.26.0-RC1 + 1.26.0 pom veraPDF Quality Assurance @@ -72,9 +72,9 @@ 0.8.1 - [1.26.0-RC,1.27.0) - [1.26.0-RC,1.27.0) - [1.26.0-RC,1.27.0) + [1.26.0,1.27.0) + [1.26.0,1.27.0) + [1.26.0,1.27.0) 1.70 diff --git a/veraPDF-integration/pom.xml b/veraPDF-integration/pom.xml index 49a870c..fdce2ff 100644 --- a/veraPDF-integration/pom.xml +++ b/veraPDF-integration/pom.xml @@ -28,7 +28,7 @@ verapdf-integration-tests org.verapdf - 1.26.0-RC1 + 1.26.0 veraPDF-integration diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java index 12d02cd..cc040bc 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/AbstractTestCorpus.java @@ -41,7 +41,7 @@ */ @XmlRootElement(namespace = "http://www.verapdf.org/corpus", name = "corpus") public abstract class AbstractTestCorpus implements TestCorpus { - private static final String VERA_URL = "https://github.com/veraPDF/veraPDF-corpus/archive/rc/1.26.zip"; + private static final String VERA_URL = "https://github.com/veraPDF/veraPDF-corpus/archive/rel/1.26.zip"; private static final String ISARTOR_URL = "https://corpora.openpreservation.org/veraPDF/isartor-pdfa-2008-08-13.zip"; private static final String BFO_URL = "https://github.com/bfosupport/pdfa-testsuite/archive/master.zip"; diff --git a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java index 5897ce4..f79c06c 100644 --- a/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java +++ b/veraPDF-integration/src/main/java/org/verapdf/pdfa/qa/RegressionTestingHelper.java @@ -52,7 +52,7 @@ import org.xml.sax.SAXException; public class RegressionTestingHelper { - private static final String testFilesZipUrl = "https://github.com/veraPDF/veraPDF-regression-tests/archive/refs/heads/rc/1.26.zip"; + private static final String testFilesZipUrl = "https://github.com/veraPDF/veraPDF-regression-tests/archive/refs/heads/rel/1.26.zip"; private final ZipFile zipSource; private final Map pdfMap; diff --git a/veraPDF-integration/src/test/java/org/verapdf/pdfa/validation/validators/test/ValidatorTest.java b/veraPDF-integration/src/test/java/org/verapdf/pdfa/validation/validators/test/ValidatorTest.java index ff5ab1e..5057550 100644 --- a/veraPDF-integration/src/test/java/org/verapdf/pdfa/validation/validators/test/ValidatorTest.java +++ b/veraPDF-integration/src/test/java/org/verapdf/pdfa/validation/validators/test/ValidatorTest.java @@ -61,7 +61,7 @@ */ @SuppressWarnings("static-method") public class ValidatorTest { - private static final ProfileDirectory PROFILES = GitHubBackedProfileDirectory.fromBranch("rc/1.26"); + private static final ProfileDirectory PROFILES = GitHubBackedProfileDirectory.fromBranch("rel/1.26"); @BeforeClass public static final void SetUp() { diff --git a/veraPDF-integration/src/test/java/org/verapdf/pdfa/validators/test/ProfilesTest.java b/veraPDF-integration/src/test/java/org/verapdf/pdfa/validators/test/ProfilesTest.java index 9c67dbb..37c9ac6 100644 --- a/veraPDF-integration/src/test/java/org/verapdf/pdfa/validators/test/ProfilesTest.java +++ b/veraPDF-integration/src/test/java/org/verapdf/pdfa/validators/test/ProfilesTest.java @@ -36,7 +36,7 @@ */ @SuppressWarnings("static-method") public class ProfilesTest { - private static final org.verapdf.pdfa.validation.profiles.ProfileDirectory INTEGRATION_PROFILES = GitHubBackedProfileDirectory.fromBranch("rc/1.26"); + private static final org.verapdf.pdfa.validation.profiles.ProfileDirectory INTEGRATION_PROFILES = GitHubBackedProfileDirectory.fromBranch("rel/1.26"); /** * Test method for {@link org.verapdf.pdfa.validation.profiles.ValidationProfileImpl#getPDFAFlavour()}. diff --git a/veraPDF-pdf-regression-tests/pom.xml b/veraPDF-pdf-regression-tests/pom.xml index dc280ea..cafbb58 100644 --- a/veraPDF-pdf-regression-tests/pom.xml +++ b/veraPDF-pdf-regression-tests/pom.xml @@ -26,7 +26,7 @@ verapdf-integration-tests org.verapdf - 1.26.0-RC1 + 1.26.0 4.0.0 diff --git a/veraPDF-wcag-regression-tests/pom.xml b/veraPDF-wcag-regression-tests/pom.xml index 102047a..40fa8fc 100644 --- a/veraPDF-wcag-regression-tests/pom.xml +++ b/veraPDF-wcag-regression-tests/pom.xml @@ -26,12 +26,12 @@ verapdf-integration-tests org.verapdf - 1.26.0-RC1 + 1.26.0 4.0.0 veraPDF-wcag-regression-tests - 1.26.0-RC1 + 1.26.0 veraPDF WCAG Regression Tests diff --git a/veraPDF-wcag-regression-tests/src/main/java/org/verapdf/wcag/regression/tests/WCAGRegressionTestUtils.java b/veraPDF-wcag-regression-tests/src/main/java/org/verapdf/wcag/regression/tests/WCAGRegressionTestUtils.java index d0ba37b..cf911a6 100644 --- a/veraPDF-wcag-regression-tests/src/main/java/org/verapdf/wcag/regression/tests/WCAGRegressionTestUtils.java +++ b/veraPDF-wcag-regression-tests/src/main/java/org/verapdf/wcag/regression/tests/WCAGRegressionTestUtils.java @@ -15,7 +15,7 @@ import java.util.Map; public class WCAGRegressionTestUtils { - private static final String wcagProfileUrl = "https://github.com/veraPDF/veraPDF-validation-profiles/raw/rc/1.26/PDF_UA/WCAG-2-2-Complete.xml"; + private static final String wcagProfileUrl = "https://github.com/veraPDF/veraPDF-validation-profiles/raw/rel/1.26/PDF_UA/WCAG-2-2-Complete.xml"; public static void main(String[] args) { test(); From 88a4dd2c298ab24afdc199293c3cdbce9f3841d8 Mon Sep 17 00:00:00 2001 From: Maxim Date: Thu, 18 Apr 2024 18:22:56 +0300 Subject: [PATCH 24/24] Update corpus-pdfbox.yml --- .../integration/tests/rules/corpus-pdfbox.yml | 49 ++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml b/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml index ebc2e33..ca26850 100644 --- a/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml +++ b/veraPDF-integration/src/test/resources/org/verapdf/integration/tests/rules/corpus-pdfbox.yml @@ -245,7 +245,54 @@ ] "ua2": [ - "5-t2-pass-a" + "5-t2-pass-a", + "8.2.2-t1-pass-a", + "8.2.2-t1-pass-b", + "8.2.4-t1-pass-a", + "8.2.4-t1-pass-b", + "8.2.4-t2-pass-a", + "8.2.5.26-t1-pass-a", + "8.2.5.26-t1-pass-b", + "8.2.5.26-t5-pass-a", + "8.2.5.26-t5-pass-b", + "8.2.5.26-t5-pass-c", + "8.2.5.26-t5-pass-d", + "8.2.5.26-t5-pass-e", + "8.2.5.28.2-t1-pass-a", + "8.2.5.28.2-t1-pass-b", + "8.2.5.28.2-t1-pass-c", + "8.4.4-t2-pass-a", + "8.4.4-t2-pass-b", + "8.4.4-t2-pass-c", + "8.4.4-t2-pass-d", + "8.4.4-t2-pass-e", + "8.4.4-t2-pass-f", + "8.4.4-t2-pass-g", + "8.4.4-t2-pass-h", + "8.4.4-t2-pass-i", + "8.4.4-t2-pass-j", + "8.4.5.3.1-t1-pass-a", + "8.4.5.3.1-t1-pass-b", + "8.4.5.3.1-t1-pass-c", + "8.4.5.3.1-t1-pass-d", + "8.4.5.3.2-t1-pass-a", + "8.4.5.4-t1-pass-a", + "8.4.5.4-t2-pass-a", + "8.4.5.4-t3-pass-a", + "8.4.5.5.1-t1-pass-a", + "8.4.5.6-t1-pass-a", + "8.4.5.7-t2-pass-a", + "8.4.5.7-t2-pass-b", + "8.4.5.7-t2-pass-c", + "8.4.5.7-t2-pass-d", + "8.4.5.7-t3-pass-a", + "8.4.5.8-t1-pass-a", + "8.4.5.8-t1-pass-b", + "8.4.5.8-t1-pass-c", + "8.4.5.8-t2-pass-a", + "8.7-t2-pass-a", + "8.11.1-t1-pass-a", + "8.11.2-t1-pass-a" ] "BFO": "2b":