diff --git a/.classpath b/.classpath index 1e8fddb84..115baaf13 100644 --- a/.classpath +++ b/.classpath @@ -1,8 +1,6 @@ - - @@ -52,7 +50,6 @@ - @@ -109,5 +106,6 @@ + diff --git a/.codecov.yml b/.codecov.yml index 42c0d62b4..b75b4f7a4 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -26,5 +26,4 @@ comment: require_changes: no ignore: - - "build" - "deployment" diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..00a51aff5 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +# +# https://help.github.com/articles/dealing-with-line-endings/ +# +# These are explicitly windows files and should use crlf +*.bat text eol=crlf + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aab241b1a..fa95c318a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,13 +49,13 @@ jobs: mongo: 'mongodb-linux-x86_64-ubuntu2204-7.0.4' minio: '2019-05-23T00-29-34Z' wired_tiger: 'true' - ant_test: 'test_quick_coverage' + gradle_test: 'testQuick' # the current production setup - java: '11' mongo: 'mongodb-linux-x86_64-3.6.13' minio: '2019-05-23T00-29-34Z' wired_tiger: 'false' - ant_test: 'test_quick_coverage' + gradle_test: 'testQuick' steps: - uses: actions/checkout@v3 @@ -84,10 +84,6 @@ jobs: # move to parent dir of homedir to install binaries etc cd .. - # set up jars - git clone https://github.com/kbase/jars - export JARSDIR=$(pwd)/jars/lib/jars/ - # set up arango export ARANGODB_VER=3.9.1 export ARANGODB_V=39 @@ -153,8 +149,7 @@ jobs: - name: Run tests shell: bash run: | - ant javadoc - ant ${{matrix.ant_test}} + ./gradlew ${{matrix.gradle_test}} - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 diff --git a/build.gradle b/build.gradle new file mode 100644 index 000000000..9b787744c --- /dev/null +++ b/build.gradle @@ -0,0 +1,245 @@ +/* + * This file was generated by the Gradle 'init' task. + */ + +plugins { + id 'java' + id 'war' + id 'jacoco' + id 'org.ajoberstar.grgit' version '4.1.1' + id 'com.github.johnrengelman.shadow' version '8.1.1' +} + +// TODO NOW test shadow jar works in groups - remove JNA - commit 2 +// TODO NOW get docserver working in WAR and test in docker-compose <- edit to start test server - commit 3 +// TODO NOW client jar - commit 4 +// TODO NOW client jar javadoc - needs java_common source - commit 4 +// TODO NOW schema updater script - commit 5 +// TODO NOW sdk-compile all, java, and docs - commit 6 +// TODO NOW handle the git commit the same way as auth does - commit 7 +// TODO NOW delete build.xml, , and Makefile - commit 8 +// TODO NOW run tests from Eclipse w/o specifying classpath manually & remove sourceSets & claspath - commit 9 + +repositories { + mavenCentral() +} +compileJava { + options.release = 11 +} + +// jacoco doesn't play nicely with test tasks not named "test" +def coverageFile = layout -> layout.buildDirectory.file('jacoco/coverage.exec').get() + +tasks.withType(Test) { + /* + * TODO TEST Figure out why tests fail without this and remove. Might have something to do + * with the stfuLoggers() call in many of the tests, might kill logging for tests that + * require it + * Although it seems to make Mongo start up correctly as well which is odd + */ + forkEvery = 1 + /* + * TODO TEST split tests into mongo wrapper tests & all other tests (incl. integration). + * Set up GHA to run the non-mongo tests with a single version of mongo and run the + * mongo tests with matrixed mongo versions. Combine coverage at the end somehow + */ + systemProperty "test.cfg", "./test.cfg" + maxHeapSize = "3G" + testLogging { + exceptionFormat = 'full' + showStandardStreams = true + } + filter { + // gradle thinks that classes annotated with @RunWith are tests + excludeTestsMatching "*Tester" + } + jacoco { + destinationFile = coverageFile(layout).asFile + } + finalizedBy jacocoTestReport +} + +jacocoTestReport { + getExecutionData().setFrom(files(coverageFile(layout))) + reports { + xml.required = true + csv.required = true + } +} + +test { + // no special config needed +} + +task testQuick(type: Test) { + // for Gradle 9.0 compatibility + testClassesDirs = testing.suites.test.sources.output.classesDirs + classpath = testing.suites.test.sources.runtimeClasspath + + filter { + excludeTestsMatching "*LongTest" + } +} + +// Custom java project layout +sourceSets { + main { + java { + srcDirs = ["src"] + exclude '**/test/**' + } + } + test { + java { + srcDirs = ["src"] + include '**/test/**' + } + resources { + srcDirs = ["src"] + include "**/*.properties" + include '**/*.spec' + include '**/*instance.*' + include '**/*.instance*' + include '**/*.html' + include '**/*.css' + include '**/*.gif' + include '**/*.js' + include '**/*.png' + include '**/*.txt' + include '**/*.weirdsuffix' + } + } +} + +javadoc { + options { + links "https://docs.oracle.com/en/java/javase/11/docs/api/" + links "https://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-core/2.9.9/" + links "https://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind/2.9.9/" + } +} + +war { + webXml = file('war/web.xml') +} + +configurations { + // can't directly access testImplementation, so extend and access + testimpl.extendsFrom testImplementation +} + +def fromURL = { url, name -> + File file = new File("$buildDir/download/${name}.jar") + file.parentFile.mkdirs() + if (!file.exists()) { + new URL(url).withInputStream { downloadStream -> + file.withOutputStream { fileOut -> + fileOut << downloadStream + } + } + } + files(file.absolutePath) +} + +dependencies { + + // ### General application dependencies ### + + implementation fromURL( + 'https://github.com/kbase/jars/raw/master/lib/jars/kbase/auth/kbase-auth-0.4.4.jar', + 'kbase-auth-0.4.4' + ) + implementation fromURL( + 'https://github.com/kbase/jars/raw/master/lib/jars/kbase/kidl/kbase-kidl-parser-1409261812-7863aef.jar', + 'kbase-kidl-parser-1409261812-7863aef' + ) + implementation 'com.fasterxml.jackson.core:jackson-annotations:2.9.9' + implementation 'com.fasterxml.jackson.core:jackson-core:2.9.9' + implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.9' + implementation 'org.ini4j:ini4j:0.5.2' + implementation 'commons-io:commons-io:2.4' + implementation 'org.apache.commons:commons-lang3:3.1' + implementation 'commons-codec:commons-codec:1.8' + implementation 'info.picocli:picocli:4.6.1' + implementation 'org.mongodb:mongodb-driver-core:4.11.1' + implementation 'org.mongodb:mongodb-driver-sync:4.11.1' + implementation 'org.mongodb:bson-record-codec:4.11.1' + implementation 'org.mongodb:bson:4.11.1' + implementation 'org.slf4j:slf4j-api:1.7.30' + implementation 'ch.qos.logback:logback-classic:1.1.2' + implementation 'com.google.guava:guava:14.0.1' + implementation 'com.github.ben-manes.caffeine:caffeine:2.9.3' + implementation 'org.apache.kafka:kafka-clients:2.1.0' + implementation fromURL( + 'https://github.com/kbase/jars/raw/master/lib/jars/kbase/handle/AbstractHandleClient-1.0.0.jar', + 'AbstractHandleClient-1.0.0' + ) + implementation fromURL( + 'https://github.com/kbase/jars/raw/master/lib/jars/kbase/sample/SampleServiceClient-0.1.1.jar', + 'SampleServiceClient-0.1.1' + ) + + // ### Server dependencies, specifically for java_common JsonServerServlet ### + + implementation fromURL( + 'https://github.com/kbase/jars/raw/master/lib/jars/kbase/common/kbase-common-0.2.0.jar', + 'kbase-common-0.2.0' + ) + // joda-time is required for kbase-common and syslog4j + implementation 'joda-time:joda-time:2.2' + // this is OOOOOOLD. But that probably means updating java_common + implementation 'org.eclipse.jetty.aggregate:jetty-all:7.0.0.v20091005' + implementation 'javax.servlet:servlet-api:2.5' + implementation 'javax.annotation:javax.annotation-api:1.3.2' + // Syslog4j 0.9.46 doesn't appear to be available on Maven. It apparently lives in + // a JetBrains artifact server, but that's too much trouble and there's only one version there + // anyway. + // https://mvnrepository.com/artifact/org.jetbrains/syslog4j/0.9.46 + // Need to rework the java common logger to not use syslog4j at all since it's abandonware + // and has a ton of CVEs, even in the newer versions. + implementation fromURL( + 'https://github.com/kbase/jars/raw/master/lib/jars/syslog4j/syslog4j-0.9.46.jar', + 'syslog4j-0.9.46' + ) + // needed for syslog4j + implementation 'net.java.dev.jna:jna:3.4.0' + + // ### Blobstore / Shock client and dependencies ### + + implementation fromURL( + 'https://github.com/kbase/jars/raw/master/lib/jars/kbase/shock/shock-client-0.1.0.jar', + 'shock-client-0.1.0' + ) + implementation 'org.apache.httpcomponents:httpclient:4.5.9' + implementation 'org.apache.httpcomponents:httpmime:4.5.8' + + // ### Amazon S3 ### + + implementation('software.amazon.awssdk:s3:2.17.214') { + exclude module: 'apache-client' + exclude module: 'netty-nio-client' + } + implementation 'software.amazon.awssdk:url-connection-client:2.17.214' + + // ### Test ### + + testImplementation 'junit:junit:4.12' + testImplementation 'org.hamcrest:hamcrest-core:1.3' + testImplementation 'com.github.zafarkhaja:java-semver:0.9.0' + testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.1.10' + testImplementation 'com.arangodb:arangodb-java-driver:6.7.2' + testImplementation 'org.mockito:mockito-core:3.0.0' + + testImplementation 'commons-lang:commons-lang:2.4' + testImplementation fromURL( + 'https://github.com/kbase/jars/raw/master/lib/jars/kbase/auth2/kbase-auth2-test-shadow-all-0.7.0.jar', + 'kbase-auth2-test-shadow-all-0.7.0' + ) +} + +task showTestClassPath { + doLast { + configurations.testimpl.each { println it } + } +} + diff --git a/docsource/releasenotes.rst b/docsource/releasenotes.rst index 6d67c630c..9e1afb90f 100644 --- a/docsource/releasenotes.rst +++ b/docsource/releasenotes.rst @@ -8,7 +8,10 @@ VERSION: 0.14.3 (Released 2/22/2024) UPDATES: -* The MongoDB clients have been updated to the most recent version and the service tested against Mongo 7. +* The MongoDB clients have been updated to the most recent version and the service tested + against Mongo 7. +* Gradle has replaced Ant as the build tool. As a consequence, all the built artifacts are now + located in the build directory, including the ``update_workspace_database_schema`` script. VERSION: 0.14.2 (Released 11/9/2023) diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..41d9927a4 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..17655d0ef --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 000000000..1b6c78733 --- /dev/null +++ b/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/server_scripts/README.md b/server_scripts/README.md new file mode 100644 index 000000000..6c7181b3b --- /dev/null +++ b/server_scripts/README.md @@ -0,0 +1,4 @@ +These scripts are deprecated in favor of a tomcat based deployment via Dockerfile. + +TODO: Redo the dockerfile with a clean install of an updated Tomcat installation +TODO: Redo server startup instructions in the docs cleanly, step by step \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 000000000..957ae4c25 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,11 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * + * Detailed information about configuring a multi-project build in Gradle can be found + * in the user manual at https://docs.gradle.org/7.4.2/userguide/multi_project_builds.html + * This project uses @Incubating APIs which are subject to change. + */ + +rootProject.name = 'workspace_deluxe' diff --git a/src/us/kbase/common/test/TestCommon.java b/src/us/kbase/common/test/TestCommon.java index 85e7fc6d8..e89b4f052 100644 --- a/src/us/kbase/common/test/TestCommon.java +++ b/src/us/kbase/common/test/TestCommon.java @@ -50,8 +50,6 @@ public class TestCommon { public static final String ARANGOEXE = "test.arango.exe"; public static final String ARANGOJS = "test.arango.js"; - public static final String JARS_PATH = "test.jars.dir"; - public static final String TEST_TEMP_DIR = "test.temp.dir"; public static final String KEEP_TEMP_DIR = "test.temp.dir.keep"; @@ -167,10 +165,6 @@ public static Path getSampleServiceDir() { return Paths.get(getTestProperty(SAMPLE_SERVICE_DIR)); } - public static Path getJarsDir() { - return Paths.get(getTestProperty(JARS_PATH)); - } - public static boolean getDeleteTempFiles() { return !"true".equals(getTestProperty(KEEP_TEMP_DIR)); } diff --git a/src/us/kbase/typedobj/core/NullJsonGenerator.java b/src/us/kbase/typedobj/core/NullJsonGenerator.java index 37c45470a..ecc57981a 100644 --- a/src/us/kbase/typedobj/core/NullJsonGenerator.java +++ b/src/us/kbase/typedobj/core/NullJsonGenerator.java @@ -240,6 +240,7 @@ public int getFeatureMask() { } @Override + @Deprecated public JsonGenerator setFeatureMask(int values) { return null; } diff --git a/src/us/kbase/typedobj/db/KidlUtil.java b/src/us/kbase/typedobj/db/KidlUtil.java index 02bfc00a6..d90b675c2 100644 --- a/src/us/kbase/typedobj/db/KidlUtil.java +++ b/src/us/kbase/typedobj/db/KidlUtil.java @@ -1,8 +1,5 @@ package us.kbase.typedobj.db; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - import java.io.BufferedReader; import java.io.IOException; import java.io.StringReader; @@ -37,30 +34,6 @@ public static boolean compareJson(Map parse1, Map parse2, String hea return ok; } - public static boolean compareJsonSchemas(Map> schemas1, - Map> schemas2, String header) throws IOException, - JsonParseException, JsonMappingException, JsonGenerationException, - Exception { - boolean ok = true; - assertThat(schemas1.keySet(), is(schemas2.keySet())); - for (String moduleName : schemas1.keySet()) { - assertThat(schemas1.get(moduleName).keySet(), is(schemas2.get(moduleName).keySet())); - for (Map.Entry entry : schemas1.get(moduleName).entrySet()) { - String schema1 = rewriteJson(entry.getValue()); - String schema2 = rewriteJson(schemas2.get(moduleName).get(entry.getKey())); - if (!schema1.equals(schema2)) { - ok = false; - System.out.println(header + " (" + moduleName + "." + entry.getKey() + "):"); - System.out.println("--------------------------------------------------------"); - showDiff(schema1, schema2); - System.out.println(); - System.out.println("*"); - } - } - } - return ok; - } - private static void showDiff(String origText, String newText) throws Exception { List origLn = getLines(origText); List newLn = getLines(newText); diff --git a/src/us/kbase/typedobj/db/test/MongoTypeStorageTest.java b/src/us/kbase/typedobj/db/test/MongoTypeStorageTest.java index e3a5afb04..930fd45cd 100644 --- a/src/us/kbase/typedobj/db/test/MongoTypeStorageTest.java +++ b/src/us/kbase/typedobj/db/test/MongoTypeStorageTest.java @@ -43,7 +43,6 @@ public static void setUp() throws Exception { System.out.println("Started test mongo instance at localhost:" + MONGO.getServerPort()); - @SuppressWarnings("resource") final MongoClient mc = MongoClients.create("mongodb://localhost:" + MONGO.getServerPort()); MONGO_DB = mc.getDatabase("test_" + MongoTypeStorageTest.class.getSimpleName()); } diff --git a/src/us/kbase/typedobj/db/test/TypeRegisteringTest.java b/src/us/kbase/typedobj/db/test/TypeRegisteringTest.java index a71f7cd7a..2a89162fe 100644 --- a/src/us/kbase/typedobj/db/test/TypeRegisteringTest.java +++ b/src/us/kbase/typedobj/db/test/TypeRegisteringTest.java @@ -144,7 +144,6 @@ public static MongoDatabase createMongoDbConnection() throws Exception { System.out.println("Using mongo temp dir " + mongo.getTempDir()); } - @SuppressWarnings("resource") final MongoClient mcli = MongoClients.create("mongodb://localhost:" + mongo.getServerPort()); final MongoDatabase mdb = mcli.getDatabase("TypeRegisteringTest"); TestCommon.destroyDB(mdb); diff --git a/src/us/kbase/workspace/database/Workspace.java b/src/us/kbase/workspace/database/Workspace.java index a0b843f2b..f2513dccb 100644 --- a/src/us/kbase/workspace/database/Workspace.java +++ b/src/us/kbase/workspace/database/Workspace.java @@ -1244,7 +1244,7 @@ public List> getReferencingObjects( return ret; } - /** @deprecated */ + @Deprecated public List getReferencingObjectCounts( final WorkspaceUser user, final List loi) throws WorkspaceCommunicationException, InaccessibleObjectException, diff --git a/src/us/kbase/workspace/database/WorkspaceDatabase.java b/src/us/kbase/workspace/database/WorkspaceDatabase.java index 53fc2a095..9f2873c03 100644 --- a/src/us/kbase/workspace/database/WorkspaceDatabase.java +++ b/src/us/kbase/workspace/database/WorkspaceDatabase.java @@ -442,7 +442,7 @@ Map getObjectIncomingReferences( Set objs) throws NoSuchObjectException, WorkspaceCommunicationException; - /** @deprecated */ + @Deprecated Map getReferencingObjectCounts( Set objects) throws WorkspaceCommunicationException, NoSuchObjectException; diff --git a/src/us/kbase/workspace/database/mongo/MongoWorkspaceDB.java b/src/us/kbase/workspace/database/mongo/MongoWorkspaceDB.java index 9aba5ad06..8f5b6f9b2 100644 --- a/src/us/kbase/workspace/database/mongo/MongoWorkspaceDB.java +++ b/src/us/kbase/workspace/database/mongo/MongoWorkspaceDB.java @@ -2734,8 +2734,8 @@ public Map> getReferencingObjects( private static final Set FLDS_REF_CNT = newHashSet( Fields.OBJ_ID, Fields.OBJ_NAME, Fields.OBJ_DEL, Fields.OBJ_VCNT, Fields.OBJ_REFCOUNTS); - /** @deprecated */ @Override + @Deprecated public Map getReferencingObjectCounts( final Set objects) throws WorkspaceCommunicationException, NoSuchObjectException { diff --git a/src/us/kbase/workspace/kbase/admin/AdministrationCommandSetInstaller.java b/src/us/kbase/workspace/kbase/admin/AdministrationCommandSetInstaller.java index 7b263325e..07722c58c 100644 --- a/src/us/kbase/workspace/kbase/admin/AdministrationCommandSetInstaller.java +++ b/src/us/kbase/workspace/kbase/admin/AdministrationCommandSetInstaller.java @@ -11,7 +11,7 @@ import java.util.Optional; import java.util.stream.Collectors; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/us/kbase/workspace/test/database/mongo/GridFSBlobStoreTest.java b/src/us/kbase/workspace/test/database/mongo/GridFSBlobStoreTest.java index 4a0f308cd..e98e112f6 100644 --- a/src/us/kbase/workspace/test/database/mongo/GridFSBlobStoreTest.java +++ b/src/us/kbase/workspace/test/database/mongo/GridFSBlobStoreTest.java @@ -59,7 +59,6 @@ public static void setUpClass() throws Exception { System.out.println("Using Mongo temp dir " + mongo.getTempDir()); TestCommon.stfuLoggers(); - @SuppressWarnings("resource") final MongoClient mongoClient = MongoClients.create("mongodb://localhost:" + mongo.getServerPort()); final MongoDatabase db = mongoClient.getDatabase("GridFSBackendTest"); gfs = GridFSBuckets.create(db); diff --git a/src/us/kbase/workspace/test/database/mongo/MongoWorkspaceDBTest.java b/src/us/kbase/workspace/test/database/mongo/MongoWorkspaceDBTest.java index c0242c697..602e7366f 100644 --- a/src/us/kbase/workspace/test/database/mongo/MongoWorkspaceDBTest.java +++ b/src/us/kbase/workspace/test/database/mongo/MongoWorkspaceDBTest.java @@ -117,7 +117,6 @@ public static void setup() throws Exception { System.out.println("Started test mongo instance at localhost:" + MONGO.getServerPort()); - @SuppressWarnings("resource") final MongoClient mc = MongoClients.create("mongodb://localhost:" + MONGO.getServerPort()); MONGO_DB = mc.getDatabase("test_" + MongoWorkspaceDBTest.class.getSimpleName()); diff --git a/src/us/kbase/workspace/test/database/mongo/S3BlobStoreIntegrationTest.java b/src/us/kbase/workspace/test/database/mongo/S3BlobStoreIntegrationTest.java index 8c3a3c1f4..250d80d56 100644 --- a/src/us/kbase/workspace/test/database/mongo/S3BlobStoreIntegrationTest.java +++ b/src/us/kbase/workspace/test/database/mongo/S3BlobStoreIntegrationTest.java @@ -68,7 +68,6 @@ public static void setUpClass() throws Exception { System.out.println("Using Mongo temp dir " + mongoCon.getTempDir()); System.out.println("Started mongo server at localhost:" + mongoCon.getServerPort()); - @SuppressWarnings("resource") MongoClient mongoClient = MongoClients.create("mongodb://localhost:" + mongoCon.getServerPort()); mongo = mongoClient.getDatabase("MinioBackendTest"); diff --git a/src/us/kbase/workspace/test/database/mongo/SchemaUpdaterTest.java b/src/us/kbase/workspace/test/database/mongo/SchemaUpdaterTest.java index 5fec5968e..40298e6ea 100644 --- a/src/us/kbase/workspace/test/database/mongo/SchemaUpdaterTest.java +++ b/src/us/kbase/workspace/test/database/mongo/SchemaUpdaterTest.java @@ -12,7 +12,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.Date; -import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; diff --git a/src/us/kbase/workspace/test/workspace/WorkspaceIntegrationWithGridFSTest.java b/src/us/kbase/workspace/test/workspace/WorkspaceIntegrationWithGridFSTest.java index ffbb3681d..5a28058ca 100644 --- a/src/us/kbase/workspace/test/workspace/WorkspaceIntegrationWithGridFSTest.java +++ b/src/us/kbase/workspace/test/workspace/WorkspaceIntegrationWithGridFSTest.java @@ -114,7 +114,6 @@ public static void setUpClass() throws Exception { System.out.println("Using Mongo temp dir " + MONGO.getTempDir()); System.out.println("Started test mongo instance at localhost: " + MONGO.getServerPort()); - @SuppressWarnings("resource") final MongoClient mcli = MongoClients.create("mongodb://localhost:" + MONGO.getServerPort()); WSDB = mcli.getDatabase(WSDB_NAME); TYPEDB = mcli.getDatabase(TYPEDB_NAME); diff --git a/src/us/kbase/workspace/test/workspace/WorkspaceTester.java b/src/us/kbase/workspace/test/workspace/WorkspaceTester.java index 1e4e6e3f3..d933fae52 100644 --- a/src/us/kbase/workspace/test/workspace/WorkspaceTester.java +++ b/src/us/kbase/workspace/test/workspace/WorkspaceTester.java @@ -204,7 +204,6 @@ public WorkspaceTester( mongo.getServerPort()); } if (!CONFIGS.containsKey(config)) { - @SuppressWarnings("resource") final MongoClient mcli = MongoClients.create("mongodb://localhost:" + mongo.getServerPort()); final MongoDatabase wsdb = mcli.getDatabase(DB_WS_NAME); final MongoDatabase tdb = mcli.getDatabase(DB_TYPE_NAME); diff --git a/test.cfg.example b/test.cfg.example index a66c1312f..ea4f09a66 100644 --- a/test.cfg.example +++ b/test.cfg.example @@ -2,10 +2,6 @@ [Workspacetest] -# The path to the jars dir inside the jars repo, e.g. -# [path to jars repo]/lib/jars -test.jars.dir = - # Minio exe file location test.minio.exe = minio