Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression where unlabeled files are not being identified #836

Merged
merged 4 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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())) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This got removed in #734. Not sure why and did not leave myself a good comment. Without it, the filter is looking for just XML files.

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