Skip to content
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
11 changes: 6 additions & 5 deletions dap4/src/main/java/dap4/core/dmr/parser/DOM4Parser.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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";

Expand Down Expand Up @@ -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));
Expand Down
6 changes: 3 additions & 3 deletions dap4/src/main/java/dap4/core/util/ChecksumMode.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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"};
Expand Down
39 changes: 22 additions & 17 deletions dap4/src/test/java/dap4/test/TestHyrax.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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)
Expand All @@ -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";
Expand Down Expand Up @@ -112,14 +107,24 @@ public static List<TestCaseCommon> 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;
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/ncj.libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down