Skip to content

Commit

Permalink
Merge pull request #836 from NASA-PDS/i822
Browse files Browse the repository at this point in the history
Fix regression where unlabeled files are not being identified
  • Loading branch information
jordanpadams authored Feb 23, 2024
2 parents 918da20 + a42e3a3 commit 58835e1
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 782 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package gov.nasa.pds.tools.validate.rule;

import java.net.URISyntaxException;
import java.util.Arrays;
import gov.nasa.pds.tools.util.Utility;
import gov.nasa.pds.tools.validate.Target;
import gov.nasa.pds.tools.validate.TargetRegistrar;
Expand Down Expand Up @@ -48,6 +49,9 @@ public void registerTargets() {
try {
Crawler crawler = getContext().getCrawler();
WildcardOSFilter fileFilter = getContext().getFileFilters();
if (!"PDS4 Directory".equalsIgnoreCase(getContext().getRule().getCaption())) {
fileFilter = new WildcardOSFilter(Arrays.asList(new String[] {"*"}));
}
for (Target child : crawler.crawl(getTarget(), getContext().isRecursive(), fileFilter)) {
try {
String childLocation = child.getUrl().toURI().normalize().toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static AuthInformation buildFrom(String filename)
// Determine which file processing to use
if (line.startsWith("<?xml ") && line.endsWith("?>")) { // XML
// <registry url="http://localhost:9200" index="registry" auth="/path/to/auth.cfg" />
DocumentBuilder builder = DocumentBuilderFactory.newDefaultInstance().newDocumentBuilder();
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = builder.parse(file);
NodeList registries = document.getElementsByTagName("registry");

Expand Down
3 changes: 2 additions & 1 deletion src/test/resources/features/developer.feature
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ Scenario Outline: Execute validate command for tests below.
|"NASA-PDS/validate#51 2" | "github51" | 2 | "2 errors expected for GENERAL_INFO." | "GENERAL_INFO" | "src/test/resources" | "target/test" | "-R pds4.bundle --alternate_file_paths src/test/resources/github51_additionals/additional_dir1/data_spectra,src/test/resources/github51_additionals/additional_dir2/data_spectra --skip-product-validation --skip-content-validation -r {reportDir}/report_github51_2.json -s json -t {resourceDir}/github51/valid" | "report_github51_2.json" |
#
|"NASA-PDS/validate#6 1" | "github6" | 7 | "7 errors expected for FILE_NAME_HAS_INVALID_CHARS,UNALLOWED_BASE_NAME,UNALLOWED_FILE_NAME,DIR_NAME_HAS_INVALID_CHARS." | "FILE_NAME_HAS_INVALID_CHARS,UNALLOWED_BASE_NAME,UNALLOWED_FILE_NAME,DIR_NAME_HAS_INVALID_CHARS" | "src/test/resources" | "target/test" | "-R pds4.bundle -r {reportDir}/report_github6_bundle_invalid_cucumber.json -s json {resourceDir}/github6/invalid/bundle_kaguya_derived.xml" | "report_github6_bundle_invalid_cucumber.json" |
|"NASA-PDS/validate#6 2" | "github6" | 0 | "0 errors expected for totalErrors." | "totalErrors" | "src/test/resources" | "target/test" | "-R pds4.bundle -r {reportDir}/report_github6_bundle_valid_cucumber.json -s json {resourceDir}/github6/valid/bundle_kaguya_derived.xml" | "report_github6_bundle_valid_cucumber.json" |
|"NASA-PDS/validate#6 2" | "github6" | 7 | "7 warnings expected for warning.file.not_referenced_in_label." | "UNLABELED_FILE" | "src/test/resources" | "target/test" | "-R pds4.bundle -r {reportDir}/report_github6_2.json -s json {resourceDir}/github6/invalid/bundle_kaguya_derived_7.xml" | "report_github6_2.json" |
|"NASA-PDS/validate#6 3" | "github6" | 0 | "0 errors expected for totalErrors." | "totalErrors" | "src/test/resources" | "target/test" | "-R pds4.bundle -r {reportDir}/report_github6_3.json -s json {resourceDir}/github6/valid/bundle_kaguya_derived.xml" | "report_github6_3.json" |
|"NASA-PDS/validate#240 1" | "github240" | 0 | "0 errors expected for totalErrors." | "totalErrors" | "src/test/resources" | "target/test" | "-R pds4.bundle -r {reportDir}/report_github240_bundle_valid_cucumber.json -s json {resourceDir}/github240/valid/bundle_kaguya_derived.xml" | "report_github240_bundle_valid_cucumber.json" |
|"NASA-PDS/validate#240 2" | "github240" | 3 | "3 warnings expected for UNALLOWED_BUNDLE_SUBDIR_NAME." | "UNALLOWED_BUNDLE_SUBDIR_NAME" | "src/test/resources" | "target/test" | "-R pds4.bundle -r {reportDir}/report_github240_bundle_invalid_cucumber.json -s json {resourceDir}/github240/invalid/bundle_kaguya_derived.xml" | "report_github240_bundle_invalid_cucumber.json" |

Expand Down
130 changes: 0 additions & 130 deletions src/test/resources/github6/valid/bundle_kaguya_derived_2.xml

This file was deleted.

130 changes: 0 additions & 130 deletions src/test/resources/github6/valid/bundle_kaguya_derived_3.xml

This file was deleted.

Loading

0 comments on commit 58835e1

Please sign in to comment.