Skip to content

Commit

Permalink
Only keep necessary classes in tds-test-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
lesserwhirls committed Jul 26, 2021
1 parent 1b51bc2 commit 19c52a7
Show file tree
Hide file tree
Showing 52 changed files with 338 additions and 3,066 deletions.
1 change: 1 addition & 0 deletions dap4/d4tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ dependencies {
compile 'org.springframework:spring-webmvc'

testCompile 'junit:junit'
testCompile project(':tds-test-utils')
testCompile 'edu.ucar:cdm-test-utils'
}

Expand Down
10 changes: 5 additions & 5 deletions dap4/d4tests/src/test/java/dap4/test/DapTestCommon.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) 2021 University Corporation for Atmospheric Research/Unidata
* See LICENSE for license information.
*/

package dap4.test;
Expand Down Expand Up @@ -29,6 +29,7 @@
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.test.web.servlet.setup.StandaloneMockMvcBuilder;
import thredds.TdsUnitTestCommon;
import thredds.core.DatasetManager;
import thredds.core.TdsRequestedDataset;
import thredds.server.dap4.Dap4Controller;
Expand All @@ -37,12 +38,11 @@
import ucar.nc2.NetcdfFile;
import ucar.nc2.jni.netcdf.Nc4prototypes;
import ucar.unidata.util.test.TestDir;
import ucar.unidata.util.test.UnitTestCommon;

import javax.servlet.ServletException;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URI;
Expand All @@ -51,7 +51,7 @@

