diff --git a/dap4/src/main/java/dap4/core/dmr/parser/DOM4Parser.java b/dap4/src/main/java/dap4/core/dmr/parser/DOM4Parser.java index 93a4a2c1df..8d437445ad 100644 --- a/dap4/src/main/java/dap4/core/dmr/parser/DOM4Parser.java +++ b/dap4/src/main/java/dap4/core/dmr/parser/DOM4Parser.java @@ -1,6 +1,6 @@ /* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. + * Copyright (c) 2012-2026 University Corporation for Atmospheric Research/Unidata + * See LICENSE for license information. */ package dap4.core.dmr.parser; @@ -35,7 +35,8 @@ public class DOM4Parser implements Dap4Parser { // Constants static final float DAPVERSION = 4.0f; - static final float DMRVERSION = 1.0f; + static final float DMRVERSION_10 = 1.0f; + static final float DMRVERSION_20 = 2.0f; static final String DEFAULTATTRTYPE = "Int32"; @@ -461,9 +462,9 @@ protected void parsedataset(Node rootnode) throws ParseException { try { ndmrversion = Float.parseFloat(dmrversion); } catch (NumberFormatException nfe) { - ndmrversion = DMRVERSION; + ndmrversion = DMRVERSION_10; } - if (ndmrversion != DMRVERSION) + if (ndmrversion != DMRVERSION_10 && ndmrversion != DMRVERSION_20) throw new ParseException("Dataset dmrVersion mismatch: " + dmrversion); this.root = factory.newDataset(name); this.root.setDapVersion(Float.toString(ndapversion)); diff --git a/dap4/src/main/java/dap4/core/util/ChecksumMode.java b/dap4/src/main/java/dap4/core/util/ChecksumMode.java index 9c341a0610..f42cbc11ac 100644 --- a/dap4/src/main/java/dap4/core/util/ChecksumMode.java +++ b/dap4/src/main/java/dap4/core/util/ChecksumMode.java @@ -1,6 +1,6 @@ /* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. + * Copyright (c) 2012-2026 University Corporation for Atmospheric Research/Unidata + * See LICENSE for license information. */ package dap4.core.util; @@ -14,7 +14,7 @@ public enum ChecksumMode { FALSE, // => dap4.checksum=false TRUE; // => dap4.checksum=true - public static final ChecksumMode dfalt = TRUE; // Must be TRUE|FALSE + public static final ChecksumMode dfalt = FALSE; // Must be TRUE|FALSE static final String[] trues = new String[] {"true", "on", "yes", "1"}; static final String[] falses = new String[] {"false", "off", "no", "0"}; diff --git a/dap4/src/test/java/dap4/test/TestHyrax.java b/dap4/src/test/java/dap4/test/TestHyrax.java index 95b74159d3..ca795dcd5c 100644 --- a/dap4/src/test/java/dap4/test/TestHyrax.java +++ b/dap4/src/test/java/dap4/test/TestHyrax.java @@ -1,6 +1,6 @@ /* - * Copyright 2012, UCAR/Unidata. - * See the LICENSE file for more information. + * Copyright (c) 2012-2026 University Corporation for Atmospheric Research/Unidata + * See LICENSE for license information. */ package dap4.test; @@ -22,12 +22,6 @@ import java.util.List; import ucar.unidata.util.test.category.NeedsExternalResource; -/** - * This Test uses the JUNIT Version 4 parameterized test mechanism. - * The set of arguments for each test is encapsulated in a class - * called TestCase. This allows for code re-use and for extending - * tests by adding fields to the TestCase object. - */ /** * This test set reads DAP4 datasets (both constrained and not) @@ -48,7 +42,8 @@ public class TestHyrax extends DapTestCommon implements Dap4ManifestIF { // Define the input set location(s) protected static final String INPUTEXT = ""; - protected static final String INPUTQUERY = "?dap4.checksum=true"; + // request checksums true, false, and default + protected static final String[] INPUTQUERY = new String[] {"?dap4.checksum=true", "?dap4.checksum=false", ""}; protected static final String INPUTFRAG = "#dap4&hyrax"; protected static final String BASELINEDIR = "/baselinehyrax"; @@ -112,14 +107,24 @@ public static List defineTestCases() { String file = tuple[0]; String prefix = tuple[1]; String query = tuple[2]; // excluding leading '?' - // Unfortunately, The OPeNDAP test server does not appear to support https: - String url = server.getURL("http:") + "/" + prefix + "/" + file + INPUTEXT + INPUTQUERY; - if (query != null) - url += ("&" + DapConstants.CONSTRAINTTAG + "=" + query); - url += INPUTFRAG; - String baseline = resourceroot + BASELINEDIR + "/" + file + BASELINEEXT; - TestCase tc = new TestCase(file, url, baseline, query); - testcases.add(tc); + for (String IQ : INPUTQUERY) { + // Unfortunately, The OPeNDAP test server does not appear to support https: + String url = server.getURL("http:") + "/" + prefix + "/" + file + INPUTEXT + IQ; + System.out.println(url); + if (query != null) { + if (IQ.isEmpty()) { + url += ("?"); + } else { + url += ("&"); + } + url += (DapConstants.CONSTRAINTTAG + "=" + query); + } + + url += INPUTFRAG; + String baseline = resourceroot + BASELINEDIR + "/" + file + BASELINEEXT; + TestCase tc = new TestCase(file, url, baseline, query); + testcases.add(tc); + } } return testcases; } diff --git a/gradle/ncj.libs.versions.toml b/gradle/ncj.libs.versions.toml index e69ee12d67..2fa9172ca4 100644 --- a/gradle/ncj.libs.versions.toml +++ b/gradle/ncj.libs.versions.toml @@ -39,7 +39,7 @@ junit4 = "4.13.1" junit5 = "5.14.0" junitparams = "1.0.5" mockito-core = "2.28.2" -testcontainers = "1.19.7" +testcontainers = "1.21.4" truth = "1.0" # runtime only