diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..097f9f9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +# +# https://help.github.com/articles/dealing-with-line-endings/ +# +# Linux start script should use lf +/gradlew text eol=lf + +# These are Windows script files and should use crlf +*.bat text eol=crlf + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f7ef41b..5e6bfab 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,10 +25,10 @@ jobs: # the current production setup - java: '8' mongo: 'mongodb-linux-x86_64-3.6.13' - ant_test: 'test' + gradle_test: 'test' - java: '11' mongo: 'mongodb-linux-x86_64-3.6.23' - ant_test: 'test' + gradle_test: 'test' steps: - uses: actions/checkout@v3 @@ -75,7 +75,7 @@ jobs: run: | PATH=$PATH:$MASH_PATH echo $PATH - ant ${{matrix.ant_test}} + ./gradlew ${{matrix.gradle_test}} - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 diff --git a/Dockerfile b/Dockerfile index 71fbb1b..fe612e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,22 @@ FROM kbase/sdkbase2 as build -RUN cd / && git clone https://github.com/kbase/jars +WORKDIR /tmp/ah -ADD . /src -RUN cd /src && ant build -RUN find /src +# dependencies take a while to D/L, so D/L & cache before the build so code changes don't cause +# a new D/L +# can't glob *gradle because of the .gradle dir +COPY build.gradle gradlew settings.gradle /tmp/ah/ +COPY gradle/ /tmp/ah/gradle/ +RUN ./gradlew dependencies + +# Now build the code +COPY deployment/ /tmp/ah/deployment/ +COPY jettybase/ /tmp/ah/jettybase/ +COPY src /tmp/ah/src/ +COPY war /tmp/ah/war/ +# for the git commit +COPY .git /tmp/ah/.git/ +RUN ./gradlew war FROM kbase/kb_jre:latest @@ -14,10 +26,9 @@ ARG BUILD_DATE ARG VCS_REF ARG BRANCH=develop -COPY --from=build /src/deployment/ /kb/deployment/ -COPY --from=build /src/jettybase/ /kb/deployment/jettybase/ -COPY --from=build /src/dist/ /src/dist/ -COPY --from=build /src/assembly_homology /kb/deployment/bin/ +COPY --from=build /tmp/ah/deployment/ /kb/deployment/ +COPY --from=build /tmp/ah/jettybase/ /kb/deployment/jettybase/ +COPY --from=build /tmp/ah/build/libs/AssemblyHomologyService.war /kb/deployment/jettybase/webapps/ROOT.war # The BUILD_DATE value seem to bust the docker cache when the timestamp changes, move to # the end @@ -33,6 +44,9 @@ ENV ASSEMBLY_HOMOLOGY_CONFIG=/kb/deployment/conf/deployment.cfg ENV PATH=/bin:/usr/bin:/kb/deployment/bin ENV JETTY_HOME=/usr/local/jetty +# TODO BUILD update to no longer use dockerize and take env vars (e.g. like Collections). +# TODO BUILD Use subsections in the ini file / switch to TOML + RUN wget https://github.com/marbl/Mash/releases/download/v2.0/mash-Linux64-v2.0.tar && \ tar xf mash-Linux64-v2.0.tar && \ cp mash-Linux64-v2.0/mash /usr/bin/mash diff --git a/README.md b/README.md index fbe56b6..9f18f2b 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,6 @@ This repo contains the KBase / JGI Assembly Homology Service (AHS). The service assembly matching based on implementations of the [MinHash algorithm](https://ieeexplore.ieee.org/abstract/document/666900/?reload=tru). -Build status (master): -[![Build Status](https://travis-ci.org/jgi-kbase/AssemblyHomologyService.svg?branch=master)](https://travis-ci.org/jgi-kbase/AssemblyHomologyService) [![codecov](https://codecov.io/gh/jgi-kbase/AssemblyHomologyService/branch/master/graph/badge.svg)](https://codecov.io/gh/jgi-kbase/AssemblyHomologyService) ## Usage @@ -33,21 +31,20 @@ is supported. Mash is configured to never return sequences with a distance great ## Requirements Java 8 (OpenJDK OK) -Apache Ant (http://ant.apache.org/) MongoDB 2.6+ (https://www.mongodb.com/) Jetty 9.3+ (http://www.eclipse.org/jetty/download.html) (see jetty-config.md for version used for testing) This repo (git clone https://github.com/jgi-kbase/AssemblyHomologyService) -The jars repo (git clone https://github.com/kbase/jars) -The two repos above need to be in the same parent folder. ## Build ``` cd [assembly homology repo directory] -ant build +./gradlew buildAll ``` +Build artifacts reside in the `build` directory. + ## Load data These instructions assume @@ -230,7 +227,13 @@ processing and either discard or pass on all distances to the collector. ensure `mash` is available on the system path start mongodb cd into the assembly homology repo -`ant build` + +``` +./gradlew buildAll +mkdir jettybase/webapps +cp build/libs/AssemblyHomologyService.war jettybase/webapps/ROOT.war +``` + copy `deploy.cfg.example` to `deploy.cfg` and fill in appropriately `export ASSEMBLY_HOMOLOGY_CONFIG=` OR @@ -306,8 +309,7 @@ authorization source specified may be searched at the same time as namespaces wi ### Running tests * Copy `test.cfg.example` to `test.cfg` and fill in the values appropriately. - * If it works as is start buying lottery tickets immediately. -* `ant test` +* `./gradlew test` ### UI diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 7bc67ce..0b4943a 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,5 +1,10 @@ # Assembly Homology Service release notes +## 0.1.4 + +* Switched the build system from Ant to Gradle. As such, all build artifacts, including the + `assembly_homology` script, are now found in the `build` directory. + ## 0.1.3 * Update the Java Mongo client to 3.10.1. This supports the latest Mongo version, 4.0. diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..f195c58 --- /dev/null +++ b/build.gradle @@ -0,0 +1,200 @@ +/* + * This file was generated by the Gradle 'init' task. + */ + +plugins { + id 'java' + id 'war' + id 'jacoco' + id 'org.ajoberstar.grgit' version '4.1.1' +} + +// TODO NOW switch to std gradle layout +// TODO NOW use jitpacked workspace client and shadow jar when available and remove jars + +repositories { + mavenCentral() + + maven { + name = "Clojars" + url = "https://repo.clojars.org/" + } + maven { + name = "JitPack" + url = 'https://jitpack.io' + } +} +task buildGitCommitFile { + doLast { + def commitId = grgit.head().id + // is there a variable for builddir/classes/java/main? + file("$buildDir/classes/java/main/us/kbase/assemblyhomology/gitcommit").text = commitId + } +} + +compileJava { + // TODO BUILD remove when we no longer support java 8, use `options.release = 11` if needed + java.sourceCompatibility = JavaVersion.VERSION_1_8 + java.targetCompatibility = JavaVersion.VERSION_1_8 + finalizedBy buildGitCommitFile +} + +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 "ASSEMHOMOL_TEST_CONFIG", "./test.cfg" + testLogging { + exceptionFormat = 'full' + showStandardStreams = true + } + finalizedBy jacocoTestReport +} + +// TODO TEST add a test that starts the server in a docker container and checks some simple cmds + +jacocoTestReport { + reports { + xml.required = true + csv.required = true + } +} + +javadoc { + options { + // I don't know why this isn't working, but it's not worth spending time on right now + links "https://docs.oracle.com/javase/8/docs/api/" + } +} + +war { + webXml = file('war/web.xml') +} + +configurations { + // can't directly access testImplementation, so extend and access + testimpl.extendsFrom testImplementation +} + +task generateCLIScript { + dependsOn compileJava + doLast { + def dependencies = configurations.runtimeClasspath.collect { File file -> + file.absolutePath + } + + def classpath = dependencies.join(':') + + def scriptContent = """#!/bin/sh + +CLASSPATH=$classpath + +java -cp build/classes/java/main:\$CLASSPATH us.kbase.assemblyhomology.cli.AssemblyHomologyCLI \$@ +""" + + file("$buildDir/assembly_homology").text = scriptContent + file("$buildDir/assembly_homology").setExecutable(true) + } +} + +task buildAll { + dependsOn generateCLIScript + dependsOn war + dependsOn javadoc +} + +sourceSets { + main { + java { + srcDirs = ["src"] + exclude '**/test/**' + } + } + test { + java { + srcDirs = ["src"] + include '**/test/**' + } + resources { + srcDirs = ["src"] + include "**/*.msh" + include "**/*.txt" + include "**/wsjars" + } + } +} + +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 { + + implementation fromURL( + 'https://github.com/kbase/jars/raw/master/lib/jars/kbase/workspace/WorkspaceService-0.8.0.jar', + 'WorkspaceService-0.8.0' + ) + + implementation 'org.ini4j:ini4j:0.5.2' + implementation 'commons-io:commons-io:2.4' + implementation 'com.beust:jcommander:1.72' + implementation 'org.mongodb:mongo-java-driver:3.10.1' + implementation 'com.google.guava:guava:18.0' + implementation "com.github.kbase:auth2_client_java:0.5.0" + implementation('com.github.kbase:java_common:0.3.0') { + exclude group: 'net.java.dev.jna' // breaks mac builds, not needed + exclude group: 'org.eclipse.jetty.aggregate' // ugh, java common pollutes everything + exclude group: 'com.fasterxml.jackson.core' // breaks everything if we upgrade + exclude group: 'javax.servlet', module: 'servlet-api' // 2.5 vs 3.1 below + } + implementation 'com.github.zafarkhaja:java-semver:0.9.0' + implementation 'org.yaml:snakeyaml:1.18' + implementation 'ch.qos.logback:logback-classic:1.1.2' + implementation 'org.slf4j:slf4j-api:1.7.25' + // TODO DEPS 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 "org.syslog4j:syslog4j:0.9.46" + implementation 'com.fasterxml.jackson.core:jackson-annotations:2.5.4' + implementation 'com.fasterxml.jackson.core:jackson-databind:2.5.4' + implementation 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.5.4' + implementation 'org.glassfish.jersey.containers:jersey-container-servlet:2.23.2' + implementation 'org.glassfish.jersey.media:jersey-media-json-jackson:2.23.2' + implementation 'javax.servlet:javax.servlet-api:3.0.1' + implementation 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359' + + testImplementation "com.github.kbase:auth2:0.7.1" + testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.1.10' + testImplementation 'junit:junit:4.12' + testImplementation('org.eclipse.jetty:jetty-servlet:9.3.11.v20160721') { + exclude group: "javax.servlet", module: "javax.servlet-api" // upgrading breaks tests + } + testImplementation 'org.mockito:mockito-core:3.0.0' + testImplementation 'org.apache.commons:commons-lang3:3.5' + testImplementation('com.github.kbase:java_test_utilities:0.1.0') { + exclude group: 'com.fasterxml.jackson.core' // upgrading breaks stuff + } +} + +task showTestClassPath { + doLast { + configurations.testimpl.each { println it } + } +} diff --git a/build.xml b/build.xml deleted file mode 100644 index f803fdf..0000000 --- a/build.xml +++ /dev/null @@ -1,350 +0,0 @@ - - - - Build file for the joint KBase / JGI Assembly Homology Service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #!/bin/sh -java -cp ${dist}/${jar.file}:${lib.classpath} us.kbase.assemblyhomology.cli.AssemblyHomologyCLI $@ - - - - - - - - - - - - diff --git a/docker-compose.yml b/docker-compose.yml index 2063d41..3e7125f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,20 +5,24 @@ version: "3.1" # that is started up and polled services: assembly_homology: - image: kbase/assembly_homology:latest + build: + context: . + dockerfile: Dockerfile ports: - "8080:8080" environment: - - ASSEMBLY_HOMOLOGY_CONFIG=/kb/deployment/conf/deployment.cfg + mongo_host: "mongo:27017" command: - "-wait" - - "tcp://ci-mongo:27017" - - "-wait" - - "tcp://mongoinit:8080" + - "tcp://mongo:27017" - "-timeout" - "120s" - "-template" - "/kb/deployment/conf/.templates/deployment.cfg.templ:/kb/deployment/conf/deployment.cfg" + - "java" + - "-Djetty.home=/usr/local/jetty" + - "-jar" + - "/usr/local/jetty/start.jar" # If you needed to pass in context for template evaluation you would put something like # these lines that tell dockerize to hit github for an INI style file for the context # - "-env" @@ -34,22 +38,10 @@ services: # If your server is using self-signed certs, or otherwise problematic for cert validation # you can add the following flag: # - "-validateCert=false" - depends_on: ["ci-mongo", "mongoinit"] + depends_on: ["mongo"] - mongoinit: - image: kbase/db_initialize:latest - entrypoint: - - "/kb/deployment/bin/dockerize.sh" - - "-wait" - - "tcp://ci-mongo:27017" - - "-timeout" - - "120s" - depends_on: [ "ci-mongo" ] - - ci-mongo: - image: mongo:2 - command: - - "--smallfiles" + mongo: + image: mongo:3.6.23 ports: - "27017:27017" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..4ac3234 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,2 @@ +# This file was generated by the Gradle 'init' task. +# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e644113 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 0000000..b82aa23 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..1aa94a4 --- /dev/null +++ b/gradlew @@ -0,0 +1,249 @@ +#!/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/HEAD/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 + +# This is normally unused +# 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 + +# 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 + if ! command -v java >/dev/null 2>&1 + then + 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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + 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 + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_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. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# 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/settings.gradle b/settings.gradle new file mode 100644 index 0000000..19e74eb --- /dev/null +++ b/settings.gradle @@ -0,0 +1,8 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.7/userguide/multi_project_builds.html in the Gradle documentation. + */ + +rootProject.name = 'AssemblyHomologyService' diff --git a/src/us/kbase/assemblyhomology/config/AssemblyHomologyConfig.java b/src/us/kbase/assemblyhomology/config/AssemblyHomologyConfig.java index 7c8d5cc..0a5dc8e 100644 --- a/src/us/kbase/assemblyhomology/config/AssemblyHomologyConfig.java +++ b/src/us/kbase/assemblyhomology/config/AssemblyHomologyConfig.java @@ -32,8 +32,8 @@ * mongo-pwd * temp-dir * filters - * filter--factory-class - * filter--init- + * filter-<name>-factory-class + * filter-<name>-init-<key> * dont-trust-x-ip-headers * * @@ -123,6 +123,7 @@ private AssemblyHomologyConfig( if (nullLogger) { logger = new NullLogger(); } else { + JsonServerSyslog.setStaticUseSyslog(false); // may want to allow configuring the logger name, but YAGNI logger = new JsonServerSysLogAutoLogger(new JsonServerSyslog(LOG_NAME, //TODO KBASECOMMON allow null for the fake config prop arg diff --git a/src/us/kbase/assemblyhomology/core/AssemblyHomology.java b/src/us/kbase/assemblyhomology/core/AssemblyHomology.java index ca3652e..cd21e3b 100644 --- a/src/us/kbase/assemblyhomology/core/AssemblyHomology.java +++ b/src/us/kbase/assemblyhomology/core/AssemblyHomology.java @@ -178,8 +178,8 @@ public Optional getExpectedFileExtension(final MinHashImplementationName i * @param namespaceIDs the namespace IDs for the namespaces of interest. * @param sketchDB the input query sketch that will be measured against the sketch databases * associated with the given sequences. - * @param returnCount the number of measurements to return. If < 1 or > 1000, 10 measurements - * will be returned. + * @param returnCount the number of measurements to return. If < 1 or > 1000, + * 10 measurements will be returned. * @param strict true to enforce an exact match between sketch parameters. If false, * differences in the parameters will be ignored if the MinHash implementation allows it. * @param token a token to use for namespaces that accept or require authentication. Pass null diff --git a/src/us/kbase/assemblyhomology/load/NamespaceLoadInfo.java b/src/us/kbase/assemblyhomology/load/NamespaceLoadInfo.java index fae3589..b0c4906 100644 --- a/src/us/kbase/assemblyhomology/load/NamespaceLoadInfo.java +++ b/src/us/kbase/assemblyhomology/load/NamespaceLoadInfo.java @@ -30,7 +30,7 @@ * sourcedatabase: CI Refdata * description: some reference data * filterid: myfilter - *
+ * 
* * @author gaprice@lbl.gov * diff --git a/src/us/kbase/assemblyhomology/service/api/Namespaces.java b/src/us/kbase/assemblyhomology/service/api/Namespaces.java index ff9c953..c6fdba2 100644 --- a/src/us/kbase/assemblyhomology/service/api/Namespaces.java +++ b/src/us/kbase/assemblyhomology/service/api/Namespaces.java @@ -117,11 +117,12 @@ private Map fromNamespace(final NamespaceView ns) { /** Search one or more namespaces. Expects a sketch database file in the request body. * @param request the incoming servlet request. + * @param auth the authorization token. * @param namespaces a comma delimited string of namespace IDs. * @param notStrict if non null, MinHash searches will continue if possible if the query * sketch database parameters do not match the target database parameters. - * @param max the maximum number of matches to return. If missing, < 1, or > 100 the maximum - * is set to 10. + * @param max the maximum number of matches to return. If missing, < 1, or > + * 100 the maximum is set to 10. * @return the matches. * @throws IOException if an error occurs retrieving the sketch database file from the * request or saving the file to a temporary file. diff --git a/src/us/kbase/assemblyhomology/storage/AssemblyHomologyStorage.java b/src/us/kbase/assemblyhomology/storage/AssemblyHomologyStorage.java index f1f6b9e..92f643e 100644 --- a/src/us/kbase/assemblyhomology/storage/AssemblyHomologyStorage.java +++ b/src/us/kbase/assemblyhomology/storage/AssemblyHomologyStorage.java @@ -67,6 +67,7 @@ List getSequenceMetadata(NamespaceID namespaceID, List * storage system fails. * @throws NoSuchSequenceException if the requested sequence id(s) does not exist within the * namespace and its current load ID. + * @throws NoSuchNamespaceException if the provided namespace does not exist. */ List getSequenceMetadata( NamespaceID namespaceID, diff --git a/src/us/kbase/assemblyhomology/util/Restreamable.java b/src/us/kbase/assemblyhomology/util/Restreamable.java index 8b90a18..5f08347 100644 --- a/src/us/kbase/assemblyhomology/util/Restreamable.java +++ b/src/us/kbase/assemblyhomology/util/Restreamable.java @@ -17,7 +17,9 @@ public interface Restreamable { */ InputStream getInputStream() throws IOException; - /** Get information about the source of a stream. Typically a file name. */ + /** Get information about the source of a stream. Typically a file name. + * @return the source information. + */ String getSourceInfo(); } diff --git a/src/us/kbase/assemblyhomology/util/Util.java b/src/us/kbase/assemblyhomology/util/Util.java index c036c52..03ca5e1 100644 --- a/src/us/kbase/assemblyhomology/util/Util.java +++ b/src/us/kbase/assemblyhomology/util/Util.java @@ -86,6 +86,7 @@ private static int codePoints(final String s) { } /** Check that the provided collection is not null and contains no null elements. + * @param the type of the collecction items. * @param col the collection to test. * @param name the name of the collection to use in any error messages. */ @@ -115,7 +116,7 @@ public static void checkNoNullsOrEmpties(final Collection strings, final /** Load and instantiate a class with a given interface. Expects a constructor that takes - * a single Map argument. + * a single Map<String, String> argument. * @param the class that will be instantiated. * @param className the fully qualified class name. * @param interfce the required interface. diff --git a/src/us/kbase/test/assemblyhomology/MongoStorageTestManager.java b/src/us/kbase/test/assemblyhomology/MongoStorageTestManager.java index 11fddc7..d60c2cb 100644 --- a/src/us/kbase/test/assemblyhomology/MongoStorageTestManager.java +++ b/src/us/kbase/test/assemblyhomology/MongoStorageTestManager.java @@ -13,7 +13,7 @@ import com.mongodb.client.MongoDatabase; import us.kbase.assemblyhomology.storage.mongo.MongoAssemblyHomologyStorage; -import us.kbase.common.test.controllers.mongo.MongoController; +import us.kbase.testutils.controllers.mongo.MongoController; public class MongoStorageTestManager { diff --git a/src/us/kbase/test/assemblyhomology/TestCommon.java b/src/us/kbase/test/assemblyhomology/TestCommon.java index 7b2a343..5462889 100644 --- a/src/us/kbase/test/assemblyhomology/TestCommon.java +++ b/src/us/kbase/test/assemblyhomology/TestCommon.java @@ -40,7 +40,7 @@ import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.IThrowableProxy; import ch.qos.logback.core.AppenderBase; -import us.kbase.common.test.TestException; +import us.kbase.testutils.TestException; public class TestCommon { diff --git a/src/us/kbase/test/assemblyhomology/controllers/workspace/WorkspaceController.java b/src/us/kbase/test/assemblyhomology/controllers/workspace/WorkspaceController.java index 188db06..b4d2eb0 100644 --- a/src/us/kbase/test/assemblyhomology/controllers/workspace/WorkspaceController.java +++ b/src/us/kbase/test/assemblyhomology/controllers/workspace/WorkspaceController.java @@ -1,7 +1,7 @@ package us.kbase.test.assemblyhomology.controllers.workspace; -import static us.kbase.common.test.controllers.ControllerCommon.findFreePort; -import static us.kbase.common.test.controllers.ControllerCommon.makeTempDirs; +import static us.kbase.testutils.controllers.ControllerCommon.findFreePort; +import static us.kbase.testutils.controllers.ControllerCommon.makeTempDirs; import java.io.BufferedReader; import java.io.File; @@ -27,7 +27,7 @@ import com.mongodb.MongoClient; import com.mongodb.client.MongoDatabase; -import us.kbase.common.test.TestException; +import us.kbase.testutils.TestException; /** Q&D Utility to run a Workspace server for the purposes of testing from diff --git a/src/us/kbase/test/assemblyhomology/core/AssemblyHomologyTest.java b/src/us/kbase/test/assemblyhomology/core/AssemblyHomologyTest.java index dce5ca3..acf2961 100644 --- a/src/us/kbase/test/assemblyhomology/core/AssemblyHomologyTest.java +++ b/src/us/kbase/test/assemblyhomology/core/AssemblyHomologyTest.java @@ -77,7 +77,7 @@ import us.kbase.assemblyhomology.minhash.exceptions.MinHashInitException; import us.kbase.assemblyhomology.minhash.exceptions.NotASketchException; import us.kbase.assemblyhomology.storage.AssemblyHomologyStorage; -import us.kbase.common.test.TestException; +import us.kbase.testutils.TestException; import us.kbase.test.assemblyhomology.TestCommon; import us.kbase.test.assemblyhomology.TestCommon.LogEvent; diff --git a/src/us/kbase/test/assemblyhomology/data/TestDataManager.java b/src/us/kbase/test/assemblyhomology/data/TestDataManager.java index 5684577..b0f2403 100644 --- a/src/us/kbase/test/assemblyhomology/data/TestDataManager.java +++ b/src/us/kbase/test/assemblyhomology/data/TestDataManager.java @@ -7,7 +7,7 @@ import org.apache.commons.io.IOUtils; -import us.kbase.common.test.TestException; +import us.kbase.testutils.TestException; public class TestDataManager { diff --git a/src/us/kbase/test/assemblyhomology/integration/ServiceIntegrationTest.java b/src/us/kbase/test/assemblyhomology/integration/ServiceIntegrationTest.java index e3d9d7e..8226ccf 100644 --- a/src/us/kbase/test/assemblyhomology/integration/ServiceIntegrationTest.java +++ b/src/us/kbase/test/assemblyhomology/integration/ServiceIntegrationTest.java @@ -66,7 +66,7 @@ import us.kbase.assemblyhomology.minhash.MinHashSketchDatabase; import us.kbase.assemblyhomology.minhash.exceptions.MinHashDistanceFilterAuthenticationException; import us.kbase.auth.AuthToken; -import us.kbase.common.test.RegexMatcher; +import us.kbase.testutils.RegexMatcher; import us.kbase.test.assemblyhomology.MapBuilder; import us.kbase.test.assemblyhomology.MongoStorageTestManager; import us.kbase.test.assemblyhomology.StandaloneAssemblyHomologyServer;