diff --git a/.all-contributorsrc b/.all-contributorsrc index 0fcd57dd293..10756a01aa0 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -22,13 +22,21 @@ "avatar_url": "https://avatars1.githubusercontent.com/u/4381558?v=4", "profile": "https://github.com/mediumTaj", "contributions": [ - "review" + "code", + "design", + "bug" + ] + }, + { "login": "germanattanasio", "name": "German Attanasio", "avatar_url": "https://avatars3.githubusercontent.com/u/313157?v=4", "profile": "https://germanattanasio.com", "contributions": [ - "code" + "code", + "design", + "doc", + "test" ] } ], diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 73b3f4e35d7..dca3f55a880 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,37 +1,22 @@ [bumpversion] -current_version = 8.3.1 +current_version = 16.2.0 commit = True message = Update version numbers from {current_version} -> {new_version} - -[bumpversion:file:gradle.properties] +search = {current_version} +replace = {new_version} [bumpversion:file:README.md] [bumpversion:file:assistant/README.md] -[bumpversion:file:compare-comply/README.md] - [bumpversion:file:discovery/README.md] -[bumpversion:file:language-translator/README.md] - -[bumpversion:file:natural-language-classifier/README.md] - [bumpversion:file:natural-language-understanding/README.md] -[bumpversion:file:personality-insights/README.md] - [bumpversion:file:speech-to-text/README.md] [bumpversion:file:text-to-speech/README.md] -[bumpversion:file:tone-analyzer/README.md] - -[bumpversion:file:visual-recognition/README.md] - [bumpversion:file:docker/pom.xml] -[bumpversion:file:examples/build.gradle] -search = {current_version} -replace = {new_version} - +[bumpversion:file:.github/workflows/deploy.yml] diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index cdc9d8c65ab..4736f1db669 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -4,14 +4,15 @@ If you encounter an issue with the Java SDK, you are welcome to submit a [bug re Before that, please search for similar issues. It's possible somebody has encountered this issue already. # Building and testing -This project uses [Gradle] as the build tool (> v1.x). Here are some helpful commands: +This project uses [Maven] as the build tool (> v1.x). Here are some helpful commands: ```sh cd java-sdk -gradle jar # build jar file (build/libs/watson-developer-cloud-6.14.0.jar) -gradle test # run tests -gradle check # performs quality checks on source files and generates reports -gradle testReport # run tests and generate the aggregated test report (build/reports/allTests) -gradle codeCoverageReport # run tests and generate the code coverage report (build/reports/jacoco) +mvn clean # Delete target directory. +mvn test # Run tests +mvn package # Take the compiled code and package it in its distributable format, e.g. JAR. +mvn verify # Run any checks to verify the MVN package is valid and meets quality criteria. +mvn verify -fae -DskipITs=false # Run Integration tests to verify the MVN package is valid and meets quality criteria. +mvn install # Install the package into the local maven repository cache. ``` # Pull Requests @@ -19,8 +20,8 @@ gradle codeCoverageReport # run tests and generate the code coverage report (bui If you want to contribute to the repository, here's a quick guide: 1. Fork the repository 1. Edit the [`config.properties`](../common/src/test/resources/config.properties) file to add your service credentials to the appropriate fields. - 2. develop and test your code changes, gradle: `gradle test`. - * Run `checkstyle`: `gradle checkstyle`. 🏁 + 2. develop and test your code changes: `mvn verify -fae -DskipITs=false`. + * Run `checkstyle`: `mvn checkstyle:check`. 🏁 * Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change. * Check for unnecessary whitespace with git diff --check before committing. 3. Make the test pass diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 00000000000..5c51075c04f --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,48 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support documentation. +# This workflow will do a clean install of java dependencies, build the source code and run tests across different versions of java +# For more information see: https://docs.github.com/en/actions/guides/building-and-testing-java-with-maven + +name: Build and Test + +on: + push: + branches: [ '**' ] + pull_request: + branches: [ master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build_test: + name: Build and Test on Java ${{ matrix.java-version }} and ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + java-version: ['8'] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Java + uses: actions/setup-java@v2 + with: + java-version: ${{ matrix.java-version }} + distribution: 'adopt' + + - name: Install Java dependencies + run: curl -s https://codecov.io/bash > $HOME/codecov-bash.sh && chmod +x $HOME/codecov-bash.sh + + - name: Execute Java unit tests + env: + MVN_ARGS: '-B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' + run: mvn verify -fae -DskipITs $MVN_ARGS + + - name: Publish Java code coverage + if: github.ref == 'refs/heads/master' + env: + CC_TOK: ${{ secrets.CODECOV_TOKEN }} + run: $HOME/codecov-bash.sh -s modules/coverage-reports/target/site/jacoco-aggregate -t $CC_TOK diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000000..2568b34895b --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,122 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support documentation. +# This workflow will download a prebuilt Java version, install dependencies, build and deploy/publish a new release +# For more information see: https://docs.github.com/en/actions/guides/building-and-testing-java-with-maven + +name: Deploy and Publish + +on: + workflow_run: + workflows: ["Build and Test"] + branches: [ master ] + types: + - completed + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + deploy: + if: "!contains(github.event.head_commit.message, 'skip ci')" + name: Deploy and Publish + env: + MVN_ARGS: '-B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + token: ${{ secrets.GH_TOKEN }} + persist-credentials: true + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.8' + + - name: Set up Java + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + + - name: Build Java package + run: mvn verify -fae -DskipITs -Dskip.unit.tests $MVN_ARGS + + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: 20 + + - name: Install Semantic Release dependencies + run: | + pip3 install --user bump2version + npm install -g semantic-release + npm install -g @semantic-release/changelog + npm install -g @semantic-release/exec + npm install -g @semantic-release/git + npm install -g @semantic-release/github + npm install -g @semantic-release/commit-analyzer + npm install -g @semantic-release/release-notes-generator + + - name: Check if semantic release generated a release + id: is_new_release + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + echo "IS_NEW_RELEASE=$(npx semantic-release --dry-run | grep -c -i "Published release")" >> $GITHUB_OUTPUT + echo "The full TAG - ${{ github.ref }}" + + - name: Get the nextRelease.version from semantic release + if: ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == '1' }} + id: next_release + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: echo "NEXT_RELEASE=$(npx semantic-release --dry-run | grep -oP "Published release \K[0-9]+\.[0-9]+\.[0-9]+")" >> $GITHUB_OUTPUT + + - name: Publish to Git Releases and Tags + if: ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == '1' }} + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npx semantic-release # --dry-run --branches 9662_addcheck + + - name: Publish to Maven Central + env: + GHA_TAG: "refs/tags/v16.2.0" # for setMavenVersion_gha + CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }} # for .travis.settings.xml + CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }} + GPG_KEYNAME: ${{ secrets.SIGNING_KEY }} + GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSWORD }} + SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} # for setupSigning_gha + run: | + echo "The NEXT_RELEASE - ${{ steps.next_release.outputs.NEXT_RELEASE }}" + echo -e "\n\033[0;35mCommand: setupSigning" + build/setupSigning_gha.sh + echo -e "\n\033[0;35mCommand: setMavenVersion" + build/setMavenVersion_gha.sh + echo -e "\n\033[0;35mCommand: mvn deploy" + mvn deploy --settings build/.travis.settings.xml -DskipITs -Dskip.unit.tests -P central $MVN_ARGS + + - name: Publish Java docs + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + GHA_REPO_SLUG: ${{ github.repository }} + GHA_BRANCH: ${{ github.ref }} # non PR only need to get last part + GHA_PULL_REQUEST: ${{ github.event.number }} + GHA_BUILD_NUMBER: ${{ github.run_number }} + GHA_JOB_NUMBER: ${{ github.job_number }} + GHA_COMMIT: ${{ github.sha }} + GHA_TAG: "refs/tags/v16.2.0" # for setMavenVersion_gha + run: | + build/setMavenVersion_gha.sh + mvn clean javadoc:aggregate $MVN_ARGS + build/publish_gha.sh + + - name: SKIP - Publish/Deploy to Git and Maven Central + if: ${{ steps.is_new_release.outputs.IS_NEW_RELEASE == '0' }} + run: | + echo -e "\n\033[0;35mCommand: Skipping the deployment because semantic release has determined there are no relevant changes that warrent a new release.\n" diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml new file mode 100644 index 00000000000..426617a7ac9 --- /dev/null +++ b/.github/workflows/integration-test.yml @@ -0,0 +1,79 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support documentation. +# This workflow will download a prebuilt Java version, install dependencies and run integration tests + +name: Run Integration Tests + +on: + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + integration_test: + name: Build and Run Integration Tests on Java ${{ matrix.java-version }} and ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + java-version: ['8'] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Java + uses: actions/setup-java@v2 + with: + java-version: ${{ matrix.java-version }} + distribution: 'adopt' + + - name: Execute Java integration tests + # continue-on-error: true + env: + MVN_ARGS: '-B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' + NATURAL_LANGUAGE_UNDERSTANDING_APIKEY: ${{ secrets.NLU_APIKEY }} + NATURAL_LANGUAGE_UNDERSTANDING_URL: "https://api.us-south.natural-language-understanding.watson.cloud.ibm.com" + SPEECH_TO_TEXT_APIKEY: ${{ secrets.STT_APIKEY }} + SPEECH_TO_TEXT_URL: "https://api.us-south.speech-to-text.watson.cloud.ibm.com" + SPEECH_TO_TEXT_CUSTOM_ID: ${{ secrets.STT_APIKEY_CUSTOM_ID }} + SPEECH_TO_TEXT_ACOUSTIC_CUSTOM_ID: ${{ secrets.STT_APIKEY_ACOUSTIC_CUSTOM_ID }} + TEXT_TO_SPEECH_APIKEY: ${{ secrets.TTS_APIKEY }} + TEXT_TO_SPEECH_URL: "https://api.us-south.text-to-speech.watson.cloud.ibm.com" + ASSISTANT_APIKEY: ${{ secrets.WA_APIKEY }} + ASSISTANT_WORKSPACE_ID: ${{ secrets.WA_WORKSPACE_ID }} + ASSISTANT_ASSISTANT_ID: ${{ secrets.WA_ASSISTANT_ID }} + ASSISTANT_URL: "https://api.us-south.assistant.watson.cloud.ibm.com" + DISCOVERY_V2_APIKEY: ${{ secrets.D2_APIKEY }} + DISCOVERY_V2_PROJECT_ID: ${{ secrets.D2_PROJECT_ID }} + DISCOVERY_V2_COLLECTION_ID: ${{ secrets.D2_COLLECTION_ID }} + DISCOVERY_V2_URL: "https://api.us-south.discovery.watson.cloud.ibm.com" + run: | + mvn test -Dtest=v1/AssistantServiceIT -DfailIfNoTests=false -pl assistant,common $MVN_ARGS + mvn test -Dtest=v2/AssistantServiceIT -DfailIfNoTests=false -pl assistant,common $MVN_ARGS + mvn test -Dtest=v2/DiscoveryIT -DfailIfNoTests=false -pl discovery,common $MVN_ARGS + mvn test -Dtest=NaturalLanguageUnderstandingIT -DfailIfNoTests=false -pl natural-language-understanding,common $MVN_ARGS + mvn test -Dtest=SpeechToTextIT -DfailIfNoTests=false -pl speech-to-text,common $MVN_ARGS + mvn test -Dtest=TextToSpeechIT -DfailIfNoTests=false -pl text-to-speech,common $MVN_ARGS + mvn test -Dtest=CustomizationsIT -DfailIfNoTests=false -pl text-to-speech,common $MVN_ARGS + + # Do not notify on success. We will leave the code here just in case we decide to switch gears + - name: Notify slack on success + if: false # success() + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }} + uses: voxmedia/github-action-slack-notify-build@v1 + with: + channel: watson-e2e-tests + status: SUCCESS + color: good + + - name: Notify slack on failure + if: false # failure() + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }} + uses: voxmedia/github-action-slack-notify-build@v1 + with: + channel: watson-e2e-tests + status: FAILED + color: danger diff --git a/.gitignore b/.gitignore index c430fc4728c..220350e7b47 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,6 @@ .idea .project .settings -build out target bin/ @@ -33,4 +32,35 @@ package-lock.json .pre-commit-config.yaml .secrets.baseline *.test-metadata.txt -*.py \ No newline at end of file +*.py +fix-copyrights.sh +/.utility/secring.gpg +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +/**/target/ +/**/test-output/ +.settings/ +.factorypath +*-apiref.json + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +*.key + +/node_modules \ No newline at end of file diff --git a/.releaserc b/.releaserc index c6e99960da4..5fe2ab68c63 100644 --- a/.releaserc +++ b/.releaserc @@ -1,6 +1,7 @@ { - "branch": "master", "debug": true, + "branches": [ "master" ], + "tagFormat": "v${version}", "plugins": [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", @@ -8,25 +9,15 @@ [ "@semantic-release/exec", { - "prepareCmd": "bumpversion --current-version ${lastRelease.version} --new-version ${nextRelease.version} --verbose --allow-dirty patch" + "prepareCmd": "bump2version --allow-dirty --current-version ${lastRelease.version} --new-version ${nextRelease.version} patch" } ], [ "@semantic-release/git", { - "message": "docs(release): Add release notes for ${nextRelease.version}" + "message": "chore(release): ${nextRelease.version} release notes\n\n${nextRelease.notes}" } ], - [ - "@semantic-release/github", - { - "assets": [ - { - "path": "ibm-watson/build/libs/*.jar", - "name": "ibm-watson-${nextRelease.version}-jar-with-dependencies.jar" - } - ] - } - ] + "@semantic-release/github" ] -} +} \ No newline at end of file diff --git a/.secrets.baseline b/.secrets.baseline index 30699ff4865..63e7fc50b13 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -1,9 +1,9 @@ { "exclude": { - "files": "package-lock.json|credentials.json", + "files": "package-lock.json|credentials.json|^.secrets.baseline$", "lines": null }, - "generated_at": "2020-03-03T19:34:45Z", + "generated_at": "2024-02-26T19:16:17Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -25,9 +25,7 @@ "name": "CloudantDetector" }, { - "name": "Db2Detector" - }, - { + "ghe_instance": "github.ibm.com", "name": "GheDetector" }, { @@ -66,8 +64,57 @@ "name": "TwilioKeyDetector" } ], - "results": {}, - "version": "0.13.0+ibm.9.dss", + "results": { + "CHANGELOG.md": [ + { + "hashed_secret": "939999726d2023fca902233e45790c08081dc91b", + "is_secret": false, + "is_verified": false, + "line_number": 182, + "type": "Hex High Entropy String", + "verified_result": null + } + ], + "assistant/src/test/resources/assistant/assistant.json": [ + { + "hashed_secret": "49568690e3778497671beb117ceecc48e01cdd4c", + "is_secret": false, + "is_verified": false, + "line_number": 117, + "type": "Secret Keyword", + "verified_result": null + } + ], + "assistant/src/test/resources/assistant/message_response.json": [ + { + "hashed_secret": "d506bd5213c46bd49e16c634754ad70113408252", + "is_secret": false, + "is_verified": false, + "line_number": 165, + "type": "Secret Keyword", + "verified_result": null + } + ], + "discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java": [ + { + "hashed_secret": "e8fc807ce6fbcda13f91c5b64850173873de0cdc", + "is_secret": false, + "is_verified": false, + "line_number": 42, + "type": "Secret Keyword", + "verified_result": null + }, + { + "hashed_secret": "fdee05598fdd57ff8e9ae29e92c25a04f2c52fa6", + "is_secret": false, + "is_verified": false, + "line_number": 44, + "type": "Secret Keyword", + "verified_result": null + } + ] + }, + "version": "0.13.1+ibm.56.dss", "word_list": { "file": null, "hash": null diff --git a/.travis.yml b/.travis.yml index ffa38a0135f..02a7a19eae2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,75 +1,78 @@ +--- language: java -dist: trusty +dist: xenial os: linux + jdk: -- openjdk7 -- oraclejdk8 + - openjdk8 + +notifications: + email: true + branches: except: - - gh-pages -before_cache: -- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock -- rm -fr $HOME/.gradle/caches/*/plugin-resolution/ + - gh-pages + cache: directories: - - "$HOME/.m2" - - "$HOME/.gradle/caches/" - - "$HOME/.gradle/wrapper/" -before_install: -- | - if [ "$TRAVIS_JDK_VERSION" == "openjdk7" ]; then - sudo wget "https://bouncycastle.org/download/bcprov-ext-jdk15on-158.jar" -O "${JAVA_HOME}/jre/lib/ext/bcprov-ext-jdk15on-158.jar" - sudo perl -pi.bak -e 's/^(security\.provider\.)([0-9]+)/$1.($2+1)/ge' /etc/java-7-openjdk/security/java.security - echo "security.provider.1=org.bouncycastle.jce.provider.BouncyCastleProvider" | sudo tee -a /etc/java-7-openjdk/security/java.security - fi -- sudo apt-get update -- sudo apt-get install python -install: -- if [ "${TRAVIS_TAG}" = "${TRAVIS_BRANCH}" ]; then cd appscan; make asoc-tool; cd - ../; fi -- pip install --user bumpversion -before_script: -- if [ "${TRAVIS_TAG}" = "${TRAVIS_BRANCH}" ]; then chmod a+x ./appscan/ASOC.sh; fi -- env -- echo "TRAVIS_TAG = '${TRAVIS_TAG}'" -script: -- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] - && openssl aes-256-cbc -K $encrypted_42d9c68e608d_key -iv $encrypted_42d9c68e608d_iv -in secrets.tar.enc -out secrets.tar -d - && tar xvf secrets.tar - || true' -- if [ "${TRAVIS_TAG}" = "${TRAVIS_BRANCH}" ]; then ./appscan/ASOC.sh; fi -- "./gradlew install -x check" -- "./gradlew checkstyleMain" -- "./gradlew checkstyleTest" -- "./gradlew shadowJar" -- if [ "${TRAVIS_EVENT_TYPE}" == "push" ] && [ "${TRAVIS_BRANCH}" != "master" ] && [ "${TRAVIS_TAG}" != "${TRAVIS_BRANCH}" ]; then ./gradlew codeCoverageReport --continue; fi -- "./gradlew docs > /dev/null" -after_success: -- bash <(curl -s https://codecov.io/bash) -before_deploy: -- nvm install 12 -- npm install @semantic-release/changelog -- npm install @semantic-release/exec -- npm install @semantic-release/git -deploy: -- provider: script - skip_cleanup: true - script: npx semantic-release - on: - branch: master - jdk: openjdk7 -- provider: script - script: ".utility/push-javadoc-to-gh-pages.sh" - skip_cleanup: true - on: - repo: watson-developer-cloud/java-sdk - jdk: openjdk7 - tags: true -- provider: script - skip_cleanup: true - script: ".utility/deploy-travis-wrapper.sh" - on: - tags: true - jdk: openjdk7 -notifications: - email: true + - "$HOME/.m2" + +env: + global: + - MVN_ARGS="--settings build/.travis.settings.xml" + +stages: + - name: Build and test + - name: Semantic-Release + if: branch = master AND type = push AND fork = false + - name: Publish-Release + if: tag IS present + +jobs: + include: + - stage: Build and test + jdk: openjdk8 + language: java + install: + - curl -s https://codecov.io/bash > $HOME/codecov-bash.sh && chmod +x $HOME/codecov-bash.sh + script: + - build/setMavenVersion.sh + - mvn verify -fae -DskipITs $MVN_ARGS + after_success: + - build/publishCodeCoverage.sh + + - stage: Semantic-Release + install: + - sudo apt-get install python + - nvm install 12 + - npm install -g npm@6.x + - pip install --user bump2version + - npm install @semantic-release/changelog + - npm install @semantic-release/exec + - npm install @semantic-release/git + - npm install @semantic-release/github + script: + - npx semantic-release + after_success: + - echo "Semantic release has successfully created a new tagged-release" + + - stage: Publish-Release + jdk: openjdk8 + name: Publish-Javadoc + install: true + script: + - build/setMavenVersion.sh + - mvn clean javadoc:aggregate $MVN_ARGS + - build/publishJavadoc.sh + after_success: + - echo "Javadocs successfully published to gh-pages!" + + - jdk: openjdk8 + name: Publish-To-Maven-Central + install: true + script: + - build/setupSigning.sh + - build/setMavenVersion.sh + - mvn deploy $MVN_ARGS -DskipTests -P central + after_success: + - echo "Maven artifacts successfully published to Maven Central!" \ No newline at end of file diff --git a/.utility/bintray-properties.gradle b/.utility/bintray-properties.gradle deleted file mode 100644 index cafd26342be..00000000000 --- a/.utility/bintray-properties.gradle +++ /dev/null @@ -1,8 +0,0 @@ -ext { - packageName = PACKAGE_NAME - libraryName = NAME - artifact = ARTIFACT_ID - libraryDescription = DESCRIPTION -} - -apply from: rootProject.file('.utility/bintray-release.gradle') \ No newline at end of file diff --git a/.utility/bintray-release.gradle b/.utility/bintray-release.gradle deleted file mode 100644 index f4ef12de562..00000000000 --- a/.utility/bintray-release.gradle +++ /dev/null @@ -1,97 +0,0 @@ -apply plugin: 'com.jfrog.bintray' -apply plugin: 'com.github.johnrengelman.shadow' -apply plugin: 'java' -apply plugin: 'java-library' -apply plugin: 'maven' -apply plugin: 'maven-publish' - -bintrayUpload.dependsOn assemble -bintrayUpload.dependsOn sourcesJar -bintrayUpload.dependsOn javadocJar - -bintray { - user = System.getenv('BINTRAY_USER') - key = System.getenv('BINTRAY_APIKEY') - publications = ['maven'] - publish = true - pkg { - repo = 'ibm-cloud-sdk-repo' - name = packageName - userOrg = 'ibm-cloud-sdks' - licenses = ['Apache-2.0'] - vcsUrl = 'https://github.com/watson-developer-cloud/java-sdk.git' - version { - name = project.property('version') - vcsTag = project.property('version') - released = new Date() - gpg { - sign = true - } - mavenCentralSync { - sync = true - user = System.getenv('SONATYPE_USER') - password = System.getenv('SONATYPE_PASSWORD') //pragma: whitelist secret - } - } - } -} - -def pomConfig = { - scm { - connection 'scm:git:git@github.com:watson-developer-cloud/java-sdk.git' - developerConnection 'scm:git:git@github.com:watson-developer-cloud/java-sdk.git' - url 'https://github.com/watson-developer-cloud/java-sdk' - } - - issueManagement { - system 'GitHub' - url 'https://github.com/watson-developer-cloud/java-sdk/issues' - - } - - ciManagement { - system 'Travis CI' - url 'https://travis-ci.org/watson-developer-cloud/java-sdk' - } - - licenses { - license { - name 'The Apache License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } - - developers { - developer { - id 'german' - name 'German Attanasio' - email 'germanatt@us.ibm.com' - } - developer { - id 'logan' - name 'Logan Patino' - email 'loganpatino10@ibm.com' - } - } -} - -publishing { - publications { - maven(MavenPublication) { - from components.java - artifact sourcesJar - artifact javadocJar - artifact shadowJar - groupId 'com.ibm.watson' - artifactId artifact - version project.property('version') - pom.withXml { - def root = asNode() - root.appendNode('description', libraryDescription) - root.appendNode('name', libraryName) - root.appendNode('url', 'https://cloud.ibm.com/developer/watson/dashboard') - root.children().last() + pomConfig - } - } - } -} \ No newline at end of file diff --git a/.utility/cd/secring.gpg.enc b/.utility/cd/secring.gpg.enc deleted file mode 100644 index ab53a4058a5..00000000000 Binary files a/.utility/cd/secring.gpg.enc and /dev/null differ diff --git a/.utility/deploy-travis-wrapper.sh b/.utility/deploy-travis-wrapper.sh deleted file mode 100755 index 83070cc73ea..00000000000 --- a/.utility/deploy-travis-wrapper.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -./gradlew bintrayUpload & - -# output every 9 min to prevent a Travis timeout -PID=$! -while [[ $(ps -p $PID | tail -n +2) ]]; do - echo 'Deploying...' - sleep 540 -done diff --git a/.utility/generate-index-html.sh b/.utility/generate-index-html.sh deleted file mode 100755 index 5b896491bad..00000000000 --- a/.utility/generate-index-html.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -# based on https://odoepner.wordpress.com/2012/02/17/shell-script-to-generate-simple-index-html/ - -echo ' - -
- - - -Info - | Documentation - | GitHub - | Maven -
- -Javadoc by branch/tag:
-Logan Patino 💻 🎨 🐛 |
- Ajiemar Santiago 👀 |
- German Attanasio 💻 |
+ Ajiemar Santiago 💻 🎨 🐛 |
+ German Attanasio 💻 🎨 📖 ⚠️ |
+ Kevin Kowalski 💻 🎨 🐛 📖 ⚠️ 💬️ |
+ Jeff Arn 💻 🎨 🐛 📖 ⚠️ 💬️ |
+ Angelo Paparazzi 💻 🎨 🐛 📖 ⚠️ 💬️ 🥷🏼 |
diff --git a/assistant/README.md b/assistant/README.md
index dfe2e052a3e..457f2b4b38a 100644
--- a/assistant/README.md
+++ b/assistant/README.md
@@ -8,14 +8,14 @@
The Assistant v1 API provides authoring methods your application can use to create or update a + * workspace. * - * @version v1 - * @see Assistant + *
API Version: 1.0 See: https://cloud.ibm.com/docs/assistant */ public class Assistant extends BaseService { - private static final String DEFAULT_SERVICE_NAME = "assistant"; + /** Default service name used when configuring the `Assistant` client. */ + public static final String DEFAULT_SERVICE_NAME = "assistant"; - private static final String DEFAULT_SERVICE_URL = "https://gateway.watsonplatform.net/assistant/api"; + /** Default service endpoint URL. */ + public static final String DEFAULT_SERVICE_URL = + "https://api.us-south.assistant.watson.cloud.ibm.com"; - private String versionDate; + private String version; /** - * Constructs a new `Assistant` client using the DEFAULT_SERVICE_NAME. + * Constructs an instance of the `Assistant` client. The default service name is used to configure + * the client instance. * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. + * @param version Release date of the API version you want to use. Specify dates in YYYY-MM-DD + * format. The current version is `2021-11-27`. */ - public Assistant(String versionDate) { - this(versionDate, DEFAULT_SERVICE_NAME, ConfigBasedAuthenticatorFactory.getAuthenticator(DEFAULT_SERVICE_NAME)); + public Assistant(String version) { + this( + version, + DEFAULT_SERVICE_NAME, + ConfigBasedAuthenticatorFactory.getAuthenticator(DEFAULT_SERVICE_NAME)); } /** - * Constructs a new `Assistant` client with the DEFAULT_SERVICE_NAME - * and the specified Authenticator. + * Constructs an instance of the `Assistant` client. The default service name and specified + * authenticator are used to configure the client instance. * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param authenticator the Authenticator instance to be configured for this service + * @param version Release date of the API version you want to use. Specify dates in YYYY-MM-DD + * format. The current version is `2021-11-27`. + * @param authenticator the {@link Authenticator} instance to be configured for this client */ - public Assistant(String versionDate, Authenticator authenticator) { - this(versionDate, DEFAULT_SERVICE_NAME, authenticator); + public Assistant(String version, Authenticator authenticator) { + this(version, DEFAULT_SERVICE_NAME, authenticator); } /** - * Constructs a new `Assistant` client with the specified serviceName. + * Constructs an instance of the `Assistant` client. The specified service name is used to + * configure the client instance. * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param serviceName The name of the service to configure. + * @param version Release date of the API version you want to use. Specify dates in YYYY-MM-DD + * format. The current version is `2021-11-27`. + * @param serviceName the service name to be used when configuring the client instance */ - public Assistant(String versionDate, String serviceName) { - this(versionDate, serviceName, ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName)); + public Assistant(String version, String serviceName) { + this(version, serviceName, ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName)); } /** - * Constructs a new `Assistant` client with the specified Authenticator - * and serviceName. + * Constructs an instance of the `Assistant` client. The specified service name and authenticator + * are used to configure the client instance. * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API - * calls from failing when the service introduces breaking changes. - * @param serviceName The name of the service to configure. - * @param authenticator the Authenticator instance to be configured for this service + * @param version Release date of the API version you want to use. Specify dates in YYYY-MM-DD + * format. The current version is `2021-11-27`. + * @param serviceName the service name to be used when configuring the client instance + * @param authenticator the {@link Authenticator} instance to be configured for this client */ - public Assistant(String versionDate, String serviceName, Authenticator authenticator) { + public Assistant(String version, String serviceName, Authenticator authenticator) { super(serviceName, authenticator); setServiceUrl(DEFAULT_SERVICE_URL); - com.ibm.cloud.sdk.core.util.Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), - "version cannot be null."); - this.versionDate = versionDate; + setVersion(version); this.configureService(serviceName); } /** - * Get response to user input. + * Gets the version. + * + *
Release date of the API version you want to use. Specify dates in YYYY-MM-DD format. The + * current version is `2021-11-27`. * - * Send user input to a workspace and receive a response. + * @return the version + */ + public String getVersion() { + return this.version; + } + + /** + * Sets the version. + * + * @param version the new version + */ + public void setVersion(final String version) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(version, "version cannot be empty."); + this.version = version; + } + + /** + * Update dialog node. * - * **Important:** This method has been superseded by the new v2 runtime API. The v2 API offers significant advantages, - * including ease of deployment, automatic state management, versioning, and search capabilities. For more - * information, see the [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-api-overview). + *
Update an existing dialog node with new or modified data. * - * There is no rate limit for this operation. + *
If you want to update multiple dialog nodes with a single API call, consider using the
+ * **[Update workspace](#update-workspace)** method instead.
+ *
+ * @param UpdateDialogNodeNullableOptions the {@link UpdateDialogNodeNullableOptions} containing
+ * the options for the call
+ * @return a {@link ServiceCall} with a result of type {@link DialogNode}
+ */
+ public ServiceCall Send user input to a workspace and receive a response.
+ *
+ * **Important:** This method has been superseded by the new v2 runtime API. The v2 API offers
+ * significant advantages, including ease of deployment, automatic state management, versioning,
+ * and search capabilities. For more information, see the
+ * [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-api-overview).
*
* @param messageOptions the {@link MessageOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of {@link MessageResponse}
+ * @return a {@link ServiceCall} with a result of type {@link MessageResponse}
*/
public ServiceCall Send multiple user inputs to a workspace in a single request and receive information about
+ * the intents and entities recognized in each input. This method is useful for testing and
+ * comparing the performance of different workspaces.
*
- * This operation is limited to 500 requests per 30 minutes. For more information, see **Rate limiting**.
+ * This method is available only with Enterprise with Data Isolation plans.
*
- * @param listWorkspacesOptions the {@link ListWorkspacesOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of {@link WorkspaceCollection}
+ * @param bulkClassifyOptions the {@link BulkClassifyOptions} containing the options for the call
+ * @return a {@link ServiceCall} with a result of type {@link BulkClassifyResponse}
*/
- public ServiceCall List the workspaces associated with a Watson Assistant service instance.
*
- * This operation is limited to 500 requests per 30 minutes. For more information, see **Rate limiting**.
+ * @param listWorkspacesOptions the {@link ListWorkspacesOptions} containing the options for the
+ * call
+ * @return a {@link ServiceCall} with a result of type {@link WorkspaceCollection}
+ */
+ public ServiceCall List the workspaces associated with a Watson Assistant service instance.
*
- * @return a {@link ServiceCall} with a response type of {@link WorkspaceCollection}
+ * @return a {@link ServiceCall} with a result of type {@link WorkspaceCollection}
*/
public ServiceCall Create a workspace based on component objects. You must provide workspace components
+ * defining the content of the new workspace.
*
- * This operation is limited to 30 requests per 30 minutes. For more information, see **Rate limiting**.
+ * **Note:** The new workspace data cannot be larger than 1.5 MB. For larger requests, use the
+ * **Create workspace asynchronously** method.
*
- * @param createWorkspaceOptions the {@link CreateWorkspaceOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of {@link Workspace}
+ * @param createWorkspaceOptions the {@link CreateWorkspaceOptions} containing the options for the
+ * call
+ * @return a {@link ServiceCall} with a result of type {@link Workspace}
*/
public ServiceCall Create a workspace based on component objects. You must provide workspace components
+ * defining the content of the new workspace.
*
- * This operation is limited to 30 requests per 30 minutes. For more information, see **Rate limiting**.
+ * **Note:** The new workspace data cannot be larger than 1.5 MB. For larger requests, use the
+ * **Create workspace asynchronously** method.
*
- * @return a {@link ServiceCall} with a response type of {@link Workspace}
+ * @return a {@link ServiceCall} with a result of type {@link Workspace}
*/
public ServiceCall Get information about a workspace, optionally including all workspace content.
*
* @param getWorkspaceOptions the {@link GetWorkspaceOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of {@link Workspace}
+ * @return a {@link ServiceCall} with a result of type {@link Workspace}
*/
public ServiceCall Update an existing workspace with new or modified data. You must provide component objects
+ * defining the content of the updated workspace.
*
- * This operation is limited to 30 request per 30 minutes. For more information, see **Rate limiting**.
+ * **Note:** The new workspace data cannot be larger than 1.5 MB. For larger requests, use the
+ * **Update workspace asynchronously** method.
*
- * @param updateWorkspaceOptions the {@link UpdateWorkspaceOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of {@link Workspace}
+ * @param updateWorkspaceOptions the {@link UpdateWorkspaceOptions} containing the options for the
+ * call
+ * @return a {@link ServiceCall} with a result of type {@link Workspace}
*/
public ServiceCall Delete a workspace from the service instance.
+ *
+ * @param deleteWorkspaceOptions the {@link DeleteWorkspaceOptions} containing the options for the
+ * call
+ * @return a {@link ServiceCall} with a void result
+ */
+ public ServiceCall Create a workspace asynchronously based on component objects. You must provide workspace
+ * components defining the content of the new workspace.
+ *
+ * A successful call to this method only initiates asynchronous creation of the workspace. The
+ * new workspace is not available until processing completes. To check the status of the
+ * asynchronous operation, use the **Get information about a workspace** method.
+ *
+ * @param createWorkspaceAsyncOptions the {@link CreateWorkspaceAsyncOptions} containing the
+ * options for the call
+ * @return a {@link ServiceCall} with a result of type {@link Workspace}
+ */
+ public ServiceCall Create a workspace asynchronously based on component objects. You must provide workspace
+ * components defining the content of the new workspace.
*
- * This operation is limited to 30 requests per 30 minutes. For more information, see **Rate limiting**.
+ * A successful call to this method only initiates asynchronous creation of the workspace. The
+ * new workspace is not available until processing completes. To check the status of the
+ * asynchronous operation, use the **Get information about a workspace** method.
*
- * @param deleteWorkspaceOptions the {@link DeleteWorkspaceOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of Void
+ * @return a {@link ServiceCall} with a result of type {@link Workspace}
*/
- public ServiceCall Update an existing workspace asynchronously with new or modified data. You must provide
+ * component objects defining the content of the updated workspace.
+ *
+ * A successful call to this method only initiates an asynchronous update of the workspace. The
+ * updated workspace is not available until processing completes. To check the status of the
+ * asynchronous operation, use the **Get information about a workspace** method.
+ *
+ * @param updateWorkspaceAsyncOptions the {@link UpdateWorkspaceAsyncOptions} containing the
+ * options for the call
+ * @return a {@link ServiceCall} with a result of type {@link Workspace}
+ */
+ public ServiceCall Export the entire workspace asynchronously, including all workspace content.
+ *
+ * A successful call to this method only initiates an asynchronous export. The exported JSON
+ * data is not available until processing completes. After the initial request is submitted, you
+ * can continue to poll by calling the same request again and checking the value of the **status**
+ * property. When processing has completed, the request returns the exported JSON data. Remember
+ * that the usual rate limits apply.
+ *
+ * @param exportWorkspaceAsyncOptions the {@link ExportWorkspaceAsyncOptions} containing the
+ * options for the call
+ * @return a {@link ServiceCall} with a result of type {@link Workspace}
+ */
+ public ServiceCall List the intents for a workspace.
*
* @param listIntentsOptions the {@link ListIntentsOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of {@link IntentCollection}
+ * @return a {@link ServiceCall} with a result of type {@link IntentCollection}
*/
public ServiceCall Create a new intent.
*
- * If you want to create multiple intents with a single API call, consider using the **[Update
+ * If you want to create multiple intents with a single API call, consider using the **[Update
* workspace](#update-workspace)** method instead.
*
- * This operation is limited to 2000 requests per 30 minutes. For more information, see **Rate limiting**.
- *
* @param createIntentOptions the {@link CreateIntentOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of {@link Intent}
+ * @return a {@link ServiceCall} with a result of type {@link Intent}
*/
public ServiceCall Get information about an intent, optionally including all intent content.
*
* @param getIntentOptions the {@link GetIntentOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of {@link Intent}
+ * @return a {@link ServiceCall} with a result of type {@link Intent}
*/
public ServiceCall Update an existing intent with new or modified data. You must provide component objects
+ * defining the content of the updated intent.
*
- * If you want to update multiple intents with a single API call, consider using the **[Update
+ * If you want to update multiple intents with a single API call, consider using the **[Update
* workspace](#update-workspace)** method instead.
*
- * This operation is limited to 2000 requests per 30 minutes. For more information, see **Rate limiting**.
- *
* @param updateIntentOptions the {@link UpdateIntentOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of {@link Intent}
+ * @return a {@link ServiceCall} with a result of type {@link Intent}
*/
public ServiceCall Delete an intent from a workspace.
*
* @param deleteIntentOptions the {@link DeleteIntentOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of Void
+ * @return a {@link ServiceCall} with a void result
*/
public ServiceCall List the user input examples for an intent, optionally including contextual entity mentions.
*
* @param listExamplesOptions the {@link ListExamplesOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of {@link ExampleCollection}
+ * @return a {@link ServiceCall} with a result of type {@link ExampleCollection}
*/
public ServiceCall Add a new user input example to an intent.
*
- * This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**.
+ * If you want to add multiple examples with a single API call, consider using the **[Update
+ * intent](#update-intent)** method instead.
*
- * @param createExampleOptions the {@link CreateExampleOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of {@link Example}
+ * @param createExampleOptions the {@link CreateExampleOptions} containing the options for the
+ * call
+ * @return a {@link ServiceCall} with a result of type {@link Example}
*/
public ServiceCall Get information about a user input example.
*
* @param getExampleOptions the {@link GetExampleOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of {@link Example}
+ * @return a {@link ServiceCall} with a result of type {@link Example}
*/
public ServiceCall Update the text of a user input example.
*
- * If you want to update multiple examples with a single API call, consider using the **[Update
+ * If you want to update multiple examples with a single API call, consider using the **[Update
* intent](#update-intent)** method instead.
*
- * This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**.
- *
- * @param updateExampleOptions the {@link UpdateExampleOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of {@link Example}
+ * @param updateExampleOptions the {@link UpdateExampleOptions} containing the options for the
+ * call
+ * @return a {@link ServiceCall} with a result of type {@link Example}
*/
public ServiceCall Delete a user input example from an intent.
*
- * @param deleteExampleOptions the {@link DeleteExampleOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of Void
+ * @param deleteExampleOptions the {@link DeleteExampleOptions} containing the options for the
+ * call
+ * @return a {@link ServiceCall} with a void result
*/
public ServiceCall List the counterexamples for a workspace. Counterexamples are examples that have been marked
+ * as irrelevant input.
*
- * This operation is limited to 2500 requests per 30 minutes. For more information, see **Rate limiting**.
- *
- * @param listCounterexamplesOptions the {@link ListCounterexamplesOptions} containing the options for the call
- * @return a {@link ServiceCall} with a response type of {@link CounterexampleCollection}
+ * @param listCounterexamplesOptions the {@link ListCounterexamplesOptions} containing the options
+ * for the call
+ * @return a {@link ServiceCall} with a result of type {@link CounterexampleCollection}
*/
public ServiceCall