diff --git a/src/main/java/com/adobe/epubcheck/ocf/OCFChecker.java b/src/main/java/com/adobe/epubcheck/ocf/OCFChecker.java index 6521d9b70..1e055d619 100755 --- a/src/main/java/com/adobe/epubcheck/ocf/OCFChecker.java +++ b/src/main/java/com/adobe/epubcheck/ocf/OCFChecker.java @@ -28,7 +28,6 @@ import java.util.HashSet; import java.util.LinkedList; import java.util.List; -import java.util.Map; import java.util.Set; import org.w3c.epubcheck.constants.MIMEType; @@ -319,7 +318,7 @@ private boolean checkContainerStructure(OCFCheckerState state) new OCFFilenameChecker(resource.getPath(), state.context().build()).check(); // Report entry metadata - reportFeatures(resource.getProperties()); + reportFeatures(resource); // Add the resource to the container model state.addResource(resource); @@ -553,11 +552,12 @@ private EPUBVersion checkPublicationVersion(OCFCheckerState state) } } - private void reportFeatures(Map features) + private void reportFeatures(OCFResource resource) { - for (FeatureEnum feature : features.keySet()) + for (FeatureEnum feature : resource.getProperties().keySet()) { - report.info(context.path, feature, features.get(feature)); +// report.info(context.path, feature, resource.getProperties().get(feature)); + report.info(resource.getPath(), feature, resource.getProperties().get(feature)); } } diff --git a/src/main/java/com/adobe/epubcheck/opf/OPFHandler.java b/src/main/java/com/adobe/epubcheck/opf/OPFHandler.java index ed6ff7f16..c709247f9 100755 --- a/src/main/java/com/adobe/epubcheck/opf/OPFHandler.java +++ b/src/main/java/com/adobe/epubcheck/opf/OPFHandler.java @@ -287,8 +287,6 @@ else if (name.equals("item")) String mediaOverlay = e.getAttribute("media-overlay"); itemBuilder.mediaOverlay(mediaOverlay); - - report.info(href, FeatureEnum.UNIQUE_IDENT, id); } } } @@ -641,6 +639,7 @@ private void buildItems() */ protected void reportItem(OPFItem item) { + report.info(item.getPath(), FeatureEnum.UNIQUE_IDENT, item.getId()); if (item.isInSpine()) { report.info(item.getPath(), FeatureEnum.IS_SPINEITEM, "true"); diff --git a/src/test/resources/reporting/files/minimal/EPUB/content_001.xhtml b/src/test/resources/reporting/files/minimal/EPUB/content_001.xhtml new file mode 100644 index 000000000..43a520ea2 --- /dev/null +++ b/src/test/resources/reporting/files/minimal/EPUB/content_001.xhtml @@ -0,0 +1,11 @@ + + + + + Minimal EPUB + + +

Loomings

+

Call me Ishmael.

+ + diff --git a/src/test/resources/reporting/files/minimal/EPUB/nav.xhtml b/src/test/resources/reporting/files/minimal/EPUB/nav.xhtml new file mode 100644 index 000000000..240745e63 --- /dev/null +++ b/src/test/resources/reporting/files/minimal/EPUB/nav.xhtml @@ -0,0 +1,14 @@ + + + + + Minimal Nav + + + + + diff --git a/src/test/resources/reporting/files/minimal/EPUB/package.opf b/src/test/resources/reporting/files/minimal/EPUB/package.opf new file mode 100644 index 000000000..0d1eec6e9 --- /dev/null +++ b/src/test/resources/reporting/files/minimal/EPUB/package.opf @@ -0,0 +1,16 @@ + + + + Minimal EPUB 3.0 + en + NOID + 2017-06-14T00:00:01Z + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/reporting/files/minimal/META-INF/container.xml b/src/test/resources/reporting/files/minimal/META-INF/container.xml new file mode 100644 index 000000000..318782179 --- /dev/null +++ b/src/test/resources/reporting/files/minimal/META-INF/container.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/test/resources/reporting/files/minimal/mimetype b/src/test/resources/reporting/files/minimal/mimetype new file mode 100644 index 000000000..57ef03f24 --- /dev/null +++ b/src/test/resources/reporting/files/minimal/mimetype @@ -0,0 +1 @@ +application/epub+zip \ No newline at end of file diff --git a/src/test/resources/reporting/json-report.feature b/src/test/resources/reporting/json-report.feature new file mode 100644 index 000000000..4a86b4e04 --- /dev/null +++ b/src/test/resources/reporting/json-report.feature @@ -0,0 +1,15 @@ + Feature: EPUBCheck - JSON Report tests + + Checks the JSON report format + + + Background: + Given EPUB test files located at '/reporting/files/' + And the reporting format is set to JSON + And EPUBCheck with default settings + + Scenario: Basic well-formedness checks + When checking EPUB 'minimal' + Then the JSON report is valid + And JSON at '$.items' contains 5 items + And JSON at '$..checkSum' has no null values