diff --git a/.classpath b/.classpath deleted file mode 100644 index 65f47be6..00000000 --- a/.classpath +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.codecov.yml b/.codecov.yml deleted file mode 100644 index 42c0d62b..00000000 --- a/.codecov.yml +++ /dev/null @@ -1,30 +0,0 @@ -codecov: - notify: - require_ci_to_pass: yes - -coverage: - precision: 2 - round: down - range: "70...100" - - status: - project: no - patch: yes - changes: no - -parsers: - gcov: - branch_detection: - conditional: yes - loop: yes - method: no - macro: no - -comment: - layout: "header, diff" - behavior: default - require_changes: no - -ignore: - - "build" - - "deployment" diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..097f9f98 --- /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/codeql.yml b/.github/codeql.yml new file mode 100644 index 00000000..9771ca0f --- /dev/null +++ b/.github/codeql.yml @@ -0,0 +1,52 @@ +name: "Code scanning - action" + +on: + push: + pull_request: + schedule: + - cron: '0 19 * * 0' + +jobs: + CodeQL-Build: + + # CodeQL runs on ubuntu-latest and windows-latest + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + # We must fetch at least the immediate parents so that if this is + # a pull request then we can checkout the head. + fetch-depth: 2 + + # If this run was triggered by a pull request event, then checkout + # the head of the pull request instead of the merge commit. + - run: git checkout HEAD^2 + if: ${{ github.event_name == 'pull_request' }} + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + # Override language selection by uncommenting this and choosing your languages + # with: + # languages: go, javascript, csharp, python, cpp, java + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..2659fed2 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +version: 2 +updates: +- package-ecosystem: docker + directory: "/" + schedule: + interval: weekly + time: '11:00' + open-pull-requests-limit: 10 +- package-ecosystem: pip + directory: "/" + schedule: + interval: daily + time: '11:00' + open-pull-requests-limit: 10 diff --git a/.github/workflows/manual-build.yml b/.github/workflows/manual-build.yml new file mode 100644 index 00000000..944f9035 --- /dev/null +++ b/.github/workflows/manual-build.yml @@ -0,0 +1,11 @@ +--- +name: Manual Build & Push +on: + workflow_dispatch: +jobs: + build-push: + uses: kbase/.github/.github/workflows/reusable_build-push.yml@main + with: + name: '${{ github.event.repository.name }}-develop' + tags: br-${{ github.ref_name }} + secrets: inherit diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml new file mode 100644 index 00000000..0fa1c464 --- /dev/null +++ b/.github/workflows/pr_build.yml @@ -0,0 +1,43 @@ +--- +name: Pull Request Build, Tag, & Push +on: + pull_request: + branches: + - develop + - main + - master + types: + - opened + - reopened + - synchronize + - closed +jobs: + build-develop-open: + if: github.base_ref == 'develop' && github.event.pull_request.merged == false + uses: kbase/.github/.github/workflows/reusable_build.yml@main + secrets: inherit + build-develop-merge: + if: github.base_ref == 'develop' && github.event.pull_request.merged == true + uses: kbase/.github/.github/workflows/reusable_build-push.yml@main + with: + name: '${{ github.event.repository.name }}-develop' + tags: pr-${{ github.event.number }},latest + secrets: inherit + build-main-open: + if: (github.base_ref == 'main' || github.base_ref == 'master') && github.event.pull_request.merged == false + uses: kbase/.github/.github/workflows/reusable_build-push.yml@main + with: + name: '${{ github.event.repository.name }}' + tags: pr-${{ github.event.number }} + secrets: inherit + build-main-merge: + if: (github.base_ref == 'main' || github.base_ref == 'master') && github.event.pull_request.merged == true + uses: kbase/.github/.github/workflows/reusable_build-push.yml@main + with: + name: '${{ github.event.repository.name }}' + tags: pr-${{ github.event.number }},latest-rc + secrets: inherit + trivy-scans: + if: (github.base_ref == 'develop' || github.base_ref == 'main' || github.base_ref == 'master' ) && github.event.pull_request.merged == false + uses: kbase/.github/.github/workflows/reusable_trivy-scans.yml@main + secrets: inherit diff --git a/.github/workflows/release-main.yml b/.github/workflows/release-main.yml new file mode 100644 index 00000000..a2546781 --- /dev/null +++ b/.github/workflows/release-main.yml @@ -0,0 +1,25 @@ +--- +name: Release - Build & Push Image +on: + release: + branches: + - main + - master + types: [ published ] +jobs: + check-source-branch: + uses: kbase/.github/.github/workflows/reusable_validate-branch.yml@main + with: + build_branch: '${{ github.event.release.target_commitish }}' + validate-release-tag: + needs: check-source-branch + uses: kbase/.github/.github/workflows/reusable_validate-release-tag.yml@main + with: + release_tag: '${{ github.event.release.tag_name }}' + build-push: + needs: validate-release-tag + uses: kbase/.github/.github/workflows/reusable_build-push.yml@main + with: + name: '${{ github.event.repository.name }}' + tags: '${{ github.event.release.tag_name }},latest' + secrets: inherit diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..83beaa92 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,69 @@ +name: KBase Groups tests + +on: + pull_request: + types: + - opened + - reopened + - synchronize + - ready_for_review + push: + # run workflow when merging to main or develop + branches: + - main + - master + - develop + +jobs: + + groups_tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - java: '8' + mongo: 'mongodb-linux-x86_64-ubuntu2204-7.0.4' + wired_tiger: 'false' + - java: '11' + mongo: 'mongodb-linux-x86_64-3.6.23' + wired_tiger: 'true' + steps: + - uses: actions/checkout@v3 + + - name: Set up java + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: ${{matrix.java}} + + - name: Install dependencies and set up test config + shell: bash + run: | + export HOMEDIR=`pwd` + + # move to parent dir of homedir to install binaries etc + cd .. + + # set up mongo + wget -q http://fastdl.mongodb.org/linux/${{matrix.mongo}}.tgz + tar xfz ${{matrix.mongo}}.tgz + export MONGOD=`pwd`/${{matrix.mongo}}/bin/mongod + + # set up test config + cd $HOMEDIR + cp -n test.cfg.example test.cfg + sed -i "s#^test.temp.dir=.*#test.temp.dir=temp_test_dir#" test.cfg + sed -i "s#^test.mongo.exe.*#test.mongo.exe=$MONGOD#" test.cfg + sed -i "s#^test.mongo.useWiredTiger.*#test.mongo.useWiredTiger=${{matrix.wired_tiger}}#" test.cfg + cat test.cfg + + - name: Run tests + shell: bash + run: ./gradlew test + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 46211e94..00000000 --- a/.travis.yml +++ /dev/null @@ -1,51 +0,0 @@ -dist: trusty -sudo: required -language: java -jdk: - - openjdk8 - - oraclejdk8 -env: - - MONGODB_VER=mongodb-linux-x86_64-2.6.12 ANT_TEST=test WIRED_TIGER=false - - MONGODB_VER=mongodb-linux-x86_64-3.4.18 ANT_TEST=test_mongo_storage WIRED_TIGER=false - - MONGODB_VER=mongodb-linux-x86_64-3.4.18 ANT_TEST=test_mongo_storage WIRED_TIGER=true - - MONGODB_VER=mongodb-linux-x86_64-3.6.8 ANT_TEST=test_mongo_storage WIRED_TIGER=false - - MONGODB_VER=mongodb-linux-x86_64-3.6.8 ANT_TEST=test_mongo_storage WIRED_TIGER=true - -before_install: - - sudo apt-get -qq update - - sudo apt-get install -y ant-optional - -install: - - cd .. - - git clone https://github.com/kbase/jars - - export JARSDIR=`pwd`/jars/lib/jars/ - - cd - - -script: - - cd .. - - wget http://fastdl.mongodb.org/linux/$MONGODB_VER.tgz - - tar xfz $MONGODB_VER.tgz - - export MONGOD=`pwd`/$MONGODB_VER/bin/mongod - - cd - - - cp -n test.cfg.example test.cfg - - sed -i "s#^test.temp.dir=.*#test.temp.dir=temp_test_dir#" test.cfg - - sed -i "s#^test.mongo.exe.*#test.mongo.exe=$MONGOD#" test.cfg - - sed -i "s#^test.mongo.wired_tiger.*#test.mongo.wired_tiger=$WIRED_TIGER#" test.cfg - - sed -i "s#^test.jars.dir=.*#test.jars.dir=$JARSDIR#" test.cfg - - cat test.cfg - - ant $ANT_TEST - -jobs: - include: - - stage: deploy - env: # The following are secure declarations for DOCKER_USER, DOCKER_PASS - - secure: "FOUsz7GwzqjxmoaB2kAQ7T+5twy4F844ApklMSgRynemayqsEWhuEzygXQ+QwLO426s39QtqNgkwYkhTvfInzf+wpUMmTr4tXu0ljYueiEWDOE8CA5FjkPe10e6UWlTqfKPj9jZv2JMc0N3S8evRVTO4UeGjg70gk00QrPsxU7c5gxt7zrabQ0aBXFFswfbnrVcEZXwyqKYOszUxeI7n2bRkLtUSgpKgluPYOcRu8YN51G5yUakC/eHqXM7MtivzTA/fQNbQSB3Ga8O7EmT7zZrpVHPpjEQBkRAhiQLgxNJaoQsRTh31qmj4S0r2/i6fSb2CJftVu2OmlbuQHHyJJvliR6rFTdPKDMXYWTJ7zGjgT5K5DUb96Yix+vEi1lq48mKfjqy+akeqC6z9mXHXZc4aCaLVCOHKCsttH0tUZ+Mb4akfjFFZeVsQ0NTMskfDSisyMniZffAA3A0qRPhgQVFw1F4CeiOabjXBn1K4pLLtbx4lYFrmRPV89umYKOJXV9yt5pPA69dTgJqaUTAdvA1MoKgZ5OzEUzxcVLQlQi+nxUKcBOac705s2rfYuo5yEbrbHrIshBq6cMTgoEzgOfja9Mm6pdL8pmcxp1MyiVcOtvQjHgJ2RWb1TbdKar4ZHVs1U1DsEeB4u/C+o02yVfJBqufFPUxEc74cn7pMMuE=" - - secure: "XOdfRLxVxIwJxiwC0aiSGfzgNZVKXajqqil6mINuwuCTZAsGTvEyGsU9uy0QTsgjwIrg4USV3TQ0mEo74yQuUPBNKRUImn8ChKIsWkqY+8qbzm40WXQNZ/0DAM+NZ7vtrSXtNfP6Kvy8ffkntYt2zbUCAZDl5hyYzXL0WuAUWnINmwJ3SBTPPYbyvezSW9R1dTsL1xmY63exwqD8ebUslRRcRp3ssSnyLZ24kdqkWiCfbTvELqZkK4xhJ3WhNU0uTe7NHXZD0RDpNUOkHpFOuDJQvcYbp39ua3BpA6Atqtdhnz7n/kDj3osiKnAnDMtVdWodWePE2fOkXGlYobR0kGf2YXPIM4eH+3XstMb8XewmbqQeYPHs/y2Fn8bi7VlCjcvKNGUrEutit0nVINb1le86az08/Sf2wvpyOawTuGugJOdw1rRrEV6Eo1dM4DotIcYaywSP8R+GVh9fNb4rHIWaVq5jJT3rs55xe73417dVUDNcGg6qJ/sHvgxGorulVmKWzZrv6tTLpdq4+YNVzdQ71iD9rJqPbEWChVDDdtURjoW18jNynz4AVSDmzBFeWJobNnAxVpqn/2MlLEvCzar1X9w7dyp4KBTbLCb+1s5ZfJzO29tiaXSMrKLLbYsB5BTfHeMhQMy6m+jl26Z791zdatPZG7mL3ir9sdUAhXo=" - script: # Only push to dockerhub if this isn't a PR and we're updating master or develop - - docker pull kbase/kb_jre - - ant docker_image - - IMAGE_NAME=kbase/groups build/push2dockerhub.sh -after_success: - - ls test-reports - - bash <(curl -s https://codecov.io/bash) -f test-reports/coverage-report.xml - diff --git a/Dockerfile b/Dockerfile index 78909750..fd2899b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,24 @@ +FROM kbase/sdkbase2 as build + +WORKDIR /tmp/groups + +# 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/groups/ +COPY gradle/ /tmp/groups/gradle/ +RUN ./gradlew dependencies + +# Now build the code +COPY deployment/ /tmp/groups/deployment/ +COPY jettybase/ /tmp/groups/jettybase/ +COPY src /tmp/groups/src/ +COPY war /tmp/groups/war/ +# for the git commit +COPY .git /tmp/groups/.git/ +RUN ./gradlew war + + FROM kbase/kb_jre:latest # These ARGs values are passed in via the docker build command @@ -5,10 +26,9 @@ ARG BUILD_DATE ARG VCS_REF ARG BRANCH=develop -RUN apt-get -y update && apt-get -y install ant git openjdk-8-jdk - -COPY deployment/ /kb/deployment/ -COPY jettybase/ /kb/deployment/jettybase/ +COPY --from=build /tmp/groups/deployment/ /kb/deployment/ +COPY --from=build /tmp/groups/jettybase/ /kb/deployment/jettybase/ +COPY --from=build /tmp/groups/build/libs/groups.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 @@ -24,6 +44,9 @@ ENV KB_DEPLOYMENT_CONFIG=/kb/deployment/conf/deployment.cfg RUN chmod -R a+rwx /kb/deployment/conf /kb/deployment/jettybase/ +# 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 + ENTRYPOINT [ "/kb/deployment/bin/dockerize" ] # Here are some default params passed to dockerize. They would typically diff --git a/LICENSE.md b/LICENSE.md index a1fa12dc..deafd790 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright (c) 2018 The KBase Project and its Contributors +Copyright (c) 2018-present The KBase Project and its Contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/README.md b/README.md index 6f080d65..7ad6d693 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ Service for creating and managing groups of KBase users and associated Narratives. Build status (master): -[![Build Status](https://travis-ci.org/kbase/groups.svg?branch=master)](https://travis-ci.org/kbase/groups) [![codecov](https://codecov.io/gh/kbase/groups/branch/master/graph/badge.svg)](https://codecov.io/gh/kbase/groups) ## API Data structures @@ -943,7 +942,8 @@ field--param-image-exists=<'true' or any other value for false> ``` `strict-length` will cause the validator to throw an error if the field is not exactly 32 -characters, and is false by default. Gravatar allows for extra characters at the end of the hash. +characters, and is false by default. In some cases (such as adding a `.jpg` extension) +Gravatar allows for extra characters at the end of the hash. `image-exists` will cause the validator to throw an error if there is no [image associated with the hash (see Default Image)](https://en.gravatar.com/site/implement/images/), and is false @@ -982,24 +982,41 @@ that the fields be kept few and small in size. ## 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/kbase/groups) -The jars repo (git clone https://github.com/kbase/jars) -The two repos above need to be in the same parent folder. -## To start server +## Starting the server -start mongodb -if using mongo auth, create a mongo user -cd into the groups repo -`ant build` -copy `deploy.cfg.example` to `deploy.cfg` and fill in appropriately -`export KB_DEPLOYMENT_CONFIG=` -`cd jettybase` -`./jettybase$ java -jar -Djetty.http.port= /start.jar` +### Docker + +The provided `Dockerfile` can be used to build and run an image. See the deployment template +in `deployment/conf/.templates` for the environment variables available to configure the +service - the `deploy.cfg.example` file provides documentation for these variables. + +`docker-compose --build -d` can be used to start a MongoDB instance and groups +service pointed at the KBase environment of your choice. + +### Manually + +* Start mongodb +* If using mongo auth, create a mongo user +* `cd` into the groups repo + +```shell +./gradlew war +mkdir -p jettybase/webapps +cp build/libs/groups.war jettybase/webapps/ROOT.war +``` + +* copy `deploy.cfg.example` to `deploy.cfg` and fill in appropriately + +```shell +export KB_DEPLOYMENT_CONFIG= +cd jettybase +./jettybase$ java -jar -Djetty.port= /start.jar +``` ## Developer notes @@ -1015,14 +1032,15 @@ copy `deploy.cfg.example` to `deploy.cfg` and fill in appropriately * Releases * The master branch is the stable branch. Releases are made from the develop branch to the master branch. - * Update the version as per the semantic version rules in `src/us/kbase/groups/api/Root.java`. + * Update the version as per the semantic version rules in + `src/main/java/us/kbase/groups/service/api/Root.java`. * Tag the version in git and github. ### 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 6973d6b2..f07b9c94 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,5 +1,12 @@ # KBase Groups Service release notes +## 0.1.7 + +* The MongoDB clients have been updated to the most recent version. +* Added the ``mongo-retrywrites`` configuration setting in ``deploy.cfg``, defaulting to + ``false``. +* The build tool has been switched from Ant to Gradle. + ## 0.1.6 ### Admin notes: diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..15a0d3e4 --- /dev/null +++ b/build.gradle @@ -0,0 +1,155 @@ +/* + * This file was generated by the Gradle 'init' task. + */ + +plugins { + id 'java' + id 'war' + id 'jacoco' + id 'org.ajoberstar.grgit' version '4.1.1' +} + +repositories { + mavenCentral() + maven { + name = "Jitpack" + url = 'https://jitpack.io' + } + maven { + name = "Clojars" + url = "https://repo.clojars.org/" + } +} + +task buildGitCommitFile { + doLast { + def commitId = grgit.head().id + // is there a variable for builddir/classes/java/main? + file("$buildDir/classes/java/main/us/kbase/groups/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 mongo wrapper tests out. + * Set up GHA to run the full test suite with a single version of mongo and run the + * mongo tests with matrixed mongo versions. + * Since the tests only take a minute or two this isn't high ROI. + */ + systemProperty "KBASE_GROUPS_TEST_CONFIG", "./test.cfg" + maxHeapSize = "3G" + 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 + } +} + +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 { + + compileOnly 'javax.servlet:javax.servlet-api:3.0.1' + + implementation fromURL( + 'https://github.com/kbase/jars/raw/master/lib/jars/kbase/catalog/kbase-catalog-client-2.1.3.jar', + 'kbase-catalog-client-2.1.3' + ) + // 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 'ch.qos.logback:logback-classic:1.1.2' + implementation("com.github.kbase:auth2_client_java:0.5.0") { + exclude group: 'com.fasterxml.jackson.core' // breaks everything if we upgrade + } + 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.0.1 above + } + implementation('com.github.kbase.workspace_deluxe:workspace-client:0.15.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.0.1 above + } + implementation 'org.ini4j:ini4j:0.5.2' + 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.apache.kafka:kafka-clients:2.1.0' + implementation 'com.google.guava:guava:18.0' + implementation 'org.slf4j:slf4j-api:1.7.25' + implementation 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.5.4' + implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8: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 'com.github.zafarkhaja:java-semver:0.9.0' + + testImplementation "com.github.kbase:auth2:0.7.1" + testImplementation('com.github.kbase:java_test_utilities:0.1.0') { + exclude group: 'com.fasterxml.jackson.core' // breaks everything if we upgrade + } + testImplementation 'com.github.kbase.workspace_deluxe:workspace_deluxe-test-shadow-all:0.15.0' + testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.1.10' + testImplementation 'junit:junit:4.12' + testImplementation 'org.mockito:mockito-core:3.0.0' + testImplementation('org.mock-server:mockserver-netty:5.4.1') { + // otherwise a newer jackson implementation is brought in and tests make a poo poo + // TODO BUILD on upgrade switch to the no dependencies version + exclude group: "com.fasterxml.jackson.core" + } + testImplementation 'org.eclipse.jetty:jetty-servlet:9.3.11.v20160721' +} + +task showTestClassPath { + doLast { + configurations.testimpl.each { println it } + } +} + diff --git a/build.xml b/build.xml deleted file mode 100644 index a97e42f7..00000000 --- a/build.xml +++ /dev/null @@ -1,355 +0,0 @@ - - - - Build file for the KBase Groups Service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/build/build_docker_image.sh b/build/build_docker_image.sh deleted file mode 100755 index 1a43bcf5..00000000 --- a/build/build_docker_image.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -x - -export BRANCH=${TRAVIS_BRANCH:-`git symbolic-ref --short HEAD`} -export DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` -export COMMIT=${TRAVIS_COMMIT:-`git rev-parse --short HEAD`} -docker build --build-arg BUILD_DATE=$DATE \ - --build-arg VCS_REF=$COMMIT \ - --build-arg BRANCH=$BRANCH \ - -t kbase/groups:$COMMIT . diff --git a/build/push2dockerhub.sh b/build/push2dockerhub.sh deleted file mode 100755 index 1b37e11c..00000000 --- a/build/push2dockerhub.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# -# This script is intended to be run in the deploy stage of a travis build -# It checks to make sure that this is a not a PR, and that we have the secure -# environment variables available and then checks if this is either the master -# or develop branch, otherwise we don't push anything -# -# NOTE: IMAGE_NAME is expected to be passed in via the environment so that this -# script can be more general -# -# sychan@lbl.gov -# 8/31/2017 - -TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi` -COMMIT=${TRAVIS_COMMIT:-`git rev-parse --short HEAD`} - -if ( [ "$TRAVIS_SECURE_ENV_VARS" == "true" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] ); then - # $TAG was set from TRAVIS_BRANCH, which is a little wonky on pull requests, - # but it should be okay since we should never get here on a PR - if ( [ "$TAG" == "latest" ] || [ "$TAG" == "develop" ] ) ; then - echo "Logging into Dockerhub as $DOCKER_USER" - docker login -u $DOCKER_USER -p $DOCKER_PASS && \ - docker tag $IMAGE_NAME:$COMMIT $IMAGE_NAME:$TAG && \ - echo "Pushing $IMAGE_NAME:$TAG" && \ - docker push $IMAGE_NAME:$TAG || \ - ( echo "Failed to login and push tagged image" && exit 1 ) - else - echo "Not pushing image for branch $TAG" - fi -else - echo "Not building image for pull requests or if secure variables unavailable" -fi diff --git a/deploy.cfg.example b/deploy.cfg.example index 49547470..fc262f26 100644 --- a/deploy.cfg.example +++ b/deploy.cfg.example @@ -10,6 +10,10 @@ mongo-db= mongo-user= mongo-pwd= +# Whether to enable ('true') the MongoDB retryWrites parameter or not (anything other than 'true'). +# See https://www.mongodb.com/docs/manual/core/retryable-writes/ +mongo-retrywrites=false + # KBase Auth server root url. auth-url=https://ci.kbase.us/services/auth diff --git a/deployment/conf/.templates/deployment.cfg.templ b/deployment/conf/.templates/deployment.cfg.templ index 46f7e870..8dc4f5fe 100644 --- a/deployment/conf/.templates/deployment.cfg.templ +++ b/deployment/conf/.templates/deployment.cfg.templ @@ -3,6 +3,7 @@ mongo-host={{ default .Env.mongo_host "ci-mongo" }} mongo-db={{ default .Env.mongo_db "groups" }} mongo-user={{ default .Env.mongo_user "" }} mongo-pwd={{ default .Env.mongo_pwd "" }} +mongo-retrywrites={{ default .Env.mongo_retrywrites "false" }} auth-url={{ default .Env.auth_url "https://ci.kbase.us/services/auth" }} workspace-url={{ default .Env.workspace_url "https://ci.kbase.us/services/ws" }} workspace-admin-token={{ default .Env.workspace_admin_token ""}} diff --git a/docker-compose.yml b/docker-compose.yml index beb4b9b3..2aaed1b7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,15 +5,18 @@ version: "3.1" # that is started up and polled services: kbase_groups: - image: kbase/groups:latest + build: . ports: - "8080:8080" environment: - mongo-host: localhost:27017 - mongo-db: dc_groups_test + mongo_host: "mongo:27017" + mongo_db: dc_groups_test auth_url: https://ci.kbase.us/services/auth workspace_url: https://ci.kbase.us/services/ws + catalog_url: https://ci.kbase.us/services/catalog + notifier_url: https://ci.kbase.us/services/feeds workspace_admin_token: faketoken_replace + notifier_token: faketoken_replace field_validator_configs: | field-foo-validator=us.kbase.groups.fieldvalidators.SimpleFieldValidatorFactory field-foo-is-numbered=true @@ -21,9 +24,7 @@ services: command: - "-multiline" - "-wait" - - "tcp://ci-mongo:27017" - - "-wait" - - "tcp://mongoinit:8080" + - "tcp://mongo:27017" - "-timeout" - "120s" - "-template" @@ -32,37 +33,10 @@ services: - "-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" - # - "https://raw.githubusercontent.com/kbase/mini_kb/master/deployment/conf/tauth2-minikb.yml" - # If the -env URL needs authentication you would use an -env-header directive that specified - # either the hard coded string for the header, or a path to a file that contains the header - # string ( used for working with docker secrets files) - # - "-env-header" - # - "AUTHORIZATION:authtokenvalue" - # or for a path to a secrets file: - # - "env-header" - # - "/run/secrets/authheader" - # 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 ports: - "27017:27017" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..4ac3234a --- /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 00000000..e6441136 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 00000000..b82aa23a --- /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 00000000..1aa94a42 --- /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 00000000..751f4065 --- /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 = 'groups' diff --git a/src/us/kbase/groups/GitCommit.java b/src/main/java/us/kbase/groups/GitCommit.java similarity index 100% rename from src/us/kbase/groups/GitCommit.java rename to src/main/java/us/kbase/groups/GitCommit.java diff --git a/src/us/kbase/groups/build/GroupsBuilder.java b/src/main/java/us/kbase/groups/build/GroupsBuilder.java similarity index 94% rename from src/us/kbase/groups/build/GroupsBuilder.java rename to src/main/java/us/kbase/groups/build/GroupsBuilder.java index 433b0faf..fd511d3b 100644 --- a/src/us/kbase/groups/build/GroupsBuilder.java +++ b/src/main/java/us/kbase/groups/build/GroupsBuilder.java @@ -9,8 +9,9 @@ import org.slf4j.LoggerFactory; import com.google.common.collect.ImmutableMap; -import com.mongodb.MongoClient; -import com.mongodb.MongoClientOptions; +import com.mongodb.client.MongoClient; +import com.mongodb.client.MongoClients; +import com.mongodb.MongoClientSettings; import com.mongodb.MongoCredential; import com.mongodb.MongoException; import com.mongodb.ServerAddress; @@ -106,15 +107,18 @@ public GroupsBuilder(final GroupsConfig cfg, final MongoClient mc) private MongoClient buildMongo(final GroupsConfig c) throws StorageInitException { //TODO ZLATER MONGO handle shards & replica sets + final MongoClientSettings.Builder mongoBuilder = MongoClientSettings.builder() + .retryWrites(c.getMongoRetryWrites()) + .applyToClusterSettings(builder -> builder.hosts( + Arrays.asList(new ServerAddress(c.getMongoHost())))); try { if (c.getMongoUser().isPresent()) { final MongoCredential creds = MongoCredential.createCredential( c.getMongoUser().get(), c.getMongoDatabase(), c.getMongoPwd().get()); // unclear if and when it's safe to clear the password - return new MongoClient(new ServerAddress(c.getMongoHost()), creds, - MongoClientOptions.builder().build()); + return MongoClients.create(mongoBuilder.credential(creds).build()); } else { - return new MongoClient(new ServerAddress(c.getMongoHost())); + return MongoClients.create(mongoBuilder.build()); } } catch (MongoException e) { LoggerFactory.getLogger(getClass()).error( @@ -129,8 +133,7 @@ private Groups buildGroups(final GroupsConfig c, final GroupsStorage storage) // these handler creation methods may need changes if we want to allow alternate // implementations. YAGNI for now. try { - uh = new KBaseUserHandler( - c.getAuthURL(), c.getWorkspaceAdminToken(), c.isAllowInsecureURLs()); + uh = new KBaseUserHandler(c.getAuthURL(), c.getWorkspaceAdminToken()); } catch (IOException | URISyntaxException | AuthenticationException e) { //TODO CODE check for a bad login and note the workspace token failed or throw a better error from the handler throw new GroupsConfigurationException( diff --git a/src/us/kbase/groups/cataloghandler/SDKClientCatalogHandler.java b/src/main/java/us/kbase/groups/cataloghandler/SDKClientCatalogHandler.java similarity index 100% rename from src/us/kbase/groups/cataloghandler/SDKClientCatalogHandler.java rename to src/main/java/us/kbase/groups/cataloghandler/SDKClientCatalogHandler.java diff --git a/src/us/kbase/groups/config/GroupsConfig.java b/src/main/java/us/kbase/groups/config/GroupsConfig.java similarity index 97% rename from src/us/kbase/groups/config/GroupsConfig.java rename to src/main/java/us/kbase/groups/config/GroupsConfig.java index ef1213fa..47d9df30 100644 --- a/src/us/kbase/groups/config/GroupsConfig.java +++ b/src/main/java/us/kbase/groups/config/GroupsConfig.java @@ -54,6 +54,7 @@ public class GroupsConfig { private static final String KEY_MONGO_DB = "mongo-db"; private static final String KEY_MONGO_USER = "mongo-user"; private static final String KEY_MONGO_PWD = "mongo-pwd"; + private static final String KEY_MONGO_RETRY_WRITES = "mongo-retrywrites"; private static final String KEY_AUTH_URL = "auth-url"; private static final String KEY_WORKSPACE_URL = "workspace-url"; private static final String KEY_WORKSPACE_TOKEN = "workspace-admin-token"; @@ -81,6 +82,7 @@ public class GroupsConfig { private final String mongoDB; private final Optional mongoUser; private final Optional mongoPwd; + private final boolean mongoRetryWrites; private final URL authURL; private final URL workspaceURL; private final Token workspaceAdminToken; @@ -133,6 +135,7 @@ private GroupsConfig( logger = new NullLogger(); } else { // may want to allow configuring the logger name, but YAGNI + JsonServerSyslog.setStaticUseSyslog(false); logger = new JsonServerSysLogAutoLogger(new JsonServerSyslog( LOG_NAME, null, JsonServerSyslog.LOG_LEVEL_INFO, true)); } @@ -147,6 +150,7 @@ private GroupsConfig( notifierParameters = getParams(KEY_PREFIX_NOTIFIER_PARAMS, cfg); mongoHost = getString(KEY_MONGO_HOST, cfg, true); mongoDB = getString(KEY_MONGO_DB, cfg, true); + mongoRetryWrites = TRUE.equals(getString(KEY_MONGO_RETRY_WRITES, cfg)); mongoUser = Optional.fromNullable(getString(KEY_MONGO_USER, cfg)); Optional mongop = Optional.fromNullable(getString(KEY_MONGO_PWD, cfg)); if (mongoUser.isPresent() ^ mongop.isPresent()) { @@ -419,13 +423,20 @@ public String getMongoHost() { return mongoHost; } - /** Ge the MongoDB database to use. + /** Get the MongoDB database to use. * @return the database. */ public String getMongoDatabase() { return mongoDB; } + /** Get whether the MongoDB retryWrites parameter should be set. + * @return True to set the retryWrites parameter when connecting to MongoDB, false otherwise. + */ + public boolean getMongoRetryWrites() { + return mongoRetryWrites; + } + /** Get the MongoDB user name, if any. If provided a password will also be provided. * @return the user name */ diff --git a/src/us/kbase/groups/config/GroupsConfigurationException.java b/src/main/java/us/kbase/groups/config/GroupsConfigurationException.java similarity index 100% rename from src/us/kbase/groups/config/GroupsConfigurationException.java rename to src/main/java/us/kbase/groups/config/GroupsConfigurationException.java diff --git a/src/us/kbase/groups/core/CreateAndModTimes.java b/src/main/java/us/kbase/groups/core/CreateAndModTimes.java similarity index 100% rename from src/us/kbase/groups/core/CreateAndModTimes.java rename to src/main/java/us/kbase/groups/core/CreateAndModTimes.java diff --git a/src/us/kbase/groups/core/CreateModAndExpireTimes.java b/src/main/java/us/kbase/groups/core/CreateModAndExpireTimes.java similarity index 100% rename from src/us/kbase/groups/core/CreateModAndExpireTimes.java rename to src/main/java/us/kbase/groups/core/CreateModAndExpireTimes.java diff --git a/src/us/kbase/groups/core/FieldItem.java b/src/main/java/us/kbase/groups/core/FieldItem.java similarity index 100% rename from src/us/kbase/groups/core/FieldItem.java rename to src/main/java/us/kbase/groups/core/FieldItem.java diff --git a/src/us/kbase/groups/core/GetGroupsParams.java b/src/main/java/us/kbase/groups/core/GetGroupsParams.java similarity index 100% rename from src/us/kbase/groups/core/GetGroupsParams.java rename to src/main/java/us/kbase/groups/core/GetGroupsParams.java diff --git a/src/us/kbase/groups/core/GetRequestsParams.java b/src/main/java/us/kbase/groups/core/GetRequestsParams.java similarity index 100% rename from src/us/kbase/groups/core/GetRequestsParams.java rename to src/main/java/us/kbase/groups/core/GetRequestsParams.java diff --git a/src/us/kbase/groups/core/Group.java b/src/main/java/us/kbase/groups/core/Group.java similarity index 100% rename from src/us/kbase/groups/core/Group.java rename to src/main/java/us/kbase/groups/core/Group.java diff --git a/src/us/kbase/groups/core/GroupCreationParams.java b/src/main/java/us/kbase/groups/core/GroupCreationParams.java similarity index 100% rename from src/us/kbase/groups/core/GroupCreationParams.java rename to src/main/java/us/kbase/groups/core/GroupCreationParams.java diff --git a/src/us/kbase/groups/core/GroupHasRequests.java b/src/main/java/us/kbase/groups/core/GroupHasRequests.java similarity index 100% rename from src/us/kbase/groups/core/GroupHasRequests.java rename to src/main/java/us/kbase/groups/core/GroupHasRequests.java diff --git a/src/us/kbase/groups/core/GroupID.java b/src/main/java/us/kbase/groups/core/GroupID.java similarity index 100% rename from src/us/kbase/groups/core/GroupID.java rename to src/main/java/us/kbase/groups/core/GroupID.java diff --git a/src/us/kbase/groups/core/GroupIDAndName.java b/src/main/java/us/kbase/groups/core/GroupIDAndName.java similarity index 100% rename from src/us/kbase/groups/core/GroupIDAndName.java rename to src/main/java/us/kbase/groups/core/GroupIDAndName.java diff --git a/src/us/kbase/groups/core/GroupIDNameMembership.java b/src/main/java/us/kbase/groups/core/GroupIDNameMembership.java similarity index 100% rename from src/us/kbase/groups/core/GroupIDNameMembership.java rename to src/main/java/us/kbase/groups/core/GroupIDNameMembership.java diff --git a/src/us/kbase/groups/core/GroupName.java b/src/main/java/us/kbase/groups/core/GroupName.java similarity index 100% rename from src/us/kbase/groups/core/GroupName.java rename to src/main/java/us/kbase/groups/core/GroupName.java diff --git a/src/us/kbase/groups/core/GroupUpdateParams.java b/src/main/java/us/kbase/groups/core/GroupUpdateParams.java similarity index 100% rename from src/us/kbase/groups/core/GroupUpdateParams.java rename to src/main/java/us/kbase/groups/core/GroupUpdateParams.java diff --git a/src/us/kbase/groups/core/GroupUser.java b/src/main/java/us/kbase/groups/core/GroupUser.java similarity index 100% rename from src/us/kbase/groups/core/GroupUser.java rename to src/main/java/us/kbase/groups/core/GroupUser.java diff --git a/src/us/kbase/groups/core/GroupView.java b/src/main/java/us/kbase/groups/core/GroupView.java similarity index 100% rename from src/us/kbase/groups/core/GroupView.java rename to src/main/java/us/kbase/groups/core/GroupView.java diff --git a/src/us/kbase/groups/core/Groups.java b/src/main/java/us/kbase/groups/core/Groups.java similarity index 100% rename from src/us/kbase/groups/core/Groups.java rename to src/main/java/us/kbase/groups/core/Groups.java diff --git a/src/us/kbase/groups/core/Name.java b/src/main/java/us/kbase/groups/core/Name.java similarity index 100% rename from src/us/kbase/groups/core/Name.java rename to src/main/java/us/kbase/groups/core/Name.java diff --git a/src/us/kbase/groups/core/OptionalGroupFields.java b/src/main/java/us/kbase/groups/core/OptionalGroupFields.java similarity index 100% rename from src/us/kbase/groups/core/OptionalGroupFields.java rename to src/main/java/us/kbase/groups/core/OptionalGroupFields.java diff --git a/src/us/kbase/groups/core/OptionalString.java b/src/main/java/us/kbase/groups/core/OptionalString.java similarity index 100% rename from src/us/kbase/groups/core/OptionalString.java rename to src/main/java/us/kbase/groups/core/OptionalString.java diff --git a/src/us/kbase/groups/core/Token.java b/src/main/java/us/kbase/groups/core/Token.java similarity index 100% rename from src/us/kbase/groups/core/Token.java rename to src/main/java/us/kbase/groups/core/Token.java diff --git a/src/us/kbase/groups/core/UUIDGenerator.java b/src/main/java/us/kbase/groups/core/UUIDGenerator.java similarity index 100% rename from src/us/kbase/groups/core/UUIDGenerator.java rename to src/main/java/us/kbase/groups/core/UUIDGenerator.java diff --git a/src/us/kbase/groups/core/UserHandler.java b/src/main/java/us/kbase/groups/core/UserHandler.java similarity index 100% rename from src/us/kbase/groups/core/UserHandler.java rename to src/main/java/us/kbase/groups/core/UserHandler.java diff --git a/src/us/kbase/groups/core/UserName.java b/src/main/java/us/kbase/groups/core/UserName.java similarity index 100% rename from src/us/kbase/groups/core/UserName.java rename to src/main/java/us/kbase/groups/core/UserName.java diff --git a/src/us/kbase/groups/core/exceptions/AuthenticationException.java b/src/main/java/us/kbase/groups/core/exceptions/AuthenticationException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/AuthenticationException.java rename to src/main/java/us/kbase/groups/core/exceptions/AuthenticationException.java diff --git a/src/us/kbase/groups/core/exceptions/ClosedRequestException.java b/src/main/java/us/kbase/groups/core/exceptions/ClosedRequestException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/ClosedRequestException.java rename to src/main/java/us/kbase/groups/core/exceptions/ClosedRequestException.java diff --git a/src/us/kbase/groups/core/exceptions/ErrorType.java b/src/main/java/us/kbase/groups/core/exceptions/ErrorType.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/ErrorType.java rename to src/main/java/us/kbase/groups/core/exceptions/ErrorType.java diff --git a/src/us/kbase/groups/core/exceptions/GroupExistsException.java b/src/main/java/us/kbase/groups/core/exceptions/GroupExistsException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/GroupExistsException.java rename to src/main/java/us/kbase/groups/core/exceptions/GroupExistsException.java diff --git a/src/us/kbase/groups/core/exceptions/GroupsException.java b/src/main/java/us/kbase/groups/core/exceptions/GroupsException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/GroupsException.java rename to src/main/java/us/kbase/groups/core/exceptions/GroupsException.java diff --git a/src/us/kbase/groups/core/exceptions/IllegalParameterException.java b/src/main/java/us/kbase/groups/core/exceptions/IllegalParameterException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/IllegalParameterException.java rename to src/main/java/us/kbase/groups/core/exceptions/IllegalParameterException.java diff --git a/src/us/kbase/groups/core/exceptions/IllegalResourceIDException.java b/src/main/java/us/kbase/groups/core/exceptions/IllegalResourceIDException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/IllegalResourceIDException.java rename to src/main/java/us/kbase/groups/core/exceptions/IllegalResourceIDException.java diff --git a/src/us/kbase/groups/core/exceptions/InvalidTokenException.java b/src/main/java/us/kbase/groups/core/exceptions/InvalidTokenException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/InvalidTokenException.java rename to src/main/java/us/kbase/groups/core/exceptions/InvalidTokenException.java diff --git a/src/us/kbase/groups/core/exceptions/MissingParameterException.java b/src/main/java/us/kbase/groups/core/exceptions/MissingParameterException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/MissingParameterException.java rename to src/main/java/us/kbase/groups/core/exceptions/MissingParameterException.java diff --git a/src/us/kbase/groups/core/exceptions/NoDataException.java b/src/main/java/us/kbase/groups/core/exceptions/NoDataException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/NoDataException.java rename to src/main/java/us/kbase/groups/core/exceptions/NoDataException.java diff --git a/src/us/kbase/groups/core/exceptions/NoSuchCustomFieldException.java b/src/main/java/us/kbase/groups/core/exceptions/NoSuchCustomFieldException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/NoSuchCustomFieldException.java rename to src/main/java/us/kbase/groups/core/exceptions/NoSuchCustomFieldException.java diff --git a/src/us/kbase/groups/core/exceptions/NoSuchGroupException.java b/src/main/java/us/kbase/groups/core/exceptions/NoSuchGroupException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/NoSuchGroupException.java rename to src/main/java/us/kbase/groups/core/exceptions/NoSuchGroupException.java diff --git a/src/us/kbase/groups/core/exceptions/NoSuchRequestException.java b/src/main/java/us/kbase/groups/core/exceptions/NoSuchRequestException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/NoSuchRequestException.java rename to src/main/java/us/kbase/groups/core/exceptions/NoSuchRequestException.java diff --git a/src/us/kbase/groups/core/exceptions/NoSuchResourceException.java b/src/main/java/us/kbase/groups/core/exceptions/NoSuchResourceException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/NoSuchResourceException.java rename to src/main/java/us/kbase/groups/core/exceptions/NoSuchResourceException.java diff --git a/src/us/kbase/groups/core/exceptions/NoSuchResourceTypeException.java b/src/main/java/us/kbase/groups/core/exceptions/NoSuchResourceTypeException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/NoSuchResourceTypeException.java rename to src/main/java/us/kbase/groups/core/exceptions/NoSuchResourceTypeException.java diff --git a/src/us/kbase/groups/core/exceptions/NoSuchUserException.java b/src/main/java/us/kbase/groups/core/exceptions/NoSuchUserException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/NoSuchUserException.java rename to src/main/java/us/kbase/groups/core/exceptions/NoSuchUserException.java diff --git a/src/us/kbase/groups/core/exceptions/NoTokenProvidedException.java b/src/main/java/us/kbase/groups/core/exceptions/NoTokenProvidedException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/NoTokenProvidedException.java rename to src/main/java/us/kbase/groups/core/exceptions/NoTokenProvidedException.java diff --git a/src/us/kbase/groups/core/exceptions/RequestExistsException.java b/src/main/java/us/kbase/groups/core/exceptions/RequestExistsException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/RequestExistsException.java rename to src/main/java/us/kbase/groups/core/exceptions/RequestExistsException.java diff --git a/src/us/kbase/groups/core/exceptions/ResourceExistsException.java b/src/main/java/us/kbase/groups/core/exceptions/ResourceExistsException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/ResourceExistsException.java rename to src/main/java/us/kbase/groups/core/exceptions/ResourceExistsException.java diff --git a/src/us/kbase/groups/core/exceptions/ResourceHandlerException.java b/src/main/java/us/kbase/groups/core/exceptions/ResourceHandlerException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/ResourceHandlerException.java rename to src/main/java/us/kbase/groups/core/exceptions/ResourceHandlerException.java diff --git a/src/us/kbase/groups/core/exceptions/UnauthorizedException.java b/src/main/java/us/kbase/groups/core/exceptions/UnauthorizedException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/UnauthorizedException.java rename to src/main/java/us/kbase/groups/core/exceptions/UnauthorizedException.java diff --git a/src/us/kbase/groups/core/exceptions/UserIsMemberException.java b/src/main/java/us/kbase/groups/core/exceptions/UserIsMemberException.java similarity index 100% rename from src/us/kbase/groups/core/exceptions/UserIsMemberException.java rename to src/main/java/us/kbase/groups/core/exceptions/UserIsMemberException.java diff --git a/src/us/kbase/groups/core/fieldvalidation/CustomField.java b/src/main/java/us/kbase/groups/core/fieldvalidation/CustomField.java similarity index 100% rename from src/us/kbase/groups/core/fieldvalidation/CustomField.java rename to src/main/java/us/kbase/groups/core/fieldvalidation/CustomField.java diff --git a/src/us/kbase/groups/core/fieldvalidation/FieldConfiguration.java b/src/main/java/us/kbase/groups/core/fieldvalidation/FieldConfiguration.java similarity index 100% rename from src/us/kbase/groups/core/fieldvalidation/FieldConfiguration.java rename to src/main/java/us/kbase/groups/core/fieldvalidation/FieldConfiguration.java diff --git a/src/us/kbase/groups/core/fieldvalidation/FieldValidator.java b/src/main/java/us/kbase/groups/core/fieldvalidation/FieldValidator.java similarity index 100% rename from src/us/kbase/groups/core/fieldvalidation/FieldValidator.java rename to src/main/java/us/kbase/groups/core/fieldvalidation/FieldValidator.java diff --git a/src/us/kbase/groups/core/fieldvalidation/FieldValidatorConfiguration.java b/src/main/java/us/kbase/groups/core/fieldvalidation/FieldValidatorConfiguration.java similarity index 100% rename from src/us/kbase/groups/core/fieldvalidation/FieldValidatorConfiguration.java rename to src/main/java/us/kbase/groups/core/fieldvalidation/FieldValidatorConfiguration.java diff --git a/src/us/kbase/groups/core/fieldvalidation/FieldValidatorException.java b/src/main/java/us/kbase/groups/core/fieldvalidation/FieldValidatorException.java similarity index 100% rename from src/us/kbase/groups/core/fieldvalidation/FieldValidatorException.java rename to src/main/java/us/kbase/groups/core/fieldvalidation/FieldValidatorException.java diff --git a/src/us/kbase/groups/core/fieldvalidation/FieldValidatorFactory.java b/src/main/java/us/kbase/groups/core/fieldvalidation/FieldValidatorFactory.java similarity index 100% rename from src/us/kbase/groups/core/fieldvalidation/FieldValidatorFactory.java rename to src/main/java/us/kbase/groups/core/fieldvalidation/FieldValidatorFactory.java diff --git a/src/us/kbase/groups/core/fieldvalidation/FieldValidators.java b/src/main/java/us/kbase/groups/core/fieldvalidation/FieldValidators.java similarity index 100% rename from src/us/kbase/groups/core/fieldvalidation/FieldValidators.java rename to src/main/java/us/kbase/groups/core/fieldvalidation/FieldValidators.java diff --git a/src/us/kbase/groups/core/fieldvalidation/IllegalFieldValueException.java b/src/main/java/us/kbase/groups/core/fieldvalidation/IllegalFieldValueException.java similarity index 100% rename from src/us/kbase/groups/core/fieldvalidation/IllegalFieldValueException.java rename to src/main/java/us/kbase/groups/core/fieldvalidation/IllegalFieldValueException.java diff --git a/src/us/kbase/groups/core/fieldvalidation/NumberedCustomField.java b/src/main/java/us/kbase/groups/core/fieldvalidation/NumberedCustomField.java similarity index 100% rename from src/us/kbase/groups/core/fieldvalidation/NumberedCustomField.java rename to src/main/java/us/kbase/groups/core/fieldvalidation/NumberedCustomField.java diff --git a/src/us/kbase/groups/core/notifications/Notifications.java b/src/main/java/us/kbase/groups/core/notifications/Notifications.java similarity index 100% rename from src/us/kbase/groups/core/notifications/Notifications.java rename to src/main/java/us/kbase/groups/core/notifications/Notifications.java diff --git a/src/us/kbase/groups/core/notifications/NotificationsFactory.java b/src/main/java/us/kbase/groups/core/notifications/NotificationsFactory.java similarity index 100% rename from src/us/kbase/groups/core/notifications/NotificationsFactory.java rename to src/main/java/us/kbase/groups/core/notifications/NotificationsFactory.java diff --git a/src/us/kbase/groups/core/request/GroupRequest.java b/src/main/java/us/kbase/groups/core/request/GroupRequest.java similarity index 100% rename from src/us/kbase/groups/core/request/GroupRequest.java rename to src/main/java/us/kbase/groups/core/request/GroupRequest.java diff --git a/src/us/kbase/groups/core/request/GroupRequestStatus.java b/src/main/java/us/kbase/groups/core/request/GroupRequestStatus.java similarity index 100% rename from src/us/kbase/groups/core/request/GroupRequestStatus.java rename to src/main/java/us/kbase/groups/core/request/GroupRequestStatus.java diff --git a/src/us/kbase/groups/core/request/GroupRequestStatusType.java b/src/main/java/us/kbase/groups/core/request/GroupRequestStatusType.java similarity index 100% rename from src/us/kbase/groups/core/request/GroupRequestStatusType.java rename to src/main/java/us/kbase/groups/core/request/GroupRequestStatusType.java diff --git a/src/us/kbase/groups/core/request/GroupRequestUserAction.java b/src/main/java/us/kbase/groups/core/request/GroupRequestUserAction.java similarity index 100% rename from src/us/kbase/groups/core/request/GroupRequestUserAction.java rename to src/main/java/us/kbase/groups/core/request/GroupRequestUserAction.java diff --git a/src/us/kbase/groups/core/request/GroupRequestWithActions.java b/src/main/java/us/kbase/groups/core/request/GroupRequestWithActions.java similarity index 100% rename from src/us/kbase/groups/core/request/GroupRequestWithActions.java rename to src/main/java/us/kbase/groups/core/request/GroupRequestWithActions.java diff --git a/src/us/kbase/groups/core/request/RequestID.java b/src/main/java/us/kbase/groups/core/request/RequestID.java similarity index 100% rename from src/us/kbase/groups/core/request/RequestID.java rename to src/main/java/us/kbase/groups/core/request/RequestID.java diff --git a/src/us/kbase/groups/core/request/RequestType.java b/src/main/java/us/kbase/groups/core/request/RequestType.java similarity index 100% rename from src/us/kbase/groups/core/request/RequestType.java rename to src/main/java/us/kbase/groups/core/request/RequestType.java diff --git a/src/us/kbase/groups/core/resource/ResourceAccess.java b/src/main/java/us/kbase/groups/core/resource/ResourceAccess.java similarity index 100% rename from src/us/kbase/groups/core/resource/ResourceAccess.java rename to src/main/java/us/kbase/groups/core/resource/ResourceAccess.java diff --git a/src/us/kbase/groups/core/resource/ResourceAdministrativeID.java b/src/main/java/us/kbase/groups/core/resource/ResourceAdministrativeID.java similarity index 100% rename from src/us/kbase/groups/core/resource/ResourceAdministrativeID.java rename to src/main/java/us/kbase/groups/core/resource/ResourceAdministrativeID.java diff --git a/src/us/kbase/groups/core/resource/ResourceDescriptor.java b/src/main/java/us/kbase/groups/core/resource/ResourceDescriptor.java similarity index 100% rename from src/us/kbase/groups/core/resource/ResourceDescriptor.java rename to src/main/java/us/kbase/groups/core/resource/ResourceDescriptor.java diff --git a/src/us/kbase/groups/core/resource/ResourceHandler.java b/src/main/java/us/kbase/groups/core/resource/ResourceHandler.java similarity index 100% rename from src/us/kbase/groups/core/resource/ResourceHandler.java rename to src/main/java/us/kbase/groups/core/resource/ResourceHandler.java diff --git a/src/us/kbase/groups/core/resource/ResourceID.java b/src/main/java/us/kbase/groups/core/resource/ResourceID.java similarity index 100% rename from src/us/kbase/groups/core/resource/ResourceID.java rename to src/main/java/us/kbase/groups/core/resource/ResourceID.java diff --git a/src/us/kbase/groups/core/resource/ResourceInformation.java b/src/main/java/us/kbase/groups/core/resource/ResourceInformation.java similarity index 100% rename from src/us/kbase/groups/core/resource/ResourceInformation.java rename to src/main/java/us/kbase/groups/core/resource/ResourceInformation.java diff --git a/src/us/kbase/groups/core/resource/ResourceInformationSet.java b/src/main/java/us/kbase/groups/core/resource/ResourceInformationSet.java similarity index 100% rename from src/us/kbase/groups/core/resource/ResourceInformationSet.java rename to src/main/java/us/kbase/groups/core/resource/ResourceInformationSet.java diff --git a/src/us/kbase/groups/core/resource/ResourceType.java b/src/main/java/us/kbase/groups/core/resource/ResourceType.java similarity index 100% rename from src/us/kbase/groups/core/resource/ResourceType.java rename to src/main/java/us/kbase/groups/core/resource/ResourceType.java diff --git a/src/us/kbase/groups/fieldvalidators/EnumFieldValidatorFactory.java b/src/main/java/us/kbase/groups/fieldvalidators/EnumFieldValidatorFactory.java similarity index 100% rename from src/us/kbase/groups/fieldvalidators/EnumFieldValidatorFactory.java rename to src/main/java/us/kbase/groups/fieldvalidators/EnumFieldValidatorFactory.java diff --git a/src/us/kbase/groups/fieldvalidators/GravatarFieldValidatorFactory.java b/src/main/java/us/kbase/groups/fieldvalidators/GravatarFieldValidatorFactory.java similarity index 95% rename from src/us/kbase/groups/fieldvalidators/GravatarFieldValidatorFactory.java rename to src/main/java/us/kbase/groups/fieldvalidators/GravatarFieldValidatorFactory.java index 42753665..718deb02 100644 --- a/src/us/kbase/groups/fieldvalidators/GravatarFieldValidatorFactory.java +++ b/src/main/java/us/kbase/groups/fieldvalidators/GravatarFieldValidatorFactory.java @@ -22,7 +22,8 @@ /** Validates that a gravatar hash is a valid MD5. * Include "strict-length": "true" in the configuration to enforce an exact 32 character MD5. - * If omitted, any extra characters are ignored (which is what Gravatar does). + * If omitted, any extra characters are ignored. This may will likely cause the validation to fail + * if "image-exists" is true and Gravatar doesn't know how to process the extra characters. * Include "image-exists": "true" in the configuration to enforce that an image is associated * with the hash (see Default Image section at https://en.gravatar.com/site/implement/images/). diff --git a/src/us/kbase/groups/fieldvalidators/SimpleFieldValidatorFactory.java b/src/main/java/us/kbase/groups/fieldvalidators/SimpleFieldValidatorFactory.java similarity index 100% rename from src/us/kbase/groups/fieldvalidators/SimpleFieldValidatorFactory.java rename to src/main/java/us/kbase/groups/fieldvalidators/SimpleFieldValidatorFactory.java diff --git a/src/us/kbase/groups/notifications/DirectFeedsServiceNotifierFactory.java b/src/main/java/us/kbase/groups/notifications/DirectFeedsServiceNotifierFactory.java similarity index 100% rename from src/us/kbase/groups/notifications/DirectFeedsServiceNotifierFactory.java rename to src/main/java/us/kbase/groups/notifications/DirectFeedsServiceNotifierFactory.java diff --git a/src/us/kbase/groups/notifications/KafkaFeedsNotifierFactory.java b/src/main/java/us/kbase/groups/notifications/KafkaFeedsNotifierFactory.java similarity index 100% rename from src/us/kbase/groups/notifications/KafkaFeedsNotifierFactory.java rename to src/main/java/us/kbase/groups/notifications/KafkaFeedsNotifierFactory.java diff --git a/src/us/kbase/groups/notifications/SLF4JNotifierFactory.java b/src/main/java/us/kbase/groups/notifications/SLF4JNotifierFactory.java similarity index 100% rename from src/us/kbase/groups/notifications/SLF4JNotifierFactory.java rename to src/main/java/us/kbase/groups/notifications/SLF4JNotifierFactory.java diff --git a/src/us/kbase/groups/service/AppEventListener.java b/src/main/java/us/kbase/groups/service/AppEventListener.java similarity index 100% rename from src/us/kbase/groups/service/AppEventListener.java rename to src/main/java/us/kbase/groups/service/AppEventListener.java diff --git a/src/us/kbase/groups/service/Fields.java b/src/main/java/us/kbase/groups/service/Fields.java similarity index 100% rename from src/us/kbase/groups/service/Fields.java rename to src/main/java/us/kbase/groups/service/Fields.java diff --git a/src/us/kbase/groups/service/GroupsService.java b/src/main/java/us/kbase/groups/service/GroupsService.java similarity index 98% rename from src/us/kbase/groups/service/GroupsService.java rename to src/main/java/us/kbase/groups/service/GroupsService.java index 2b4f6052..ef6acb29 100644 --- a/src/us/kbase/groups/service/GroupsService.java +++ b/src/main/java/us/kbase/groups/service/GroupsService.java @@ -4,7 +4,7 @@ import org.glassfish.jersey.server.ResourceConfig; import org.slf4j.LoggerFactory; -import com.mongodb.MongoClient; +import com.mongodb.client.MongoClient; import ch.qos.logback.classic.Level; import ch.qos.logback.classic.Logger; diff --git a/src/us/kbase/groups/service/JacksonFeature.java b/src/main/java/us/kbase/groups/service/JacksonFeature.java similarity index 100% rename from src/us/kbase/groups/service/JacksonFeature.java rename to src/main/java/us/kbase/groups/service/JacksonFeature.java diff --git a/src/us/kbase/groups/service/LoggingFilter.java b/src/main/java/us/kbase/groups/service/LoggingFilter.java similarity index 100% rename from src/us/kbase/groups/service/LoggingFilter.java rename to src/main/java/us/kbase/groups/service/LoggingFilter.java diff --git a/src/us/kbase/groups/service/SLF4JAutoLogger.java b/src/main/java/us/kbase/groups/service/SLF4JAutoLogger.java similarity index 100% rename from src/us/kbase/groups/service/SLF4JAutoLogger.java rename to src/main/java/us/kbase/groups/service/SLF4JAutoLogger.java diff --git a/src/us/kbase/groups/service/api/APICommon.java b/src/main/java/us/kbase/groups/service/api/APICommon.java similarity index 100% rename from src/us/kbase/groups/service/api/APICommon.java rename to src/main/java/us/kbase/groups/service/api/APICommon.java diff --git a/src/us/kbase/groups/service/api/APIConstants.java b/src/main/java/us/kbase/groups/service/api/APIConstants.java similarity index 100% rename from src/us/kbase/groups/service/api/APIConstants.java rename to src/main/java/us/kbase/groups/service/api/APIConstants.java diff --git a/src/us/kbase/groups/service/api/Fields.java b/src/main/java/us/kbase/groups/service/api/Fields.java similarity index 100% rename from src/us/kbase/groups/service/api/Fields.java rename to src/main/java/us/kbase/groups/service/api/Fields.java diff --git a/src/us/kbase/groups/service/api/GroupsAPI.java b/src/main/java/us/kbase/groups/service/api/GroupsAPI.java similarity index 100% rename from src/us/kbase/groups/service/api/GroupsAPI.java rename to src/main/java/us/kbase/groups/service/api/GroupsAPI.java diff --git a/src/us/kbase/groups/service/api/IncomingJSON.java b/src/main/java/us/kbase/groups/service/api/IncomingJSON.java similarity index 100% rename from src/us/kbase/groups/service/api/IncomingJSON.java rename to src/main/java/us/kbase/groups/service/api/IncomingJSON.java diff --git a/src/us/kbase/groups/service/api/MemberAPI.java b/src/main/java/us/kbase/groups/service/api/MemberAPI.java similarity index 100% rename from src/us/kbase/groups/service/api/MemberAPI.java rename to src/main/java/us/kbase/groups/service/api/MemberAPI.java diff --git a/src/us/kbase/groups/service/api/NamesAPI.java b/src/main/java/us/kbase/groups/service/api/NamesAPI.java similarity index 100% rename from src/us/kbase/groups/service/api/NamesAPI.java rename to src/main/java/us/kbase/groups/service/api/NamesAPI.java diff --git a/src/us/kbase/groups/service/api/RequestAPI.java b/src/main/java/us/kbase/groups/service/api/RequestAPI.java similarity index 100% rename from src/us/kbase/groups/service/api/RequestAPI.java rename to src/main/java/us/kbase/groups/service/api/RequestAPI.java diff --git a/src/us/kbase/groups/service/api/Root.java b/src/main/java/us/kbase/groups/service/api/Root.java similarity index 96% rename from src/us/kbase/groups/service/api/Root.java rename to src/main/java/us/kbase/groups/service/api/Root.java index eb476c4d..c93c2695 100644 --- a/src/us/kbase/groups/service/api/Root.java +++ b/src/main/java/us/kbase/groups/service/api/Root.java @@ -26,7 +26,7 @@ public class Root { //TODO ZLATER ROOT add configurable contact email or link //TODO ZLATER swagger - private static final String VERSION = "0.1.6"; + private static final String VERSION = "0.1.7"; private static final String SERVER_NAME = "Groups service"; /** Return the root information. diff --git a/src/us/kbase/groups/service/api/ServicePaths.java b/src/main/java/us/kbase/groups/service/api/ServicePaths.java similarity index 100% rename from src/us/kbase/groups/service/api/ServicePaths.java rename to src/main/java/us/kbase/groups/service/api/ServicePaths.java diff --git a/src/us/kbase/groups/service/exceptions/ErrorMessage.java b/src/main/java/us/kbase/groups/service/exceptions/ErrorMessage.java similarity index 100% rename from src/us/kbase/groups/service/exceptions/ErrorMessage.java rename to src/main/java/us/kbase/groups/service/exceptions/ErrorMessage.java diff --git a/src/us/kbase/groups/service/exceptions/ExceptionHandler.java b/src/main/java/us/kbase/groups/service/exceptions/ExceptionHandler.java similarity index 100% rename from src/us/kbase/groups/service/exceptions/ExceptionHandler.java rename to src/main/java/us/kbase/groups/service/exceptions/ExceptionHandler.java diff --git a/src/us/kbase/groups/storage/GroupsStorage.java b/src/main/java/us/kbase/groups/storage/GroupsStorage.java similarity index 100% rename from src/us/kbase/groups/storage/GroupsStorage.java rename to src/main/java/us/kbase/groups/storage/GroupsStorage.java diff --git a/src/us/kbase/groups/storage/exceptions/GroupsStorageException.java b/src/main/java/us/kbase/groups/storage/exceptions/GroupsStorageException.java similarity index 100% rename from src/us/kbase/groups/storage/exceptions/GroupsStorageException.java rename to src/main/java/us/kbase/groups/storage/exceptions/GroupsStorageException.java diff --git a/src/us/kbase/groups/storage/exceptions/StorageInitException.java b/src/main/java/us/kbase/groups/storage/exceptions/StorageInitException.java similarity index 100% rename from src/us/kbase/groups/storage/exceptions/StorageInitException.java rename to src/main/java/us/kbase/groups/storage/exceptions/StorageInitException.java diff --git a/src/us/kbase/groups/storage/mongo/Fields.java b/src/main/java/us/kbase/groups/storage/mongo/Fields.java similarity index 100% rename from src/us/kbase/groups/storage/mongo/Fields.java rename to src/main/java/us/kbase/groups/storage/mongo/Fields.java diff --git a/src/us/kbase/groups/storage/mongo/MongoGroupsStorage.java b/src/main/java/us/kbase/groups/storage/mongo/MongoGroupsStorage.java similarity index 100% rename from src/us/kbase/groups/storage/mongo/MongoGroupsStorage.java rename to src/main/java/us/kbase/groups/storage/mongo/MongoGroupsStorage.java diff --git a/src/us/kbase/groups/userhandler/KBaseUserHandler.java b/src/main/java/us/kbase/groups/userhandler/KBaseUserHandler.java similarity index 65% rename from src/us/kbase/groups/userhandler/KBaseUserHandler.java rename to src/main/java/us/kbase/groups/userhandler/KBaseUserHandler.java index 3ab942e6..7b3f199c 100644 --- a/src/us/kbase/groups/userhandler/KBaseUserHandler.java +++ b/src/main/java/us/kbase/groups/userhandler/KBaseUserHandler.java @@ -3,17 +3,15 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.io.IOException; -import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.util.Arrays; import org.slf4j.LoggerFactory; -import us.kbase.auth.AuthConfig; import us.kbase.auth.AuthException; import us.kbase.auth.AuthToken; -import us.kbase.auth.ConfigurableAuthService; +import us.kbase.auth.client.AuthClient; import us.kbase.groups.core.Token; import us.kbase.groups.core.UserHandler; import us.kbase.groups.core.UserName; @@ -29,22 +27,15 @@ */ public class KBaseUserHandler implements UserHandler { - // TODO TEST + // note the auth client handles its own caching. - // note the configurable auth service handles its own caching. - - private static final String GLOBUS_URL_SUFFIX = "api/legacy/globus"; - private static final String KBASE_URL_SUFFIX = "api/legacy/KBase/Sessions/Login"; - - private final URI rootAuthURI; - private final ConfigurableAuthService auth; + private final AuthClient auth; private final Token serviceToken; /** Create the handler. * @param rootAuthURL the root url of the KBase authentication service. * @param serviceToken a service token for the KBase authentication service. This is used * to check that user names are valid. - * @param allowInsecureURL allow a non-https URL. * @throws IOException if the authentication service could not be contacted. * @throws URISyntaxException if the URL is not a valid URI. * @throws InvalidTokenException if the service token is invalid. @@ -52,21 +43,19 @@ public class KBaseUserHandler implements UserHandler { */ public KBaseUserHandler( final URL rootAuthURL, - final Token serviceToken, - final boolean allowInsecureURL) + final Token serviceToken) throws IOException, URISyntaxException, InvalidTokenException, AuthenticationException { checkNotNull(rootAuthURL, "rootAuthURL"); checkNotNull(serviceToken, "serviceToken"); - if (rootAuthURL.toString().endsWith("/")) { - this.rootAuthURI = rootAuthURL.toURI(); - } else { - this.rootAuthURI = new URL(rootAuthURL.toString() + "/").toURI(); + try { + auth = AuthClient.from(rootAuthURL.toURI()); + } catch (AuthException e) { + throw new AuthenticationException( + ErrorType.AUTHENTICATION_FAILED, + "Failed to contact the auth service: " + e.getMessage(), + e); } - auth = new ConfigurableAuthService(new AuthConfig() - .withAllowInsecureURLs(allowInsecureURL) - .withKBaseAuthServerURL(this.rootAuthURI.resolve(KBASE_URL_SUFFIX).toURL()) - .withGlobusAuthURL(this.rootAuthURI.resolve(GLOBUS_URL_SUFFIX).toURL())); this.serviceToken = serviceToken; getUser(this.serviceToken); // check token is valid } @@ -78,12 +67,12 @@ public UserName getUser(final Token token) try { final AuthToken user = auth.validateToken(token.getToken()); return new UserName(user.getUserName()); - } catch (IOException e) { + } catch (IOException e) { // no good way to test this throw new AuthenticationException(ErrorType.AUTHENTICATION_FAILED, "Failed contacting authentication server: " + e.getMessage(), e); } catch (AuthException e) { throw new InvalidTokenException(e.getMessage(), e); - } catch (MissingParameterException | IllegalParameterException e) { + } catch (MissingParameterException | IllegalParameterException e) { // can't test throw new RuntimeException( "The auth service is returning invalid usernames, something is very wrong", e); } @@ -94,24 +83,12 @@ public boolean isValidUser(final UserName userName) throws AuthenticationExcepti checkNotNull(userName, "userName"); try { return auth.isValidUserName( - Arrays.asList(userName.getName()), - new AuthToken(serviceToken.getToken(), "fakeuser")) + Arrays.asList(userName.getName()), serviceToken.getToken()) .get(userName.getName()); - } catch (IOException | AuthException e) { + } catch (IOException | AuthException e) { // no good way to test this LoggerFactory.getLogger(getClass()).error("Unexpected auth service response", e); throw new AuthenticationException(ErrorType.AUTHENTICATION_FAILED, "Recieved unexpected response from authentication server.", e); } } - - public static void main(final String[] args) throws Exception { - final String token = args[0]; - final UserHandler uh = new KBaseUserHandler(new URL("https://ci.kbase.us/services/auth"), - new Token(token), false); - System.out.println(uh.getUser(new Token(token))); - - System.out.println(uh.isValidUser(new UserName("kkeller"))); - System.out.println(uh.isValidUser(new UserName("veryfakeindeed"))); - } - } diff --git a/src/us/kbase/groups/util/FileOpener.java b/src/main/java/us/kbase/groups/util/FileOpener.java similarity index 100% rename from src/us/kbase/groups/util/FileOpener.java rename to src/main/java/us/kbase/groups/util/FileOpener.java diff --git a/src/us/kbase/groups/util/Util.java b/src/main/java/us/kbase/groups/util/Util.java similarity index 100% rename from src/us/kbase/groups/util/Util.java rename to src/main/java/us/kbase/groups/util/Util.java diff --git a/src/us/kbase/groups/workspacehandler/SDKClientWorkspaceHandler.java b/src/main/java/us/kbase/groups/workspacehandler/SDKClientWorkspaceHandler.java similarity index 100% rename from src/us/kbase/groups/workspacehandler/SDKClientWorkspaceHandler.java rename to src/main/java/us/kbase/groups/workspacehandler/SDKClientWorkspaceHandler.java diff --git a/src/us/kbase/groups/workspacehandler/WorkspacePermission.java b/src/main/java/us/kbase/groups/workspacehandler/WorkspacePermission.java similarity index 100% rename from src/us/kbase/groups/workspacehandler/WorkspacePermission.java rename to src/main/java/us/kbase/groups/workspacehandler/WorkspacePermission.java diff --git a/src/us/kbase/test/groups/MapBuilder.java b/src/test/java/us/kbase/test/groups/MapBuilder.java similarity index 100% rename from src/us/kbase/test/groups/MapBuilder.java rename to src/test/java/us/kbase/test/groups/MapBuilder.java diff --git a/src/us/kbase/test/groups/MongoStorageTestManager.java b/src/test/java/us/kbase/test/groups/MongoStorageTestManager.java similarity index 92% rename from src/us/kbase/test/groups/MongoStorageTestManager.java rename to src/test/java/us/kbase/test/groups/MongoStorageTestManager.java index 36d42b36..6345280b 100644 --- a/src/us/kbase/test/groups/MongoStorageTestManager.java +++ b/src/test/java/us/kbase/test/groups/MongoStorageTestManager.java @@ -12,12 +12,13 @@ import org.bson.Document; import com.github.zafarkhaja.semver.Version; -import com.mongodb.MongoClient; +import com.mongodb.client.MongoClient; +import com.mongodb.client.MongoClients; import com.mongodb.client.MongoDatabase; -import us.kbase.common.test.controllers.mongo.MongoController; import us.kbase.groups.core.resource.ResourceType; import us.kbase.groups.storage.mongo.MongoGroupsStorage; +import us.kbase.testutils.controllers.mongo.MongoController; public class MongoStorageTestManager { @@ -39,7 +40,7 @@ public MongoStorageTestManager(final String dbName) throws Exception { wiredTiger = TestCommon.useWiredTigerEngine(); System.out.println(String.format("Testing against mongo executable %s on port %s", TestCommon.getMongoExe(), mongo.getServerPort())); - mc = new MongoClient("localhost:" + mongo.getServerPort()); + mc = MongoClients.create("mongodb://localhost:" + mongo.getServerPort()); db = mc.getDatabase(dbName); final Document bi = db.runCommand(new Document("buildinfo", 1)); diff --git a/src/us/kbase/test/groups/StandaloneGroupsServer.java b/src/test/java/us/kbase/test/groups/StandaloneGroupsServer.java similarity index 100% rename from src/us/kbase/test/groups/StandaloneGroupsServer.java rename to src/test/java/us/kbase/test/groups/StandaloneGroupsServer.java diff --git a/src/us/kbase/test/groups/TestCommon.java b/src/test/java/us/kbase/test/groups/TestCommon.java similarity index 98% rename from src/us/kbase/test/groups/TestCommon.java rename to src/test/java/us/kbase/test/groups/TestCommon.java index 2b19fa85..64d94f14 100644 --- a/src/us/kbase/test/groups/TestCommon.java +++ b/src/test/java/us/kbase/test/groups/TestCommon.java @@ -40,15 +40,13 @@ 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 { public static final String MONGOEXE = "test.mongo.exe"; public static final String MONGO_USE_WIRED_TIGER = "test.mongo.wired_tiger"; - 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"; @@ -171,10 +169,6 @@ public static Path getMongoExe() { return Paths.get(getTestProperty(MONGOEXE)).toAbsolutePath().normalize(); } - public static Path getJarsDir() { - return Paths.get(getTestProperty(JARS_PATH)).toAbsolutePath().normalize(); - } - public static Path getTempDir() { return Paths.get(getTestProperty(TEST_TEMP_DIR)).toAbsolutePath().normalize(); } diff --git a/src/us/kbase/test/groups/cataloghandler/SDKClientCatalogHandlerTest.java b/src/test/java/us/kbase/test/groups/cataloghandler/SDKClientCatalogHandlerTest.java similarity index 99% rename from src/us/kbase/test/groups/cataloghandler/SDKClientCatalogHandlerTest.java rename to src/test/java/us/kbase/test/groups/cataloghandler/SDKClientCatalogHandlerTest.java index 352592d7..4fdb4acb 100644 --- a/src/us/kbase/test/groups/cataloghandler/SDKClientCatalogHandlerTest.java +++ b/src/test/java/us/kbase/test/groups/cataloghandler/SDKClientCatalogHandlerTest.java @@ -30,7 +30,6 @@ import us.kbase.catalog.ModuleVersionInfo; import us.kbase.catalog.SelectOneModuleParams; import us.kbase.common.service.JsonClientException; -import us.kbase.common.test.TestException; import us.kbase.groups.cataloghandler.SDKClientCatalogHandler; import us.kbase.groups.core.UserName; import us.kbase.groups.core.exceptions.ResourceHandlerException; @@ -43,6 +42,7 @@ import us.kbase.groups.core.resource.ResourceInformationSet; import us.kbase.test.groups.MapBuilder; import us.kbase.test.groups.TestCommon; +import us.kbase.testutils.TestException; public class SDKClientCatalogHandlerTest { diff --git a/src/us/kbase/test/groups/config/GroupsConfigTest.java b/src/test/java/us/kbase/test/groups/config/GroupsConfigTest.java similarity index 98% rename from src/us/kbase/test/groups/config/GroupsConfigTest.java rename to src/test/java/us/kbase/test/groups/config/GroupsConfigTest.java index 4196f3d2..e996a473 100644 --- a/src/us/kbase/test/groups/config/GroupsConfigTest.java +++ b/src/test/java/us/kbase/test/groups/config/GroupsConfigTest.java @@ -89,6 +89,7 @@ public void sysPropNoUserNoBools() throws Throwable { assertThat("incorrect mongo db", cfg.getMongoDatabase(), is("database")); assertThat("incorrect mongo user", cfg.getMongoUser(), is(Optional.absent())); assertThat("incorrect mongo pwd", cfg.getMongoPwd(), is(Optional.absent())); + assertThat("incorrect retry writes", cfg.getMongoRetryWrites(), is(false)); assertThat("incorrect auth url", cfg.getAuthURL(), is(new URL("http://auth.com"))); assertThat("incorrect catalog url", cfg.getCatalogURL(), is(new URL("http://cat.com"))); assertThat("incorrect ws url", cfg.getWorkspaceURL(), is(new URL("http://ws.com"))); @@ -116,6 +117,7 @@ public void sysPropNoUserNoBoolsWhitespaceFields() throws Throwable { "mongo-db=database\n" + "mongo-user=\n" + "mongo-pwd=\n" + + "mongo-retrywrites= false \n" + "notifier-factory= factoryclass \n" + "notifier-param-p1 = np1 \n" + "notifier-param-p2 = np2 \n" + @@ -165,6 +167,7 @@ public void sysPropNoUserNoBoolsWhitespaceFields() throws Throwable { assertThat("incorrect mongo db", cfg.getMongoDatabase(), is("database")); assertThat("incorrect mongo user", cfg.getMongoUser(), is(Optional.absent())); assertThat("incorrect mongo pwd", cfg.getMongoPwd(), is(Optional.absent())); + assertThat("incorrect retry writes", cfg.getMongoRetryWrites(), is(false)); assertThat("incorrect auth url", cfg.getAuthURL(), is(new URL("http://auth.com"))); assertThat("incorrect catalog url", cfg.getCatalogURL(), is(new URL("http://cat.com"))); assertThat("incorrect ws url", cfg.getWorkspaceURL(), is(new URL("http://ws.com"))); @@ -241,6 +244,7 @@ public void envVarWithUserWithBools() throws Throwable { "mongo-db=database\n" + "mongo-user=userfoo\n" + "mongo-pwd=somepwd\n" + + "mongo-retrywrites=true \n" + "notifier-factory= factoryclass \n" + "auth-url=https://auth.com\n" + "catalog-url= http://cat.com \n" + @@ -256,6 +260,7 @@ public void envVarWithUserWithBools() throws Throwable { assertThat("incorrect mongo host", cfg.getMongoHost(), is("mongo")); assertThat("incorrect mongo db", cfg.getMongoDatabase(), is("database")); + assertThat("incorrect retry writes", cfg.getMongoRetryWrites(), is(true)); assertThat("incorrect mongo user", cfg.getMongoUser(), is(Optional.of("userfoo"))); assertThat("incorrect mongo pwd", cfg.getMongoPwd().get(), equalTo("somepwd".toCharArray())); @@ -292,6 +297,7 @@ public void pathNoUserNoBoolsStdLogger() throws Throwable { assertThat("incorrect mongo db", cfg.getMongoDatabase(), is("database")); assertThat("incorrect mongo user", cfg.getMongoUser(), is(Optional.absent())); assertThat("incorrect mongo pwd", cfg.getMongoPwd(), is(Optional.absent())); + assertThat("incorrect retry writes", cfg.getMongoRetryWrites(), is(false)); assertThat("incorrect auth url", cfg.getAuthURL(), is(new URL("https://auth.com"))); assertThat("incorrect catalog url", cfg.getCatalogURL(), is(new URL("http://cat.com"))); assertThat("incorrect ws url", cfg.getWorkspaceURL(), is(new URL("https://ws.com"))); @@ -315,6 +321,7 @@ public void pathWithUserWithBoolsNullLogger() throws Throwable { "mongo-db=database\n" + "mongo-user=userfoo\n" + "mongo-pwd=somepwd\n" + + "mongo-retrywrites=true\n" + "notifier-factory= factoryclass \n" + "auth-url=https://auth.com\n" + "catalog-url= http://cat.com \n" + @@ -327,6 +334,7 @@ public void pathWithUserWithBoolsNullLogger() throws Throwable { assertThat("incorrect mongo host", cfg.getMongoHost(), is("mongo")); assertThat("incorrect mongo db", cfg.getMongoDatabase(), is("database")); + assertThat("incorrect retry writes", cfg.getMongoRetryWrites(), is(true)); assertThat("incorrect mongo user", cfg.getMongoUser(), is(Optional.of("userfoo"))); assertThat("incorrect mongo pwd", cfg.getMongoPwd().get(), equalTo("somepwd".toCharArray())); diff --git a/src/us/kbase/test/groups/core/CreateModExpireTimesTest.java b/src/test/java/us/kbase/test/groups/core/CreateModExpireTimesTest.java similarity index 100% rename from src/us/kbase/test/groups/core/CreateModExpireTimesTest.java rename to src/test/java/us/kbase/test/groups/core/CreateModExpireTimesTest.java diff --git a/src/us/kbase/test/groups/core/FieldItemTest.java b/src/test/java/us/kbase/test/groups/core/FieldItemTest.java similarity index 100% rename from src/us/kbase/test/groups/core/FieldItemTest.java rename to src/test/java/us/kbase/test/groups/core/FieldItemTest.java diff --git a/src/us/kbase/test/groups/core/GetGroupsParamsTest.java b/src/test/java/us/kbase/test/groups/core/GetGroupsParamsTest.java similarity index 100% rename from src/us/kbase/test/groups/core/GetGroupsParamsTest.java rename to src/test/java/us/kbase/test/groups/core/GetGroupsParamsTest.java diff --git a/src/us/kbase/test/groups/core/GetRequestParamsTest.java b/src/test/java/us/kbase/test/groups/core/GetRequestParamsTest.java similarity index 100% rename from src/us/kbase/test/groups/core/GetRequestParamsTest.java rename to src/test/java/us/kbase/test/groups/core/GetRequestParamsTest.java diff --git a/src/us/kbase/test/groups/core/GroupCreationParamsTest.java b/src/test/java/us/kbase/test/groups/core/GroupCreationParamsTest.java similarity index 100% rename from src/us/kbase/test/groups/core/GroupCreationParamsTest.java rename to src/test/java/us/kbase/test/groups/core/GroupCreationParamsTest.java diff --git a/src/us/kbase/test/groups/core/GroupHasRequestsTest.java b/src/test/java/us/kbase/test/groups/core/GroupHasRequestsTest.java similarity index 100% rename from src/us/kbase/test/groups/core/GroupHasRequestsTest.java rename to src/test/java/us/kbase/test/groups/core/GroupHasRequestsTest.java diff --git a/src/us/kbase/test/groups/core/GroupIDAndNameTest.java b/src/test/java/us/kbase/test/groups/core/GroupIDAndNameTest.java similarity index 100% rename from src/us/kbase/test/groups/core/GroupIDAndNameTest.java rename to src/test/java/us/kbase/test/groups/core/GroupIDAndNameTest.java diff --git a/src/us/kbase/test/groups/core/GroupIDNameMembershipTest.java b/src/test/java/us/kbase/test/groups/core/GroupIDNameMembershipTest.java similarity index 100% rename from src/us/kbase/test/groups/core/GroupIDNameMembershipTest.java rename to src/test/java/us/kbase/test/groups/core/GroupIDNameMembershipTest.java diff --git a/src/us/kbase/test/groups/core/GroupIDTest.java b/src/test/java/us/kbase/test/groups/core/GroupIDTest.java similarity index 100% rename from src/us/kbase/test/groups/core/GroupIDTest.java rename to src/test/java/us/kbase/test/groups/core/GroupIDTest.java diff --git a/src/us/kbase/test/groups/core/GroupNameTest.java b/src/test/java/us/kbase/test/groups/core/GroupNameTest.java similarity index 100% rename from src/us/kbase/test/groups/core/GroupNameTest.java rename to src/test/java/us/kbase/test/groups/core/GroupNameTest.java diff --git a/src/us/kbase/test/groups/core/GroupTest.java b/src/test/java/us/kbase/test/groups/core/GroupTest.java similarity index 100% rename from src/us/kbase/test/groups/core/GroupTest.java rename to src/test/java/us/kbase/test/groups/core/GroupTest.java diff --git a/src/us/kbase/test/groups/core/GroupUpdateParamsTest.java b/src/test/java/us/kbase/test/groups/core/GroupUpdateParamsTest.java similarity index 100% rename from src/us/kbase/test/groups/core/GroupUpdateParamsTest.java rename to src/test/java/us/kbase/test/groups/core/GroupUpdateParamsTest.java diff --git a/src/us/kbase/test/groups/core/GroupUserTest.java b/src/test/java/us/kbase/test/groups/core/GroupUserTest.java similarity index 100% rename from src/us/kbase/test/groups/core/GroupUserTest.java rename to src/test/java/us/kbase/test/groups/core/GroupUserTest.java diff --git a/src/us/kbase/test/groups/core/GroupViewTest.java b/src/test/java/us/kbase/test/groups/core/GroupViewTest.java similarity index 100% rename from src/us/kbase/test/groups/core/GroupViewTest.java rename to src/test/java/us/kbase/test/groups/core/GroupViewTest.java diff --git a/src/us/kbase/test/groups/core/GroupsTest.java b/src/test/java/us/kbase/test/groups/core/GroupsTest.java similarity index 100% rename from src/us/kbase/test/groups/core/GroupsTest.java rename to src/test/java/us/kbase/test/groups/core/GroupsTest.java diff --git a/src/us/kbase/test/groups/core/NameTest.java b/src/test/java/us/kbase/test/groups/core/NameTest.java similarity index 100% rename from src/us/kbase/test/groups/core/NameTest.java rename to src/test/java/us/kbase/test/groups/core/NameTest.java diff --git a/src/us/kbase/test/groups/core/OptionalGroupFieldsTest.java b/src/test/java/us/kbase/test/groups/core/OptionalGroupFieldsTest.java similarity index 100% rename from src/us/kbase/test/groups/core/OptionalGroupFieldsTest.java rename to src/test/java/us/kbase/test/groups/core/OptionalGroupFieldsTest.java diff --git a/src/us/kbase/test/groups/core/OptionalStringTest.java b/src/test/java/us/kbase/test/groups/core/OptionalStringTest.java similarity index 100% rename from src/us/kbase/test/groups/core/OptionalStringTest.java rename to src/test/java/us/kbase/test/groups/core/OptionalStringTest.java diff --git a/src/us/kbase/test/groups/core/TokenTest.java b/src/test/java/us/kbase/test/groups/core/TokenTest.java similarity index 100% rename from src/us/kbase/test/groups/core/TokenTest.java rename to src/test/java/us/kbase/test/groups/core/TokenTest.java diff --git a/src/us/kbase/test/groups/core/UserNameTest.java b/src/test/java/us/kbase/test/groups/core/UserNameTest.java similarity index 100% rename from src/us/kbase/test/groups/core/UserNameTest.java rename to src/test/java/us/kbase/test/groups/core/UserNameTest.java diff --git a/src/us/kbase/test/groups/core/fieldvalidation/CustomFieldTest.java b/src/test/java/us/kbase/test/groups/core/fieldvalidation/CustomFieldTest.java similarity index 100% rename from src/us/kbase/test/groups/core/fieldvalidation/CustomFieldTest.java rename to src/test/java/us/kbase/test/groups/core/fieldvalidation/CustomFieldTest.java diff --git a/src/us/kbase/test/groups/core/fieldvalidation/FieldConfigurationTest.java b/src/test/java/us/kbase/test/groups/core/fieldvalidation/FieldConfigurationTest.java similarity index 100% rename from src/us/kbase/test/groups/core/fieldvalidation/FieldConfigurationTest.java rename to src/test/java/us/kbase/test/groups/core/fieldvalidation/FieldConfigurationTest.java diff --git a/src/us/kbase/test/groups/core/fieldvalidation/FieldValidatorConfigurationTest.java b/src/test/java/us/kbase/test/groups/core/fieldvalidation/FieldValidatorConfigurationTest.java similarity index 100% rename from src/us/kbase/test/groups/core/fieldvalidation/FieldValidatorConfigurationTest.java rename to src/test/java/us/kbase/test/groups/core/fieldvalidation/FieldValidatorConfigurationTest.java diff --git a/src/us/kbase/test/groups/core/fieldvalidation/FieldValidatorsTest.java b/src/test/java/us/kbase/test/groups/core/fieldvalidation/FieldValidatorsTest.java similarity index 100% rename from src/us/kbase/test/groups/core/fieldvalidation/FieldValidatorsTest.java rename to src/test/java/us/kbase/test/groups/core/fieldvalidation/FieldValidatorsTest.java diff --git a/src/us/kbase/test/groups/core/fieldvalidation/NumberedCustomFieldTest.java b/src/test/java/us/kbase/test/groups/core/fieldvalidation/NumberedCustomFieldTest.java similarity index 100% rename from src/us/kbase/test/groups/core/fieldvalidation/NumberedCustomFieldTest.java rename to src/test/java/us/kbase/test/groups/core/fieldvalidation/NumberedCustomFieldTest.java diff --git a/src/us/kbase/test/groups/core/request/GroupRequestStatusTest.java b/src/test/java/us/kbase/test/groups/core/request/GroupRequestStatusTest.java similarity index 100% rename from src/us/kbase/test/groups/core/request/GroupRequestStatusTest.java rename to src/test/java/us/kbase/test/groups/core/request/GroupRequestStatusTest.java diff --git a/src/us/kbase/test/groups/core/request/GroupRequestStatusTypeTest.java b/src/test/java/us/kbase/test/groups/core/request/GroupRequestStatusTypeTest.java similarity index 100% rename from src/us/kbase/test/groups/core/request/GroupRequestStatusTypeTest.java rename to src/test/java/us/kbase/test/groups/core/request/GroupRequestStatusTypeTest.java diff --git a/src/us/kbase/test/groups/core/request/GroupRequestTest.java b/src/test/java/us/kbase/test/groups/core/request/GroupRequestTest.java similarity index 100% rename from src/us/kbase/test/groups/core/request/GroupRequestTest.java rename to src/test/java/us/kbase/test/groups/core/request/GroupRequestTest.java diff --git a/src/us/kbase/test/groups/core/request/GroupRequestUserActionTest.java b/src/test/java/us/kbase/test/groups/core/request/GroupRequestUserActionTest.java similarity index 100% rename from src/us/kbase/test/groups/core/request/GroupRequestUserActionTest.java rename to src/test/java/us/kbase/test/groups/core/request/GroupRequestUserActionTest.java diff --git a/src/us/kbase/test/groups/core/request/GroupRequestWithActionsTest.java b/src/test/java/us/kbase/test/groups/core/request/GroupRequestWithActionsTest.java similarity index 100% rename from src/us/kbase/test/groups/core/request/GroupRequestWithActionsTest.java rename to src/test/java/us/kbase/test/groups/core/request/GroupRequestWithActionsTest.java diff --git a/src/us/kbase/test/groups/core/request/RequestIDTest.java b/src/test/java/us/kbase/test/groups/core/request/RequestIDTest.java similarity index 100% rename from src/us/kbase/test/groups/core/request/RequestIDTest.java rename to src/test/java/us/kbase/test/groups/core/request/RequestIDTest.java diff --git a/src/us/kbase/test/groups/core/request/RequestTypeTest.java b/src/test/java/us/kbase/test/groups/core/request/RequestTypeTest.java similarity index 100% rename from src/us/kbase/test/groups/core/request/RequestTypeTest.java rename to src/test/java/us/kbase/test/groups/core/request/RequestTypeTest.java diff --git a/src/us/kbase/test/groups/core/resource/ResourceIDTest.java b/src/test/java/us/kbase/test/groups/core/resource/ResourceIDTest.java similarity index 100% rename from src/us/kbase/test/groups/core/resource/ResourceIDTest.java rename to src/test/java/us/kbase/test/groups/core/resource/ResourceIDTest.java diff --git a/src/us/kbase/test/groups/core/resource/ResourceInformationSetTest.java b/src/test/java/us/kbase/test/groups/core/resource/ResourceInformationSetTest.java similarity index 100% rename from src/us/kbase/test/groups/core/resource/ResourceInformationSetTest.java rename to src/test/java/us/kbase/test/groups/core/resource/ResourceInformationSetTest.java diff --git a/src/us/kbase/test/groups/core/resource/ResourceInformationTest.java b/src/test/java/us/kbase/test/groups/core/resource/ResourceInformationTest.java similarity index 100% rename from src/us/kbase/test/groups/core/resource/ResourceInformationTest.java rename to src/test/java/us/kbase/test/groups/core/resource/ResourceInformationTest.java diff --git a/src/us/kbase/test/groups/core/resource/ResourceTypeTest.java b/src/test/java/us/kbase/test/groups/core/resource/ResourceTypeTest.java similarity index 100% rename from src/us/kbase/test/groups/core/resource/ResourceTypeTest.java rename to src/test/java/us/kbase/test/groups/core/resource/ResourceTypeTest.java diff --git a/src/us/kbase/test/groups/fieldvalidators/EnumFieldValidatorFactoryTest.java b/src/test/java/us/kbase/test/groups/fieldvalidators/EnumFieldValidatorFactoryTest.java similarity index 100% rename from src/us/kbase/test/groups/fieldvalidators/EnumFieldValidatorFactoryTest.java rename to src/test/java/us/kbase/test/groups/fieldvalidators/EnumFieldValidatorFactoryTest.java diff --git a/src/us/kbase/test/groups/fieldvalidators/GravatarFieldValidatorFactoryTest.java b/src/test/java/us/kbase/test/groups/fieldvalidators/GravatarFieldValidatorFactoryTest.java similarity index 99% rename from src/us/kbase/test/groups/fieldvalidators/GravatarFieldValidatorFactoryTest.java rename to src/test/java/us/kbase/test/groups/fieldvalidators/GravatarFieldValidatorFactoryTest.java index da5d19c5..04c756b9 100644 --- a/src/us/kbase/test/groups/fieldvalidators/GravatarFieldValidatorFactoryTest.java +++ b/src/test/java/us/kbase/test/groups/fieldvalidators/GravatarFieldValidatorFactoryTest.java @@ -53,7 +53,7 @@ public void validateWithAccount() throws Exception { // if there's no error, the test passes v.validate(KNOWN_GOOD); // check that extra characters pass - v.validate(KNOWN_GOOD + "Z"); + v.validate(KNOWN_GOOD + ".jpg"); } @Test diff --git a/src/us/kbase/test/groups/fieldvalidators/SimpleFieldValidatorFactoryTest.java b/src/test/java/us/kbase/test/groups/fieldvalidators/SimpleFieldValidatorFactoryTest.java similarity index 100% rename from src/us/kbase/test/groups/fieldvalidators/SimpleFieldValidatorFactoryTest.java rename to src/test/java/us/kbase/test/groups/fieldvalidators/SimpleFieldValidatorFactoryTest.java diff --git a/src/us/kbase/test/groups/integration/ServiceIntegrationTest.java b/src/test/java/us/kbase/test/groups/integration/ServiceIntegrationTest.java similarity index 99% rename from src/us/kbase/test/groups/integration/ServiceIntegrationTest.java rename to src/test/java/us/kbase/test/groups/integration/ServiceIntegrationTest.java index 3837f0d6..0267799f 100644 --- a/src/us/kbase/test/groups/integration/ServiceIntegrationTest.java +++ b/src/test/java/us/kbase/test/groups/integration/ServiceIntegrationTest.java @@ -42,7 +42,6 @@ import com.mongodb.client.MongoDatabase; import us.kbase.auth.AuthToken; -import us.kbase.common.test.RegexMatcher; import us.kbase.groups.core.exceptions.GroupsException; import us.kbase.groups.core.exceptions.IllegalParameterException; import us.kbase.groups.core.exceptions.NoSuchCustomFieldException; @@ -55,8 +54,9 @@ import us.kbase.test.groups.StandaloneGroupsServer; import us.kbase.test.groups.StandaloneGroupsServer.ServerThread; import us.kbase.test.groups.TestCommon; -import us.kbase.test.groups.controllers.workspace.WorkspaceController; import us.kbase.test.groups.service.api.RootTest; +import us.kbase.test.workspace.controllers.workspace.WorkspaceController; +import us.kbase.testutils.RegexMatcher; import us.kbase.workspace.WorkspaceClient; public class ServiceIntegrationTest { @@ -110,7 +110,6 @@ public static void beforeClass() throws Exception { // set up auth AUTH = new AuthController( - TestCommon.getJarsDir(), "localhost:" + MANAGER.mongo.getServerPort(), "GroupsServiceIntgrationTestAuth", TEMP_DIR); @@ -123,11 +122,11 @@ public static void beforeClass() throws Exception { // set up Workspace WS = new WorkspaceController( - TestCommon.getJarsDir(), "localhost:" + MANAGER.mongo.getServerPort(), "GroupsServiceIntegTestWSDB", + "GroupsServiceIntegTestWSDB_types", "user2", - authURL, + new URL(authURL.toString() + "/"), TEMP_DIR); WSDB = MANAGER.mc.getDatabase("GroupsServiceIntegTestWSDB"); diff --git a/src/us/kbase/test/groups/notifications/KafkaFeedsNotifierFactoryTest.java b/src/test/java/us/kbase/test/groups/notifications/KafkaFeedsNotifierFactoryTest.java similarity index 100% rename from src/us/kbase/test/groups/notifications/KafkaFeedsNotifierFactoryTest.java rename to src/test/java/us/kbase/test/groups/notifications/KafkaFeedsNotifierFactoryTest.java diff --git a/src/us/kbase/test/groups/service/LoggingFilterTest.java b/src/test/java/us/kbase/test/groups/service/LoggingFilterTest.java similarity index 100% rename from src/us/kbase/test/groups/service/LoggingFilterTest.java rename to src/test/java/us/kbase/test/groups/service/LoggingFilterTest.java diff --git a/src/us/kbase/test/groups/service/api/APICommonTest.java b/src/test/java/us/kbase/test/groups/service/api/APICommonTest.java similarity index 100% rename from src/us/kbase/test/groups/service/api/APICommonTest.java rename to src/test/java/us/kbase/test/groups/service/api/APICommonTest.java diff --git a/src/us/kbase/test/groups/service/api/GroupsAPITest.java b/src/test/java/us/kbase/test/groups/service/api/GroupsAPITest.java similarity index 100% rename from src/us/kbase/test/groups/service/api/GroupsAPITest.java rename to src/test/java/us/kbase/test/groups/service/api/GroupsAPITest.java diff --git a/src/us/kbase/test/groups/service/api/IncomingJSONTest.java b/src/test/java/us/kbase/test/groups/service/api/IncomingJSONTest.java similarity index 100% rename from src/us/kbase/test/groups/service/api/IncomingJSONTest.java rename to src/test/java/us/kbase/test/groups/service/api/IncomingJSONTest.java diff --git a/src/us/kbase/test/groups/service/api/MemberAPITest.java b/src/test/java/us/kbase/test/groups/service/api/MemberAPITest.java similarity index 100% rename from src/us/kbase/test/groups/service/api/MemberAPITest.java rename to src/test/java/us/kbase/test/groups/service/api/MemberAPITest.java diff --git a/src/us/kbase/test/groups/service/api/NamesAPITest.java b/src/test/java/us/kbase/test/groups/service/api/NamesAPITest.java similarity index 100% rename from src/us/kbase/test/groups/service/api/NamesAPITest.java rename to src/test/java/us/kbase/test/groups/service/api/NamesAPITest.java diff --git a/src/us/kbase/test/groups/service/api/RequestAPITest.java b/src/test/java/us/kbase/test/groups/service/api/RequestAPITest.java similarity index 100% rename from src/us/kbase/test/groups/service/api/RequestAPITest.java rename to src/test/java/us/kbase/test/groups/service/api/RequestAPITest.java diff --git a/src/us/kbase/test/groups/service/api/RootTest.java b/src/test/java/us/kbase/test/groups/service/api/RootTest.java similarity index 96% rename from src/us/kbase/test/groups/service/api/RootTest.java rename to src/test/java/us/kbase/test/groups/service/api/RootTest.java index 7414cf61..f5d9aa04 100644 --- a/src/us/kbase/test/groups/service/api/RootTest.java +++ b/src/test/java/us/kbase/test/groups/service/api/RootTest.java @@ -17,7 +17,7 @@ public class RootTest { - public static final String SERVER_VER = "0.1.6"; + public static final String SERVER_VER = "0.1.7"; private static final String GIT_ERR = "Missing git commit file gitcommit, should be in us.kbase.groups"; diff --git a/src/us/kbase/test/groups/service/exceptions/ErrorMessageTest.java b/src/test/java/us/kbase/test/groups/service/exceptions/ErrorMessageTest.java similarity index 100% rename from src/us/kbase/test/groups/service/exceptions/ErrorMessageTest.java rename to src/test/java/us/kbase/test/groups/service/exceptions/ErrorMessageTest.java diff --git a/src/us/kbase/test/groups/service/exceptions/ExceptionHandlerTest.java b/src/test/java/us/kbase/test/groups/service/exceptions/ExceptionHandlerTest.java similarity index 100% rename from src/us/kbase/test/groups/service/exceptions/ExceptionHandlerTest.java rename to src/test/java/us/kbase/test/groups/service/exceptions/ExceptionHandlerTest.java diff --git a/src/us/kbase/test/groups/storage/mongo/MongoGroupsStorageDuplicateKeyCheckerTest.java b/src/test/java/us/kbase/test/groups/storage/mongo/MongoGroupsStorageDuplicateKeyCheckerTest.java similarity index 97% rename from src/us/kbase/test/groups/storage/mongo/MongoGroupsStorageDuplicateKeyCheckerTest.java rename to src/test/java/us/kbase/test/groups/storage/mongo/MongoGroupsStorageDuplicateKeyCheckerTest.java index 54594c80..6b1c2c48 100644 --- a/src/us/kbase/test/groups/storage/mongo/MongoGroupsStorageDuplicateKeyCheckerTest.java +++ b/src/test/java/us/kbase/test/groups/storage/mongo/MongoGroupsStorageDuplicateKeyCheckerTest.java @@ -131,7 +131,9 @@ public void unparseable() throws Exception { fail("expected exception"); } catch (InvocationTargetException ex) { TestCommon.assertExceptionCorrect((Exception) ex.getTargetException(), - new GroupsStorageException("Unable to parse duplicate key error: some ")); + new GroupsStorageException("Unable to parse duplicate key error: " + + "Write operation error on server 127.0.0.1:27017. " + + "Write error: WriteError{code=11000, message='some ")); } } diff --git a/src/us/kbase/test/groups/storage/mongo/MongoGroupsStorageOpsTest.java b/src/test/java/us/kbase/test/groups/storage/mongo/MongoGroupsStorageOpsTest.java similarity index 100% rename from src/us/kbase/test/groups/storage/mongo/MongoGroupsStorageOpsTest.java rename to src/test/java/us/kbase/test/groups/storage/mongo/MongoGroupsStorageOpsTest.java diff --git a/src/us/kbase/test/groups/storage/mongo/MongoGroupsStorageStartupTest.java b/src/test/java/us/kbase/test/groups/storage/mongo/MongoGroupsStorageStartupTest.java similarity index 84% rename from src/us/kbase/test/groups/storage/mongo/MongoGroupsStorageStartupTest.java rename to src/test/java/us/kbase/test/groups/storage/mongo/MongoGroupsStorageStartupTest.java index bee6fb9c..536c7f35 100644 --- a/src/us/kbase/test/groups/storage/mongo/MongoGroupsStorageStartupTest.java +++ b/src/test/java/us/kbase/test/groups/storage/mongo/MongoGroupsStorageStartupTest.java @@ -107,9 +107,10 @@ public void startUpWith2ConfigDocs() throws Exception { final Pattern errorPattern = Pattern.compile( "Failed to create index: Write failed with error code 11000 and error message " + - "'(exception: )?E11000 duplicate key error (index|collection): " + + "'(exception: )?(.*)E11000 duplicate key error (index|collection): " + "startUpWith2ConfigDocs.config( index: |\\.\\$)schema_1\\s+dup key: " + - "\\{ : \"schema\" \\}'"); + "(\\{ schema: \"schema\" \\}'|\\{ : \"schema\" \\}')"); + try { new MongoGroupsStorage(db, set()); fail("started mongo with bad config"); @@ -188,27 +189,21 @@ public void checkCollectionNames() throws Exception { @Test public void indexesConfig() { - final Set indexes = new HashSet<>(); - manager.db.getCollection("config").listIndexes() - .forEach((Consumer) indexes::add); + final Set indexes = getAndNormalizeIndexes("config"); assertThat("incorrect indexes", indexes, is(set( new Document("v", manager.indexVer) .append("unique", true) .append("key", new Document("schema", 1)) - .append("name", "schema_1") - .append("ns", "test_mongogroupsstorage.config"), + .append("name", "schema_1"), new Document("v", manager.indexVer) .append("key", new Document("_id", 1)) .append("name", "_id_") - .append("ns", "test_mongogroupsstorage.config") ))); } @Test public void indexesGroups() { - final Set indexes = new HashSet<>(); - manager.db.getCollection("groups").listIndexes() - .forEach((Consumer) indexes::add); + final Set indexes = getAndNormalizeIndexes("groups"); assertThat("incorrect indexes", indexes, is(getDefaultGroupsIndexes())); } @@ -218,28 +213,22 @@ private Set getDefaultGroupsIndexes() { new Document("v", manager.indexVer) .append("unique", true) .append("key", new Document("id", 1)) - .append("name", "id_1") - .append("ns", col), + .append("name", "id_1"), new Document("v", manager.indexVer) .append("key", new Document("own", 1).append("id", 1)) - .append("name", "own_1_id_1") - .append("ns", col), + .append("name", "own_1_id_1"), new Document("v", manager.indexVer) .append("key", new Document("admin", 1).append("id", 1)) - .append("name", "admin_1_id_1") - .append("ns", col), + .append("name", "admin_1_id_1"), new Document("v", manager.indexVer) .append("key", new Document("_id", 1)) - .append("name", "_id_") - .append("ns", col), + .append("name", "_id_"), new Document("v", manager.indexVer) .append("key", new Document("priv", 1).append("id", 1)) - .append("name", "priv_1_id_1") - .append("ns", col), + .append("name", "priv_1_id_1"), new Document("v", manager.indexVer) .append("key", new Document("memb.user", 1).append("id", 1)) .append("name", "memb.user_1_id_1") - .append("ns", col) ); } @@ -250,10 +239,8 @@ public void indexesGroupsWithResourceTypes() throws Exception { try { new MongoGroupsStorage( manager.db, Arrays.asList(new ResourceType("t1"), new ResourceType("t2"))); - final Set indexes = new HashSet<>(); - manager.db.getCollection("groups").listIndexes() - .forEach((Consumer) indexes::add); - + final Set indexes = getAndNormalizeIndexes("groups"); + final String col = "test_mongogroupsstorage.groups"; final Set expected = getDefaultGroupsIndexes(); for (final String t: set("t1", "t2")) { @@ -263,19 +250,16 @@ public void indexesGroupsWithResourceTypes() throws Exception { .append("key", new Document(resKey, 1) .append("own", 1) .append("id", 1)) - .append("name", resKey + "_1_own_1_id_1") - .append("ns", col), + .append("name", resKey + "_1_own_1_id_1"), new Document("v", manager.indexVer) .append("key", new Document(resKey, 1) .append("id", 1)) - .append("name", resKey + "_1_id_1") - .append("ns", col), + .append("name", resKey + "_1_id_1"), new Document("v", manager.indexVer) .append("key", new Document(resKey, 1) .append("priv", 1) .append("id", 1)) .append("name", resKey + "_1_priv_1_id_1") - .append("ns", col) )); } assertThat("incorrect indexes", indexes, is(expected)); @@ -287,75 +271,63 @@ public void indexesGroupsWithResourceTypes() throws Exception { @Test public void indexesRequests() { - final Set indexes = new HashSet<>(); - manager.db.getCollection("requests").listIndexes() - .forEach((Consumer) indexes::add); + final Set indexes = getAndNormalizeIndexes("requests"); final String col = "test_mongogroupsstorage.requests"; assertThat("incorrect indexes", indexes, is(set( new Document("v", manager.indexVer) .append("unique", true) .append("key", new Document("id", 1)) - .append("name", "id_1") - .append("ns", col), + .append("name", "id_1"), new Document("v", manager.indexVer) .append("key", new Document("gid", 1).append("type", 1).append("mod", 1)) - .append("name", "gid_1_type_1_mod_1") - .append("ns", col), + .append("name", "gid_1_type_1_mod_1"), new Document("v", manager.indexVer) .append("key", new Document("gid", 1) .append("status", 1) .append("type", 1) .append("mod", 1)) - .append("name", "gid_1_status_1_type_1_mod_1") - .append("ns", col), + .append("name", "gid_1_status_1_type_1_mod_1"), new Document("v", manager.indexVer) .append("key", new Document("requester", 1).append("mod", 1)) - .append("name", "requester_1_mod_1") - .append("ns", col), + .append("name", "requester_1_mod_1"), new Document("v", manager.indexVer) .append("key", new Document("requester", 1) .append("status", 1) .append("mod", 1)) - .append("name", "requester_1_status_1_mod_1") - .append("ns", col), + .append("name", "requester_1_status_1_mod_1"), new Document("v", manager.indexVer) .append("key", new Document("resaid", 1) .append("restype", 1) .append("type", 1) .append("mod", 1)) - .append("name", "resaid_1_restype_1_type_1_mod_1") - .append("ns", col), + .append("name", "resaid_1_restype_1_type_1_mod_1"), new Document("v", manager.indexVer) .append("key", new Document("resaid", 1) .append("restype", 1) .append("status", 1) .append("type", 1) .append("mod", 1)) - .append("name", "resaid_1_restype_1_status_1_type_1_mod_1") - .append("ns", col), + .append("name", "resaid_1_restype_1_status_1_type_1_mod_1"), new Document("v", manager.indexVer) .append("key", new Document("resrid", 1) .append("restype", 1) .append("type", 1) .append("mod", 1)) - .append("name", "resrid_1_restype_1_type_1_mod_1") - .append("ns", col), + .append("name", "resrid_1_restype_1_type_1_mod_1"), new Document("v", manager.indexVer) .append("key", new Document("resrid", 1) .append("restype", 1) .append("status", 1) .append("type", 1) .append("mod", 1)) - .append("name", "resrid_1_restype_1_status_1_type_1_mod_1") - .append("ns", col), + .append("name", "resrid_1_restype_1_status_1_type_1_mod_1"), new Document("v", manager.indexVer) .append("key", new Document("resrid", 1) .append("requester", 1) .append("restype", 1) .append("type", 1) .append("mod", 1)) - .append("name", "resrid_1_requester_1_restype_1_type_1_mod_1") - .append("ns", col), + .append("name", "resrid_1_requester_1_restype_1_type_1_mod_1"), new Document("v", manager.indexVer) .append("key", new Document("resrid", 1) .append("requester", 1) @@ -363,16 +335,14 @@ public void indexesRequests() { .append("status", 1) .append("type", 1) .append("mod", 1)) - .append("name", "resrid_1_requester_1_restype_1_status_1_type_1_mod_1") - .append("ns", col), + .append("name", "resrid_1_requester_1_restype_1_status_1_type_1_mod_1"), new Document("v", manager.indexVer) .append("key", new Document("resrid", 1) .append("gid", 1) .append("restype", 1) .append("type", 1) .append("mod", 1)) - .append("name", "resrid_1_gid_1_restype_1_type_1_mod_1") - .append("ns", col), + .append("name", "resrid_1_gid_1_restype_1_type_1_mod_1"), new Document("v", manager.indexVer) .append("key", new Document("resrid", 1) .append("gid", 1) @@ -380,23 +350,34 @@ public void indexesRequests() { .append("status", 1) .append("type", 1) .append("mod", 1)) - .append("name", "resrid_1_gid_1_restype_1_status_1_type_1_mod_1") - .append("ns", col), + .append("name", "resrid_1_gid_1_restype_1_status_1_type_1_mod_1"), new Document("v", manager.indexVer) .append("key", new Document("expire", 1)) - .append("name", "expire_1") - .append("ns", col), + .append("name", "expire_1"), new Document("v", manager.indexVer) .append("unique", true) .append("sparse", true) .append("key", new Document("charstr", 1)) - .append("name", "charstr_1") - .append("ns", col), + .append("name", "charstr_1"), new Document("v", manager.indexVer) .append("key", new Document("_id", 1)) .append("name", "_id_") - .append("ns", col) ))); } + + private Set getAndNormalizeIndexes(final String collectionName) { + final Set indexes = new HashSet<>(); + for (Document index: manager.db.getCollection(collectionName).listIndexes()) { + // In MongoDB 4.4, the listIndexes and the mongo shell helper method db.collection.getIndexes() + // no longer returns the namespace ns field in the index specification documents. + index.remove("ns"); + // some versions of Mongo return ints, some longs. Convert all to longs. + if (index.containsKey("expireAfterSeconds")) { + index.put("expireAfterSeconds", ((Number) index.get("expireAfterSeconds")).longValue()); + } + indexes.add(index); + } + return indexes; + } } diff --git a/src/test/java/us/kbase/test/groups/userhandler/KBaseUserHandlerTest.java b/src/test/java/us/kbase/test/groups/userhandler/KBaseUserHandlerTest.java new file mode 100644 index 00000000..2634548a --- /dev/null +++ b/src/test/java/us/kbase/test/groups/userhandler/KBaseUserHandlerTest.java @@ -0,0 +1,148 @@ +package us.kbase.test.groups.userhandler; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; + +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.UUID; + +import org.apache.commons.io.FileUtils; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import us.kbase.groups.core.Token; +import us.kbase.groups.core.UserName; +import us.kbase.groups.core.exceptions.AuthenticationException; +import us.kbase.groups.core.exceptions.ErrorType; +import us.kbase.groups.core.exceptions.InvalidTokenException; +import us.kbase.groups.userhandler.KBaseUserHandler; +import us.kbase.test.auth2.authcontroller.AuthController; +import us.kbase.test.groups.TestCommon; +import us.kbase.testutils.controllers.mongo.MongoController; + +public class KBaseUserHandlerTest { + + private static MongoController MONGO; + private static AuthController AUTH = null; + private static URL AUTHURL = null; + private static Path TEMP_DIR = null; + + private static String TOKEN1 = null; + private static String TOKEN2 = null; + + @BeforeClass + public static void beforeClass() throws Exception { + TestCommon.stfuLoggers(); + TEMP_DIR = TestCommon.getTempDir().resolve(KBaseUserHandlerTest.class.getSimpleName() + + UUID.randomUUID().toString()); + Files.createDirectories(TEMP_DIR); + + MONGO = new MongoController( + TestCommon.getMongoExe().toString(), + TEMP_DIR, + TestCommon.useWiredTigerEngine()); + + AUTH = new AuthController( + "localhost:" + MONGO.getServerPort(), + KBaseUserHandlerTest.class.getSimpleName() + "_test", + TEMP_DIR); + AUTHURL = new URL("http://localhost:" + AUTH.getServerPort() + "/testmode"); + System.out.println("started auth server at " + AUTHURL); + TestCommon.createAuthUser(AUTHURL, "user1", "display1"); + TOKEN1 = TestCommon.createLoginToken(AUTHURL, "user1"); + TestCommon.createAuthUser(AUTHURL, "user2", "display2"); + TOKEN2 = TestCommon.createLoginToken(AUTHURL, "user2"); + } + + @AfterClass + public static void afterClass() throws Exception { + final boolean deleteTempFiles = TestCommon.isDeleteTempFiles(); + if (AUTH != null) { + AUTH.destroy(deleteTempFiles); + } + if (MONGO != null) { + MONGO.destroy(deleteTempFiles); + } + if (TEMP_DIR != null && Files.exists(TEMP_DIR) && deleteTempFiles) { + FileUtils.deleteQuietly(TEMP_DIR.toFile()); + } + } + + @Test + public void getUser() throws Exception { + final KBaseUserHandler kuh = new KBaseUserHandler(AUTHURL, new Token(TOKEN2)); + + final UserName user = kuh.getUser(new Token(TOKEN1)); + assertThat("incorrect username", user, is(new UserName("user1"))); + } + + @Test + public void isValidUser() throws Exception { + final KBaseUserHandler kuh = new KBaseUserHandler(AUTHURL, new Token(TOKEN2)); + + assertThat("incorrect user valid", kuh.isValidUser(new UserName("user1")), is(true)); + assertThat("incorrect user valid", kuh.isValidUser(new UserName("user3")), is(false)); + } + + @Test + public void constructFailNulls() throws Exception { + failConstruct(null, new Token("t"), new NullPointerException("rootAuthURL")); + failConstruct(AUTHURL, null, new NullPointerException("serviceToken")); + } + + @Test + public void constructFailBadArgs() throws Exception { + failConstruct(new URL(AUTHURL.toString() + "/foo"), new Token(TOKEN1), + new AuthenticationException( + ErrorType.AUTHENTICATION_FAILED, + "Failed to contact the auth service: Auth service returned an error: " + + "HTTP 404 Not Found")); + failConstruct(AUTHURL, new Token("fake"), new InvalidTokenException( + "Auth service returned an error: 10020 Invalid token")); + } + + private void failConstruct(final URL url, final Token token, final Exception expected) { + try { + new KBaseUserHandler(url, token); + fail("expected exception"); + } catch (Exception got) { + TestCommon.assertExceptionCorrect(got, expected); + } + } + + @Test + public void getUserFail() throws Exception { + final KBaseUserHandler kuh = new KBaseUserHandler(AUTHURL, new Token(TOKEN2)); + + failGetUser(kuh, null, new NullPointerException("token")); + failGetUser(kuh, new Token("fake"), new InvalidTokenException( + "Auth service returned an error: 10020 Invalid token")); + } + + private void failGetUser( + final KBaseUserHandler kuh, + final Token token, + final Exception expected) { + try { + kuh.getUser(token); + fail("expected exception"); + } catch (Exception got) { + TestCommon.assertExceptionCorrect(got, expected); + } + } + + @Test + public void isValidUserFail() throws Exception { + final KBaseUserHandler kuh = new KBaseUserHandler(AUTHURL, new Token(TOKEN2)); + try { + kuh.isValidUser(null); + fail("expected exception"); + } catch (Exception got) { + TestCommon.assertExceptionCorrect(got, new NullPointerException("userName")); + } + } +} diff --git a/src/us/kbase/test/groups/util/FailOnInstantiation.java b/src/test/java/us/kbase/test/groups/util/FailOnInstantiation.java similarity index 100% rename from src/us/kbase/test/groups/util/FailOnInstantiation.java rename to src/test/java/us/kbase/test/groups/util/FailOnInstantiation.java diff --git a/src/us/kbase/test/groups/util/FailOnInstantiationNoNullaryConstructor.java b/src/test/java/us/kbase/test/groups/util/FailOnInstantiationNoNullaryConstructor.java similarity index 100% rename from src/us/kbase/test/groups/util/FailOnInstantiationNoNullaryConstructor.java rename to src/test/java/us/kbase/test/groups/util/FailOnInstantiationNoNullaryConstructor.java diff --git a/src/us/kbase/test/groups/util/FailOnInstantiationPrivateConstructor.java b/src/test/java/us/kbase/test/groups/util/FailOnInstantiationPrivateConstructor.java similarity index 100% rename from src/us/kbase/test/groups/util/FailOnInstantiationPrivateConstructor.java rename to src/test/java/us/kbase/test/groups/util/FailOnInstantiationPrivateConstructor.java diff --git a/src/us/kbase/test/groups/util/UtilTest.java b/src/test/java/us/kbase/test/groups/util/UtilTest.java similarity index 91% rename from src/us/kbase/test/groups/util/UtilTest.java rename to src/test/java/us/kbase/test/groups/util/UtilTest.java index be39ca18..f7d69178 100644 --- a/src/us/kbase/test/groups/util/UtilTest.java +++ b/src/test/java/us/kbase/test/groups/util/UtilTest.java @@ -1,6 +1,8 @@ package us.kbase.test.groups.util; import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.CoreMatchers.startsWith; +import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; @@ -229,13 +231,23 @@ FieldValidatorFactory.class, new GroupsConfigurationException( @Test public void loadClassWithInterfaceFailPrivateConstructor() throws Exception { - failLoadClassWithInterface(FailOnInstantiationPrivateConstructor.class.getName(), - FieldValidatorFactory.class, new GroupsConfigurationException( - "Module us.kbase.test.groups.util.FailOnInstantiation" + - "PrivateConstructor could not be instantiated: Class us.kbase.groups." + - "util.Util can not access a member of class us." + - "kbase.test.groups.util.FailOnInstantiationPrivateConstructor " + - "with modifiers \"private\"")); + try { + Util.loadClassWithInterface( + FailOnInstantiationPrivateConstructor.class.getName(), + FieldValidatorFactory.class); + fail("expected exception"); + } catch (GroupsConfigurationException got) { + assertThat("incorrect exception message", got.getMessage(), startsWith( + "Module us.kbase.test.groups.util.FailOnInstantiation" + + "PrivateConstructor could not be instantiated: " + )); + // trivial text changes from java 8 -> 11 + assertThat("incorrect exception message", got.getMessage(), endsWith( + "not access a member of class us." + + "kbase.test.groups.util.FailOnInstantiationPrivateConstructor " + + "with modifiers \"private\"" + )); + } } private void failLoadClassWithInterface( diff --git a/src/us/kbase/test/groups/workspacehandler/SDKClientWorkspaceHandlerTest.java b/src/test/java/us/kbase/test/groups/workspacehandler/SDKClientWorkspaceHandlerTest.java similarity index 100% rename from src/us/kbase/test/groups/workspacehandler/SDKClientWorkspaceHandlerTest.java rename to src/test/java/us/kbase/test/groups/workspacehandler/SDKClientWorkspaceHandlerTest.java diff --git a/src/us/kbase/test/groups/workspacehandler/WorkspacePermissionTest.java b/src/test/java/us/kbase/test/groups/workspacehandler/WorkspacePermissionTest.java similarity index 100% rename from src/us/kbase/test/groups/workspacehandler/WorkspacePermissionTest.java rename to src/test/java/us/kbase/test/groups/workspacehandler/WorkspacePermissionTest.java diff --git a/src/us/kbase/test/groups/controllers/workspace/WorkspaceController.java b/src/us/kbase/test/groups/controllers/workspace/WorkspaceController.java deleted file mode 100644 index 9e7c22e7..00000000 --- a/src/us/kbase/test/groups/controllers/workspace/WorkspaceController.java +++ /dev/null @@ -1,176 +0,0 @@ -package us.kbase.test.groups.controllers.workspace; - -import static us.kbase.common.test.controllers.ControllerCommon.findFreePort; -import static us.kbase.common.test.controllers.ControllerCommon.makeTempDirs; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Scanner; - -import org.apache.commons.io.FileUtils; -import org.bson.Document; -import org.ini4j.Ini; -import org.ini4j.Profile.Section; - -import com.mongodb.MongoClient; -import com.mongodb.client.MongoDatabase; - -import us.kbase.common.test.TestException; - - -/** Q&D Utility to run a Workspace server for the purposes of testing from - * Java. Ideally this'll be swapped out for a Docker container that runs automatically with - * kb-sdk test at some point. - * - * Initializes a GridFS backend and does not support handles. - * @author gaprice@lbl.gov - * - */ -public class WorkspaceController { - //TODO CODE move to workspace repo, follow auth controller pattern. Need some way of handling event listener configuration - - private final static String DATA_DIR = "temp_data"; - private static final String WS_CLASS = "us.kbase.workspace.WorkspaceServer"; - - private static final String JARS_FILE = "wsjars"; - - private final static List tempDirectories = new LinkedList(); - static { - tempDirectories.add(DATA_DIR); - } - - private final Path tempDir; - - private final Process workspace; - private final int port; - - public WorkspaceController( - final Path jarsDir, - final String mongoHost, - final String mongoDatabase, - final String adminUser, - final URL authServiceRootURL, - final Path rootTempDir) - throws Exception { - final String classpath = getClassPath(jarsDir); - tempDir = makeTempDirs(rootTempDir, "WorkspaceController-", tempDirectories); - port = findFreePort(); - final Path deployCfg = createDeployCfg( - mongoHost, mongoDatabase, authServiceRootURL, adminUser); - - try (final MongoClient mc = new MongoClient(mongoHost)) { - final MongoDatabase db = mc.getDatabase(mongoDatabase); - db.getCollection("settings").insertOne( - new Document("type_db", "WorkspaceController_types") - .append("backend", "gridFS")); - } - - final List command = new LinkedList(); - command.addAll(Arrays.asList("java", "-classpath", classpath, WS_CLASS, "" + port)); - final ProcessBuilder servpb = new ProcessBuilder(command) - .redirectErrorStream(true) - .redirectOutput(tempDir.resolve("workspace.log").toFile()); - - final Map env = servpb.environment(); - env.put("KB_DEPLOYMENT_CONFIG", deployCfg.toString()); - - workspace = servpb.start(); - Thread.sleep(5000); //wait for server to start up - } - - private Path createDeployCfg( - final String mongoHost, - final String mongoDatabase, - final URL authRootURL, - final String adminUser) - throws IOException { - final File iniFile = new File(tempDir.resolve("test.cfg").toString()); - System.out.println("Created temporary workspace config file: " + - iniFile.getAbsolutePath()); - final Ini ini = new Ini(); - Section ws = ini.add("Workspace"); - ws.add("mongodb-host", mongoHost); - ws.add("mongodb-database", mongoDatabase); - ws.add("auth-service-url", authRootURL.toString() + "/api/legacy/KBase"); - ws.add("auth-service-url-allow-insecure", "true"); - ws.add("globus-url", authRootURL.toString() + "/api/legacy/globus"); - ws.add("ws-admin", adminUser); - ws.add("temp-dir", tempDir.resolve("temp_data")); - ws.add("ignore-handle-service", "true"); - // search listener config - ini.store(iniFile); - return iniFile.toPath(); - } - - private String getClassPath(final Path jarsDir) - throws IOException { - final InputStream is = getClass().getResourceAsStream(JARS_FILE); - if (is == null) { - throw new TestException("No workspace versions file " + JARS_FILE); - } - final List classpath = new LinkedList<>(); - try (final Reader r = new InputStreamReader(is)) { - final BufferedReader br = new BufferedReader(r); - String line; - while ((line = br.readLine()) != null) { - if (!line.trim().isEmpty()) { - final Path jarPath = jarsDir.resolve(line); - if (Files.notExists(jarPath)) { - throw new TestException("Required jar does not exist: " + jarPath); - } - classpath.add(jarPath.toString()); - } - } - } - return String.join(":", classpath); - } - - public int getServerPort() { - return port; - } - - public Path getTempDir() { - return tempDir; - } - - public void destroy(boolean deleteTempFiles) throws IOException { - if (workspace != null) { - workspace.destroy(); - } - if (tempDir != null && deleteTempFiles) { - FileUtils.deleteDirectory(tempDir.toFile()); - } - } - - public static void main(String[] args) throws Exception { - WorkspaceController ac = new WorkspaceController( - Paths.get("/home/crusherofheads/localgit/jars"), - "localhost:27017", - "WSController", - "workspaceadmin", - new URL("https://ci.kbase.us/services/auth"), - Paths.get("workspacetesttemp")); - System.out.println(ac.getServerPort()); - System.out.println(ac.getTempDir()); - Scanner reader = new Scanner(System.in); - System.out.println("any char to shut down"); - //get user input for a - reader.next(); - ac.destroy(false); - reader.close(); - } - -} - diff --git a/src/us/kbase/test/groups/controllers/workspace/wsjars b/src/us/kbase/test/groups/controllers/workspace/wsjars deleted file mode 100644 index 317b088b..00000000 --- a/src/us/kbase/test/groups/controllers/workspace/wsjars +++ /dev/null @@ -1,37 +0,0 @@ -kbase/workspace/WorkspaceService-0.8.2.jar - -kbase/common/kbase-common-0.0.24.jar -ini4j/ini4j-0.5.2.jar -jetty/jetty-all-7.0.0.jar -jna/jna-3.4.0.jar -servlet/servlet-api-2.5.jar -syslog4j/syslog4j-0.9.46.jar -joda/joda-time-2.2.jar - -junit/junit-4.12.jar -hamcrest/hamcrest-core-1.3.jar -kbase/auth/kbase-auth-0.4.4.jar -jackson/jackson-annotations-2.2.3.jar -jackson/jackson-core-2.2.3.jar -jackson/jackson-databind-2.2.3.jar - -kbase/shock/shock-client-0.0.14.jar -apache_commons/commons-logging-1.1.1.jar -apache_commons/http/httpclient-4.3.1.jar -apache_commons/http/httpcore-4.3.jar -apache_commons/http/httpmime-4.3.1.jar - -kbase/kidl/kbase-kidl-parser-1409261812-7863aef.jar -apache_commons/commons-codec-1.8.jar -apache_commons/commons-io-2.4.jar -apache_commons/commons-lang3-3.1.jar -mongo/mongo-java-driver-2.13.3.jar -jongo/jongo-0.5-early-20130912-1506.jar -bson4jackson/bson4jackson-2.2.0-2.2.0.jar -slf4j/slf4j-api-1.7.7.jar -logback/logback-core-1.1.2.jar -logback/logback-classic-1.1.2.jar -google/guava-14.0.1.jar -kbase/handle/HandleServiceClient-160803-b9de699.jar -kbase/handle/HandleManagerClient-160803-08c8da3.jar - diff --git a/test.cfg.example b/test.cfg.example index a39db114..2e6acd68 100644 --- a/test.cfg.example +++ b/test.cfg.example @@ -6,9 +6,6 @@ # path to the mongodb executable to use for the tests. test.mongo.exe=/path/to/mongodbexecutable -# path to the KBase jars directory, e.g. [path to parent folder]/jars/lib/jars -test.jars.dir=/path/to/jars/dir - # true to use wired tiger, anything else for false. test.mongo.wired_tiger=false