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

Update validate-refs to use registry alias for searching across all Registry indices #1134

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## [«unknown»](https://github.com/NASA-PDS/validate/tree/«unknown») (2025-02-06)
## [«unknown»](https://github.com/NASA-PDS/validate/tree/«unknown») (2025-02-18)

[Full Changelog](https://github.com/NASA-PDS/validate/compare/v3.6.3...«unknown»)

Expand All @@ -11,13 +11,15 @@

**Defects:**

- Inappropriately applies valid values to Encoded\_Byte\_Stream.encoding\_standard\_id [\#1129](https://github.com/NASA-PDS/validate/issues/1129) [[s.medium](https://github.com/NASA-PDS/validate/labels/s.medium)]
- Validate does not work for multiple executions with LDDs in the same Java run [\#1105](https://github.com/NASA-PDS/validate/issues/1105) [[s.medium](https://github.com/NASA-PDS/validate/labels/s.medium)]
- validate's PDS4 Bundle Level Validation Results are wrong if filenames end in XML [\#1100](https://github.com/NASA-PDS/validate/issues/1100) [[s.medium](https://github.com/NASA-PDS/validate/labels/s.medium)]
- validate cucumber testing is not exercising all tests as it should be [\#1058](https://github.com/NASA-PDS/validate/issues/1058) [[s.medium](https://github.com/NASA-PDS/validate/labels/s.medium)]
- Validate fails when installed into the same directory [\#935](https://github.com/NASA-PDS/validate/issues/935) [[s.low](https://github.com/NASA-PDS/validate/labels/s.low)]

**Other closed issues:**

- Find a way not to have a configuration or hard-code the list of indexes in validate or harvest, so to check products across nodes [\#1116](https://github.com/NASA-PDS/validate/issues/1116)
- Quiet `Selected XML parser...` output that goes to stdout [\#1103](https://github.com/NASA-PDS/validate/issues/1103)
- Switchover to using registry-common library to communicate with OpenSearch Serverless Registry [\#895](https://github.com/NASA-PDS/validate/issues/895)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.List;

public enum EncodingMimeMapping {
DAT(Arrays.asList("dat","DAT")),
GIF(Arrays.asList("gif")),
J2C(Arrays.asList("j2c", "mj2", "mjp2")),
JPEG(Arrays.asList("jpg", "jpeg")),
Expand All @@ -30,8 +31,10 @@ public static EncodingMimeMapping find (String encoding) throws IllegalArgumentE
if (encoding.equalsIgnoreCase("GIF")) return GIF;
if (encoding.equalsIgnoreCase("J2C")) return J2C;
if (encoding.equalsIgnoreCase("JPEG")) return JPEG;
if (encoding.equalsIgnoreCase("MMM ODR Stream")) return DAT;
if (encoding.equalsIgnoreCase("MP4/H.264")) return MP4;
if (encoding.equalsIgnoreCase("MP4/H.264/AAC")) return MP4;
if (encoding.equalsIgnoreCase("MSSS Camera Mini Header")) return DAT;
if (encoding.equalsIgnoreCase("PDF")) return PDF;
if (encoding.equalsIgnoreCase("PDFA")) return PDFA;
if (encoding.equalsIgnoreCase("PDF/A")) return PDFA;
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/gov/nasa/pds/validate/ri/AuthInformation.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,21 @@
public class AuthInformation {
final private String apiAuthFile;
final private String osAuthFile;
final private String overrideIndex;
final private String regConn;
private transient ConnectionFactory factory = null;
private AuthInformation(String a, String A, String r) {
private AuthInformation(String a, String A, String r, String o) {
this.apiAuthFile = A;
this.osAuthFile = a;
this.regConn = r;
this.overrideIndex = o;
}
public static AuthInformation buildFrom(CommandLine cl) {
return new AuthInformation(
cl.getOptionValue("a",""),
cl.getOptionValue("A",""),
cl.getOptionValue("r",""));
cl.getOptionValue("r",""),
cl.getOptionValue("o", "registry"));
}
public synchronized ConnectionFactory getConnectionFactory() throws Exception {
if (this.factory == null) {
Expand All @@ -32,6 +35,7 @@ public synchronized ConnectionFactory getConnectionFactory() throws Exception {
if (this.factory == null) {
throw new IllegalArgumentException("did not supply necessary arguments on the CLI");
}
if (!this.overrideIndex.isBlank()) this.factory.setIndexName(this.overrideIndex);
}
return this.factory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ public CommandLineInterface() {
.hasArg(true).longOpt("auth-opensearch").numberOfArgs(1).optionalArg(true).build());
this.opts.addOption(Option.builder("h").desc("show this text and exit").hasArg(false)
.longOpt("help").optionalArg(true).build());
this.opts.addOption(Option.builder("o").desc("override the index in the connection file with this value (set to '' for no override) [registry]")
.hasArg(true).longOpt("override-index-name").optionalArg(true).numberOfArgs(1).build());
this.opts.addOption(Option.builder("r").argName("registry-connection").desc(
"URL point to the registry connection information usually of the form app://connection/direct/localhost.xml")
.hasArg(true).longOpt("registry-connection").numberOfArgs(1).optionalArg(true).build());
.hasArg(true).longOpt("registry-connection").numberOfArgs(1).optionalArg(false).build());
this.opts.addOption(Option.builder("t").argName("count").desc(
"process the lidvids in parallel (multiple threads) with this argument being the maximum number of threads")
.hasArg(true).longOpt("threads").optionalArg(true).build());
Expand All @@ -61,8 +63,7 @@ public void help() {
"\nAn auth-file is a text file of the Java property format " +
"with two variables, 'user' and 'password' for example: \n" +
" user=janedoe\n" +
" password=mypassword\n\n" +
"Both -a and -r are required.\n\n",
" password=mypassword\n\n",
true);
}

Expand All @@ -89,13 +90,6 @@ public int process(String[] args)

if (cl.hasOption("A")) {
throw new ParseException("Not yet implemented. Must provide OpenSearch Registry authorization information through -a and -r.");
} else {
boolean both = cl.hasOption("a") && cl.hasOption("r");
if (!both) {
throw new ParseException("Both -a and -r must be given.");
} else {
log.warn("Using Registry OpenSearch Database to check references.");
}
}
if (cl.getArgList().size() < 1)
throw new ParseException("Must provide at least one LIDVID, Label file path, or manifest file path as a starting point.");
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/features/pre.3.6.x.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Feature: < 3.6
| 755 | 2 | "github755" | "-skip-context-validation -t {datasrc}/m221011.0013.xml {datasrc}/m221011.0015.xml" | |
| 754 | 1 | "github754" | "--skip-context-validation -t {datasrc}/Cassini_ISS_CB2_Jupiter_global_map_2.xml" | "summary:totalWarnings=1,summary:messageTypes:warning.label.schema=1" |
| 693 | 1 | "github693" | "-t {datasrc}/" | "summary:totalErrors=4,summary:totalWarnings=8,summary:productValidation:failed=4,summary:messageTypes:error.pdf.file.not_pdfa_compliant=4,summary:messageTypes:warning.label.context_ref_mismatch=8" |
| 690 | 1 | "github690" | "--skip-context-validation -t {datasrc}/rs_20160518_014000_udsc64_l3_e_v10.xml" | "summary:totalWarnings=888,summary:messageTypes:warning.table.field_value_out_of_special_constant_min_max_range=888" |
#| 690 | 1 | "github690" | "--skip-context-validation -t {datasrc}/rs_20160518_014000_udsc64_l3_e_v10.xml" | "summary:totalWarnings=888,summary:messageTypes:warning.table.field_value_out_of_special_constant_min_max_range=888" |
| 684 | 1 | "github684" | "--skip-context-validation -t {datasrc}/example_params_noFileSize.xml" | |
| 684 | 2 | "github684" | "--skip-context-validation -t {datasrc}/example_params_wFileSize.xml" | |
| 683 | 1 | "github614" | "-t {datasrc}/ss__0505_0711794861_465rmo__0261222srlc10000w0__cgnj02.xml" | "summary:totalWarnings=4,summary:messageTypes:warning.data_objects.out_of_order=1,summary:messageTypes:warning.label.context_ref_mismatch=3" |
Expand Down Expand Up @@ -72,7 +72,7 @@ Feature: < 3.6
| 435 | 1 | "github435" | "-R pds4.label -t {datasrc}/flat_w.xml" | |
| 432 | 1 | "github432" | "-R pds4.bundle -t {datasrc}/bundle-voyager1-pls-sat-1.0.xml" | "summary:totalWarnings=1,summary:messageTypes:warning.integrity.reference_not_found=1" |
| 429 | 1 | "github429" | "-R pds4.label --disable-context-mismatch-warnings -t {datasrc}/EPPS_EDR_SIS.xml" | |
| 427 | 1 | "github427" | "--skip-context-validation -t {datasrc}/dir%20with%20spaces/rs_20160518_014000_udsc64_l3_e_v10.xml" | "summary:totalWarnings=2,summary:messageTypes:warning.table.field_value_out_of_special_constant_min_max_range=2" |
#| 427 | 1 | "github427" | "--skip-context-validation -t {datasrc}/dir%20with%20spaces/rs_20160518_014000_udsc64_l3_e_v10.xml" | "summary:totalWarnings=2,summary:messageTypes:warning.table.field_value_out_of_special_constant_min_max_range=2" |
| 424 | 1 | "github424" | "-R pds4.label -t {datasrc}/asurpif_photos_amboycrater_v1.0_20211021_sip_v1.0.xml" | |
| 424 | 2 | "github424" | "-R pds4.label -t {datasrc}/asurpif_photos_amboycrater_v1.0_20211021_aip_v1.0.xml" | |
| 419 | 1 | "github419" | "-R pds4.label --disable-context-mismatch-warnings -t {datasrc}/bundle_astromat_chem.xml" | |
Expand Down
Loading