This is an automated email from the ASF dual-hosted git repository. xiangying pushed a commit to branch stable in repository https://gitbox.apache.org/repos/asf/pulsar-java-contrib.git
commit 5b8361a2a66e42bd930cce12d19965a9ab4d714f Author: xiangying <[email protected]> AuthorDate: Sun Aug 18 12:45:29 2024 +0800 Init github ci --- .ci/environments/common/update_quarkus.sh | 14 + .ci/environments/quarkus-branch/before.sh | 14 + .ci/environments/quarkus-lts/before.sh | 14 + .ci/environments/quarkus-main/before.sh | 14 + .ci/environments/update.sh | 14 + .ci/jenkins/dsl/jobs.groovy | 13 + .ci/jenkins/dsl/test.sh | 14 + .github/workflows/contrib-ci.yml | 48 +++ .github/workflows/full-downstream.yml | 67 ---- .github/workflows/gradle.yml | 68 ---- .github/workflows/jenkins-tests-PR.yml | 31 -- .github/workflows/nightly.yml | 57 --- .github/workflows/pr-backporting.yml | 40 -- .github/workflows/pull_request.yml | 54 --- .github/workflows/quarkus-snapshot.yml | 57 --- .../workflows/rhbop_productized_pull_request.yml | 57 --- LICENSE.txt | 14 + README.md | 3 + build/optaplanner-distribution/pom.xml | 15 + .../assembly/assembly-optaplanner-quickstarts.xml | 15 + .../src/main/assembly/resources/ReadMe.txt | 14 + .../src/main/assembly/scripts/runQuickstarts.bat | 14 + .../src/main/assembly/scripts/runQuickstarts.sh | 14 + .../src/main/assembly/sources.xml | 15 + build/quickstarts-showcase/pom.xml | 15 + .../quickstarts/all/domain/QuickstartMeta.java | 13 + .../quickstarts/all/rest/ExitResource.java | 13 + .../all/rest/QuickstartLauncherResource.java | 13 + .../src/main/resources/META-INF/resources/app.js | 13 + .../main/resources/META-INF/resources/index.html | 15 + .../src/main/resources/application.properties | 14 + .../all/rest/QuickstartLauncherResourceTest.java | 13 + build/release/upload_distribution.sh | 14 + etc/APACHE-2.txt | 11 + etc/checkstyle.xml | 217 +++++++++++ etc/findbugsExclude.xml | 133 +++++++ pom.xml | 179 ++++++++- pulsar-auth-contrib/pom.xml | 26 +- pulsar-bookkeeper-contrib/pom.xml | 25 +- pulsar-client-common-contrib/pom.xml | 44 ++- .../pulsar/client/api/MessageListenerExecutor.java | 61 ++- .../api/impl/CommonMessageListenerExecutor.java | 56 ++- .../api/impl/KeySharedMessageListenerExecutor.java | 56 ++- .../PartitionOrderMessageListenerExecutor.java | 45 ++- .../pulsar/client/api/impl/package-info.java | 14 + .../org/apache/pulsar/client/api/package-info.java | 14 + .../src/test/java/DemoTest.java | 24 ++ pulsar-connector-contrib/pom.xml | 27 +- pulsar-function-contrib/pom.xml | 26 +- pulsar-interceptor-contrib/pom.xml | 26 +- pulsar-loadbalance-contrib/pom.xml | 26 +- pulsar-metrics-contrib/pom.xml | 27 +- pulsar-transaction-contrib/pom.xml | 26 +- src/main/resources/checkstyle.xml | 429 +++++++++++++++++++++ src/main/resources/suppressions.xml | 82 ++++ 55 files changed, 1776 insertions(+), 601 deletions(-) diff --git a/.ci/environments/common/update_quarkus.sh b/.ci/environments/common/update_quarkus.sh index 6ac5e81..e8f2aa1 100755 --- a/.ci/environments/common/update_quarkus.sh +++ b/.ci/environments/common/update_quarkus.sh @@ -1,4 +1,18 @@ #!/bin/bash +# +# 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 +# +# http://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. +# + set -euo pipefail mvn_cmd="mvn ${BUILD_MVN_OPTS:-} ${BUILD_MVN_OPTS_QUARKUS_UPDATE:-}" diff --git a/.ci/environments/quarkus-branch/before.sh b/.ci/environments/quarkus-branch/before.sh index d2cf2e7..251336b 100755 --- a/.ci/environments/quarkus-branch/before.sh +++ b/.ci/environments/quarkus-branch/before.sh @@ -1,4 +1,18 @@ #!/bin/bash +# +# 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 +# +# http://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. +# + set -euo pipefail script_dir_path=$(cd `dirname "${BASH_SOURCE[0]}"`; pwd -P) diff --git a/.ci/environments/quarkus-lts/before.sh b/.ci/environments/quarkus-lts/before.sh index d2cf2e7..251336b 100755 --- a/.ci/environments/quarkus-lts/before.sh +++ b/.ci/environments/quarkus-lts/before.sh @@ -1,4 +1,18 @@ #!/bin/bash +# +# 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 +# +# http://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. +# + set -euo pipefail script_dir_path=$(cd `dirname "${BASH_SOURCE[0]}"`; pwd -P) diff --git a/.ci/environments/quarkus-main/before.sh b/.ci/environments/quarkus-main/before.sh index d2cf2e7..251336b 100755 --- a/.ci/environments/quarkus-main/before.sh +++ b/.ci/environments/quarkus-main/before.sh @@ -1,4 +1,18 @@ #!/bin/bash +# +# 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 +# +# http://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. +# + set -euo pipefail script_dir_path=$(cd `dirname "${BASH_SOURCE[0]}"`; pwd -P) diff --git a/.ci/environments/update.sh b/.ci/environments/update.sh index 6360cc7..438e12b 100755 --- a/.ci/environments/update.sh +++ b/.ci/environments/update.sh @@ -1,4 +1,18 @@ #!/bin/bash +# +# 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 +# +# http://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. +# + set -euo pipefail script_dir_path=$(cd `dirname "${BASH_SOURCE[0]}"`; pwd -P) diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index 314898c..21cbd82 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -1,3 +1,16 @@ +/* + * 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 + * + * http://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. + */ /* * This file is describing all the Jenkins jobs in the DSL format (see https://plugins.jenkins.io/job-dsl/) * needed by the Kogito pipelines. diff --git a/.ci/jenkins/dsl/test.sh b/.ci/jenkins/dsl/test.sh index 1dd3b10..0b207b3 100755 --- a/.ci/jenkins/dsl/test.sh +++ b/.ci/jenkins/dsl/test.sh @@ -1,4 +1,18 @@ #!/bin/bash -e +# +# 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 +# +# http://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. +# + # Used to retrieve current git author, to set correctly the main config file repo GIT_SERVER='github.com' diff --git a/.github/workflows/contrib-ci.yml b/.github/workflows/contrib-ci.yml new file mode 100644 index 0000000..e62100c --- /dev/null +++ b/.github/workflows/contrib-ci.yml @@ -0,0 +1,48 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven + +# 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. + +name: Java CI with Maven + +on: + push: + branches: [ "stable" ] + pull_request: + branches: [ "stable" ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: true + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --file pom.xml + - name: Unit test + run: mvn clean verify + unit-test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Unit test + run: mvn clean verify \ No newline at end of file diff --git a/.github/workflows/full-downstream.yml b/.github/workflows/full-downstream.yml deleted file mode 100644 index dffec7c..0000000 --- a/.github/workflows/full-downstream.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: (FDB) Build Chain - -on: - pull_request: - types: [labeled] - branches: - - development - - 8.* - paths-ignore: - - 'LICENSE*' - - '.gitignore' - - '**.md' - - '**.adoc' - - '*.txt' - - '.ci/**' - -jobs: - build-chain: - if: contains(github.event.pull_request.labels.*.name, 'run_fdb') - concurrency: - group: fdb-${{ github.head_ref }} - cancel-in-progress: true - strategy: - matrix: - os: [ubuntu-latest] - java-version: [17] - fail-fast: false - runs-on: ${{ matrix.os }} - name: Maven Build - steps: - - name: Free disk space - if: ${{ matrix.os == 'ubuntu-latest' }} - shell: bash - run: | - sudo rm -rf /usr/share/dotnet - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/ghc - docker rmi $(docker image ls -aq) - df -h - - name: Set up JDK - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: ${{ matrix.java-version }} - check-latest: true - # See https://docs.github.com/en/actions/guides/building-and-testing-java-with-maven#caching-dependencies - - name: Cache Maven packages - uses: actions/cache@v3 - with: - path: ~/.m2 - key: ${{ runner.os }}-${{ matrix.java-version }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-${{ matrix.java-version }}-m2 - - name: Build Chain ${{ matrix.java-version }} - id: build-chain - uses: kiegroup/[email protected] - with: - definition-file: https://raw.githubusercontent.com/${GROUP}/optaplanner/main/.ci/buildchain-config.yaml - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - OPTAPLANNER_BUILD_MVN_OPTS_UPSTREAM: "-Dfull" - - name: Check Surefire Report - if: ${{ always() }} - uses: ScaCap/[email protected] - with: - fail_on_test_failures: true - fail_if_no_tests: false - skip_publishing: true diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml deleted file mode 100644 index 5750974..0000000 --- a/.github/workflows/gradle.yml +++ /dev/null @@ -1,68 +0,0 @@ -# Tests PRs on Gradle for the quickstarts that support it. - -name: OptaPlanner Gradle CI - -on: - push: - branches: - - development - paths-ignore: - - 'LICENSE*' - - '.gitignore' - - '.gitattributes' - - '**.md' - - '**.adoc' - - '*.txt' - - 'build/**' - - '.ci/**' - pull_request: - types: [opened, synchronize, reopened, ready_for_review] - branches: - - development - paths-ignore: - - 'LICENSE*' - - '.gitignore' - - '.gitattributes' - - '**.md' - - '**.adoc' - - '*.txt' - - 'build/**' - - '.ci/**' - -defaults: - run: - shell: bash - -jobs: - quickstarts: - name: Matrix - runs-on: ubuntu-latest - strategy: - matrix: - quickstartDir: ['hello-world', 'pulsar-client-contrib', 'use-cases/school-timetabling', 'technology/java-spring-boot'] - java-version: [17] # JDK 19 not yet supported by Gradle. - steps: - - uses: actions/checkout@v3 - - name: Set up JDK - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: ${{ matrix.java-version }} - check-latest: true - - name: Cache Gradle packages - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - name: Build with Gradle - run: cd ${{ matrix.quickstartDir }} && gradle build - - name: Cleanup Gradle Cache - # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. - # Restoring these files from a GitHub Actions cache might cause problems for future builds. - run: | - rm -f ~/.gradle/caches/modules-2/modules-2.lock - rm -f ~/.gradle/caches/modules-2/gc.properties diff --git a/.github/workflows/jenkins-tests-PR.yml b/.github/workflows/jenkins-tests-PR.yml deleted file mode 100644 index bfb08b1..0000000 --- a/.github/workflows/jenkins-tests-PR.yml +++ /dev/null @@ -1,31 +0,0 @@ -# This workflow will build a Java project with Maven -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven -name: Jenkins Tests -on: - pull_request: - paths: - - '.ci/jenkins/**' - - '.github/workflows/jenkins-tests-PR.yml' - -jobs: - dsl-tests: - concurrency: - group: ${{ github.repository.name }}_dsl_tests-${{ github.head_ref }} - cancel-in-progress: true - runs-on: ubuntu-latest - steps: - - name: Set correct base branch - run: | - branch="${{ github.base_ref }}" - if [ "${branch}" = "development" ]; then - branch='main' - fi - echo "BASE_BRANCH=${branch}" >> $GITHUB_ENV - - name: DSL tests - uses: kiegroup/kie-ci/.ci/actions/dsl-tests@main - with: - project: optaplanner - main-config-file-repo: kiegroup/optaplanner - main-config-file-path: .ci/jenkins/config/main.yaml - branch-config-file-repo: kiegroup/optaplanner - base-branch: ${{ env.BASE_BRANCH }} \ No newline at end of file diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml deleted file mode 100644 index b79e74e..0000000 --- a/.github/workflows/nightly.yml +++ /dev/null @@ -1,57 +0,0 @@ - -name: Nightly - -on: - schedule: - - cron: "0 0 * * *" - workflow_dispatch: - -jobs: - nightly: - if: github.repository == 'kiegroup/optaplanner-quickstarts' - concurrency: - group: nightly - cancel-in-progress: true - strategy: - matrix: - os: [ubuntu-latest] - java-version: [17] - fail-fast: true - runs-on: ${{ matrix.os }} - name: ${{ matrix.os }} - Java ${{ matrix.java-version }} - Maven - steps: - - name: Support long paths - if: ${{ matrix.os == 'windows-latest' }} - uses: kiegroup/kie-ci/.ci/actions/long-paths@main - - name: Java and Maven Setup - uses: kiegroup/kie-ci/.ci/actions/maven@main - with: - java-version: ${{ matrix.java-version }} - maven-version: ${{ matrix.maven-version }} - cache-key-prefix: ${{ runner.os }}-${{ matrix.java-version }}-maven${{ matrix.maven-version }} - - uses: actions/checkout@v3 - - name: Build with Maven - run: mvn -B clean install --file pom.xml dependency:tree -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3 - - name: Set build information - if: ${{ always() }} - run: | - echo "project_branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV - echo "project_name=${{github.repository}}" >> $GITHUB_ENV - echo "action_url=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV - - name: Set failure message - if: ${{ failure() }} - run: echo "zulip_message=:cross_mark:Build ERROR. See ${{env.action_url}}" >> $GITHUB_ENV - - name: Set success message - if: ${{ success() }} - run: echo "zulip_message=:check:Build OK. See ${{env.action_url}}" >> $GITHUB_ENV - - name: Send a stream message - if: ${{ always() }} - uses: zulip/github-actions-zulip/send-message@v1 - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: ${{ secrets.ZULIP_EMAIL }} - organization-url: 'https://kie.zulipchat.com' - to: 'optaplanner-ci' - type: 'stream' - topic: 'status of ${{env.project_name}} - ${{env.project_branch}}' - content: ${{ env.zulip_message }} diff --git a/.github/workflows/pr-backporting.yml b/.github/workflows/pr-backporting.yml deleted file mode 100644 index 62b31d5..0000000 --- a/.github/workflows/pr-backporting.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Pull Request Backporting - -on: - pull_request_target: - types: [closed, labeled] -env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - -jobs: - compute-targets: - if: ${{ github.event.pull_request.state == 'closed' && github.event.pull_request.merged }} - runs-on: ubuntu-latest - outputs: - target-branches: ${{ steps.set-targets.outputs.targets }} - env: - LABELS: ${{ toJSON(github.event.pull_request.labels) }} - steps: - - name: Set target branches - id: set-targets - uses: kiegroup/kie-ci/.ci/actions/parse-labels@main - with: - labels: ${LABELS} - - backporting: - if: ${{ github.event.pull_request.state == 'closed' && github.event.pull_request.merged && needs.compute-targets.outputs.target-branches != '[]' }} - name: "[${{ matrix.target-branch }}] - Backporting" - runs-on: ubuntu-latest - needs: compute-targets - strategy: - matrix: - target-branch: ${{ fromJSON(needs.compute-targets.outputs.target-branches) }} - fail-fast: false - env: - REVIEWERS: ${{ toJSON(github.event.pull_request.requested_reviewers) }} - steps: - - name: Backporting - uses: kiegroup/kie-ci/.ci/actions/backporting@main - with: - target-branch: ${{ matrix.target-branch }} - additional-reviewers: ${REVIEWERS} diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml deleted file mode 100644 index 8b0a17f..0000000 --- a/.github/workflows/pull_request.yml +++ /dev/null @@ -1,54 +0,0 @@ - -name: Build Chain - -on: - pull_request: - types: [opened, synchronize, reopened, ready_for_review] - branches: - - development - - 8.* - paths-ignore: - - 'LICENSE*' - - '.gitignore' - - '.gitattributes' - - '**.md' - - '**.adoc' - - '*.txt' - -jobs: - build-chain: - concurrency: - group: pull_request-${{ github.event_name }}-${{ github.head_ref }}-${{ matrix.os }}-${{ matrix.java-version }} - cancel-in-progress: true - strategy: - matrix: - os: [ubuntu-latest, windows-latest] - java-version: [17, 19] - fail-fast: true - runs-on: ${{ matrix.os }} - name: Maven Build - steps: - - name: Support long paths - if: ${{ matrix.os == 'windows-latest' }} - uses: kiegroup/kie-ci/.ci/actions/long-paths@main - - name: Sets the migration env variable on Windows - if: runner.os == 'Windows' - run: echo "MIGRATE_TO_9=${{ github.base_ref == 'development' }}" >> $env:GITHUB_ENV - - name: Sets the migration env variable on Linux - if: runner.os != 'Windows' - run: echo "MIGRATE_TO_9=${{ github.base_ref == 'development' }}" >> $GITHUB_ENV - - name: Java and Maven Setup - uses: kiegroup/kie-ci/.ci/actions/maven@main - with: - java-version: ${{ matrix.java-version }} - maven-version: ${{ matrix.maven-version }} - cache-key-prefix: ${{ runner.os }}-${{ matrix.java-version }}-maven${{ matrix.maven-version }} - - name: Build Chain - uses: kiegroup/kie-ci/.ci/actions/build-chain@main - with: - definition-file: https://raw.githubusercontent.com/${GROUP:kiegroup}/optaplanner/${BRANCH:main}/.ci/buildchain-config.yaml - annotations-prefix: ${{ runner.os }}-${{ matrix.java-version }}/${{ matrix.maven-version }} - github-token: "${{ secrets.GITHUB_TOKEN }}" - - name: Surefire Report - uses: kiegroup/kie-ci/.ci/actions/surefire-report@main - if: ${{ always() }} diff --git a/.github/workflows/quarkus-snapshot.yml b/.github/workflows/quarkus-snapshot.yml deleted file mode 100644 index 5798791..0000000 --- a/.github/workflows/quarkus-snapshot.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: "Quarkus ecosystem" -on: - watch: - types: [ started ] - - # For this CI to work, ECOSYSTEM_CI_TOKEN needs to contain a GitHub with rights to close the Quarkus issue that the user/bot has opened, - # while 'ECOSYSTEM_CI_REPO_PATH' needs to be set to the corresponding path in the 'quarkusio/quarkus-ecosystem-ci' repository - -env: - ECOSYSTEM_CI_REPO: quarkusio/quarkus-ecosystem-ci - ECOSYSTEM_CI_REPO_FILE: context.yaml - - ######################### - # Repo specific setting # - ######################### - - ECOSYSTEM_CI_REPO_PATH: optaplanner-quickstarts # a directory inside the ${ECOSYSTEM_CI_REPO} - -jobs: - build: - strategy: - matrix: - os: [ ubuntu-latest ] - java-version: [ 17 ] - maven-version: [ '3.8.7' ] - fail-fast: false - runs-on: ${{ matrix.os }} - if: github.actor == 'quarkusbot' - name: ${{ matrix.os }} - Java ${{ matrix.java-version }} - Maven - steps: - - name: Install yq - run: sudo add-apt-repository ppa:rmescandon/yq && sudo apt update && sudo apt install yq -y - - - name: Java and Maven Setup - uses: kiegroup/kie-ci/.ci/actions/maven@main - with: - java-version: ${{ matrix.java-version }} - maven-version: ${{ matrix.maven-version }} - cache-key-prefix: ${{ runner.os }}-${{ matrix.java-version }}-maven${{ matrix.maven-version }} - - - name: Checkout repo - uses: actions/checkout@v3 - with: - path: current-repo - ref: development - - - name: Checkout Ecosystem - uses: actions/checkout@v3 - with: - repository: ${{ env.ECOSYSTEM_CI_REPO }} - ref: main - path: ecosystem-ci - - - name: Setup and Run Tests - run: ./ecosystem-ci/setup-and-test - env: - ECOSYSTEM_CI_TOKEN: ${{ secrets.ECOSYSTEM_CI_TOKEN }} diff --git a/.github/workflows/rhbop_productized_pull_request.yml b/.github/workflows/rhbop_productized_pull_request.yml deleted file mode 100644 index ca0a9ea..0000000 --- a/.github/workflows/rhbop_productized_pull_request.yml +++ /dev/null @@ -1,57 +0,0 @@ -# Tests RHBOP productized profile builds on PRs -name: Productized Build Chain - -on: - pull_request: - types: [opened, synchronize, reopened, labeled] - branches: - - main - - 8.* - paths-ignore: - - 'LICENSE*' - - '.gitignore' - - '.gitattributes' - - '**.md' - - '**.adoc' - - '*.txt' - - '.ci/jenkins/**' - -defaults: - run: - shell: bash - -jobs: - productized-build-chain: - concurrency: - group: rhbop_pull_request-${{ github.event_name }}-${{ github.head_ref }}-${{ matrix.os }}-${{ matrix.java-version }} - cancel-in-progress: true - timeout-minutes: 120 - strategy: - matrix: - os: [ubuntu-latest] - java-version: [17] - maven-version: ['3.8.7'] - fail-fast: false - runs-on: ${{ matrix.os }} - name: ${{ matrix.os }} - Java ${{ matrix.java-version }} - Maven - steps: - - name: Clean Disk Space - uses: kiegroup/kie-ci/.ci/actions/ubuntu-disk-space@main - - name: Java and Maven Setup - uses: kiegroup/kie-ci/.ci/actions/maven@main - with: - java-version: ${{ matrix.java-version }} - maven-version: ${{ matrix.maven-version }} - cache-key-prefix: ${{ runner.os }}-${{ matrix.java-version }}-maven${{ matrix.maven-version }} - - name: Productized Build Chain - uses: kiegroup/kie-ci/.ci/actions/build-chain@main - with: - definition-file: https://raw.githubusercontent.com/${GROUP:kiegroup}/optaplanner/${BRANCH:main}/.ci/pull-request-config-rhbop.yaml - annotations-prefix: ${{ runner.os }}-${{ matrix.java-version }}/${{ matrix.maven-version }} - github-token: "${{ secrets.GITHUB_TOKEN }}" - - name: Surefire Report - uses: kiegroup/kie-ci/.ci/actions/surefire-report@main - if: ${{ always() }} - with: - report_paths: '**/*-reports/TEST-*.xml' - diff --git a/LICENSE.txt b/LICENSE.txt index 261eeb9..24e4a10 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,3 +1,17 @@ +==== + 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 + + http://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. +==== + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ diff --git a/README.md b/README.md index dd290c5..e08a861 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,9 @@ Pulsar java contrib is to provide a non-core code maintenance repository to coll - [Best Practices]([best-pratice-blogs](best-pratice-blogs)) lists the best practices for each function summarized by community contributions. - [consume-best-practice.md](best-pratice-blogs%2Fconsume-best-practice.md) +This project follows the terms of **Apache License 2.0**. +You can format the code by ` mvn spotless:apply` and generate license headers by `mvn license:format`. +Please note that the code formatted by Spotless may still not meet the formatting requirements. Please run `mvn checkstyle:check` for inspection. ## Contributing diff --git a/build/optaplanner-distribution/pom.xml b/build/optaplanner-distribution/pom.xml index 0818c67..c7988c1 100644 --- a/build/optaplanner-distribution/pom.xml +++ b/build/optaplanner-distribution/pom.xml @@ -1,4 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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 + + http://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. + +--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> diff --git a/build/optaplanner-distribution/src/main/assembly/assembly-optaplanner-quickstarts.xml b/build/optaplanner-distribution/src/main/assembly/assembly-optaplanner-quickstarts.xml index bc7c11a..b69384b 100644 --- a/build/optaplanner-distribution/src/main/assembly/assembly-optaplanner-quickstarts.xml +++ b/build/optaplanner-distribution/src/main/assembly/assembly-optaplanner-quickstarts.xml @@ -1,4 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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 + + http://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. + +--> <assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd"> diff --git a/build/optaplanner-distribution/src/main/assembly/resources/ReadMe.txt b/build/optaplanner-distribution/src/main/assembly/resources/ReadMe.txt index 44701c8..a150a6f 100644 --- a/build/optaplanner-distribution/src/main/assembly/resources/ReadMe.txt +++ b/build/optaplanner-distribution/src/main/assembly/resources/ReadMe.txt @@ -1,3 +1,17 @@ +==== + 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 + + http://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. +==== + Welcome to OptaPlanner ====================== diff --git a/build/optaplanner-distribution/src/main/assembly/scripts/runQuickstarts.bat b/build/optaplanner-distribution/src/main/assembly/scripts/runQuickstarts.bat index 02ec5fa..c5d246b 100644 --- a/build/optaplanner-distribution/src/main/assembly/scripts/runQuickstarts.bat +++ b/build/optaplanner-distribution/src/main/assembly/scripts/runQuickstarts.bat @@ -1,3 +1,17 @@ +@REM +@REM Licensed under the Apache License, Version 2.0 (the "License"); +@REM you may not use this file except in compliance with the License. +@REM You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM + @ECHO OFF setLocal enableExtensions enableDelayedExpansion diff --git a/build/optaplanner-distribution/src/main/assembly/scripts/runQuickstarts.sh b/build/optaplanner-distribution/src/main/assembly/scripts/runQuickstarts.sh index d6d99e6..1bbf7a0 100644 --- a/build/optaplanner-distribution/src/main/assembly/scripts/runQuickstarts.sh +++ b/build/optaplanner-distribution/src/main/assembly/scripts/runQuickstarts.sh @@ -1,4 +1,18 @@ #!/bin/sh +# +# 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 +# +# http://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. +# + # Change directory to the directory of the script cd "$(dirname $0)" || exit diff --git a/build/optaplanner-distribution/src/main/assembly/sources.xml b/build/optaplanner-distribution/src/main/assembly/sources.xml index f22ed5d..80f465c 100644 --- a/build/optaplanner-distribution/src/main/assembly/sources.xml +++ b/build/optaplanner-distribution/src/main/assembly/sources.xml @@ -1,4 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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 + + http://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. + +--> <component xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.3 http://maven.apache.org/xsd/component-1.1.3.xsd"> diff --git a/build/quickstarts-showcase/pom.xml b/build/quickstarts-showcase/pom.xml index 6981cba..9af67fc 100644 --- a/build/quickstarts-showcase/pom.xml +++ b/build/quickstarts-showcase/pom.xml @@ -1,4 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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 + + http://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. + +--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> diff --git a/build/quickstarts-showcase/src/main/java/org/optaplanner/quickstarts/all/domain/QuickstartMeta.java b/build/quickstarts-showcase/src/main/java/org/optaplanner/quickstarts/all/domain/QuickstartMeta.java index 075ac71..164ee8c 100644 --- a/build/quickstarts-showcase/src/main/java/org/optaplanner/quickstarts/all/domain/QuickstartMeta.java +++ b/build/quickstarts-showcase/src/main/java/org/optaplanner/quickstarts/all/domain/QuickstartMeta.java @@ -1,3 +1,16 @@ +/* + * 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 + * + * http://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. + */ package org.optaplanner.quickstarts.all.domain; import java.util.ArrayList; diff --git a/build/quickstarts-showcase/src/main/java/org/optaplanner/quickstarts/all/rest/ExitResource.java b/build/quickstarts-showcase/src/main/java/org/optaplanner/quickstarts/all/rest/ExitResource.java index 0f1c189..b3c712e 100644 --- a/build/quickstarts-showcase/src/main/java/org/optaplanner/quickstarts/all/rest/ExitResource.java +++ b/build/quickstarts-showcase/src/main/java/org/optaplanner/quickstarts/all/rest/ExitResource.java @@ -1,3 +1,16 @@ +/* + * 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 + * + * http://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. + */ package org.optaplanner.quickstarts.all.rest; import jakarta.ws.rs.POST; diff --git a/build/quickstarts-showcase/src/main/java/org/optaplanner/quickstarts/all/rest/QuickstartLauncherResource.java b/build/quickstarts-showcase/src/main/java/org/optaplanner/quickstarts/all/rest/QuickstartLauncherResource.java index 9b9e4c1..fad619b 100644 --- a/build/quickstarts-showcase/src/main/java/org/optaplanner/quickstarts/all/rest/QuickstartLauncherResource.java +++ b/build/quickstarts-showcase/src/main/java/org/optaplanner/quickstarts/all/rest/QuickstartLauncherResource.java @@ -1,3 +1,16 @@ +/* + * 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 + * + * http://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. + */ package org.optaplanner.quickstarts.all.rest; import java.awt.Desktop; diff --git a/build/quickstarts-showcase/src/main/resources/META-INF/resources/app.js b/build/quickstarts-showcase/src/main/resources/META-INF/resources/app.js index 4cfb473..f3fc783 100644 --- a/build/quickstarts-showcase/src/main/resources/META-INF/resources/app.js +++ b/build/quickstarts-showcase/src/main/resources/META-INF/resources/app.js @@ -1,3 +1,16 @@ +/* + * 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 + * + * http://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. + */ var loadingPorts = []; var startedPorts = []; var autoPingIntervalId = null; diff --git a/build/quickstarts-showcase/src/main/resources/META-INF/resources/index.html b/build/quickstarts-showcase/src/main/resources/META-INF/resources/index.html index 3fe9094..d5e6c05 100644 --- a/build/quickstarts-showcase/src/main/resources/META-INF/resources/index.html +++ b/build/quickstarts-showcase/src/main/resources/META-INF/resources/index.html @@ -1,3 +1,18 @@ +<!-- + + 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 + + http://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. + +--> <html lang="en"> <head> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> diff --git a/build/quickstarts-showcase/src/main/resources/application.properties b/build/quickstarts-showcase/src/main/resources/application.properties index e69de29..3663c15 100644 --- a/build/quickstarts-showcase/src/main/resources/application.properties +++ b/build/quickstarts-showcase/src/main/resources/application.properties @@ -0,0 +1,14 @@ +# +# 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 +# +# http://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. +# + diff --git a/build/quickstarts-showcase/src/test/java/org/optaplanner/quickstarts/all/rest/QuickstartLauncherResourceTest.java b/build/quickstarts-showcase/src/test/java/org/optaplanner/quickstarts/all/rest/QuickstartLauncherResourceTest.java index d0386f7..2f13d89 100644 --- a/build/quickstarts-showcase/src/test/java/org/optaplanner/quickstarts/all/rest/QuickstartLauncherResourceTest.java +++ b/build/quickstarts-showcase/src/test/java/org/optaplanner/quickstarts/all/rest/QuickstartLauncherResourceTest.java @@ -1,3 +1,16 @@ +/* + * 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 + * + * http://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. + */ package org.optaplanner.quickstarts.all.rest; import static io.restassured.RestAssured.given; diff --git a/build/release/upload_distribution.sh b/build/release/upload_distribution.sh index 0fd9b88..670df2e 100755 --- a/build/release/upload_distribution.sh +++ b/build/release/upload_distribution.sh @@ -1,4 +1,18 @@ #!/bin/bash +# +# 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 +# +# http://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. +# + function display_help() { readonly script_name="./$(basename "$0")" diff --git a/etc/APACHE-2.txt b/etc/APACHE-2.txt new file mode 100644 index 0000000..86a8bee --- /dev/null +++ b/etc/APACHE-2.txt @@ -0,0 +1,11 @@ +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 + +http://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. \ No newline at end of file diff --git a/etc/checkstyle.xml b/etc/checkstyle.xml new file mode 100644 index 0000000..2d95c2b --- /dev/null +++ b/etc/checkstyle.xml @@ -0,0 +1,217 @@ +<?xml version="1.0"?> +<!-- + + 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 + + http://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. + +--> +<!DOCTYPE module PUBLIC + "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" + "https://checkstyle.org/dtds/configuration_1_3.dtd"> +<!-- + + Checkstyle configuration that firstly conforms to the Google Java Code style + and then further incorporates recommendations and conventions from: + + - the Java Language Specification at + https://docs.oracle.com/javase/specs/jls/se11/html/index.html + + - the Javadoc guidelines at + https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html + + - the JDK Api documentation https://docs.oracle.com/en/java/javase/11/ + + - some best practices + + Checkstyle is very configurable. Be sure to read the documentation at + https://checkstyle.org (or in your downloaded distribution). + + Most Checks are configurable, be sure to consult the documentation. + + To completely disable a check, just comment it out or delete it from the file. + To suppress certain violations please review suppression filters. + + Finally, it is worth reading the documentation. + +--> + +<module name="Checker"> + <!-- + If you set the basedir property below, then all reported file + names will be relative to the specified directory. See + https://checkstyle.org/config.html#Checker + + <property name="basedir" value="${basedir}"/> + --> + <property name="severity" value="error"/> + + <property name="fileExtensions" value="java, properties, xml"/> + + <!-- Excludes all 'module-info.java' files --> + <!-- See https://checkstyle.org/config_filefilters.html --> + <module name="BeforeExecutionExclusionFileFilter"> + <property name="fileNamePattern" value="module\-info\.java$"/> + </module> + + <!-- https://checkstyle.org/config_filters.html#SuppressionFilter --> + <module name="SuppressionFilter"> + <property name="file" value="${org.checkstyle.sun.suppressionfilter.config}" + default="checkstyle-suppressions.xml" /> + <property name="optional" value="true"/> + </module> + + <!-- Checks that a package-info.java file exists for each package. --> + <!-- See https://checkstyle.org/config_javadoc.html#JavadocPackage --> + <!--<module name="JavadocPackage"/>--> + + <!-- Checks whether files end with a new line. --> + <!-- See https://checkstyle.org/config_misc.html#NewlineAtEndOfFile --> + <module name="NewlineAtEndOfFile"/> + + <!-- Checks that property files contain the same keys. --> + <!-- See https://checkstyle.org/config_misc.html#Translation --> + <module name="Translation"/> + + <!-- Checks for Size Violations. --> + <!-- See https://checkstyle.org/config_sizes.html --> + <module name="FileLength"/> + <module name="LineLength"> + <property name="fileExtensions" value="java"/> + <property name="max" value="120"/> <!-- Customization --> + </module> + + <!-- Checks for whitespace --> + <!-- See https://checkstyle.org/config_whitespace.html --> + <module name="FileTabCharacter"/> + + <!-- Miscellaneous other checks. --> + <!-- See https://checkstyle.org/config_misc.html --> + <module name="RegexpSingleline"> + <property name="format" value="\s+$"/> + <property name="minimum" value="0"/> + <property name="maximum" value="0"/> + <property name="message" value="Line has trailing spaces."/> + </module> + + <!-- Checks for Headers --> + <!-- See https://checkstyle.org/config_header.html --> + <!-- <module name="Header"> --> + <!-- <property name="headerFile" value="${checkstyle.header.file}"/> --> + <!-- <property name="fileExtensions" value="java"/> --> + <!-- </module> --> + + <module name="SuppressWarningsFilter"/> + + <module name="TreeWalker"> + <module name="SuppressWarningsHolder"/> + + <!-- Checks for Javadoc comments. --> + <!-- See https://checkstyle.org/config_javadoc.html --> + <module name="InvalidJavadocPosition"/> + <module name="JavadocMethod"/> + <module name="JavadocType"/> + <!--<module name="JavadocVariable"/>--> + <module name="JavadocStyle"/> + <!--<module name="MissingJavadocMethod"/>--> + + <!-- Checks for Naming Conventions. --> + <!-- See https://checkstyle.org/config_naming.html --> + <!--<module name="ConstantName"/>--> + <module name="LocalFinalVariableName"/> + <module name="LocalVariableName"/> + <module name="MemberName"/> + <module name="MethodName"/> + <module name="PackageName"/> + <module name="ParameterName"/> + <module name="StaticVariableName"/> + <module name="TypeName"/> + + <!-- Checks for imports --> + <!-- See https://checkstyle.org/config_imports.html --> + <module name="AvoidStarImport"/> + <module name="IllegalImport"/> <!-- defaults to sun.* packages --> + <module name="RedundantImport"/> + <module name="UnusedImports"> + <property name="processJavadoc" value="false"/> + </module> + + <!-- Checks for Size Violations. --> + <!-- See https://checkstyle.org/config_sizes.html --> + <module name="MethodLength"/> + <module name="ParameterNumber"/> + + <!-- Checks for whitespace --> + <!-- See https://checkstyle.org/config_whitespace.html --> + <module name="EmptyForIteratorPad"> + <property name="option" value="space"/> + </module> + <module name="GenericWhitespace"/> + <module name="MethodParamPad"/> + <module name="NoWhitespaceAfter"/> + <module name="NoWhitespaceBefore"/> + <module name="OperatorWrap"/> + <module name="ParenPad"/> + <module name="TypecastParenPad"/> + <module name="WhitespaceAfter"/> + <!--<module name="WhitespaceAround"/>--> + + <!-- Modifier Checks --> + <!-- See https://checkstyle.org/config_modifier.html --> + <module name="ModifierOrder"/> + <module name="RedundantModifier"/> + + <!-- Checks for blocks. You know, those {}'s --> + <!-- See https://checkstyle.org/config_blocks.html --> + <module name="AvoidNestedBlocks"/> + <module name="EmptyBlock"/> + <module name="LeftCurly"/> + <module name="NeedBraces"/> + <module name="RightCurly"/> + + <!-- Checks for common coding problems --> + <!-- See https://checkstyle.org/config_coding.html --> + <module name="EmptyStatement"/> + <module name="EqualsHashCode"/> + <!--<module name="HiddenField"/>--> + <module name="IllegalInstantiation"/> + <module name="InnerAssignment"/> + <!--<module name="MagicNumber"/>--> + <module name="MissingSwitchDefault"/> + <module name="MultipleVariableDeclarations"/> + <module name="SimplifyBooleanExpression"/> + <module name="SimplifyBooleanReturn"/> + + <!-- Checks for class design --> + <!-- See https://checkstyle.org/config_design.html --> + <!--<module name="DesignForExtension"/>--> + <module name="FinalClass"/> + <!--<module name="HideUtilityClassConstructor"/>--> + <module name="InterfaceIsType"/> + <!--<module name="VisibilityModifier"/>--> + + <!-- Miscellaneous other checks. --> + <!-- See https://checkstyle.org/config_misc.html --> + <module name="ArrayTypeStyle"/> + <!--<module name="FinalParameters"/>--> + <module name="TodoComment"/> + <module name="UpperEll"/> + + <!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter --> + <module name="SuppressionXpathFilter"> + <property name="file" value="${org.checkstyle.sun.suppressionxpathfilter.config}" + default="checkstyle-xpath-suppressions.xml" /> + <property name="optional" value="true"/> + </module> + + </module> + +</module> diff --git a/etc/findbugsExclude.xml b/etc/findbugsExclude.xml new file mode 100644 index 0000000..a5af39d --- /dev/null +++ b/etc/findbugsExclude.xml @@ -0,0 +1,133 @@ +<!-- + + 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 + + http://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. + +--> +<FindBugsFilter> + <Match> + <Class name="io.openmessaging.benchmark.driver.pulsar.config.PulsarClientConfig$AuthenticationConfiguration" /> + <Bug pattern="UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.driver.jms.JMSBenchmarkConsumer" /> + <Bug pattern="EI_EXPOSE_REP2" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.driver.jms.JMSBenchmarkProducer" /> + <Bug pattern="EI_EXPOSE_REP2" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.driver.jms.JMSBenchmarkTransactionProducer" /> + <Bug pattern="EI_EXPOSE_REP2" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.driver.kafka.KafkaTopicCreator" /> + <Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.driver.kop.config.PulsarConfig" /> + <Bug pattern="UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.driver.pravega.config.PravegaClientConfig" /> + <Bug pattern="UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.driver.rabbitmq.RabbitMqBenchmarkProducer" /> + <Bug pattern="RV_RETURN_VALUE_OF_PUTIFABSENT_IGNORED" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.driver.rabbitmq.RabbitMqBenchmarkConsumer" /> + <Bug pattern="EI_EXPOSE_REP2" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.driver.rabbitmq.RabbitMqBenchmarkProducer" /> + <Bug pattern="EI_EXPOSE_REP2" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.driver.bookkeeper.DlogBenchmarkConsumer" /> + <Bug pattern="EI_EXPOSE_REP2" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.driver.bookkeeper.DlogBenchmarkProducer" /> + <Bug pattern="EI_EXPOSE_REP2" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.driver.bookkeeper.stats.StatsLoggerAdaptor" /> + <Bug pattern="EI_EXPOSE_REP2" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.driver.nsq.NsqBenchmarkProducer" /> + <Bug pattern="NP_NONNULL_PARAM_VIOLATION" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.driver.redis.RedisBenchmarkConsumer" /> + <Bug pattern="EI_EXPOSE_REP2" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.driver.redis.RedisBenchmarkProducer" /> + <Bug pattern="EI_EXPOSE_REP2" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.ResultsToCsv" /> + <Bug pattern="DM_DEFAULT_ENCODING" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.WorkloadGenerator" /> + <Bug pattern="DLS_DEAD_LOCAL_STORE" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.WorkloadGenerator" /> + <Bug pattern="DMI_RANDOM_USED_ONLY_ONCE" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.utils.PaddingDecimalFormat" /> + <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.utils.distributor.KeyDistributor" /> + <Bug pattern="DMI_RANDOM_USED_ONLY_ONCE" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.worker.LocalWorker" /> + <Bug pattern="EI_EXPOSE_REP2" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.worker.WorkerHandler" /> + <Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.worker.jackson.HistogramDeserializer" /> + <Bug pattern="SE_BAD_FIELD" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.worker.jackson.HistogramSerializer" /> + <Bug pattern="SE_BAD_FIELD" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.worker.jackson.ObjectMappers" /> + <Bug pattern="EI_EXPOSE_REP" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.worker.WorkerStats" /> + <Bug pattern="EI_EXPOSE_REP" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.worker.WorkerStats" /> + <Bug pattern="EI_EXPOSE_REP" /> + </Match> + <Match> + <Class name="io.openmessaging.benchmark.driver.ResourceCreator" /> + <Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE" /> + </Match> +</FindBugsFilter> diff --git a/pom.xml b/pom.xml index 73a12e9..f5697cc 100644 --- a/pom.xml +++ b/pom.xml @@ -1,14 +1,29 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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 + + http://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. + +--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.optaplanner</groupId> - <artifactId>optaplanner-build-parent</artifactId> - <version>9.44.0.Final</version> - <relativePath/> - </parent> - <!-- IMPORTANT: the individual quickstarts have no parent pom. --> + <parent> + <groupId>org.apache</groupId> + <artifactId>apache</artifactId> + <version>29</version> + </parent> + + <inceptionYear>2024</inceptionYear> <artifactId>pulsar-java-contrib</artifactId> <packaging>pom</packaging> @@ -46,4 +61,154 @@ </profile> </profiles> + <dependencies> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>${lombok.version}</version> + </dependency> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>${slf4j.version}</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + <version>${slf4j.version}</version> + <type>jar</type> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <version>7.4.0</version> + <scope>test</scope> + </dependency> + </dependencies> + + <properties> + <lombok.version>1.18.32</lombok.version> + <slf4j.version>2.0.13</slf4j.version> + <maven.compiler.source>17</maven.compiler.source> + <maven.compiler.target>17</maven.compiler.target> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <pulsar.version>3.0.5</pulsar.version> + <maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version> + <puppycrawl.checkstyle.version>8.45.1</puppycrawl.checkstyle.version> + <spotless-maven-plugin.version>2.18.0</spotless-maven-plugin.version> + </properties> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.1</version> + <configuration> + <source>17</source> + <target>17</target> + <annotationProcessorPaths> + <path> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>${lombok.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + <!-- Spotless Plugin --> + <plugin> + <groupId>com.diffplug.spotless</groupId> + <artifactId>spotless-maven-plugin</artifactId> + <version>${spotless-maven-plugin.version}</version> + <configuration> + <java> + <googleJavaFormat> + <version>1.7</version> + <style>GOOGLE</style> + </googleJavaFormat> + </java> + </configuration> + <executions> + <execution> + <goals> + <goal>apply</goal> + </goals> + </execution> + </executions> + </plugin> + <!-- Checkstyle Plugin --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + <version>${maven-checkstyle-plugin.version}</version> + <dependencies> + <dependency> + <groupId>com.puppycrawl.tools</groupId> + <artifactId>checkstyle</artifactId> + <version>${puppycrawl.checkstyle.version}</version> + </dependency> + </dependencies> + <configuration> + <configLocation>./src/main/resources/checkstyle.xml</configLocation> + <suppressionsLocation>./src/main/resources/suppressions.xml</suppressionsLocation> + <includeTestSourceDirectory>true</includeTestSourceDirectory> + <encoding>UTF-8</encoding> + <excludes>**/*.proto</excludes> <!-- Example exclusion --> + </configuration> + <executions> + <execution> + <id>validate-checkstyle</id> + <phase>validate</phase> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <!-- Check that source files have appropriate license headers --> + <groupId>com.mycila</groupId> + <artifactId>license-maven-plugin</artifactId> + <version>4.1</version> + <configuration> + <header>etc/APACHE-2.txt</header> + <excludes> + <exclude>LICENSE</exclude> + <exclude>NOTICE</exclude> + <exclude>payload/**</exclude> + <exclude>**/*.pyc</exclude> + <exclude>**/.pydevproject</exclude> + <exclude>.github/**</exclude> + </excludes> + <mapping> + <benchmark>SCRIPT_STYLE</benchmark> + <j2>SCRIPT_STYLE</j2> + <conf>SCRIPT_STYLE</conf> + <yaml>SCRIPT_STYLE</yaml> + <md>XML_STYLE</md> + <lombok.config>SCRIPT_STYLE</lombok.config> + <puml>APOSTROPHE_STYLE</puml> + </mapping> + </configuration> + <dependencies> + <dependency> + <groupId>com.mycila</groupId> + <artifactId>license-maven-plugin-git</artifactId> + <version>4.1</version> + </dependency> + </dependencies> + <executions> + <execution> + <goals> + <goal>check</goal> + </goals> + <phase>process-sources</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> diff --git a/pulsar-auth-contrib/pom.xml b/pulsar-auth-contrib/pom.xml index 252e4b0..60384ca 100644 --- a/pulsar-auth-contrib/pom.xml +++ b/pulsar-auth-contrib/pom.xml @@ -1,20 +1,30 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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 + + http://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. + +--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>org.optaplanner</groupId> + <groupId>org.apache</groupId> <artifactId>pulsar-java-contrib</artifactId> - <version>9.44.0.Final</version> + <version>29</version> </parent> + <inceptionYear>2024</inceptionYear> <artifactId>pulsar-auth-contrib</artifactId> - <properties> - <maven.compiler.source>21</maven.compiler.source> - <maven.compiler.target>21</maven.compiler.target> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> - </project> \ No newline at end of file diff --git a/pulsar-bookkeeper-contrib/pom.xml b/pulsar-bookkeeper-contrib/pom.xml index f7b94ca..baed5e0 100644 --- a/pulsar-bookkeeper-contrib/pom.xml +++ b/pulsar-bookkeeper-contrib/pom.xml @@ -1,20 +1,31 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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 + + http://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. + +--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>org.optaplanner</groupId> + <groupId>org.apache</groupId> <artifactId>pulsar-java-contrib</artifactId> - <version>9.44.0.Final</version> + <version>29</version> </parent> + <inceptionYear>2024</inceptionYear> <artifactId>pulsar-bookkeeper-contrib</artifactId> - <properties> - <maven.compiler.source>21</maven.compiler.source> - <maven.compiler.target>21</maven.compiler.target> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> </project> \ No newline at end of file diff --git a/pulsar-client-common-contrib/pom.xml b/pulsar-client-common-contrib/pom.xml index 9a46ecb..5c0eeb2 100644 --- a/pulsar-client-common-contrib/pom.xml +++ b/pulsar-client-common-contrib/pom.xml @@ -1,19 +1,33 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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 + + http://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. + +--> + <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>org.acme</groupId> - <artifactId>pulsar-client-common-contrib</artifactId> - <version>1.0-SNAPSHOT</version> + <parent> + <groupId>org.apache</groupId> + <artifactId>pulsar-java-contrib</artifactId> + <version>29</version> + </parent> + <inceptionYear>2024</inceptionYear> - <properties> - <maven.compiler.source>17</maven.compiler.source> - <maven.compiler.target>17</maven.compiler.target> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <pulsar.version>3.0.5</pulsar.version> - </properties> + <artifactId>pulsar-client-common-contrib</artifactId> <dependencies> <dependency> @@ -21,5 +35,17 @@ <artifactId>pulsar-client-all</artifactId> <version>${pulsar.version}</version> </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.13.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <version>RELEASE</version> + <scope>test</scope> + </dependency> </dependencies> </project> \ No newline at end of file diff --git a/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/MessageListenerExecutor.java b/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/MessageListenerExecutor.java index 8334b9b..bc3870f 100644 --- a/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/MessageListenerExecutor.java +++ b/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/MessageListenerExecutor.java @@ -1,45 +1,38 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 + * 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 * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://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. + * 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. */ package org.apache.pulsar.client.api; /** - * Interface for providing service to execute message listeners. - * TODO Duplicate class, to be deleted after merging https://github.com/apache/pulsar/pull/22861 + * Interface for providing service to execute message listeners. TODO Duplicate class, to be deleted + * after merging https://github.com/apache/pulsar/pull/22861 */ public interface MessageListenerExecutor { - /** - * select a thread by message to execute the runnable! - * <p> - * Suggestions: - * <p> - * 1. The message listener task will be submitted to this executor for execution, - * so the implementations of this interface should carefully consider execution - * order if sequential consumption is required. - * </p> - * <p> - * 2. The users should release resources(e.g. threads) of the executor after closing - * the consumer to avoid leaks. - * </p> - * - * @param message the message - * @param runnable the runnable to execute, that is, the message listener task - */ - void execute(Message<?> message, Runnable runnable); + /** + * select a thread by message to execute the runnable! + * + * <p>Suggestions: + * + * <p>1. The message listener task will be submitted to this executor for execution, so the + * implementations of this interface should carefully consider execution order if sequential + * consumption is required. + * + * <p>2. The users should release resources(e.g. threads) of the executor after closing the + * consumer to avoid leaks. + * + * @param message the message + * @param runnable the runnable to execute, that is, the message listener task + */ + void execute(Message<?> message, Runnable runnable); } diff --git a/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/impl/CommonMessageListenerExecutor.java b/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/impl/CommonMessageListenerExecutor.java index acb5898..8f95ef5 100644 --- a/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/impl/CommonMessageListenerExecutor.java +++ b/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/impl/CommonMessageListenerExecutor.java @@ -1,33 +1,51 @@ +/* + * 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 + * + * http://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. + */ package org.apache.pulsar.client.api.impl; -import org.apache.pulsar.client.api.Message; -import org.apache.pulsar.client.api.MessageListenerExecutor; - -import java.nio.charset.StandardCharsets; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.pulsar.client.api.Message; +import org.apache.pulsar.client.api.MessageListenerExecutor; public class CommonMessageListenerExecutor implements MessageListenerExecutor { - private final ExecutorService executorService; + private final ExecutorService executorService; - public CommonMessageListenerExecutor(int numThreads, String subscriptionName) { - this.executorService = new ThreadPoolExecutor(numThreads, numThreads, 10000L, TimeUnit.MILLISECONDS, - new LinkedBlockingQueue<Runnable>(), new ThreadFactory() { - private final AtomicInteger threadId = new AtomicInteger(0); + public CommonMessageListenerExecutor(int numThreads, String subscriptionName) { + this.executorService = + new ThreadPoolExecutor( + numThreads, + numThreads, + 10000L, + TimeUnit.MILLISECONDS, + new LinkedBlockingQueue<Runnable>(), + new ThreadFactory() { + private final AtomicInteger threadId = new AtomicInteger(0); - @Override - public Thread newThread(Runnable r) { - return new Thread(r, subscriptionName + "-listener-executor-" + threadId.incrementAndGet()); - } - }); - } + @Override + public Thread newThread(Runnable r) { + return new Thread( + r, subscriptionName + "-listener-executor-" + threadId.incrementAndGet()); + } + }); + } - @Override - public void execute(Message<?> message, Runnable runnable) { - this.executorService.execute(runnable); - } + @Override + public void execute(Message<?> message, Runnable runnable) { + this.executorService.execute(runnable); + } } diff --git a/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/impl/KeySharedMessageListenerExecutor.java b/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/impl/KeySharedMessageListenerExecutor.java index 8e27bf4..0762572 100644 --- a/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/impl/KeySharedMessageListenerExecutor.java +++ b/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/impl/KeySharedMessageListenerExecutor.java @@ -1,31 +1,45 @@ +/* + * 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 + * + * http://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. + */ package org.apache.pulsar.client.api.impl; +import java.nio.charset.StandardCharsets; +import java.util.concurrent.ExecutorService; import org.apache.pulsar.client.api.Message; import org.apache.pulsar.client.api.MessageListenerExecutor; import org.apache.pulsar.client.util.ExecutorProvider; -import java.nio.charset.StandardCharsets; -import java.util.concurrent.ExecutorService; - public class KeySharedMessageListenerExecutor implements MessageListenerExecutor { - ExecutorProvider executorProvider; - public KeySharedMessageListenerExecutor(int numThreads, String subscriptionName){ - this.executorProvider = new ExecutorProvider(numThreads, subscriptionName + "listener-executor-"); - } + ExecutorProvider executorProvider; + + public KeySharedMessageListenerExecutor(int numThreads, String subscriptionName) { + this.executorProvider = + new ExecutorProvider(numThreads, subscriptionName + "listener-executor-"); + } - @Override - public void execute(Message<?> message, Runnable runnable) { - byte[] key = "".getBytes(StandardCharsets.UTF_8); - if (message.hasKey()) { - key = message.getKeyBytes(); - } else if (message.hasOrderingKey()) { - key = message.getOrderingKey(); - } - // select a thread by message key to execute the runnable! - // that say, the message listener task with same order key - // will be executed by the same thread - ExecutorService executorService = executorProvider.getExecutor(key); - // executorService is a SingleThreadExecutor - executorService.execute(runnable); + @Override + public void execute(Message<?> message, Runnable runnable) { + byte[] key = "".getBytes(StandardCharsets.UTF_8); + if (message.hasKey()) { + key = message.getKeyBytes(); + } else if (message.hasOrderingKey()) { + key = message.getOrderingKey(); } + // select a thread by message key to execute the runnable! + // that say, the message listener task with same order key + // will be executed by the same thread + ExecutorService executorService = executorProvider.getExecutor(key); + // executorService is a SingleThreadExecutor + executorService.execute(runnable); + } } diff --git a/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/impl/PartitionOrderMessageListenerExecutor.java b/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/impl/PartitionOrderMessageListenerExecutor.java index 0fb27cf..e18e496 100644 --- a/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/impl/PartitionOrderMessageListenerExecutor.java +++ b/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/impl/PartitionOrderMessageListenerExecutor.java @@ -1,26 +1,39 @@ +/* + * 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 + * + * http://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. + */ package org.apache.pulsar.client.api.impl; +import java.util.concurrent.ExecutorService; import org.apache.pulsar.client.api.Message; import org.apache.pulsar.client.api.MessageListenerExecutor; import org.apache.pulsar.client.util.ExecutorProvider; -import java.nio.charset.StandardCharsets; -import java.util.concurrent.ExecutorService; - public class PartitionOrderMessageListenerExecutor implements MessageListenerExecutor { - private final ExecutorProvider executorProvider; + private final ExecutorProvider executorProvider; - public PartitionOrderMessageListenerExecutor(int numThreads, String subscriptionName) { - this.executorProvider = new ExecutorProvider(numThreads, subscriptionName + "listener-executor-"); - } + public PartitionOrderMessageListenerExecutor(int numThreads, String subscriptionName) { + this.executorProvider = + new ExecutorProvider(numThreads, subscriptionName + "listener-executor-"); + } - @Override - public void execute(Message<?> message, Runnable runnable) { - // select a thread by partition topic name to execute the runnable! - // that say, the message listener task from the same partition topic - // will be executed by the same thread - ExecutorService executorService = executorProvider.getExecutor(message.getTopicName().getBytes()); - // executorService is a SingleThreadExecutor - executorService.execute(runnable); - } + @Override + public void execute(Message<?> message, Runnable runnable) { + // select a thread by partition topic name to execute the runnable! + // that say, the message listener task from the same partition topic + // will be executed by the same thread + ExecutorService executorService = + executorProvider.getExecutor(message.getTopicName().getBytes()); + // executorService is a SingleThreadExecutor + executorService.execute(runnable); + } } diff --git a/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/impl/package-info.java b/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/impl/package-info.java new file mode 100644 index 0000000..1a92fda --- /dev/null +++ b/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/impl/package-info.java @@ -0,0 +1,14 @@ +/* + * 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 + * + * http://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. + */ +package org.apache.pulsar.client.api.impl; \ No newline at end of file diff --git a/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/package-info.java b/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/package-info.java new file mode 100644 index 0000000..d940e2c --- /dev/null +++ b/pulsar-client-common-contrib/src/main/java/org/apache/pulsar/client/api/package-info.java @@ -0,0 +1,14 @@ +/* + * 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 + * + * http://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. + */ +package org.apache.pulsar.client.api; \ No newline at end of file diff --git a/pulsar-client-common-contrib/src/test/java/DemoTest.java b/pulsar-client-common-contrib/src/test/java/DemoTest.java new file mode 100644 index 0000000..7b2a7c4 --- /dev/null +++ b/pulsar-client-common-contrib/src/test/java/DemoTest.java @@ -0,0 +1,24 @@ +/* + * 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 + * + * http://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. + */ +import lombok.extern.slf4j.Slf4j; +import org.testng.annotations.Test; + +@Slf4j +public class DemoTest { + + @Test + public void testDemo() { + log.info("=== Test started ==="); + } +} diff --git a/pulsar-connector-contrib/pom.xml b/pulsar-connector-contrib/pom.xml index 755edc2..4146a20 100644 --- a/pulsar-connector-contrib/pom.xml +++ b/pulsar-connector-contrib/pom.xml @@ -1,20 +1,29 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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 + + http://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. + +--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>org.optaplanner</groupId> + <groupId>org.apache</groupId> <artifactId>pulsar-java-contrib</artifactId> - <version>9.44.0.Final</version> + <version>29</version> </parent> + <inceptionYear>2024</inceptionYear> <artifactId>pulsar-connector-contrib</artifactId> - - <properties> - <maven.compiler.source>21</maven.compiler.source> - <maven.compiler.target>21</maven.compiler.target> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> - </project> \ No newline at end of file diff --git a/pulsar-function-contrib/pom.xml b/pulsar-function-contrib/pom.xml index ebf242b..e3ac15f 100644 --- a/pulsar-function-contrib/pom.xml +++ b/pulsar-function-contrib/pom.xml @@ -1,20 +1,30 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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 + + http://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. + +--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>org.optaplanner</groupId> + <groupId>org.apache</groupId> <artifactId>pulsar-java-contrib</artifactId> - <version>9.44.0.Final</version> + <version>29</version> </parent> + <inceptionYear>2024</inceptionYear> <artifactId>pulsar-function-contrib</artifactId> - <properties> - <maven.compiler.source>21</maven.compiler.source> - <maven.compiler.target>21</maven.compiler.target> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> - </project> \ No newline at end of file diff --git a/pulsar-interceptor-contrib/pom.xml b/pulsar-interceptor-contrib/pom.xml index 4020f01..131d530 100644 --- a/pulsar-interceptor-contrib/pom.xml +++ b/pulsar-interceptor-contrib/pom.xml @@ -1,20 +1,32 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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 + + http://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. + +--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>org.optaplanner</groupId> + <groupId>org.apache</groupId> <artifactId>pulsar-java-contrib</artifactId> - <version>9.44.0.Final</version> + <version>29</version> </parent> + <inceptionYear>2024</inceptionYear> <artifactId>pulsar-interceptor-contrib</artifactId> - <properties> - <maven.compiler.source>21</maven.compiler.source> - <maven.compiler.target>21</maven.compiler.target> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> + </project> \ No newline at end of file diff --git a/pulsar-loadbalance-contrib/pom.xml b/pulsar-loadbalance-contrib/pom.xml index c00016e..9ee5c57 100644 --- a/pulsar-loadbalance-contrib/pom.xml +++ b/pulsar-loadbalance-contrib/pom.xml @@ -1,20 +1,30 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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 + + http://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. + +--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>org.optaplanner</groupId> + <groupId>org.apache</groupId> <artifactId>pulsar-java-contrib</artifactId> - <version>9.44.0.Final</version> + <version>29</version> </parent> + <inceptionYear>2024</inceptionYear> <artifactId>pulsar-loadbalance-contrib</artifactId> - <properties> - <maven.compiler.source>21</maven.compiler.source> - <maven.compiler.target>21</maven.compiler.target> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> - </project> \ No newline at end of file diff --git a/pulsar-metrics-contrib/pom.xml b/pulsar-metrics-contrib/pom.xml index dbf2539..defaecf 100644 --- a/pulsar-metrics-contrib/pom.xml +++ b/pulsar-metrics-contrib/pom.xml @@ -1,20 +1,29 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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 + + http://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. + +--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>org.optaplanner</groupId> + <groupId>org.apache</groupId> <artifactId>pulsar-java-contrib</artifactId> - <version>9.44.0.Final</version> + <version>29</version> </parent> + <inceptionYear>2024</inceptionYear> <artifactId>pulsar-metrics-contrib</artifactId> - - <properties> - <maven.compiler.source>21</maven.compiler.source> - <maven.compiler.target>21</maven.compiler.target> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> - </project> \ No newline at end of file diff --git a/pulsar-transaction-contrib/pom.xml b/pulsar-transaction-contrib/pom.xml index bbe725b..cda321a 100644 --- a/pulsar-transaction-contrib/pom.xml +++ b/pulsar-transaction-contrib/pom.xml @@ -1,20 +1,30 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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 + + http://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. + +--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>org.optaplanner</groupId> + <groupId>org.apache</groupId> <artifactId>pulsar-java-contrib</artifactId> - <version>9.44.0.Final</version> + <version>29</version> </parent> + <inceptionYear>2024</inceptionYear> <artifactId>pulsar-transaction-contrib</artifactId> - <properties> - <maven.compiler.source>21</maven.compiler.source> - <maven.compiler.target>21</maven.compiler.target> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> - </project> \ No newline at end of file diff --git a/src/main/resources/checkstyle.xml b/src/main/resources/checkstyle.xml new file mode 100644 index 0000000..c56dfb2 --- /dev/null +++ b/src/main/resources/checkstyle.xml @@ -0,0 +1,429 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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 + + http://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. + +--> +<!DOCTYPE module PUBLIC + "-//Puppy Crawl//DTD Check Configuration 1.3//EN" + "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> + +<!-- This is a checkstyle configuration file. For descriptions of +what the following rules do, please see the checkstyle configuration +page at http://checkstyle.sourceforge.net/config.html --> + +<module name="Checker"> + <!-- + + LENGTH and CODING CHECKS + + --> + + <module name="LineLength"> + <!-- Checks if a line is too long. --> + <property name="max" value="120"/> + <property name="severity" value="error"/> + + <!-- Checks only for Java files. --> + <property name="fileExtensions" value="java"/> + + <!-- + The default ignore pattern exempts the following elements: + - import statements + - long URLs inside comments + --> + + <property name="ignorePattern" + value="^(package .*;\s*)|(import .*;\s*)|( *\* .*https?://.*)$"/> + </module> + + <!-- Required to support SuppressWarningsComment --> + <!-- <module name="FileContentsHolder"/>--> + + <module name="SuppressWarningsFilter"/> + + <module name="FileTabCharacter"> + <!-- Checks that there are no tab characters in the file. --> + </module> + + <module name="RegexpSingleline"> + <!-- Checks that TODOs don't have stuff in parenthesis, e.g., username. --> + <property name="format" value="((//.*)|(\*.*))TODO\("/> + <property name="message" value="TODO comments must not include usernames." /> + <property name="severity" value="error" /> + </module> + + <module name="RegexpSingleline"> + <property name="format" value="\s+$"/> + <property name="message" value="Trailing whitespace"/> + <property name="severity" value="error"/> + </module> + + <module name="RegexpSingleline"> + <property name="format" value="Throwables.propagate\("/> + <property name="message" value="Throwables.propagate is deprecated"/> + <property name="severity" value="error"/> + </module> + + <!-- Prevent *Tests.java as tools may not pick them up --> + <module name="RegexpOnFilename"> + <property name="fileNamePattern" value=".*Tests\.java$" /> + </module> + + <module name="SuppressionFilter"> + <property name="file" value="${checkstyle.suppressions.file}" default="suppressions.xml" /> + </module> + + <!-- Check that every module has a package-info.java --> + <module name="JavadocPackage"/> + + <!-- All Java AST specific tests live under TreeWalker module. --> + <module name="TreeWalker"> + + <module name="SuppressionCommentFilter"> + <property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/> + <property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/> + <property name="checkFormat" value="$1"/> + </module> + + <module name="SuppressWarningsHolder" /> + + <module name="TodoComment"> + <!-- Checks that disallowed strings are not used in comments. --> + <property name="format" value="(FIXME)|(XXX)|(@author)" /> + </module> + + <!-- + + IMPORT CHECKS + + --> + + <module name="RedundantImport"> + <!-- Checks for redundant import statements. --> + <property name="severity" value="error"/> + <message key="import.redundancy" + value="Redundant import {0}."/> + </module> + + <module name="ImportOrder"> + <property name="severity" value="error"/> + <!-- This ensures that static imports go first. --> + <property name="option" value="top"/> + <property name="sortStaticImportsAlphabetically" value="true"/> + <property name="tokens" value="STATIC_IMPORT, IMPORT"/> + <message key="import.ordering" + value="Import {0} appears after other imports that it should precede"/> + </module> + + <module name="AvoidStarImport"> + <property name="severity" value="error"/> + </module> + + <module name="IllegalImport"> + <property name="illegalPkgs" + value="autovalue.shaded, avro.shaded, bk-shade, com.google.api.client.repackaged, com.google.appengine.repackaged, org.apache.curator.shaded, org.testcontainers.shaded, org.junit" /> + </module> + + <module name="RedundantModifier"> + <!-- Checks for redundant modifiers on various symbol definitions. + See: http://checkstyle.sourceforge.net/config_modifier.html#RedundantModifier + --> + <property name="tokens" value="METHOD_DEF, VARIABLE_DEF, ANNOTATION_FIELD_DEF, INTERFACE_DEF, CLASS_DEF, ENUM_DEF"/> + </module> + + <!-- + IllegalImport cannot exclude classes, and c.g.api.client.util is used for some shaded + code and some useful code. So we need to fall back to Regexp. + --> + <module name="RegexpSinglelineJava"> + <property name="format" value="com\.google\.api\.client\.util\.(ByteStreams|Charsets|Collections2|Joiner|Lists|Maps|Objects|Preconditions|Sets|Strings|Throwables)"/> + </module> + + <!-- + Require static importing from Preconditions. + --> + <module name="RegexpSinglelineJava"> + <property name="format" value="^import com.google.common.base.Preconditions;$"/> + <property name="message" value="Static import functions from Guava Preconditions"/> + </module> + + <module name="UnusedImports"> + <property name="severity" value="error"/> + <property name="processJavadoc" value="true"/> + <message key="import.unused" + value="Unused import: {0}."/> + </module> + + <!-- + + JAVADOC CHECKS + + --> + + <!-- Checks for Javadoc comments. --> + <!-- See http://checkstyle.sf.net/config_javadoc.html --> + <module name="JavadocMethod"> + <property name="accessModifiers" value="protected"/> + <property name="severity" value="error"/> + <property name="allowMissingParamTags" value="true"/> + <property name="allowMissingReturnTag" value="true"/> + </module> + + <!-- Check that paragraph tags are used correctly in Javadoc. --> + <!-- <module name="JavadocParagraph"/>--> + + <module name="JavadocType"> + <property name="scope" value="protected"/> + <property name="severity" value="error"/> + <property name="allowMissingParamTags" value="true"/> + </module> + + <module name="JavadocStyle"> + <property name="severity" value="error"/> + <property name="checkHtml" value="true"/> + </module> + + <!-- + + NAMING CHECKS + + --> + + <!-- Item 38 - Adhere to generally accepted naming conventions --> + + <module name="PackageName"> + <!-- Validates identifiers for package names against the + supplied expression. --> + <!-- Here the default checkstyle rule restricts package name parts to + seven characters, this is not in line with common practice at Google. + --> + <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]{1,})*$"/> + <property name="severity" value="error"/> + </module> + + <module name="TypeNameCheck"> + <!-- Validates static, final fields against the + expression "^[A-Z][a-zA-Z0-9]*$". --> + <metadata name="altname" value="TypeName"/> + <property name="severity" value="error"/> + </module> + + <module name="ConstantNameCheck"> + <!-- Validates non-private, static, final fields against the supplied + public/package final fields "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$". --> + <metadata name="altname" value="ConstantName"/> + <property name="applyToPublic" value="true"/> + <property name="applyToProtected" value="true"/> + <property name="applyToPackage" value="true"/> + <property name="applyToPrivate" value="false"/> + <property name="format" value="^([A-Z][A-Za-z0-9_]*|FLAG_.*)$"/> + <message key="name.invalidPattern" + value="Variable ''{0}'' should be in ALL_CAPS (if it is a constant) or be private (otherwise)."/> + <property name="severity" value="error"/> + </module> + + <module name="StaticVariableNameCheck"> + <!-- Validates static, non-final fields against the supplied + expression "^[a-z][a-zA-Z0-9]*_?$". --> + <metadata name="altname" value="StaticVariableName"/> + <property name="applyToPublic" value="true"/> + <property name="applyToProtected" value="true"/> + <property name="applyToPackage" value="true"/> + <property name="applyToPrivate" value="true"/> + <property name="format" value="^[a-z][a-zA-Z0-9]*_?$"/> + <property name="severity" value="error"/> + </module> + + <module name="MemberNameCheck"> + <!-- Validates non-static members against the supplied expression. --> + <metadata name="altname" value="MemberName"/> + <property name="applyToPublic" value="true"/> + <property name="applyToProtected" value="true"/> + <property name="applyToPackage" value="true"/> + <property name="applyToPrivate" value="true"/> + <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> + <property name="severity" value="error"/> + </module> + + <module name="MethodNameCheck"> + <!-- Validates identifiers for method names. --> + <metadata name="altname" value="MethodName"/> + <property name="format" value="(^[a-z][a-zA-Z0-9]*(_[a-zA-Z0-9]+)*$|Void)"/> + <property name="severity" value="error"/> + </module> + + <module name="ParameterName"> + <!-- Validates identifiers for method parameters against the + expression "^[a-z][a-zA-Z0-9]*$". --> + <property name="severity" value="error"/> + </module> + + <module name="LocalFinalVariableName"> + <!-- Validates identifiers for local final variables against the + expression "^[a-z][a-zA-Z0-9]*$". --> + <property name="severity" value="error"/> + </module> + + <module name="LocalVariableName"> + <!-- Validates identifiers for local variables against the + expression "^[a-z][a-zA-Z0-9]*$". --> + <property name="severity" value="error"/> + </module> + + <!-- Type parameters must be either one of the four blessed letters + T, K, V, W, X or else be capital-case terminated with a T, + such as MyGenericParameterT --> + <module name="ClassTypeParameterName"> + <property name="format" value="^(((T|K|V|W|X|R)[0-9]*)|([A-Z][a-z][a-zA-Z]*))$"/> + <property name="severity" value="error"/> + </module> + + <module name="MethodTypeParameterName"> + <property name="format" value="^(((T|K|V|W|X|R)[0-9]*)|([A-Z][a-z][a-zA-Z]*T))$"/> + <property name="severity" value="error"/> + </module> + + <module name="InterfaceTypeParameterName"> + <property name="format" value="^(((T|K|V|W|X|R)[0-9]*)|([A-Z][a-z][a-zA-Z]*T))$"/> + <property name="severity" value="error"/> + </module> + + <module name="LeftCurly"> + <!-- Checks for placement of the left curly brace ('{'). --> + <property name="severity" value="error"/> + </module> + + <module name="RightCurly"> + <!-- Checks right curlies on CATCH, ELSE, and TRY blocks are on + the same line. e.g., the following example is fine: + <pre> + if { + ... + } else + </pre> + --> + <!-- This next example is not fine: + <pre> + if { + ... + } + else + </pre> + --> + <property name="option" value="same"/> + <property name="severity" value="error"/> + </module> + + <!-- Checks for braces around if and else blocks --> + <module name="NeedBraces"> + <property name="severity" value="error"/> + <property name="tokens" value="LITERAL_IF, LITERAL_ELSE, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO"/> + </module> + + <module name="UpperEll"> + <!-- Checks that long constants are defined with an upper ell.--> + <property name="severity" value="error"/> + </module> + + <module name="FallThrough"> + <!-- Warn about falling through to the next case statement. Similar to + javac -Xlint:fallthrough, but the check is suppressed if a single-line comment + on the last non-blank line preceding the fallen-into case contains 'fall through' (or + some other variants that we don't publicized to promote consistency). + --> + <property name="reliefPattern" + value="fall through|Fall through|fallthru|Fallthru|falls through|Falls through|fallthrough|Fallthrough|No break|NO break|no break|continue on"/> + <property name="severity" value="error"/> + </module> + + <!-- Checks for over-complicated boolean expressions. --> + <module name="SimplifyBooleanExpression"/> + + <!-- Detects empty statements (standalone ";" semicolon). --> + <module name="EmptyStatement"/> + + <!-- + + WHITESPACE CHECKS + + --> + + <module name="WhitespaceAround"> + <!-- Checks that various tokens are surrounded by whitespace. + This includes most binary operators and keywords followed + by regular or curly braces. + --> + <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, + BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, + EQUAL, GE, GT, LAND, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, + LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, + LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, + MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, + SL, SL_ASSIGN, SR_ASSIGN, STAR, STAR_ASSIGN"/> + <property name="severity" value="error"/> + </module> + + <module name="WhitespaceAfter"> + <!-- Checks that commas, semicolons and typecasts are followed by + whitespace. + --> + <property name="tokens" value="COMMA, SEMI, TYPECAST"/> + </module> + + <module name="NoWhitespaceAfter"> + <!-- Checks that there is no whitespace after various unary operators. + Linebreaks are allowed. + --> + <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, + UNARY_PLUS"/> + <property name="allowLineBreaks" value="true"/> + <property name="severity" value="error"/> + </module> + + <module name="NoWhitespaceBefore"> + <!-- Checks that there is no whitespace before various unary operators. + Linebreaks are allowed. + --> + <property name="tokens" value="SEMI, DOT, POST_DEC, POST_INC"/> + <property name="allowLineBreaks" value="true"/> + <property name="severity" value="error"/> + </module> + + <module name="OperatorWrap"> + <!-- Checks that operators like + and ? appear at newlines rather than + at the end of the previous line. + --> + <property name="option" value="NL"/> + <property name="tokens" value="BAND, BOR, BSR, BXOR, DIV, EQUAL, + GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, + NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR "/> + </module> + + <module name="OperatorWrap"> + <!-- Checks that assignment operators are at the end of the line. --> + <property name="option" value="eol"/> + <property name="tokens" value="ASSIGN"/> + </module> + + <module name="ParenPad"> + <!-- Checks that there is no whitespace before close parens or after + open parens. + --> + <property name="severity" value="error"/> + </module> + + <module name="ModifierOrder"/> + + </module> +</module> diff --git a/src/main/resources/suppressions.xml b/src/main/resources/suppressions.xml new file mode 100644 index 0000000..b09e0a8 --- /dev/null +++ b/src/main/resources/suppressions.xml @@ -0,0 +1,82 @@ +<?xml version="1.0"?> +<!-- + + 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 + + http://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. + +--> +<!DOCTYPE suppressions PUBLIC + "-//Puppy Crawl//DTD Suppressions 1.1//EN" + "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd"> + +<suppressions> + <suppress checks="JavadocPackage" files=".*[\\/]src[\\/]test[\\/].*"/> + <suppress checks="JavadocPackage" files=".*[\\/]maven-archetypes[\\/].*"/> + <suppress checks="JavadocPackage" files=".*[\\/]examples[\\/].*"/> + + <!-- suppress javadoc check for impl classes and package-info.java --> + <suppress checks="JavadocType" files=".*Impl\.java$" /> + <suppress checks="JavadocStyle" files=".+[\\/]package-info\.java$" /> + + <!-- suppress all checks in the generated directories --> + <suppress checks=".*" files=".+[\\/]generated[\\/].+\.java"/> + <suppress checks=".*" files=".+[\\/]generated-sources[\\/].+\.java"/> + <suppress checks=".*" files=".+[\\/]generated-test-sources[\\/].+\.java"/> + + <!-- suppress most all checks expect below--> + <suppress checks="^(?!.*(UnusedImports|IllegalImport)).*$" files=".*[\\/]src[\\/]test[\\/].*"/> + + <suppress checks="IllegalImport" files="ProxyServiceStarter.java"/> + + <!-- suppress all checks in the copied code --> + <suppress checks=".*" files=".+[\\/]com[\\/]scurrilous[\\/]circe[\\/].+\.java"/> + + <suppress checks=".*" files="MLDataFormats.java"/> + <suppress checks=".*" files="BitSetRecyclable.java"/> + <!-- pulsar io --> + <suppress checks="RegexpSinglelineJava" files="KafkaConnectData.java"/> + <suppress checks="LineLength" files="KafkaConnectData.java"/> + <suppress checks="RegexpSinglelineJava" files="KafkaConnectSink.java"/> + <!-- pulsar io es --> + <suppress checks="LineLength" files="ElasticSearchConfig.java"/> + <suppress checks="LineLength" files="ElasticSearchClient.java"/> + <!-- pulsar io flume --> + <suppress checks="RegexpSingleline" files="Application.java"/> + <suppress checks="RegexpSinglelineJava" files="AbstractConfigurationProvider.java"/> + <suppress checks="RegexpSinglelineJava" files="AbstractZooKeeperConfigurationProvider.java"/> + <suppress checks="RegexpSinglelineJava" files="PollingPropertiesFileConfigurationProvider.java"/> + <suppress checks="RegexpSinglelineJava" files="EnvVarResolverProperties.java"/> + <!-- pulsar io hbase --> + <suppress checks="RegexpSinglelineJava" files="HbaseAbstractSink.java"/> + <suppress checks="RegexpSinglelineJava" files="HbaseAbstractConfig.java"/> + <suppress checks="RegexpSinglelineJava" files="HbaseSinkConfig.java"/> + <!-- pulsar io kafka --> + <suppress checks="FallThrough" files="KafkaConnectData.java"/> + <!-- pulsar io influxdb --> + <suppress checks="RegexpSinglelineJava" files="InfluxDBSinkConfig.java"/> + <!-- pulsar io kinesis --> + <suppress checks="LineLength" files="KinesisSinkConfig.java"/> + <suppress checks="LineLength" files="KinesisSink.java"/> + <suppress checks=".*" files=".+[\\/]org[\\/]apache[\\/]pulsar[\\/]io[\\/]kinesis[\\/]fbs[\\/].+.java"/> + <!-- pulsar io mongo --> + <suppress checks="RegexpSinglelineJava" files="MongoSink.java"/> + <suppress checks="RegexpSinglelineJava" files="MongoConfig.java"/> + <!-- pulsar io rabbitmq --> + <suppress checks="RegexpSinglelineJava" files="RabbitMQAbstractConfig.java"/> + <suppress checks="RegexpSinglelineJava" files="RabbitMQSourceConfig.java"/> + <suppress checks="RegexpSinglelineJava" files="RabbitMQSinkConfig.java"/> + <!-- pulsar io reids --> + <suppress checks="RegexpSinglelineJava" files="RedisAbstractConfig.java"/> + <suppress checks="RegexpSinglelineJava" files="RedisSinkConfig.java"/> + <!-- pulsar io solr --> + <suppress checks="RegexpSinglelineJava" files="SolrSinkConfig.java"/> +</suppressions>
