diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index f0cb2c7..977415d 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -20,7 +20,7 @@ jobs: distribution: 'adopt' java-version: '17' - name: Cache Gradle packages - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | ~/.gradle/caches diff --git a/build.gradle b/build.gradle index 68f44ea..04dca12 100644 --- a/build.gradle +++ b/build.gradle @@ -2,14 +2,14 @@ plugins { id 'java-library' id 'checkstyle' id 'jacoco' - id "com.github.spotbugs" version "6.0.25" + id "com.github.spotbugs" version "6.1.11" id 'maven-publish' id 'signing' id "io.codearte.nexus-staging" version "0.30.0" id 'com.adarshr.test-logger' version '4.0.0' - id "com.github.ben-manes.versions" version "0.51.0" - id 'org.sonatype.gradle.plugins.scan' version '2.8.3' - id "org.sonarqube" version "5.1.0.4882" + id "com.github.ben-manes.versions" version "0.52.0" + id 'org.sonatype.gradle.plugins.scan' version '3.1.1' + id "org.sonarqube" version "6.1.0.5360" } group = 'com.imsweb' @@ -18,7 +18,7 @@ description = 'Java client library for SEER*API' tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' - options.compilerArgs << "-Werror" + options.compilerArgs << "-Werror" << "-Xlint:-options" } java { @@ -34,19 +34,22 @@ repositories { } dependencies { - spotbugs 'com.github.spotbugs:spotbugs:4.8.6' + spotbugs 'com.github.spotbugs:spotbugs:4.9.3' api 'com.squareup.retrofit2:retrofit:2.11.0' api 'com.squareup.retrofit2:converter-jackson:2.11.0' // retrofit will not update these dependencies to fix vulnerabilities api 'com.squareup.okhttp3:okhttp:4.12.0' - api 'com.squareup.okio:okio:3.9.1' + api 'com.squareup.okio:okio:3.11.0' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.3' - testImplementation 'org.junit.jupiter:junit-jupiter-params:5.11.3' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.3' - testImplementation 'org.assertj:assertj-core:3.26.3' + testImplementation platform('org.junit:junit-bom:5.12.2') + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-params' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.12.2' + + testImplementation 'org.assertj:assertj-core:3.27.3' testImplementation 'com.google.code.bean-matchers:bean-matchers:0.14' } @@ -122,7 +125,7 @@ tasks.named("dependencyUpdates").configure { } wrapper { - gradleVersion = '8.8' + gradleVersion = '8.14' distributionType = Wrapper.DistributionType.ALL } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e644113..1b33c55 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6f7a6eb..6514f91 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index b740cf1..23d15a9 100644 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -84,7 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -112,7 +114,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -203,7 +205,7 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. @@ -211,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 25da30d..db3a6ac 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -68,11 +70,11 @@ goto fail :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell diff --git a/src/test/java/com/imsweb/seerapi/client/disease/DiseaseTest.java b/src/test/java/com/imsweb/seerapi/client/disease/DiseaseTest.java index a12f1d6..6efadbb 100644 --- a/src/test/java/com/imsweb/seerapi/client/disease/DiseaseTest.java +++ b/src/test/java/com/imsweb/seerapi/client/disease/DiseaseTest.java @@ -28,7 +28,7 @@ class DiseaseTest { private static DiseaseService _DISEASE; @BeforeAll - public static void setup() { + static void setup() { _DISEASE = new SeerApi.Builder().connect().disease(); } @@ -117,7 +117,7 @@ void testDiseaseById() throws IOException { assertEquals(2, disease.getTreatment().size()); assertNull(disease.getGenetics()); assertFalse(disease.getAlternateName().isEmpty()); - assertEquals("Acute erythremia", disease.getAlternateName().get(0).getValue()); + assertEquals("Acute erythemia [OBS]", disease.getAlternateName().get(0).getValue()); assertTrue(disease.getIcdO2Morphology().contains("9840/3")); assertTrue(disease.getIcdO1Morphology().contains("9840/3")); assertEquals("C94.0 Acute erythroid leukemia", disease.getIcd10CmCode().get(0).getValue()); diff --git a/src/test/java/com/imsweb/seerapi/client/glossary/GlossaryTest.java b/src/test/java/com/imsweb/seerapi/client/glossary/GlossaryTest.java index 65bd6e2..505c9f7 100644 --- a/src/test/java/com/imsweb/seerapi/client/glossary/GlossaryTest.java +++ b/src/test/java/com/imsweb/seerapi/client/glossary/GlossaryTest.java @@ -21,6 +21,7 @@ import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor; import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; import static com.imsweb.seerapi.client.glossary.Glossary.Category.GENERAL; +import static com.imsweb.seerapi.client.glossary.Glossary.Category.HEMATO; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -32,7 +33,7 @@ class GlossaryTest { private static GlossaryService _GLOSSARY; @BeforeAll - public static void setup() { + static void setup() { _GLOSSARY = new SeerApi.Builder().connect().glossary(); } @@ -49,7 +50,7 @@ void testGlossaryVersions() throws IOException { assertEquals(1, versions.size()); GlossaryVersion version = versions.get(0); assertEquals("latest", version.getName()); - assertNull(version.getType()); // type not returned when no permisisons + assertNull(version.getType()); // type isn't returned when no permisisons assertNotNull(version.getFirstPublished()); assertNotNull(version.getCount()); } @@ -68,7 +69,7 @@ void testGlossaryById() throws IOException { assertNull(glossary.getPrimarySite()); assertNull(glossary.getHistology()); - assertTrue(glossary.getDefinition().startsWith("An x-ray of the lymphatic system.")); + assertTrue(glossary.getDefinition().startsWith("An x-ray or computer image of the lymphatic system.")); assertNull(glossary.getAlternateName()); assertNull(glossary.getHistory()); } @@ -87,15 +88,15 @@ void testGlossarySearch() throws IOException { assertEquals(Collections.singletonList(term), results.getTerms()); // add the category and verify there are no results - results = _GLOSSARY.search("latest", search.paramMap(), EnumSet.of(Glossary.Category.SOLID_TUMOR)).execute().body(); + results = _GLOSSARY.search("latest", search.paramMap(), EnumSet.of(GENERAL)).execute().body(); assertNotNull(results); assertEquals(25, results.getCount().longValue()); - assertEquals(0, results.getTotal().longValue()); - assertNull(results.getResults()); + assertTrue(results.getTotal().longValue() > 0); + assertFalse(results.getResults().isEmpty()); // add a second category and verify there are we get the results again - results = _GLOSSARY.search("latest", search.paramMap(), EnumSet.of(Glossary.Category.SOLID_TUMOR, Glossary.Category.HEMATO)).execute().body(); + results = _GLOSSARY.search("latest", search.paramMap(), EnumSet.of(GENERAL, Glossary.Category.HEMATO)).execute().body(); assertNotNull(results); assertEquals(25, results.getCount().longValue()); @@ -126,19 +127,23 @@ void testGlossarySearchIterate() throws IOException { search.setOffset(search.getOffset() + results.getResults().size()); } - assertTrue(total > 100); + assertTrue(total > 0); } @Test void testGlossaryMatch() throws IOException { - String text = "This text contains summary stage which should be found."; + String text = "white blood cells that produce antibodies"; Set matches = _GLOSSARY.match(text, null, true).execute().body(); assertNotNull(matches); - assertEquals(1, matches.size()); + assertEquals(2, matches.size()); matches = _GLOSSARY.match(text, EnumSet.of(GENERAL), true).execute().body(); assertNotNull(matches); + assertEquals(2, matches.size()); + + matches = _GLOSSARY.match(text, EnumSet.of(HEMATO), true).execute().body(); + assertNotNull(matches); assertEquals(0, matches.size()); } diff --git a/src/test/java/com/imsweb/seerapi/client/rx/RxTest.java b/src/test/java/com/imsweb/seerapi/client/rx/RxTest.java index 6834468..f2029c9 100644 --- a/src/test/java/com/imsweb/seerapi/client/rx/RxTest.java +++ b/src/test/java/com/imsweb/seerapi/client/rx/RxTest.java @@ -30,7 +30,7 @@ class RxTest { private static RxService _RX; @BeforeAll - public static void setup() { + static void setup() { _RX = new SeerApi.Builder().connect().rx(); } @@ -123,8 +123,8 @@ void testRxSearch() throws IOException { assertNotNull(results); assertEquals(25, results.getCount().longValue()); - assertEquals(7, results.getTotal().longValue()); - assertEquals(7, results.getResults().size()); + assertEquals(8, results.getTotal().longValue()); + assertEquals(8, results.getResults().size()); assertEquals(Collections.singletonList("abt"), results.getTerms()); search.setMode(PublishableSearch.SearchMode.OR); diff --git a/src/test/java/com/imsweb/seerapi/client/staging/StagingTest.java b/src/test/java/com/imsweb/seerapi/client/staging/StagingTest.java index dfcc2df..97e2ac9 100644 --- a/src/test/java/com/imsweb/seerapi/client/staging/StagingTest.java +++ b/src/test/java/com/imsweb/seerapi/client/staging/StagingTest.java @@ -95,7 +95,7 @@ class StagingTest { private static StagingService _STAGING; @BeforeAll - public static void setup() { + static void setup() { _STAGING = new SeerApi.Builder().connect().staging(); } @@ -538,11 +538,11 @@ void testStagingWithErrors() throws IOException { void testStagingGlossary() throws IOException { Set matches = _STAGING.schemaGlossary("eod_public", "2.0", "breast", null, true).execute().body(); assertThat(matches).hasSize(26); - matches = _STAGING.schemaGlossary("eod_public", "2.0", "breast", EnumSet.of(Category.STAGING), true).execute().body(); - assertThat(matches).hasSize(1); + matches = _STAGING.schemaGlossary("eod_public", "2.0", "breast", EnumSet.of(Category.GENERAL), true).execute().body(); + assertThat(matches).hasSize(26); matches = _STAGING.tableGlossary("eod_public", "2.0", "cea_pretx_lab_value_33864", null, true).execute().body(); - assertThat(matches).hasSize(24); + assertThat(matches).hasSize(23); matches = _STAGING.tableGlossary("eod_public", "2.0", "cea_pretx_lab_value_33864", EnumSet.of(Category.STAGING), true).execute().body(); assertThat(matches).isEmpty(); }