@ContextConfiguration
@WebAppConfiguration("file:src/test/data")
abstract public class DapTestCommon extends UnitTestCommon {
abstract public class DapTestCommon extends TdsUnitTestCommon {

//////////////////////////////////////////////////
// Constants
Expand Down
8 changes: 5 additions & 3 deletions dap4/d4tests/src/test/java/dap4/test/TestCDMClient.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright 2016, University Corporation for Atmospheric Research
* See the LICENSE.txt file for more information.
* Copyright (c) 1998-2021 University Corporation for Atmospheric Research/Unidata
* See LICENSE for license information.
*/

package dap4.test;
Expand All @@ -12,8 +12,10 @@
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import thredds.TdsUnitTestCommon;
import ucar.nc2.dataset.NetcdfDataset;
import ucar.unidata.util.test.TestDir;

import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
Expand Down Expand Up @@ -233,7 +235,7 @@ void doOneTest(TestCase testcase) throws Exception {

NetcdfDataset ncfile;
try {
ncfile = openDatasetDap4Tests(testcase.getURL());
ncfile = TdsUnitTestCommon.openDatasetDap4Tests(testcase.getURL());
} catch (Exception e) {
e.printStackTrace();
throw new Exception("File open failed: " + testcase.getURL(), e);
Expand Down
8 changes: 7 additions & 1 deletion dap4/d4tests/src/test/java/dap4/test/TestConstraints.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* Copyright (c) 1998-2021 University Corporation for Atmospheric Research/Unidata
* See LICENSE for license information.
*/

package dap4.test;

import org.junit.Assert;
Expand All @@ -6,6 +11,7 @@
import org.junit.experimental.categories.Category;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import thredds.TdsUnitTestCommon;
import ucar.httpservices.HTTPMethod;
import ucar.nc2.dataset.NetcdfDataset;
import ucar.unidata.util.test.TestDir;
Expand Down Expand Up @@ -180,7 +186,7 @@ void doOneTest(TestCase testcase) throws Exception {
String url = testcase.makeurl();
NetcdfDataset ncfile = null;
try {
ncfile = openDatasetDap4Tests(url);
ncfile = TdsUnitTestCommon.openDatasetDap4Tests(url);
} catch (Exception e) {
throw e;
}
Expand Down
9 changes: 8 additions & 1 deletion dap4/d4tests/src/test/java/dap4/test/TestH5Iosp.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* Copyright (c) 1998-2021 John Caron and University Corporation for Atmospheric Research/Unidata
* See LICENSE for license information.
*/

package dap4.test;

import org.junit.Assert;
Expand All @@ -6,8 +11,10 @@
import org.junit.experimental.categories.Category;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import thredds.TdsUnitTestCommon;
import ucar.nc2.dataset.NetcdfDataset;
import ucar.unidata.util.test.category.NotJenkins;

import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
Expand Down Expand Up @@ -147,7 +154,7 @@ boolean doOneTest(H5IospTest testcase) throws Exception {

System.out.println("Testcase: " + testcase.testinputpath);

NetcdfDataset ncfile = openDatasetDap4Tests(testcase.testinputpath);
NetcdfDataset ncfile = TdsUnitTestCommon.openDatasetDap4Tests(testcase.testinputpath);

String metadata = null;
String data = null;
Expand Down
12 changes: 9 additions & 3 deletions dap4/d4tests/src/test/java/dap4/test/TestHyrax.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* Copyright (c) 1998-2021 John Caron and University Corporation for Atmospheric Research/Unidata
* See LICENSE for license information.
*/

package dap4.test;

import dap4.core.util.DapUtil;
Expand All @@ -7,10 +12,11 @@
import org.junit.experimental.categories.Category;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import thredds.TdsUnitTestCommon;
import ucar.nc2.dataset.NetcdfDataset;
import ucar.unidata.util.test.UnitTestCommon;
import ucar.unidata.util.test.category.NotJenkins;
import ucar.unidata.util.test.category.NotPullRequest;

import java.io.IOException;
import java.io.StringWriter;
import java.lang.invoke.MethodHandles;
Expand Down Expand Up @@ -272,13 +278,13 @@ boolean doOneTest(ClientTest testcase) throws Exception {
String url = testcase.makeurl();
NetcdfDataset ncfile = null;
try {
ncfile = openDatasetDap4Tests(url);
ncfile = TdsUnitTestCommon.openDatasetDap4Tests(url);
} catch (Exception e) {
System.err.println(testcase.xfail ? "XFail" : "Fail");
e.printStackTrace();
return testcase.xfail;
}
String usethisname = UnitTestCommon.extractDatasetname(url, null);
String usethisname = TdsUnitTestCommon.extractDatasetname(url, null);
String metadata = (NCDUMP ? ncdumpmetadata(ncfile, usethisname) : null);
if (prop_visual) {
visual(testcase.title + ".dmr", metadata);
Expand Down
25 changes: 16 additions & 9 deletions dap4/d4tests/src/test/java/dap4/test/TestNc4Iosp.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
/*
* Copyright (c) 1998-2021 John Caron and University Corporation for Atmospheric Research/Unidata
* See LICENSE for license information.
*/

package dap4.test;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import thredds.TdsUnitTestCommon;
import ucar.nc2.dataset.NetcdfDataset;
import ucar.unidata.util.test.category.NotPullRequest;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
Expand All @@ -9,14 +24,6 @@
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ucar.nc2.dataset.NetcdfDataset;
import ucar.unidata.util.test.category.NotPullRequest;

@Category(NotPullRequest.class)
public class TestNc4Iosp extends DapTestCommon {
Expand Down Expand Up @@ -153,7 +160,7 @@ public void testNc4Iosp() throws Exception {
void doOneTest(Nc4IospTest testcase) throws Exception {
System.err.println("Testcase: " + testcase.testinputpath);

NetcdfDataset ncfile = openDatasetDap4Tests(testcase.testinputpath);
NetcdfDataset ncfile = TdsUnitTestCommon.openDatasetDap4Tests(testcase.testinputpath);

String metadata = null;
String data = null;
Expand Down
12 changes: 9 additions & 3 deletions dap4/d4tests/src/test/java/dap4/test/TestSerial.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* Copyright (c) 1998-2021 John Caron and University Corporation for Atmospheric Research/Unidata
* See LICENSE for license information.
*/

package dap4.test;

import dap4.core.util.DapUtil;
Expand All @@ -6,9 +11,10 @@
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import thredds.TdsUnitTestCommon;
import ucar.nc2.dataset.NetcdfDataset;
import ucar.unidata.util.test.TestDir;
import ucar.unidata.util.test.UnitTestCommon;

import java.io.IOException;
import java.io.StringWriter;
import java.lang.invoke.MethodHandles;
Expand Down Expand Up @@ -178,12 +184,12 @@ boolean doOneTest(ClientTest testcase) throws Exception {
String url = testcase.makeurl(constraints[i]);
NetcdfDataset ncfile = null;
try {
ncfile = openDatasetDap4Tests(url);
ncfile = TdsUnitTestCommon.openDatasetDap4Tests(url);
} catch (Exception e) {
throw e;
}

String usethisname = UnitTestCommon.extractDatasetname(url, null);
String usethisname = TdsUnitTestCommon.extractDatasetname(url, null);
String metadata = (NCDUMP ? ncdumpmetadata(ncfile, usethisname) : null);
String data = (NCDUMP ? ncdumpdata(ncfile, usethisname) : null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ucar.unidata.util.test.UnitTestCommon;
// import opendap.dts.*;
import thredds.TdsUnitTestCommon;
import java.lang.invoke.MethodHandles;
import java.util.*;
import java.io.*;

// Test that the Constraint parsing is correct
public class TestCeParser extends UnitTestCommon {
public class TestCeParser extends TdsUnitTestCommon {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

static final boolean DEBUGPARSER = false;
Expand Down
1 change: 1 addition & 0 deletions tds-test-utils/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies {

implementation 'edu.ucar:cdm-core'
implementation 'edu.ucar:httpservices'
implementation 'edu.ucar:cdm-test-utils'

implementation project(':tdcommon')

Expand Down
20 changes: 20 additions & 0 deletions tds-test-utils/src/main/java/thredds/TdsTestDir.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright (c) 2021 University Corporation for Atmospheric Research/Unidata
* See LICENSE for license information.
*/

package thredds;

public class TdsTestDir {
public static String cdmUseBuildersPropName = "thredds.test.experimental.useNetcdfJavaBuilders";
public static boolean cdmUseBuilders;

// Remote Test server(s)
public static String remoteTestServer = "localhost:8081";

static {
String useBuilderProp = System.getProperty(cdmUseBuildersPropName, "");
// default (prop not set) true. Otherwise, check prop.
cdmUseBuilders = useBuilderProp.equals("") ? Boolean.TRUE : Boolean.getBoolean(cdmUseBuildersPropName);
}
}
Loading

0 comments on commit 19c52a7

Please sign in to comment.