diff --git a/cadc-quality/opencadc-1.1.gradle b/cadc-quality/opencadc-1.1.gradle index ca7f74df..2852120f 100644 --- a/cadc-quality/opencadc-1.1.gradle +++ b/cadc-quality/opencadc-1.1.gradle @@ -47,37 +47,25 @@ tasks.withType(Checkstyle).each { checkstyleTask -> } } -tasks.withType(Test) { - // reset the report destinations so that intTests go to their own page - //reports.html.destination = file("${reporting.baseDir}/${name}") - reports.html.destination = file(reporting.baseDir.getAbsolutePath() + '/' + name) - - // Assign all Java system properties from - // the command line to the tests +tasks.withType(Test).configureEach { + // separate report destinations for each test task + reports.html.outputLocation = layout.buildDirectory.dir("reports/tests/${name}") + + // assign all Java system properties from the command line to the tests systemProperties System.properties -} - -task intTest(type: Test) { - // set the configuration context - testClassesDirs = sourceSets.intTest.output.classesDirs - classpath = sourceSets.intTest.runtimeClasspath - // run the tests always - outputs.upToDateWhen { false } -} - -test { testLogging { events "PASSED", "FAILED", "SKIPPED" - // "STARTED", } } -intTest { - testLogging { - events "PASSED", "FAILED", "SKIPPED" - // "STARTED", - } +tasks.register('intTest', Test) { + // Set the configuration context + testClassesDirs = sourceSets.intTest.output.classesDirs + classpath = sourceSets.intTest.runtimeClasspath + + // Run the tests always + outputs.upToDateWhen { false } } pluginManager.withPlugin('maven-publish') { @@ -92,6 +80,6 @@ pluginManager.withPlugin('maven-publish') { } // backwards compat usage -task install { - dependsOn 'publishToMavenLocal' +tasks.register('install') { + dependsOn(tasks.named('publishToMavenLocal')) } diff --git a/cadc-util/src/test/java/ca/nrc/cadc/auth/BearerTokenPrincipalTest.java b/cadc-util/src/test/java/ca/nrc/cadc/auth/BearerTokenPrincipalTest.java index 9429ed33..71075953 100644 --- a/cadc-util/src/test/java/ca/nrc/cadc/auth/BearerTokenPrincipalTest.java +++ b/cadc-util/src/test/java/ca/nrc/cadc/auth/BearerTokenPrincipalTest.java @@ -3,7 +3,7 @@ ******************* CANADIAN ASTRONOMY DATA CENTRE ******************* ************** CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES ************** * -* (c) 2019. (c) 2019. +* (c) 2026. (c) 2026. * Government of Canada Gouvernement du Canada * National Research Council Conseil national de recherches * Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 @@ -70,10 +70,9 @@ package ca.nrc.cadc.auth; import ca.nrc.cadc.util.Log4jInit; -import junit.framework.Assert; - import org.apache.log4j.Level; import org.apache.log4j.Logger; +import org.junit.Assert; import org.junit.Test; /** diff --git a/cadc-util/src/test/java/ca/nrc/cadc/auth/OpenIdPrincipalTest.java b/cadc-util/src/test/java/ca/nrc/cadc/auth/OpenIdPrincipalTest.java index 595c1309..30c2c329 100644 --- a/cadc-util/src/test/java/ca/nrc/cadc/auth/OpenIdPrincipalTest.java +++ b/cadc-util/src/test/java/ca/nrc/cadc/auth/OpenIdPrincipalTest.java @@ -3,7 +3,7 @@ ******************* CANADIAN ASTRONOMY DATA CENTRE ******************* ************** CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES ************** * -* (c) 2019. (c) 2019. +* (c) 2026. (c) 2026. * Government of Canada Gouvernement du Canada * National Research Council Conseil national de recherches * Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 @@ -74,8 +74,8 @@ import java.net.URL; import org.apache.log4j.Level; import org.apache.log4j.Logger; +import org.junit.Assert; import org.junit.Test; -import junit.framework.Assert; /** * diff --git a/cadc-util/src/intTest/java/ca/nrc/cadc/net/HttpDownloadTest.java b/cadc-util/src/test/java/ca/nrc/cadc/net/HttpDownloadTest.java similarity index 98% rename from cadc-util/src/intTest/java/ca/nrc/cadc/net/HttpDownloadTest.java rename to cadc-util/src/test/java/ca/nrc/cadc/net/HttpDownloadTest.java index a2d34255..4697bc8b 100644 --- a/cadc-util/src/intTest/java/ca/nrc/cadc/net/HttpDownloadTest.java +++ b/cadc-util/src/test/java/ca/nrc/cadc/net/HttpDownloadTest.java @@ -105,8 +105,8 @@ public class HttpDownloadTest } public HttpDownloadTest() throws Exception { - this.okURL = new URL("https://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/robots.txt"); - this.resumableURL = new URL("https://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/robots.txt"); + this.okURL = new URL("https://raw.githubusercontent.com/opencadc/core/refs/heads/main/opencadc.gradle"); + this.resumableURL = okURL; this.redirectURL = new URL("https://httpbin.org/redirect?url=" + okURL); this.permissionDeniedURL = new URL("https://httpbin.org/status/403"); this.notFoundURL = new URL("https://httpbin.org/status/404"); @@ -180,7 +180,7 @@ public void testDownloadFileToDir() throws Exception Assert.assertNotNull("result file", out); Assert.assertTrue("dest file exists after download", out.exists()); Assert.assertTrue("dest file size > 0", out.length() > 0); - Assert.assertEquals("filename", "robots.txt", out.getName()); + Assert.assertEquals("filename", "opencadc.gradle", out.getName()); } catch (Exception unexpected) { diff --git a/cadc-util/src/intTest/java/ca/nrc/cadc/net/HttpGetTest.java b/cadc-util/src/test/java/ca/nrc/cadc/net/HttpGetTest.java similarity index 99% rename from cadc-util/src/intTest/java/ca/nrc/cadc/net/HttpGetTest.java rename to cadc-util/src/test/java/ca/nrc/cadc/net/HttpGetTest.java index 9fff29a3..71312b7d 100644 --- a/cadc-util/src/intTest/java/ca/nrc/cadc/net/HttpGetTest.java +++ b/cadc-util/src/test/java/ca/nrc/cadc/net/HttpGetTest.java @@ -104,7 +104,7 @@ public class HttpGetTest { } public HttpGetTest() throws Exception { - this.okURL = new URL("https://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/robots.txt"); + this.okURL = new URL("https://raw.githubusercontent.com/opencadc/core/refs/heads/main/opencadc.gradle"); this.permissionDeniedURL = new URL("https://httpbin.org/status/403"); this.notFoundURL = new URL("https://httpbin.org/status/404"); diff --git a/cadc-util/src/intTest/java/ca/nrc/cadc/net/HttpPostTest.java b/cadc-util/src/test/java/ca/nrc/cadc/net/HttpPostTest.java similarity index 100% rename from cadc-util/src/intTest/java/ca/nrc/cadc/net/HttpPostTest.java rename to cadc-util/src/test/java/ca/nrc/cadc/net/HttpPostTest.java diff --git a/cadc-util/src/intTest/java/ca/nrc/cadc/net/HttpUploadTest.java b/cadc-util/src/test/java/ca/nrc/cadc/net/HttpUploadTest.java similarity index 100% rename from cadc-util/src/intTest/java/ca/nrc/cadc/net/HttpUploadTest.java rename to cadc-util/src/test/java/ca/nrc/cadc/net/HttpUploadTest.java diff --git a/cadc-util/src/test/java/ca/nrc/cadc/util/ThrowableUtilTest.java b/cadc-util/src/test/java/ca/nrc/cadc/util/ThrowableUtilTest.java index b5a9fc14..97eacd97 100644 --- a/cadc-util/src/test/java/ca/nrc/cadc/util/ThrowableUtilTest.java +++ b/cadc-util/src/test/java/ca/nrc/cadc/util/ThrowableUtilTest.java @@ -3,7 +3,7 @@ ******************* CANADIAN ASTRONOMY DATA CENTRE ******************* ************** CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES ************** * -* (c) 2016. (c) 2016. +* (c) 2026. (c) 2026. * Government of Canada Gouvernement du Canada * National Research Council Conseil national de recherches * Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 @@ -70,9 +70,7 @@ package ca.nrc.cadc.util; import java.io.FileNotFoundException; - -import junit.framework.Assert; - +import org.junit.Assert; import org.junit.Test; /** diff --git a/opencadc.gradle b/opencadc.gradle index ca7f74df..2852120f 100644 --- a/opencadc.gradle +++ b/opencadc.gradle @@ -47,37 +47,25 @@ tasks.withType(Checkstyle).each { checkstyleTask -> } } -tasks.withType(Test) { - // reset the report destinations so that intTests go to their own page - //reports.html.destination = file("${reporting.baseDir}/${name}") - reports.html.destination = file(reporting.baseDir.getAbsolutePath() + '/' + name) - - // Assign all Java system properties from - // the command line to the tests +tasks.withType(Test).configureEach { + // separate report destinations for each test task + reports.html.outputLocation = layout.buildDirectory.dir("reports/tests/${name}") + + // assign all Java system properties from the command line to the tests systemProperties System.properties -} - -task intTest(type: Test) { - // set the configuration context - testClassesDirs = sourceSets.intTest.output.classesDirs - classpath = sourceSets.intTest.runtimeClasspath - // run the tests always - outputs.upToDateWhen { false } -} - -test { testLogging { events "PASSED", "FAILED", "SKIPPED" - // "STARTED", } } -intTest { - testLogging { - events "PASSED", "FAILED", "SKIPPED" - // "STARTED", - } +tasks.register('intTest', Test) { + // Set the configuration context + testClassesDirs = sourceSets.intTest.output.classesDirs + classpath = sourceSets.intTest.runtimeClasspath + + // Run the tests always + outputs.upToDateWhen { false } } pluginManager.withPlugin('maven-publish') { @@ -92,6 +80,6 @@ pluginManager.withPlugin('maven-publish') { } // backwards compat usage -task install { - dependsOn 'publishToMavenLocal' +tasks.register('install') { + dependsOn(tasks.named('publishToMavenLocal')) }