From 637d461875e6076bc6d0dbca2a80919d283e7af7 Mon Sep 17 00:00:00 2001 From: Peter Somogyvari Date: Wed, 10 Jul 2024 20:47:08 -0700 Subject: [PATCH] test(connector-corda): consolidate redundant and broken test cases 1. We can have sufficient coverage with a much lower number of test cases. 2. The plan is to focus on supporting Corda v4.12.x going forward. 3. This change will also bring easier maintenance and incrased CI performance. Signed-off-by: Peter Somogyvari --- .github/workflows/ci.yaml | 33 +- ...rda-4-6-all-in-one-obligation-publish.yaml | 57 --- ...rda-4-7-all-in-one-obligation-publish.yaml | 56 --- ...rda-4-8-all-in-one-obligation-publish.yaml | 56 --- .taprc | 6 - .../cactus-plugin-ledger-connector-corda.md | 3 +- docs/docs/cactus/support/corda.md | 89 ---- jest.config.js | 6 - .../README.md | 4 +- .../deploy-cordapp-jars-to-nodes-v4.7.test.ts | 392 ----------------- ...cordapp-jars-to-nodes-v4.8-express.test.ts | 392 ----------------- .../deploy-cordapp-jars-to-nodes-v4.8.test.ts | 393 ----------------- .../deploy-cordapp-jars-to-nodes.test.ts | 397 ------------------ .../jvm-kotlin-spring-server-v4.7.test.ts | 196 --------- .../jvm-kotlin-spring-server-v4.8.test.ts | 197 --------- tools/docker/corda-all-in-one/Dockerfile | 154 ------- tools/docker/corda-all-in-one/README.md | 128 ------ .../corda-all-in-one/corda-v4_8/Dockerfile | 147 ------- tools/docker/corda-all-in-one/healthcheck.sh | 34 -- .../corda-all-in-one/run-notary-node.sh | 13 - .../corda-all-in-one/run-party-a-node.sh | 9 - .../corda-all-in-one/run-party-a-server.sh | 9 - .../corda-all-in-one/run-party-b-node.sh | 9 - .../corda-all-in-one/run-party-b-server.sh | 9 - .../corda-all-in-one/run-party-c-node.sh | 13 - .../corda-all-in-one/run-party-c-server.sh | 9 - .../docker/corda-all-in-one/supervisord.conf | 108 ----- 27 files changed, 6 insertions(+), 2913 deletions(-) delete mode 100644 .github/workflows/corda-4-6-all-in-one-obligation-publish.yaml delete mode 100644 .github/workflows/corda-4-7-all-in-one-obligation-publish.yaml delete mode 100644 .github/workflows/corda-4-8-all-in-one-obligation-publish.yaml delete mode 100644 packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.7.test.ts delete mode 100644 packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.8-express.test.ts delete mode 100644 packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.8.test.ts delete mode 100644 packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes.test.ts delete mode 100644 packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server-v4.7.test.ts delete mode 100644 packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server-v4.8.test.ts delete mode 100644 tools/docker/corda-all-in-one/Dockerfile delete mode 100644 tools/docker/corda-all-in-one/README.md delete mode 100644 tools/docker/corda-all-in-one/corda-v4_8/Dockerfile delete mode 100755 tools/docker/corda-all-in-one/healthcheck.sh delete mode 100755 tools/docker/corda-all-in-one/run-notary-node.sh delete mode 100755 tools/docker/corda-all-in-one/run-party-a-node.sh delete mode 100755 tools/docker/corda-all-in-one/run-party-a-server.sh delete mode 100755 tools/docker/corda-all-in-one/run-party-b-node.sh delete mode 100755 tools/docker/corda-all-in-one/run-party-b-server.sh delete mode 100755 tools/docker/corda-all-in-one/run-party-c-node.sh delete mode 100755 tools/docker/corda-all-in-one/run-party-c-server.sh delete mode 100644 tools/docker/corda-all-in-one/supervisord.conf diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 54aba571aa..e84dd451af 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -41,8 +41,6 @@ jobs: plugin-ledger-connector-stellar-changed: ${{ steps.changes.outputs.plugin-ledger-connector-stellar-changed }} plugin-htlc-coordinator-besu-changed: ${{ steps.changes.outputs.plugin-htlc-coordinator-besu-changed }} test-tooling-changed: ${{ steps.changes.outputs.test-tooling-changed }} - ghcr-corda-all-in-one-obligation-changed: ${{ steps.changes.outputs.ghcr-corda-all-in-one-obligation-changed }} - ghcr-corda-all-in-one-changed: ${{ steps.changes.outputs.ghcr-corda-all-in-one-changed }} ghcr-dev-container-vscode-changed: ${{ steps.changes.outputs.ghcr-dev-container-vscode-changed }} runs-on: ubuntu-22.04 steps: @@ -138,14 +136,6 @@ jobs: - './packages/cactus-common/**' # - './.github/workflows/ci.yaml' - ghcr-corda-all-in-one-obligation-changed: - - './tools/docker/corda-all-in-one/**' - # - './.github/workflows/ci.yaml' - - ghcr-corda-all-in-one-changed: - - './tools/docker/corda-all-in-one/**' - # - './.github/workflows/ci.yaml' - ghcr-dev-container-vscode-changed: - './.devcontainer/**' @@ -1146,7 +1136,7 @@ jobs: JEST_TEST_PATTERN: packages/cactus-plugin-ledger-connector-corda/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts JEST_TEST_RUNNER_DISABLED: false TAPE_TEST_PATTERN: >- - --files={./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.7.test.ts,./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.8-express.test.ts,./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.8.test.ts,./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes.test.ts,./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/flow-database-access-v4.8.test.ts,./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server-v4.7.test.ts,./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server-v4.8.test.ts,./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/openapi/openapi-validation.test.ts} + --files={./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/flow-database-access-v4.8.test.ts,./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/openapi/openapi-validation.test.ts} TAPE_TEST_RUNNER_DISABLED: false runs-on: ubuntu-22.04 steps: @@ -2200,32 +2190,13 @@ jobs: ignore-unfixed: false vuln-type: 'os,library' severity: 'CRITICAL,HIGH' - ghcr-corda-all-in-one: - runs-on: ubuntu-22.04 - needs: - - compute_changed_packages - if: needs.compute_changed_packages.outputs.ghcr-corda-all-in-one-changed == 'true' - steps: - - uses: actions/checkout@v4.1.1 - - name: ghcr.io/hyperledger/cactus-corda-all-in-one - run: DOCKER_BUILDKIT=1 docker build ./tools/docker/corda-all-in-one/ -f ./tools/docker/corda-all-in-one/Dockerfile - ghcr-corda-all-in-one-flowdb: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4.1.1 - name: ghcr.io/hyperledger/cactus-corda-all-in-one-flowdb run: DOCKER_BUILDKIT=1 docker build ./tools/docker/corda-all-in-one/corda-v4_8-flowdb/ - ghcr-corda-all-in-one-obligation: - runs-on: ubuntu-22.04 - needs: - - compute_changed_packages - if: needs.compute_changed_packages.outputs.ghcr-corda-all-in-one-obligation-changed == 'true' - steps: - - uses: actions/checkout@v4.1.1 - - name: ghcr.io/hyperledger/cactus-corda-all-in-one-obligation - run: DOCKER_BUILDKIT=1 docker build ./tools/docker/corda-all-in-one/ -f ./tools/docker/corda-all-in-one/corda-v4_8/Dockerfile -t cactus-corda-all-in-one-obligation - + ghcr-dev-container-vscode: runs-on: ubuntu-22.04 needs: diff --git a/.github/workflows/corda-4-6-all-in-one-obligation-publish.yaml b/.github/workflows/corda-4-6-all-in-one-obligation-publish.yaml deleted file mode 100644 index 306f2ce430..0000000000 --- a/.github/workflows/corda-4-6-all-in-one-obligation-publish.yaml +++ /dev/null @@ -1,57 +0,0 @@ -name: corda-4-6-all-in-one-obligation-publish - -on: - # Publish `v1.2.3` tags as releases. - push: - tags: - - v* - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -env: - IMAGE_NAME: corda-4-6-all-in-one-obligation - -jobs: - # Push image to GitHub Packages. - # See also https://docs.docker.com/docker-hub/builds/ - build-tag-push-container: - runs-on: ubuntu-22.04 - env: - DOCKER_BUILDKIT: 1 - # FIXME: build arguments are needed to make it version 4.6 (default is 4.7) - DOCKERFILE_PATH: ./tools/docker/corda-all-in-one/Dockerfile - DOCKER_BUILD_DIR: ./tools/docker/corda-all-in-one/ - permissions: - packages: write - contents: read - - steps: - - uses: actions/checkout@v4.1.1 - - - name: Build image - run: docker build "$DOCKER_BUILD_DIR" --file "$DOCKERFILE_PATH" --tag "$IMAGE_NAME" --label "runnumber=${GITHUB_RUN_ID}" - - - name: Log in to registry - # This is where you will update the PAT to GITHUB_TOKEN - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - - name: Push image - run: | - SHORTHASH=$(git rev-parse --short "$GITHUB_SHA") - TODAYS_DATE="$(date +%F)" - DOCKER_TAG="$TODAYS_DATE-$SHORTHASH" - IMAGE_ID="ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME" - # Change all uppercase to lowercase - IMAGE_ID=$(echo "$IMAGE_ID" | tr '[:upper:]' '[:lower:]') - # Strip git ref prefix from version - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - # Strip "v" prefix from tag name - [[ "${{ github.ref }}" == "refs/tags/*" ]] && VERSION="${VERSION//^v//}" - # Do not use the `latest` tag at all, tag with date + git short hash if there is no git tag - [ "$VERSION" == "main" ] && VERSION=$DOCKER_TAG - echo IMAGE_ID="$IMAGE_ID" - echo VERSION="$VERSION" - docker tag "$IMAGE_NAME" "$IMAGE_ID:$VERSION" - docker push "$IMAGE_ID:$VERSION" diff --git a/.github/workflows/corda-4-7-all-in-one-obligation-publish.yaml b/.github/workflows/corda-4-7-all-in-one-obligation-publish.yaml deleted file mode 100644 index 8c4f32af9a..0000000000 --- a/.github/workflows/corda-4-7-all-in-one-obligation-publish.yaml +++ /dev/null @@ -1,56 +0,0 @@ -name: corda-4-7-all-in-one-obligation-publish - -on: - # Publish `v1.2.3` tags as releases. - push: - tags: - - v* - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -env: - IMAGE_NAME: cactus-corda-4-7-all-in-one-obligation - -jobs: - # Push image to GitHub Packages. - # See also https://docs.docker.com/docker-hub/builds/ - build-tag-push-container: - runs-on: ubuntu-22.04 - env: - DOCKER_BUILDKIT: 1 - DOCKERFILE_PATH: ./tools/docker/corda-all-in-one/Dockerfile - DOCKER_BUILD_DIR: ./tools/docker/corda-all-in-one/ - permissions: - packages: write - contents: read - - steps: - - uses: actions/checkout@v4.1.1 - - - name: Build image - run: docker build "$DOCKER_BUILD_DIR" --file "$DOCKERFILE_PATH" --tag "$IMAGE_NAME" --label "runnumber=${GITHUB_RUN_ID}" - - - name: Log in to registry - # This is where you will update the PAT to GITHUB_TOKEN - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - - name: Push image - run: | - SHORTHASH=$(git rev-parse --short "$GITHUB_SHA") - TODAYS_DATE="$(date +%F)" - DOCKER_TAG="$TODAYS_DATE-$SHORTHASH" - IMAGE_ID="ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME" - # Change all uppercase to lowercase - IMAGE_ID=$(echo "$IMAGE_ID" | tr '[:upper:]' '[:lower:]') - # Strip git ref prefix from version - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - # Strip "v" prefix from tag name - [[ "${{ github.ref }}" == "refs/tags/*" ]] && VERSION="${VERSION//^v//}" - # Do not use the `latest` tag at all, tag with date + git short hash if there is no git tag - [ "$VERSION" == "main" ] && VERSION=$DOCKER_TAG - echo IMAGE_ID="$IMAGE_ID" - echo VERSION="$VERSION" - docker tag "$IMAGE_NAME" "$IMAGE_ID:$VERSION" - docker push "$IMAGE_ID:$VERSION" diff --git a/.github/workflows/corda-4-8-all-in-one-obligation-publish.yaml b/.github/workflows/corda-4-8-all-in-one-obligation-publish.yaml deleted file mode 100644 index 959ed3e95c..0000000000 --- a/.github/workflows/corda-4-8-all-in-one-obligation-publish.yaml +++ /dev/null @@ -1,56 +0,0 @@ -name: corda-4-8-all-in-one-obligation-publish - -on: - # Publish `v1.2.3` tags as releases. - push: - tags: - - v* - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -env: - IMAGE_NAME: cactus-corda-4-8-all-in-one-obligation - -jobs: - # Push image to GitHub Packages. - # See also https://docs.docker.com/docker-hub/builds/ - build-tag-push-container: - runs-on: ubuntu-22.04 - env: - DOCKER_BUILDKIT: 1 - DOCKERFILE_PATH: ./tools/docker/corda-all-in-one/corda-v4_8/Dockerfile - DOCKER_BUILD_DIR: ./tools/docker/corda-all-in-one/ - permissions: - packages: write - contents: read - - steps: - - uses: actions/checkout@v4.1.1 - - - name: Build image - run: docker build "$DOCKER_BUILD_DIR" --file "$DOCKERFILE_PATH" --tag "$IMAGE_NAME" --label "runnumber=${GITHUB_RUN_ID}" - - - name: Log in to registry - # This is where you will update the PAT to GITHUB_TOKEN - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - - name: Push image - run: | - SHORTHASH=$(git rev-parse --short "$GITHUB_SHA") - TODAYS_DATE="$(date +%F)" - DOCKER_TAG="$TODAYS_DATE-$SHORTHASH" - IMAGE_ID="ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME" - # Change all uppercase to lowercase - IMAGE_ID=$(echo "$IMAGE_ID" | tr '[:upper:]' '[:lower:]') - # Strip git ref prefix from version - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - # Strip "v" prefix from tag name - [[ "${{ github.ref }}" == "refs/tags/*" ]] && VERSION="${VERSION//^v//}" - # Do not use the `latest` tag at all, tag with date + git short hash if there is no git tag - [ "$VERSION" == "main" ] && VERSION=$DOCKER_TAG - echo IMAGE_ID="$IMAGE_ID" - echo VERSION="$VERSION" - docker tag "$IMAGE_NAME" "$IMAGE_ID:$VERSION" - docker push "$IMAGE_ID:$VERSION" diff --git a/.taprc b/.taprc index 47a5712068..99284f4332 100644 --- a/.taprc +++ b/.taprc @@ -5,7 +5,6 @@ jobs: 1 timeout: 3600 ts: true files: - - ./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.8-express.test.ts - ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/add-orgs.test.ts - ./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/obtain-profiles.test.ts - ./packages/cactus-plugin-keychain-google-sm/src/test/typescript/integration/openapi/openapi-validation.test.ts @@ -17,11 +16,6 @@ files: - ./packages/cactus-test-plugin-htlc-eth-besu-erc20/src/test/typescript/integration/plugin-htlc-eth-besu-erc20/refund-endpoint.test.ts - ./packages/cactus-test-cmd-api-server/src/test/typescript/integration/plugin-import-with-npm-install-version-selection.test.ts - ./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/openapi/openapi-validation.test.ts - - ./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.7.test.ts - - ./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server-v4.7.test.ts - - ./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server-v4.8.test.ts - - ./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes.test.ts - - ./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.8.test.ts - ./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/flow-database-access-v4.8.test.ts - ./packages/cactus-plugin-keychain-google-sm/src/test/typescript/integration/plugin-factory-keychain.test.ts - ./packages/cactus-plugin-keychain-google-sm/src/test/typescript/integration/plugin-keychain-google-sm.test.ts diff --git a/docs/docs/cactus/packages/cactus-plugin-ledger-connector-corda.md b/docs/docs/cactus/packages/cactus-plugin-ledger-connector-corda.md index d4e55a8f53..ee79aa6a72 100644 --- a/docs/docs/cactus/packages/cactus-plugin-ledger-connector-corda.md +++ b/docs/docs/cactus/packages/cactus-plugin-ledger-connector-corda.md @@ -557,7 +557,8 @@ To use Prometheus with this exporter make sure to install [Prometheus main compo static\_configs: - targets: \['{host}:{port}'\] -Here the `host:port` is where the prometheus exporter metrics are exposed. The test cases (For example, packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes.test.ts) exposes it over `0.0.0.0` and a random port(). The random port can be found in the running logs of the test case and looks like (42379 in the below mentioned URL) `Metrics URL: http://0.0.0.0:42379/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-prometheus-exporter-metrics` +Here the `host:port` is where the prometheus exporter metrics are exposed. An example URL for metric would be something like this: +`http://localhost:42379/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-prometheus-exporter-metrics` Once edited, you can start the prometheus service by referencing the above edited prometheus.yml file. On the prometheus graphical interface (defaulted to http://localhost:9090), choose **Graph** from the menu bar, then select the **Console** tab. From the **Insert metric at cursor** drop down, select **cactus\_corda\_total\_tx\_count** and click **execute** diff --git a/docs/docs/cactus/support/corda.md b/docs/docs/cactus/support/corda.md index 1cb5cfdcae..814404a21a 100644 --- a/docs/docs/cactus/support/corda.md +++ b/docs/docs/cactus/support/corda.md @@ -39,95 +39,6 @@ Corda 4.5 ✅ test -Hyperledger Cactus v0.8.0 - -Corda version - -deployContract\* - -invokeContract - -runTransaction - -Corda 4.5 - -✅ [test](https://github.com/hyperledger/cactus/blob/v0.8.0/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes.test.ts) - -✅ [test](https://github.com/hyperledger/cactus/blob/v0.8.0/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server.test.ts) - -✅ [test](https://github.com/hyperledger/cactus/blob/v0.8.0/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server.test.ts) - -Hyperledger Cactus v0.7.0 - -Corda version - -deployContract\* - -invokeContract - -runTransaction - -Corda 4.5 - -✅ [test](https://github.com/hyperledger/cactus/blob/v0.7.0/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes.test.ts) - -✅ [test](https://github.com/hyperledger/cactus/blob/v0.7.0/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server.test.ts) - -✅ [test](https://github.com/hyperledger/cactus/blob/v0.7.0/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server.test.ts) - -Hyperledger Cactus v0.6.0 - -Corda version - -deployContract\* - -invokeContract - -runTransaction - -Corda 4.5 - -✅ [test](https://github.com/hyperledger/cactus/blob/v0.6.0/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes.test.ts) - -✅ [test](https://github.com/hyperledger/cactus/blob/v0.6.0/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server.test.ts) - -✅ [test](https://github.com/hyperledger/cactus/blob/v0.6.0/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server.test.ts) - -Hyperledger Cactus v0.5.0 - -Corda version - -deployContract\* - -invokeContract - -runTransaction - -Corda 4.5 - -✅ [test](https://github.com/hyperledger/cactus/blob/v0.5.0/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes.test.ts) - -✅ [test](https://github.com/hyperledger/cactus/blob/v0.5.0/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server.test.ts) - -✅ [test](https://github.com/hyperledger/cactus/blob/v0.5.0/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server.test.ts) - -Hyperledger Cactus v0.4.1 - -Corda version - -deployContract\* - -invokeContract - -runTransaction - -Corda 4.5 - -✅ [test](https://github.com/hyperledger/cactus/blob/v0.4.1/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes.test.ts) - -✅ [test](https://github.com/hyperledger/cactus/blob/v0.4.1/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server.test.ts) - -✅ [test](https://github.com/hyperledger/cactus/blob/v0.4.1/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server.test.ts) diff --git a/jest.config.js b/jest.config.js index 01e5103a63..5e76bb7d59 100644 --- a/jest.config.js +++ b/jest.config.js @@ -16,7 +16,6 @@ module.exports = { ], // Ignore the tests that are still using tap/tape for as their test runner testPathIgnorePatterns: [ - `./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.8-express.test.ts`, `./packages/cactus-plugin-ledger-connector-ethereum/src/test/typescript/manual/geth-alchemy-integration-manual-check.test.ts`, `./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/add-orgs.test.ts`, `./packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/obtain-profiles.test.ts`, @@ -29,11 +28,6 @@ module.exports = { `./packages/cactus-test-plugin-htlc-eth-besu-erc20/src/test/typescript/integration/plugin-htlc-eth-besu-erc20/refund-endpoint.test.ts`, `./packages/cactus-test-cmd-api-server/src/test/typescript/integration/plugin-import-with-npm-install-version-selection.test.ts`, `./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/openapi/openapi-validation.test.ts`, - `./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.7.test.ts`, - `./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server-v4.7.test.ts`, - `./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server-v4.8.test.ts`, - `./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes.test.ts`, - `./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.8.test.ts`, `./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/flow-database-access-v4.8.test.ts`, `./packages/cactus-plugin-keychain-google-sm/src/test/typescript/integration/plugin-factory-keychain.test.ts`, `./packages/cactus-plugin-keychain-google-sm/src/test/typescript/integration/plugin-keychain-google-sm.test.ts`, diff --git a/packages/cactus-plugin-ledger-connector-corda/README.md b/packages/cactus-plugin-ledger-connector-corda/README.md index 480b720aa9..c89eae3af1 100644 --- a/packages/cactus-plugin-ledger-connector-corda/README.md +++ b/packages/cactus-plugin-ledger-connector-corda/README.md @@ -696,8 +696,8 @@ Once Prometheus is setup, the corresponding scrape_config needs to be added to t - targets: ['{host}:{port}'] ``` -Here the `host:port` is where the prometheus exporter metrics are exposed. The test cases (For example, packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes.test.ts) exposes it over `0.0.0.0` and a random port(). The random port can be found in the running logs of the test case and looks like (42379 in the below mentioned URL) -`Metrics URL: http://0.0.0.0:42379/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-prometheus-exporter-metrics` +Here the `host:port` is where the prometheus exporter metrics are exposed. +Example metrics URL: `http://localhost:42379/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-prometheus-exporter-metrics` Once edited, you can start the prometheus service by referencing the above edited prometheus.yml file. On the prometheus graphical interface (defaulted to http://localhost:9090), choose **Graph** from the menu bar, then select the **Console** tab. From the **Insert metric at cursor** drop down, select **cactus_corda_total_tx_count** and click **execute** diff --git a/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.7.test.ts b/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.7.test.ts deleted file mode 100644 index 024260f04d..0000000000 --- a/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.7.test.ts +++ /dev/null @@ -1,392 +0,0 @@ -import test, { Test } from "tape-promise/tape"; -import { v4 as internalIpV4 } from "internal-ip"; -import { v4 as uuidv4 } from "uuid"; -import http from "http"; -import bodyParser from "body-parser"; -import express from "express"; -import { AddressInfo } from "net"; - -import { Containers, CordaTestLedger } from "@hyperledger/cactus-test-tooling"; -import { - LogLevelDesc, - IListenOptions, - Servers, -} from "@hyperledger/cactus-common"; -import { - SampleCordappEnum, - CordaConnectorContainer, -} from "@hyperledger/cactus-test-tooling"; - -import { - CordappDeploymentConfig, - DefaultApi as CordaApi, - DeployContractJarsV1Request, - FlowInvocationType, - InvokeContractV1Request, - JvmTypeKind, -} from "../../../main/typescript/generated/openapi/typescript-axios/index"; -import { Configuration } from "@hyperledger/cactus-core-api"; - -import { - IPluginLedgerConnectorCordaOptions, - PluginLedgerConnectorCorda, -} from "../../../main/typescript/plugin-ledger-connector-corda"; -import { K_CACTUS_CORDA_TOTAL_TX_COUNT } from "../../../main/typescript/prometheus-exporter/metrics"; - -const logLevel: LogLevelDesc = "TRACE"; - -// Skipping for now due to flakiness until https://github.com/hyperledger/cactus/issues/1473 -// is resolved. You can find complete logs attached at that issue as well. -test.skip("Tests are passing on the JVM side", async (t: Test) => { - test.onFailure(async () => { - await Containers.logDiagnostics({ logLevel }); - }); - - const ledger = new CordaTestLedger({ - imageName: "ghcr.io/hyperledger/cactus-corda-4-7-all-in-one-obligation", - imageVersion: "2021-08-19--feat-888", - logLevel, - }); - t.ok(ledger, "CordaTestLedger instantaited OK"); - - test.onFinish(async () => { - await ledger.stop(); - await ledger.destroy(); - }); - const ledgerContainer = await ledger.start(); - t.ok(ledgerContainer, "CordaTestLedger container truthy post-start() OK"); - - const corDappsDirPartyA = await ledger.getCorDappsDirPartyA(); - const corDappsDirPartyB = await ledger.getCorDappsDirPartyB(); - t.comment(`corDappsDirPartyA=${corDappsDirPartyA}`); - t.comment(`corDappsDirPartyB=${corDappsDirPartyB}`); - - await ledger.logDebugPorts(); - const partyARpcPort = await ledger.getRpcAPublicPort(); - const partyBRpcPort = await ledger.getRpcBPublicPort(); - - const jarFiles = await ledger.pullCordappJars( - SampleCordappEnum.BASIC_CORDAPP, - ); - t.comment(`Fetched ${jarFiles.length} cordapp jars OK`); - - const internalIpOrUndefined = await internalIpV4(); - t.ok(internalIpOrUndefined, "Determined LAN IPv4 address successfully OK"); - const internalIp = internalIpOrUndefined as string; - t.comment(`Internal IP (based on default gateway): ${internalIp}`); - - // TODO: parse the gradle build files to extract the credentials? - const partyARpcUsername = "user1"; - const partyARpcPassword = "password"; - const partyBRpcUsername = partyARpcUsername; - const partyBRpcPassword = partyARpcPassword; - const springAppConfig = { - logging: { - level: { - root: "INFO", - "net.corda": "INFO", - "org.hyperledger.cactus": "DEBUG", - }, - }, - cactus: { - corda: { - node: { host: internalIp }, - rpc: { - port: partyARpcPort, - username: partyARpcUsername, - password: partyARpcPassword, - }, - }, - }, - }; - const springApplicationJson = JSON.stringify(springAppConfig); - const envVarSpringAppJson = `SPRING_APPLICATION_JSON=${springApplicationJson}`; - t.comment(envVarSpringAppJson); - - const connector = new CordaConnectorContainer({ - logLevel, - imageName: "ghcr.io/hyperledger/cactus-connector-corda-server", - imageVersion: "2021-11-23--feat-1493", - envVars: [envVarSpringAppJson], - }); - t.ok(CordaConnectorContainer, "CordaConnectorContainer instantiated OK"); - - test.onFinish(async () => { - try { - await connector.stop(); - } finally { - await connector.destroy(); - } - }); - - const connectorContainer = await connector.start(); - t.ok(connectorContainer, "CordaConnectorContainer started OK"); - - await connector.logDebugPorts(); - const apiUrl = await connector.getApiLocalhostUrl(); - - const config = new Configuration({ basePath: apiUrl }); - const apiClient = new CordaApi(config); - - const flowsRes1 = await apiClient.listFlowsV1(); - t.ok(flowsRes1.status === 200, "flowsRes1.status === 200 OK"); - t.ok(flowsRes1.data, "flowsRes1.data truthy OK"); - t.ok(flowsRes1.data.flowNames, "flowsRes1.data.flowNames truthy OK"); - t.comment(`apiClient.listFlowsV1() => ${JSON.stringify(flowsRes1.data)}`); - const flowNamesPreDeploy = flowsRes1.data.flowNames; - - const sshConfig = await ledger.getSshConfig(); - const hostKeyEntry = "not-used-right-now-so-this-does-not-matter... ;-("; - - const cdcA: CordappDeploymentConfig = { - cordappDir: corDappsDirPartyA, - cordaNodeStartCmd: "supervisorctl start corda-a", - cordaJarPath: - "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantA/corda.jar", - nodeBaseDirPath: - "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantA/", - rpcCredentials: { - hostname: internalIp, - port: partyARpcPort, - username: partyARpcUsername, - password: partyARpcPassword, - }, - sshCredentials: { - hostKeyEntry, - hostname: internalIp, - password: "root", - port: sshConfig.port as number, - username: sshConfig.username as string, - }, - }; - - const cdcB: CordappDeploymentConfig = { - cordappDir: corDappsDirPartyB, - cordaNodeStartCmd: "supervisorctl start corda-b", - cordaJarPath: - "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantB/corda.jar", - nodeBaseDirPath: - "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantB/", - rpcCredentials: { - hostname: internalIp, - port: partyBRpcPort, - username: partyBRpcUsername, - password: partyBRpcPassword, - }, - sshCredentials: { - hostKeyEntry, - hostname: internalIp, - password: "root", - port: sshConfig.port as number, - username: sshConfig.username as string, - }, - }; - - const cordappDeploymentConfigs: CordappDeploymentConfig[] = [cdcA, cdcB]; - const depReq: DeployContractJarsV1Request = { - jarFiles, - cordappDeploymentConfigs, - }; - const depRes = await apiClient.deployContractJarsV1(depReq); - t.ok(depRes, "Jar deployment response truthy OK"); - t.equal(depRes.status, 200, "Jar deployment status code === 200 OK"); - t.ok(depRes.data, "Jar deployment response body truthy OK"); - t.ok(depRes.data.deployedJarFiles, "Jar deployment body deployedJarFiles OK"); - t.equal( - depRes.data.deployedJarFiles.length, - jarFiles.length, - "Deployed jar file count equals count in request OK", - ); - - const flowsRes2 = await apiClient.listFlowsV1(); - t.ok(flowsRes2.status === 200, "flowsRes2.status === 200 OK"); - t.comment(`apiClient.listFlowsV1() => ${JSON.stringify(flowsRes2.data)}`); - t.ok(flowsRes2.data, "flowsRes2.data truthy OK"); - t.ok(flowsRes2.data.flowNames, "flowsRes2.data.flowNames truthy OK"); - const flowNamesPostDeploy = flowsRes2.data.flowNames; - t.notDeepLooseEqual( - flowNamesPostDeploy, - flowNamesPreDeploy, - "New flows detected post Cordapp Jar deployment OK", - ); - - // let's see if this makes a difference and if yes, then we know that the issue - // is a race condition for sure - // await new Promise((r) => setTimeout(r, 120000)); - t.comment("Fetching network map for Corda network..."); - const networkMapRes = await apiClient.networkMapV1(); - t.ok(networkMapRes, "networkMapRes truthy OK"); - t.ok(networkMapRes.status, "networkMapRes.status truthy OK"); - t.ok(networkMapRes.data, "networkMapRes.data truthy OK"); - t.true(Array.isArray(networkMapRes.data), "networkMapRes.data isArray OK"); - t.true(networkMapRes.data.length > 0, "networkMapRes.data not empty OK"); - - const partyB = networkMapRes.data.find((it) => - it.legalIdentities.some((it2) => it2.name.organisation === "ParticipantB"), - ); - const partyBPublicKey = partyB?.legalIdentities[0].owningKey; - - const req: InvokeContractV1Request = { - timeoutMs: 60000, - flowFullClassName: "net.corda.samples.example.flows.ExampleFlow$Initiator", - flowInvocationType: FlowInvocationType.FlowDynamic, - params: [ - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.Integer", - }, - primitiveValue: 42, - }, - { - jvmTypeKind: JvmTypeKind.Reference, - jvmType: { - fqClassName: "net.corda.core.identity.Party", - }, - jvmCtorArgs: [ - { - jvmTypeKind: JvmTypeKind.Reference, - jvmType: { - fqClassName: "net.corda.core.identity.CordaX500Name", - }, - jvmCtorArgs: [ - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: "ParticipantB", - }, - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: "New York", - }, - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: "US", - }, - ], - }, - { - jvmTypeKind: JvmTypeKind.Reference, - jvmType: { - fqClassName: - "org.hyperledger.cactus.plugin.ledger.connector.corda.server.impl.PublicKeyImpl", - }, - jvmCtorArgs: [ - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: partyBPublicKey?.algorithm, - }, - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: partyBPublicKey?.format, - }, - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: partyBPublicKey?.encoded, - }, - ], - }, - ], - }, - ], - } as unknown as InvokeContractV1Request; - - const res = await apiClient.invokeContractV1(req); - t.ok(res, "InvokeContractV1Request truthy OK"); - t.equal(res.status, 200, "InvokeContractV1Request status code === 200 OK"); - - const pluginOptions: IPluginLedgerConnectorCordaOptions = { - instanceId: uuidv4(), - corDappsDir: corDappsDirPartyA, - sshConfigAdminShell: sshConfig, - }; - - const plugin = new PluginLedgerConnectorCorda(pluginOptions); - - const expressApp = express(); - expressApp.use(bodyParser.json({ limit: "250mb" })); - const server = http.createServer(expressApp); - const listenOptions: IListenOptions = { - hostname: "127.0.0.1", - port: 0, - server, - }; - const addressInfo = (await Servers.listen(listenOptions)) as AddressInfo; - test.onFinish(async () => await Servers.shutdown(server)); - const { address, port } = addressInfo; - const apiHost = `http://${address}:${port}`; - t.comment( - `Metrics URL: ${apiHost}/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-prometheus-exporter-metrics`, - ); - - const apiConfig = new Configuration({ basePath: apiHost }); - const apiClient1 = new CordaApi(apiConfig); - - await plugin.getOrCreateWebServices(); - await plugin.registerWebServices(expressApp); - - { - plugin.transact(); - const promRes = await apiClient1.getPrometheusMetricsV1(); - const promMetricsOutput = - "# HELP " + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - " Total transactions executed\n" + - "# TYPE " + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - " gauge\n" + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - '{type="' + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - '"} 1'; - t.ok(promRes); - t.ok(promRes.data); - t.equal(promRes.status, 200); - t.true( - promRes.data.includes(promMetricsOutput), - "Total Transaction Count of 1 recorded as expected. RESULT OK", - ); - - // Executing transaction to increment the Total transaction count metrics - plugin.transact(); - - const promRes1 = await apiClient1.getPrometheusMetricsV1(); - const promMetricsOutput1 = - "# HELP " + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - " Total transactions executed\n" + - "# TYPE " + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - " gauge\n" + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - '{type="' + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - '"} 2'; - t.ok(promRes1); - t.ok(promRes1.data); - t.equal(promRes1.status, 200); - t.true( - promRes1.data.includes(promMetricsOutput1), - "Total Transaction Count of 2 recorded as expected. RESULT OK", - ); - } - - t.end(); -}); diff --git a/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.8-express.test.ts b/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.8-express.test.ts deleted file mode 100644 index 6fb3ae559e..0000000000 --- a/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.8-express.test.ts +++ /dev/null @@ -1,392 +0,0 @@ -import type { AddressInfo } from "net"; -import test, { Test } from "tape-promise/tape"; -import { v4 as internalIpV4 } from "internal-ip"; -import { v4 as uuidv4 } from "uuid"; -import http from "http"; -import bodyParser from "body-parser"; -import express from "express"; - -import { Containers, CordaTestLedger } from "@hyperledger/cactus-test-tooling"; -import { - LogLevelDesc, - IListenOptions, - Servers, -} from "@hyperledger/cactus-common"; -import { - SampleCordappEnum, - CordaConnectorContainer, -} from "@hyperledger/cactus-test-tooling"; -import { Configuration } from "@hyperledger/cactus-core-api"; - -import { - CordappDeploymentConfig, - DefaultApi as CordaApi, - DeployContractJarsV1Request, - FlowInvocationType, - InvokeContractV1Request, - JvmTypeKind, -} from "../../../main/typescript/generated/openapi/typescript-axios/index"; - -import { - IPluginLedgerConnectorCordaOptions, - PluginLedgerConnectorCorda, -} from "../../../main/typescript/plugin-ledger-connector-corda"; -import { K_CACTUS_CORDA_TOTAL_TX_COUNT } from "../../../main/typescript/prometheus-exporter/metrics"; - -const logLevel: LogLevelDesc = "INFO"; - -test("Tests are passing on the JVM side", async (t: Test) => { - test.onFailure(async () => { - await Containers.logDiagnostics({ logLevel }); - }); - - const ledger = new CordaTestLedger({ - imageName: "ghcr.io/hyperledger/cactus-corda-4-8-all-in-one-obligation", - imageVersion: "2023-11-03-86d6b38", - logLevel, - }); - t.ok(ledger, "CordaTestLedger v4.8 instantaited OK"); - - test.onFinish(async () => { - await ledger.stop(); - await ledger.destroy(); - }); - const ledgerContainer = await ledger.start(); - t.ok( - ledgerContainer, - "CordaTestLedger v4.8 container truthy post-start() OK", - ); - - const corDappsDirPartyA = await ledger.getCorDappsDirPartyA(); - const corDappsDirPartyB = await ledger.getCorDappsDirPartyB(); - t.comment(`corDappsDirPartyA=${corDappsDirPartyA}`); - t.comment(`corDappsDirPartyB=${corDappsDirPartyB}`); - - await ledger.logDebugPorts(); - const partyARpcPort = await ledger.getRpcAPublicPort(); - const partyBRpcPort = await ledger.getRpcBPublicPort(); - - const sshConfig = await ledger.getSshConfig(); - - const jarFiles = await ledger.pullCordappJars( - SampleCordappEnum.BASIC_CORDAPP, - ); - t.comment(`Fetched ${jarFiles.length} cordapp jars OK`); - - const internalIpOrUndefined = await internalIpV4(); - t.ok(internalIpOrUndefined, "Determined LAN IPv4 address successfully OK"); - const internalIp = internalIpOrUndefined as string; - t.comment(`Internal IP (based on default gateway): ${internalIp}`); - - // TODO: parse the gradle build files to extract the credentials? - const partyARpcUsername = "user1"; - const partyARpcPassword = "password"; - const partyBRpcUsername = partyARpcUsername; - const partyBRpcPassword = partyARpcPassword; - const springAppConfig = { - logging: { - level: { - root: "INFO", - "net.corda": "INFO", - "org.hyperledger.cactus": "DEBUG", - }, - }, - cactus: { - corda: { - node: { host: internalIp }, - rpc: { - port: partyARpcPort, - username: partyARpcUsername, - password: partyARpcPassword, - }, - }, - }, - }; - const springApplicationJson = JSON.stringify(springAppConfig); - const envVarSpringAppJson = `SPRING_APPLICATION_JSON=${springApplicationJson}`; - t.comment(envVarSpringAppJson); - - const connector = new CordaConnectorContainer({ - logLevel, - imageName: "ghcr.io/hyperledger/cactus-connector-corda-server", - imageVersion: "2023-08-25-ea5522b", - envVars: [envVarSpringAppJson], - }); - t.ok(CordaConnectorContainer, "CordaConnectorContainer instantiated OK"); - - test.onFinish(async () => { - try { - await connector.stop(); - } finally { - await connector.destroy(); - } - }); - - const connectorContainer = await connector.start(); - t.ok(connectorContainer, "CordaConnectorContainer started OK"); - - await connector.logDebugPorts(); - - const apiUrl = await connector.getApiLocalhostUrl(); - const pluginOptions: IPluginLedgerConnectorCordaOptions = { - instanceId: uuidv4(), - corDappsDir: corDappsDirPartyA, - sshConfigAdminShell: sshConfig, - apiUrl, - }; - - const plugin = new PluginLedgerConnectorCorda(pluginOptions); - - const expressApp = express(); - expressApp.use(bodyParser.json({ limit: "250mb" })); - const server = http.createServer(expressApp); - const listenOptions: IListenOptions = { - hostname: "127.0.0.1", - port: 0, - server, - }; - const addressInfo = (await Servers.listen(listenOptions)) as AddressInfo; - test.onFinish(async () => await Servers.shutdown(server)); - const { address, port } = addressInfo; - const apiHost = `http://${address}:${port}`; - t.comment( - `Metrics URL: ${apiHost}/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-prometheus-exporter-metrics`, - ); - - const apiConfig = new Configuration({ basePath: apiHost }); - const apiClient = new CordaApi(apiConfig); - - await plugin.getOrCreateWebServices(); - await plugin.registerWebServices(expressApp); - - const flowsRes1 = await apiClient.listFlowsV1(); - t.ok(flowsRes1.status === 200, "flowsRes1.status === 200 OK"); - t.ok(flowsRes1.data, "flowsRes1.data truthy OK"); - t.ok(flowsRes1.data.flowNames, "flowsRes1.data.flowNames truthy OK"); - t.comment(`apiClient.listFlowsV1() => ${JSON.stringify(flowsRes1.data)}`); - const flowNamesPreDeploy = flowsRes1.data.flowNames; - - const hostKeyEntry = "not-used-right-now-so-this-does-not-matter... ;-("; - - const cdcA: CordappDeploymentConfig = { - cordappDir: corDappsDirPartyA, - cordaNodeStartCmd: "supervisorctl start corda-a", - cordaJarPath: - "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantA/corda.jar", - nodeBaseDirPath: - "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantA/", - rpcCredentials: { - hostname: internalIp, - port: partyARpcPort, - username: partyARpcUsername, - password: partyARpcPassword, - }, - sshCredentials: { - hostKeyEntry, - hostname: internalIp, - password: "root", - port: sshConfig.port as number, - username: sshConfig.username as string, - }, - }; - - const cdcB: CordappDeploymentConfig = { - cordappDir: corDappsDirPartyB, - cordaNodeStartCmd: "supervisorctl start corda-b", - cordaJarPath: - "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantB/corda.jar", - nodeBaseDirPath: - "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantB/", - rpcCredentials: { - hostname: internalIp, - port: partyBRpcPort, - username: partyBRpcUsername, - password: partyBRpcPassword, - }, - sshCredentials: { - hostKeyEntry, - hostname: internalIp, - password: "root", - port: sshConfig.port as number, - username: sshConfig.username as string, - }, - }; - - const cordappDeploymentConfigs: CordappDeploymentConfig[] = [cdcA, cdcB]; - const depReq: DeployContractJarsV1Request = { - jarFiles, - cordappDeploymentConfigs, - }; - const depRes = await apiClient.deployContractJarsV1(depReq); - t.ok(depRes, "Jar deployment response truthy OK"); - t.equal(depRes.status, 200, "Jar deployment status code === 200 OK"); - t.ok(depRes.data, "Jar deployment response body truthy OK"); - t.ok(depRes.data.deployedJarFiles, "Jar deployment body deployedJarFiles OK"); - t.equal( - depRes.data.deployedJarFiles.length, - jarFiles.length, - "Deployed jar file count equals count in request OK", - ); - - const flowsRes2 = await apiClient.listFlowsV1(); - t.ok(flowsRes2.status === 200, "flowsRes2.status === 200 OK"); - t.comment(`apiClient.listFlowsV1() => ${JSON.stringify(flowsRes2.data)}`); - t.ok(flowsRes2.data, "flowsRes2.data truthy OK"); - t.ok(flowsRes2.data.flowNames, "flowsRes2.data.flowNames truthy OK"); - const flowNamesPostDeploy = flowsRes2.data.flowNames; - t.notDeepLooseEqual( - flowNamesPostDeploy, - flowNamesPreDeploy, - "New flows detected post Cordapp Jar deployment OK", - ); - - // let's see if this makes a difference and if yes, then we know that the issue - // is a race condition for sure - // await new Promise((r) => setTimeout(r, 120000)); - t.comment("Fetching network map for Corda network..."); - const networkMapRes = await apiClient.networkMapV1(); - t.ok(networkMapRes, "networkMapRes truthy OK"); - t.ok(networkMapRes.status, "networkMapRes.status truthy OK"); - t.ok(networkMapRes.data, "networkMapRes.data truthy OK"); - t.true(Array.isArray(networkMapRes.data), "networkMapRes.data isArray OK"); - t.true(networkMapRes.data.length > 0, "networkMapRes.data not empty OK"); - - const partyB = networkMapRes.data.find((it) => - it.legalIdentities.some((it2) => it2.name.organisation === "ParticipantB"), - ); - const partyBPublicKey = partyB?.legalIdentities[0].owningKey; - - const req: InvokeContractV1Request = { - timeoutMs: 600000, - flowFullClassName: "net.corda.samples.example.flows.ExampleFlow$Initiator", - flowInvocationType: FlowInvocationType.FlowDynamic, - params: [ - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.Integer", - }, - primitiveValue: 42, - }, - { - jvmTypeKind: JvmTypeKind.Reference, - jvmType: { - fqClassName: "net.corda.core.identity.Party", - }, - jvmCtorArgs: [ - { - jvmTypeKind: JvmTypeKind.Reference, - jvmType: { - fqClassName: "net.corda.core.identity.CordaX500Name", - }, - jvmCtorArgs: [ - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: "ParticipantB", - }, - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: "New York", - }, - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: "US", - }, - ], - }, - { - jvmTypeKind: JvmTypeKind.Reference, - jvmType: { - fqClassName: - "org.hyperledger.cactus.plugin.ledger.connector.corda.server.impl.PublicKeyImpl", - }, - jvmCtorArgs: [ - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: partyBPublicKey?.algorithm, - }, - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: partyBPublicKey?.format, - }, - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: partyBPublicKey?.encoded, - }, - ], - }, - ], - }, - ], - } as unknown as InvokeContractV1Request; - - const res = await apiClient.invokeContractV1(req); - t.ok(res, "InvokeContractV1Request truthy OK"); - t.equal(res.status, 200, "InvokeContractV1Request status code === 200 OK"); - - { - plugin.transact(); - const promRes = await apiClient.getPrometheusMetricsV1(); - const promMetricsOutput = - "# HELP " + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - " Total transactions executed\n" + - "# TYPE " + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - " gauge\n" + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - '{type="' + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - '"} 1'; - t.ok(promRes); - t.ok(promRes.data); - t.equal(promRes.status, 200); - t.true( - promRes.data.includes(promMetricsOutput), - "Total Transaction Count of 1 recorded as expected. RESULT OK", - ); - - // Executing transaction to increment the Total transaction count metrics - plugin.transact(); - - const promRes1 = await apiClient.getPrometheusMetricsV1(); - const promMetricsOutput1 = - "# HELP " + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - " Total transactions executed\n" + - "# TYPE " + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - " gauge\n" + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - '{type="' + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - '"} 2'; - t.ok(promRes1); - t.ok(promRes1.data); - t.equal(promRes1.status, 200); - t.true( - promRes1.data.includes(promMetricsOutput1), - "Total Transaction Count of 2 recorded as expected. RESULT OK", - ); - } - - t.end(); -}); diff --git a/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.8.test.ts b/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.8.test.ts deleted file mode 100644 index 61ec03e36c..0000000000 --- a/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.8.test.ts +++ /dev/null @@ -1,393 +0,0 @@ -import test, { Test } from "tape-promise/tape"; -import { v4 as internalIpV4 } from "internal-ip"; -import { v4 as uuidv4 } from "uuid"; -import http from "http"; -import bodyParser from "body-parser"; -import express from "express"; -import { AddressInfo } from "net"; - -import { Containers, CordaTestLedger } from "@hyperledger/cactus-test-tooling"; -import { - LogLevelDesc, - IListenOptions, - Servers, -} from "@hyperledger/cactus-common"; -import { - SampleCordappEnum, - CordaConnectorContainer, -} from "@hyperledger/cactus-test-tooling"; - -import { - CordappDeploymentConfig, - DefaultApi as CordaApi, - DeployContractJarsV1Request, - FlowInvocationType, - InvokeContractV1Request, - JvmTypeKind, -} from "../../../main/typescript/generated/openapi/typescript-axios/index"; -import { Configuration } from "@hyperledger/cactus-core-api"; - -import { - IPluginLedgerConnectorCordaOptions, - PluginLedgerConnectorCorda, -} from "../../../main/typescript/plugin-ledger-connector-corda"; -import { K_CACTUS_CORDA_TOTAL_TX_COUNT } from "../../../main/typescript/prometheus-exporter/metrics"; - -const logLevel: LogLevelDesc = "TRACE"; - -test.skip("Tests are passing on the JVM side", async (t: Test) => { - test.onFailure(async () => { - await Containers.logDiagnostics({ logLevel }); - }); - - const ledger = new CordaTestLedger({ - imageName: "ghcr.io/hyperledger/cactus-corda-4-8-all-in-one-obligation", - imageVersion: "2021-08-31--feat-889", - logLevel, - }); - t.ok(ledger, "CordaTestLedger v4.8 instantaited OK"); - - test.onFinish(async () => { - await ledger.stop(); - await ledger.destroy(); - }); - const ledgerContainer = await ledger.start(); - t.ok( - ledgerContainer, - "CordaTestLedger v4.8 container truthy post-start() OK", - ); - - const corDappsDirPartyA = await ledger.getCorDappsDirPartyA(); - const corDappsDirPartyB = await ledger.getCorDappsDirPartyB(); - t.comment(`corDappsDirPartyA=${corDappsDirPartyA}`); - t.comment(`corDappsDirPartyB=${corDappsDirPartyB}`); - - await ledger.logDebugPorts(); - const partyARpcPort = await ledger.getRpcAPublicPort(); - const partyBRpcPort = await ledger.getRpcBPublicPort(); - - const jarFiles = await ledger.pullCordappJars( - SampleCordappEnum.BASIC_CORDAPP, - ); - t.comment(`Fetched ${jarFiles.length} cordapp jars OK`); - - const internalIpOrUndefined = await internalIpV4(); - t.ok(internalIpOrUndefined, "Determined LAN IPv4 address successfully OK"); - const internalIp = internalIpOrUndefined as string; - t.comment(`Internal IP (based on default gateway): ${internalIp}`); - - // TODO: parse the gradle build files to extract the credentials? - const partyARpcUsername = "user1"; - const partyARpcPassword = "password"; - const partyBRpcUsername = partyARpcUsername; - const partyBRpcPassword = partyARpcPassword; - const springAppConfig = { - logging: { - level: { - root: "INFO", - "net.corda": "INFO", - "org.hyperledger.cactus": "DEBUG", - }, - }, - cactus: { - corda: { - node: { host: internalIp }, - rpc: { - port: partyARpcPort, - username: partyARpcUsername, - password: partyARpcPassword, - }, - }, - }, - }; - const springApplicationJson = JSON.stringify(springAppConfig); - const envVarSpringAppJson = `SPRING_APPLICATION_JSON=${springApplicationJson}`; - t.comment(envVarSpringAppJson); - - const connector = new CordaConnectorContainer({ - logLevel, - imageName: "ghcr.io/hyperledger/cactus-connector-corda-server", - imageVersion: "2021-11-23--feat-1493", - envVars: [envVarSpringAppJson], - }); - t.ok(CordaConnectorContainer, "CordaConnectorContainer instantiated OK"); - - test.onFinish(async () => { - try { - await connector.stop(); - } finally { - await connector.destroy(); - } - }); - - const connectorContainer = await connector.start(); - t.ok(connectorContainer, "CordaConnectorContainer started OK"); - - await connector.logDebugPorts(); - const apiUrl = await connector.getApiLocalhostUrl(); - - const config = new Configuration({ basePath: apiUrl }); - const apiClient = new CordaApi(config); - - const flowsRes1 = await apiClient.listFlowsV1(); - t.ok(flowsRes1.status === 200, "flowsRes1.status === 200 OK"); - t.ok(flowsRes1.data, "flowsRes1.data truthy OK"); - t.ok(flowsRes1.data.flowNames, "flowsRes1.data.flowNames truthy OK"); - t.comment(`apiClient.listFlowsV1() => ${JSON.stringify(flowsRes1.data)}`); - const flowNamesPreDeploy = flowsRes1.data.flowNames; - - const sshConfig = await ledger.getSshConfig(); - const hostKeyEntry = "not-used-right-now-so-this-does-not-matter... ;-("; - - const cdcA: CordappDeploymentConfig = { - cordappDir: corDappsDirPartyA, - cordaNodeStartCmd: "supervisorctl start corda-a", - cordaJarPath: - "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantA/corda.jar", - nodeBaseDirPath: - "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantA/", - rpcCredentials: { - hostname: internalIp, - port: partyARpcPort, - username: partyARpcUsername, - password: partyARpcPassword, - }, - sshCredentials: { - hostKeyEntry, - hostname: internalIp, - password: "root", - port: sshConfig.port as number, - username: sshConfig.username as string, - }, - }; - - const cdcB: CordappDeploymentConfig = { - cordappDir: corDappsDirPartyB, - cordaNodeStartCmd: "supervisorctl start corda-b", - cordaJarPath: - "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantB/corda.jar", - nodeBaseDirPath: - "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantB/", - rpcCredentials: { - hostname: internalIp, - port: partyBRpcPort, - username: partyBRpcUsername, - password: partyBRpcPassword, - }, - sshCredentials: { - hostKeyEntry, - hostname: internalIp, - password: "root", - port: sshConfig.port as number, - username: sshConfig.username as string, - }, - }; - - const cordappDeploymentConfigs: CordappDeploymentConfig[] = [cdcA, cdcB]; - const depReq: DeployContractJarsV1Request = { - jarFiles, - cordappDeploymentConfigs, - }; - const depRes = await apiClient.deployContractJarsV1(depReq); - t.ok(depRes, "Jar deployment response truthy OK"); - t.equal(depRes.status, 200, "Jar deployment status code === 200 OK"); - t.ok(depRes.data, "Jar deployment response body truthy OK"); - t.ok(depRes.data.deployedJarFiles, "Jar deployment body deployedJarFiles OK"); - t.equal( - depRes.data.deployedJarFiles.length, - jarFiles.length, - "Deployed jar file count equals count in request OK", - ); - - const flowsRes2 = await apiClient.listFlowsV1(); - t.ok(flowsRes2.status === 200, "flowsRes2.status === 200 OK"); - t.comment(`apiClient.listFlowsV1() => ${JSON.stringify(flowsRes2.data)}`); - t.ok(flowsRes2.data, "flowsRes2.data truthy OK"); - t.ok(flowsRes2.data.flowNames, "flowsRes2.data.flowNames truthy OK"); - const flowNamesPostDeploy = flowsRes2.data.flowNames; - t.notDeepLooseEqual( - flowNamesPostDeploy, - flowNamesPreDeploy, - "New flows detected post Cordapp Jar deployment OK", - ); - - // let's see if this makes a difference and if yes, then we know that the issue - // is a race condition for sure - // await new Promise((r) => setTimeout(r, 120000)); - t.comment("Fetching network map for Corda network..."); - const networkMapRes = await apiClient.networkMapV1(); - t.ok(networkMapRes, "networkMapRes truthy OK"); - t.ok(networkMapRes.status, "networkMapRes.status truthy OK"); - t.ok(networkMapRes.data, "networkMapRes.data truthy OK"); - t.true(Array.isArray(networkMapRes.data), "networkMapRes.data isArray OK"); - t.true(networkMapRes.data.length > 0, "networkMapRes.data not empty OK"); - - const partyB = networkMapRes.data.find((it) => - it.legalIdentities.some((it2) => it2.name.organisation === "ParticipantB"), - ); - const partyBPublicKey = partyB?.legalIdentities[0].owningKey; - - const req: InvokeContractV1Request = { - timeoutMs: 60000, - flowFullClassName: "net.corda.samples.example.flows.ExampleFlow$Initiator", - flowInvocationType: FlowInvocationType.FlowDynamic, - params: [ - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.Integer", - }, - primitiveValue: 42, - }, - { - jvmTypeKind: JvmTypeKind.Reference, - jvmType: { - fqClassName: "net.corda.core.identity.Party", - }, - jvmCtorArgs: [ - { - jvmTypeKind: JvmTypeKind.Reference, - jvmType: { - fqClassName: "net.corda.core.identity.CordaX500Name", - }, - jvmCtorArgs: [ - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: "ParticipantB", - }, - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: "New York", - }, - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: "US", - }, - ], - }, - { - jvmTypeKind: JvmTypeKind.Reference, - jvmType: { - fqClassName: - "org.hyperledger.cactus.plugin.ledger.connector.corda.server.impl.PublicKeyImpl", - }, - jvmCtorArgs: [ - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: partyBPublicKey?.algorithm, - }, - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: partyBPublicKey?.format, - }, - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: partyBPublicKey?.encoded, - }, - ], - }, - ], - }, - ], - } as unknown as InvokeContractV1Request; - - const res = await apiClient.invokeContractV1(req); - t.ok(res, "InvokeContractV1Request truthy OK"); - t.equal(res.status, 200, "InvokeContractV1Request status code === 200 OK"); - - const pluginOptions: IPluginLedgerConnectorCordaOptions = { - instanceId: uuidv4(), - corDappsDir: corDappsDirPartyA, - sshConfigAdminShell: sshConfig, - }; - - const plugin = new PluginLedgerConnectorCorda(pluginOptions); - - const expressApp = express(); - expressApp.use(bodyParser.json({ limit: "250mb" })); - const server = http.createServer(expressApp); - const listenOptions: IListenOptions = { - hostname: "127.0.0.1", - port: 0, - server, - }; - const addressInfo = (await Servers.listen(listenOptions)) as AddressInfo; - test.onFinish(async () => await Servers.shutdown(server)); - const { address, port } = addressInfo; - const apiHost = `http://${address}:${port}`; - t.comment( - `Metrics URL: ${apiHost}/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-prometheus-exporter-metrics`, - ); - - const apiConfig = new Configuration({ basePath: apiHost }); - const apiClient1 = new CordaApi(apiConfig); - - await plugin.getOrCreateWebServices(); - await plugin.registerWebServices(expressApp); - - { - plugin.transact(); - const promRes = await apiClient1.getPrometheusMetricsV1(); - const promMetricsOutput = - "# HELP " + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - " Total transactions executed\n" + - "# TYPE " + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - " gauge\n" + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - '{type="' + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - '"} 1'; - t.ok(promRes); - t.ok(promRes.data); - t.equal(promRes.status, 200); - t.true( - promRes.data.includes(promMetricsOutput), - "Total Transaction Count of 1 recorded as expected. RESULT OK", - ); - - // Executing transaction to increment the Total transaction count metrics - plugin.transact(); - - const promRes1 = await apiClient1.getPrometheusMetricsV1(); - const promMetricsOutput1 = - "# HELP " + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - " Total transactions executed\n" + - "# TYPE " + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - " gauge\n" + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - '{type="' + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - '"} 2'; - t.ok(promRes1); - t.ok(promRes1.data); - t.equal(promRes1.status, 200); - t.true( - promRes1.data.includes(promMetricsOutput1), - "Total Transaction Count of 2 recorded as expected. RESULT OK", - ); - } - - t.end(); -}); diff --git a/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes.test.ts b/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes.test.ts deleted file mode 100644 index d0a44cca51..0000000000 --- a/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes.test.ts +++ /dev/null @@ -1,397 +0,0 @@ -import test, { Test } from "tape-promise/tape"; -import { v4 as internalIpV4 } from "internal-ip"; -import { v4 as uuidv4 } from "uuid"; -import http from "http"; -import bodyParser from "body-parser"; -import express from "express"; -import { AddressInfo } from "net"; - -import { Containers, CordaTestLedger } from "@hyperledger/cactus-test-tooling"; -import { - LogLevelDesc, - IListenOptions, - Servers, -} from "@hyperledger/cactus-common"; -import { - SampleCordappEnum, - CordaConnectorContainer, -} from "@hyperledger/cactus-test-tooling"; - -import { - CordappDeploymentConfig, - DefaultApi as CordaApi, - DeployContractJarsV1Request, - FlowInvocationType, - InvokeContractV1Request, - JvmTypeKind, -} from "../../../main/typescript/generated/openapi/typescript-axios/index"; -import { Configuration } from "@hyperledger/cactus-core-api"; - -import { - IPluginLedgerConnectorCordaOptions, - PluginLedgerConnectorCorda, -} from "../../../main/typescript/plugin-ledger-connector-corda"; -import { K_CACTUS_CORDA_TOTAL_TX_COUNT } from "../../../main/typescript/prometheus-exporter/metrics"; - -const logLevel: LogLevelDesc = "TRACE"; - -test.skip("Tests are passing on the JVM side", async (t: Test) => { - test.onFailure(async () => { - await Containers.logDiagnostics({ logLevel }); - }); - - const ledger = new CordaTestLedger({ - imageName: "ghcr.io/hyperledger/cactus-corda-4-6-all-in-one-obligation", - imageVersion: "2021-03-19-feat-686", - // imageName: "caio", - // imageVersion: "latest", - logLevel, - }); - t.ok(ledger, "CordaTestLedger instantaited OK"); - - test.onFinish(async () => { - await ledger.stop(); - await ledger.destroy(); - }); - const ledgerContainer = await ledger.start(); - t.ok(ledgerContainer, "CordaTestLedger container truthy post-start() OK"); - - const corDappsDirPartyA = await ledger.getCorDappsDirPartyA(); - const corDappsDirPartyB = await ledger.getCorDappsDirPartyB(); - t.comment(`corDappsDirPartyA=${corDappsDirPartyA}`); - t.comment(`corDappsDirPartyB=${corDappsDirPartyB}`); - - await ledger.logDebugPorts(); - const partyARpcPort = await ledger.getRpcAPublicPort(); - const partyBRpcPort = await ledger.getRpcBPublicPort(); - - const jarFiles = await ledger.pullCordappJars( - SampleCordappEnum.BASIC_CORDAPP, - ); - t.comment(`Fetched ${jarFiles.length} cordapp jars OK`); - - const internalIpOrUndefined = await internalIpV4(); - t.ok(internalIpOrUndefined, "Determined LAN IPv4 address successfully OK"); - const internalIp = internalIpOrUndefined as string; - t.comment(`Internal IP (based on default gateway): ${internalIp}`); - - // TODO: parse the gradle build files to extract the credentials? - const partyARpcUsername = "user1"; - const partyARpcPassword = "password"; - const partyBRpcUsername = partyARpcUsername; - const partyBRpcPassword = partyARpcPassword; - const springAppConfig = { - logging: { - level: { - root: "INFO", - "net.corda": "INFO", - "org.hyperledger.cactus": "DEBUG", - }, - }, - cactus: { - corda: { - node: { host: internalIp }, - rpc: { - port: partyARpcPort, - username: partyARpcUsername, - password: partyARpcPassword, - }, - }, - }, - }; - const springApplicationJson = JSON.stringify(springAppConfig); - const envVarSpringAppJson = `SPRING_APPLICATION_JSON=${springApplicationJson}`; - t.comment(envVarSpringAppJson); - - const connector = new CordaConnectorContainer({ - logLevel, - imageName: "ghcr.io/hyperledger/cactus-connector-corda-server", - imageVersion: "2021-11-23--feat-1493", - envVars: [envVarSpringAppJson], - }); - t.ok(CordaConnectorContainer, "CordaConnectorContainer instantiated OK"); - - test.onFinish(async () => { - try { - await connector.stop(); - } finally { - await connector.destroy(); - } - }); - - const connectorContainer = await connector.start(); - t.ok(connectorContainer, "CordaConnectorContainer started OK"); - - await connector.logDebugPorts(); - const apiUrl = await connector.getApiLocalhostUrl(); - - const config = new Configuration({ basePath: apiUrl }); - const apiClient = new CordaApi(config); - - const flowsRes1 = await apiClient.listFlowsV1(); - t.ok(flowsRes1.status === 200, "flowsRes1.status === 200 OK"); - t.ok(flowsRes1.data, "flowsRes1.data truthy OK"); - t.ok(flowsRes1.data.flowNames, "flowsRes1.data.flowNames truthy OK"); - t.comment(`apiClient.listFlowsV1() => ${JSON.stringify(flowsRes1.data)}`); - const flowNamesPreDeploy = flowsRes1.data.flowNames; - - const sshConfig = await ledger.getSshConfig(); - const hostKeyEntry = "not-used-right-now-so-this-does-not-matter... ;-("; - - const cdcA: CordappDeploymentConfig = { - cordappDir: corDappsDirPartyA, - cordaNodeStartCmd: "supervisorctl start corda-a", - cordaJarPath: - "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantA/corda.jar", - nodeBaseDirPath: - "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantA/", - rpcCredentials: { - hostname: internalIp, - port: partyARpcPort, - username: partyARpcUsername, - password: partyARpcPassword, - }, - sshCredentials: { - hostKeyEntry, - hostname: internalIp, - password: "root", - port: sshConfig.port as number, - username: sshConfig.username as string, - }, - }; - - const cdcB: CordappDeploymentConfig = { - cordappDir: corDappsDirPartyB, - cordaNodeStartCmd: "supervisorctl start corda-b", - cordaJarPath: - "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantB/corda.jar", - nodeBaseDirPath: - "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantB/", - rpcCredentials: { - hostname: internalIp, - port: partyBRpcPort, - username: partyBRpcUsername, - password: partyBRpcPassword, - }, - sshCredentials: { - hostKeyEntry, - hostname: internalIp, - password: "root", - port: sshConfig.port as number, - username: sshConfig.username as string, - }, - }; - - const cordappDeploymentConfigs: CordappDeploymentConfig[] = [cdcA, cdcB]; - const depReq: DeployContractJarsV1Request = { - jarFiles, - cordappDeploymentConfigs, - }; - const depRes = await apiClient.deployContractJarsV1(depReq); - t.ok(depRes, "Jar deployment response truthy OK"); - t.equal(depRes.status, 200, "Jar deployment status code === 200 OK"); - t.ok(depRes.data, "Jar deployment response body truthy OK"); - t.ok(depRes.data.deployedJarFiles, "Jar deployment body deployedJarFiles OK"); - t.equal( - depRes.data.deployedJarFiles.length, - jarFiles.length, - "Deployed jar file count equals count in request OK", - ); - - const flowsRes2 = await apiClient.listFlowsV1(); - t.ok(flowsRes2.status === 200, "flowsRes2.status === 200 OK"); - t.comment(`apiClient.listFlowsV1() => ${JSON.stringify(flowsRes2.data)}`); - t.ok(flowsRes2.data, "flowsRes2.data truthy OK"); - t.ok(flowsRes2.data.flowNames, "flowsRes2.data.flowNames truthy OK"); - const flowNamesPostDeploy = flowsRes2.data.flowNames; - t.notDeepLooseEqual( - flowNamesPostDeploy, - flowNamesPreDeploy, - "New flows detected post Cordapp Jar deployment OK", - ); - - // let's see if this makes a difference and if yes, then we know that the issue - // is a race condition for sure - // await new Promise((r) => setTimeout(r, 120000)); - t.comment("Fetching network map for Corda network..."); - const networkMapRes = await apiClient.networkMapV1(); - t.ok(networkMapRes, "networkMapRes truthy OK"); - t.ok(networkMapRes.status, "networkMapRes.status truthy OK"); - t.ok(networkMapRes.data, "networkMapRes.data truthy OK"); - t.true(Array.isArray(networkMapRes.data), "networkMapRes.data isArray OK"); - t.true(networkMapRes.data.length > 0, "networkMapRes.data not empty OK"); - - // const partyA = networkMapRes.data.find((it) => - // it.legalIdentities.some((it2) => it2.name.organisation === "ParticipantA"), - // ); - // const partyAPublicKey = partyA?.legalIdentities[0].owningKey; - - const partyB = networkMapRes.data.find((it) => - it.legalIdentities.some((it2) => it2.name.organisation === "ParticipantB"), - ); - const partyBPublicKey = partyB?.legalIdentities[0].owningKey; - - const req: InvokeContractV1Request = { - timeoutMs: 60000, - flowFullClassName: "net.corda.samples.example.flows.ExampleFlow$Initiator", - flowInvocationType: FlowInvocationType.FlowDynamic, - params: [ - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.Integer", - }, - primitiveValue: 42, - }, - { - jvmTypeKind: JvmTypeKind.Reference, - jvmType: { - fqClassName: "net.corda.core.identity.Party", - }, - jvmCtorArgs: [ - { - jvmTypeKind: JvmTypeKind.Reference, - jvmType: { - fqClassName: "net.corda.core.identity.CordaX500Name", - }, - jvmCtorArgs: [ - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: "ParticipantB", - }, - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: "New York", - }, - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: "US", - }, - ], - }, - { - jvmTypeKind: JvmTypeKind.Reference, - jvmType: { - fqClassName: - "org.hyperledger.cactus.plugin.ledger.connector.corda.server.impl.PublicKeyImpl", - }, - jvmCtorArgs: [ - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: partyBPublicKey?.algorithm, - }, - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: partyBPublicKey?.format, - }, - { - jvmTypeKind: JvmTypeKind.Primitive, - jvmType: { - fqClassName: "java.lang.String", - }, - primitiveValue: partyBPublicKey?.encoded, - }, - ], - }, - ], - }, - ], - } as unknown as InvokeContractV1Request; - - const res = await apiClient.invokeContractV1(req); - t.ok(res, "InvokeContractV1Request truthy OK"); - t.equal(res.status, 200, "InvokeContractV1Request status code === 200 OK"); - - const pluginOptions: IPluginLedgerConnectorCordaOptions = { - instanceId: uuidv4(), - corDappsDir: corDappsDirPartyA, - sshConfigAdminShell: sshConfig, - }; - - const plugin = new PluginLedgerConnectorCorda(pluginOptions); - - const expressApp = express(); - expressApp.use(bodyParser.json({ limit: "250mb" })); - const server = http.createServer(expressApp); - const listenOptions: IListenOptions = { - hostname: "127.0.0.1", - port: 0, - server, - }; - const addressInfo = (await Servers.listen(listenOptions)) as AddressInfo; - test.onFinish(async () => await Servers.shutdown(server)); - const { address, port } = addressInfo; - const apiHost = `http://${address}:${port}`; - t.comment( - `Metrics URL: ${apiHost}/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-prometheus-exporter-metrics`, - ); - - const apiConfig = new Configuration({ basePath: apiHost }); - const apiClient1 = new CordaApi(apiConfig); - - await plugin.getOrCreateWebServices(); - await plugin.registerWebServices(expressApp); - - { - plugin.transact(); - const promRes = await apiClient1.getPrometheusMetricsV1(); - const promMetricsOutput = - "# HELP " + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - " Total transactions executed\n" + - "# TYPE " + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - " gauge\n" + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - '{type="' + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - '"} 1'; - t.ok(promRes); - t.ok(promRes.data); - t.equal(promRes.status, 200); - t.true( - promRes.data.includes(promMetricsOutput), - "Total Transaction Count of 1 recorded as expected. RESULT OK", - ); - - // Executing transaction to increment the Total transaction count metrics - plugin.transact(); - - const promRes1 = await apiClient1.getPrometheusMetricsV1(); - const promMetricsOutput1 = - "# HELP " + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - " Total transactions executed\n" + - "# TYPE " + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - " gauge\n" + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - '{type="' + - K_CACTUS_CORDA_TOTAL_TX_COUNT + - '"} 2'; - t.ok(promRes1); - t.ok(promRes1.data); - t.equal(promRes1.status, 200); - t.true( - promRes1.data.includes(promMetricsOutput1), - "Total Transaction Count of 2 recorded as expected. RESULT OK", - ); - } - - t.end(); -}); diff --git a/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server-v4.7.test.ts b/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server-v4.7.test.ts deleted file mode 100644 index c809f4de52..0000000000 --- a/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server-v4.7.test.ts +++ /dev/null @@ -1,196 +0,0 @@ -import test, { Test } from "tape-promise/tape"; -import { v4 as internalIpV4 } from "internal-ip"; - -import { - Containers, - CordaTestLedger, - pruneDockerAllIfGithubAction, -} from "@hyperledger/cactus-test-tooling"; -import { LogLevelDesc } from "@hyperledger/cactus-common"; -import { - SampleCordappEnum, - CordaConnectorContainer, -} from "@hyperledger/cactus-test-tooling"; -import { Configuration } from "@hyperledger/cactus-core-api"; - -import { - CordappDeploymentConfig, - DefaultApi as CordaApi, - DeployContractJarsV1Request, - FlowInvocationType, - InvokeContractV1Request, - JvmTypeKind, -} from "../../../main/typescript/generated/openapi/typescript-axios/index"; - -import { - createJvmCordaIdentityParty, - createJvmCordaUniqueIdentifier, -} from "../../../main/typescript/public-api"; -import { createJvmCordaAmount } from "../../../main/typescript/public-api"; - -const testCase = "Tests are passing on the JVM side"; -const logLevel: LogLevelDesc = "INFO"; - -test.onFailure(async () => { - await Containers.logDiagnostics({ logLevel }); -}); - -test("BEFORE " + testCase, async (t: Test) => { - const pruning = pruneDockerAllIfGithubAction({ logLevel }); - await t.doesNotReject(pruning, "Pruning didn't throw OK"); - t.end(); -}); - -test(testCase, async (t: Test) => { - const ledger = new CordaTestLedger({ - imageName: "ghcr.io/hyperledger/cactus-corda-4-7-all-in-one-obligation", - imageVersion: "2021-08-19--feat-888", - logLevel, - }); - t.ok(ledger, "CordaTestLedger instantaited OK"); - - test.onFinish(async () => { - await ledger.stop(); - await ledger.destroy(); - await pruneDockerAllIfGithubAction({ logLevel }); - }); - const ledgerContainer = await ledger.start(); - t.ok(ledgerContainer, "CordaTestLedger container truthy post-start() OK"); - - await ledger.logDebugPorts(); - const partyARpcPort = await ledger.getRpcAPublicPort(); - - const jarFiles = await ledger.pullCordappJars( - SampleCordappEnum.ADVANCED_OBLIGATION, - ); - t.comment(`Fetched ${jarFiles.length} cordapp jars OK`); - - const internalIpOrUndefined = await internalIpV4(); - t.ok(internalIpOrUndefined, "Determined LAN IPv4 address successfully OK"); - const internalIp = internalIpOrUndefined as string; - t.comment(`Internal IP (based on default gateway): ${internalIp}`); - - const springAppConfig = { - logging: { - level: { - root: "INFO", - "org.hyperledger.cactus": "DEBUG", - }, - }, - cactus: { - corda: { - node: { host: internalIp }, - // TODO: parse the gradle build files to extract the credentials? - rpc: { port: partyARpcPort, username: "user1", password: "password" }, - }, - }, - }; - const springApplicationJson = JSON.stringify(springAppConfig); - const envVarSpringAppJson = `SPRING_APPLICATION_JSON=${springApplicationJson}`; - t.comment(envVarSpringAppJson); - - const connector = new CordaConnectorContainer({ - logLevel, - imageName: "ghcr.io/hyperledger/cactus-connector-corda-server", - imageVersion: "2021-11-23--feat-1493", - envVars: [envVarSpringAppJson], - }); - t.ok(CordaConnectorContainer, "CordaConnectorContainer instantiated OK"); - - test.onFinish(async () => { - try { - await connector.stop(); - } finally { - await connector.destroy(); - } - }); - - const connectorContainer = await connector.start(); - t.ok(connectorContainer, "CordaConnectorContainer started OK"); - - await connector.logDebugPorts(); - const apiUrl = await connector.getApiLocalhostUrl(); - const config = new Configuration({ basePath: apiUrl }); - const apiClient = new CordaApi(config); - - const flowsRes = await apiClient.listFlowsV1(); - t.ok(flowsRes.status === 200, "flowsRes.status === 200 OK"); - t.ok(flowsRes.data, "flowsRes.data truthy OK"); - t.ok(flowsRes.data.flowNames, "flowsRes.data.flowNames truthy OK"); - t.comment(`apiClient.listFlowsV1() => ${JSON.stringify(flowsRes.data)}`); - - const diagRes = await apiClient.diagnoseNodeV1(); - t.ok(diagRes.status === 200, "diagRes.status === 200 OK"); - t.ok(diagRes.data, "diagRes.data truthy OK"); - t.ok(diagRes.data.nodeDiagnosticInfo, "nodeDiagnosticInfo truthy OK"); - const ndi = diagRes.data.nodeDiagnosticInfo; - t.ok(ndi.cordapps, "ndi.cordapps truthy OK"); - t.ok(Array.isArray(ndi.cordapps), "ndi.cordapps is Array truthy OK"); - t.true((ndi.cordapps as []).length > 0, "ndi.cordapps non-empty true OK"); - t.ok(ndi.vendor, "ndi.vendor truthy OK"); - t.ok(ndi.version, "ndi.version truthy OK"); - t.ok(ndi.revision, "ndi.revision truthy OK"); - t.ok(ndi.platformVersion, "ndi.platformVersion truthy OK"); - - t.comment(`apiClient.diagnoseNodeV1() => ${JSON.stringify(diagRes.data)}`); - - const cordappDeploymentConfigs: CordappDeploymentConfig[] = []; - const depReq: DeployContractJarsV1Request = { - jarFiles, - cordappDeploymentConfigs, - }; - const depRes = await apiClient.deployContractJarsV1(depReq); - t.ok(depRes, "Jar deployment response truthy OK"); - t.equal(depRes.status, 200, "Jar deployment status code === 200 OK"); - t.ok(depRes.data, "Jar deployment response body truthy OK"); - t.ok(depRes.data.deployedJarFiles, "Jar deployment body deployedJarFiles OK"); - t.equal( - depRes.data.deployedJarFiles.length, - jarFiles.length, - "Deployed jar file count equals count in request OK", - ); - - const networkMapRes = await apiClient.networkMapV1(); - - const partyA = networkMapRes.data.find((it) => - it.legalIdentities.some((it2) => it2.name.organisation === "ParticipantA"), - ); - - const partyB = networkMapRes.data.find((it) => - it.legalIdentities.some((it2) => it2.name.organisation === "ParticipantB"), - ); - - const req: InvokeContractV1Request = { - flowFullClassName: "net.corda.samples.obligation.flows.IOUIssueFlow", - flowInvocationType: FlowInvocationType.TrackedFlowDynamic, - params: [ - { - jvmTypeKind: JvmTypeKind.Reference, - jvmType: { - fqClassName: "net.corda.samples.obligation.states.IOUState", - }, - - jvmCtorArgs: [ - createJvmCordaAmount({ currencyCode: "USD", amount: 42 }), - createJvmCordaIdentityParty({ - party: partyA!.legalIdentities[0], - }), - createJvmCordaIdentityParty({ - party: partyB!.legalIdentities[0], - }), - createJvmCordaAmount({ currencyCode: "USD", amount: 42 }), - createJvmCordaUniqueIdentifier({ - uniqueidentifier: "7fc2161e-f8d0-4c86-a596-08326bdafd56", - }), - ], - }, - ], - timeoutMs: 60000, - } as unknown as InvokeContractV1Request; - - const res = await apiClient.invokeContractV1(req); - t.ok(res, "InvokeContractV1Request truthy OK"); - t.equal(res.status, 200, "InvokeContractV1Request status code === 200 OK"); - - t.end(); -}); diff --git a/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server-v4.8.test.ts b/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server-v4.8.test.ts deleted file mode 100644 index 289bd18422..0000000000 --- a/packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/jvm-kotlin-spring-server-v4.8.test.ts +++ /dev/null @@ -1,197 +0,0 @@ -import test, { Test } from "tape-promise/tape"; -import { v4 as internalIpV4 } from "internal-ip"; - -import { - Containers, - CordaTestLedger, - pruneDockerAllIfGithubAction, -} from "@hyperledger/cactus-test-tooling"; -import { LogLevelDesc } from "@hyperledger/cactus-common"; -import { - SampleCordappEnum, - CordaConnectorContainer, -} from "@hyperledger/cactus-test-tooling"; - -import { - CordappDeploymentConfig, - DefaultApi as CordaApi, - DeployContractJarsV1Request, - FlowInvocationType, - InvokeContractV1Request, - JvmTypeKind, -} from "../../../main/typescript/generated/openapi/typescript-axios/index"; -import { Configuration } from "@hyperledger/cactus-core-api"; -import { - createJvmCordaAmount, - createJvmCordaIdentityParty, - createJvmCordaUniqueIdentifier, -} from "../../../main/typescript/public-api"; - -const testCase = "Tests are passing on the JVM side"; -const logLevel: LogLevelDesc = "INFO"; - -test.onFailure(async () => { - await Containers.logDiagnostics({ logLevel }); -}); - -test("BEFORE " + testCase, async (t: Test) => { - const pruning = pruneDockerAllIfGithubAction({ logLevel }); - await t.doesNotReject(pruning, "Pruning didn't throw OK"); - t.end(); -}); - -test(testCase, async (t: Test) => { - const ledger = new CordaTestLedger({ - imageName: "ghcr.io/hyperledger/cactus-corda-4-8-all-in-one-obligation", - imageVersion: "2021-08-31--feat-889", - logLevel, - }); - t.ok(ledger, "CordaTestLedger v4.8 instantaited OK"); - - test.onFinish(async () => { - await ledger.stop(); - await ledger.destroy(); - await pruneDockerAllIfGithubAction({ logLevel }); - }); - const ledgerContainer = await ledger.start(); - t.ok( - ledgerContainer, - "CordaTestLedger v4.8 container truthy post-start() OK", - ); - - await ledger.logDebugPorts(); - const partyARpcPort = await ledger.getRpcAPublicPort(); - - const jarFiles = await ledger.pullCordappJars( - SampleCordappEnum.ADVANCED_OBLIGATION, - ); - t.comment(`Fetched ${jarFiles.length} cordapp jars OK`); - - const internalIpOrUndefined = await internalIpV4(); - t.ok(internalIpOrUndefined, "Determined LAN IPv4 address successfully OK"); - const internalIp = internalIpOrUndefined as string; - t.comment(`Internal IP (based on default gateway): ${internalIp}`); - - const springAppConfig = { - logging: { - level: { - root: "INFO", - "org.hyperledger.cactus": "DEBUG", - }, - }, - cactus: { - corda: { - node: { host: internalIp }, - // TODO: parse the gradle build files to extract the credentials? - rpc: { port: partyARpcPort, username: "user1", password: "password" }, - }, - }, - }; - const springApplicationJson = JSON.stringify(springAppConfig); - const envVarSpringAppJson = `SPRING_APPLICATION_JSON=${springApplicationJson}`; - t.comment(envVarSpringAppJson); - - const connector = new CordaConnectorContainer({ - logLevel, - imageName: "ghcr.io/hyperledger/cactus-connector-corda-server", - imageVersion: "2021-11-23--feat-1493", - envVars: [envVarSpringAppJson], - }); - t.ok(CordaConnectorContainer, "CordaConnectorContainer instantiated OK"); - - test.onFinish(async () => { - try { - await connector.stop(); - } finally { - await connector.destroy(); - } - }); - - const connectorContainer = await connector.start(); - t.ok(connectorContainer, "CordaConnectorContainer started OK"); - - await connector.logDebugPorts(); - const apiUrl = await connector.getApiLocalhostUrl(); - const config = new Configuration({ basePath: apiUrl }); - const apiClient = new CordaApi(config); - - const flowsRes = await apiClient.listFlowsV1(); - t.ok(flowsRes.status === 200, "flowsRes.status === 200 OK"); - t.ok(flowsRes.data, "flowsRes.data truthy OK"); - t.ok(flowsRes.data.flowNames, "flowsRes.data.flowNames truthy OK"); - t.comment(`apiClient.listFlowsV1() => ${JSON.stringify(flowsRes.data)}`); - - const diagRes = await apiClient.diagnoseNodeV1(); - t.ok(diagRes.status === 200, "diagRes.status === 200 OK"); - t.ok(diagRes.data, "diagRes.data truthy OK"); - t.ok(diagRes.data.nodeDiagnosticInfo, "nodeDiagnosticInfo truthy OK"); - const ndi = diagRes.data.nodeDiagnosticInfo; - t.ok(ndi.cordapps, "ndi.cordapps truthy OK"); - t.ok(Array.isArray(ndi.cordapps), "ndi.cordapps is Array truthy OK"); - t.true((ndi.cordapps as []).length > 0, "ndi.cordapps non-empty true OK"); - t.ok(ndi.vendor, "ndi.vendor truthy OK"); - t.ok(ndi.version, "ndi.version truthy OK"); - t.ok(ndi.revision, "ndi.revision truthy OK"); - t.ok(ndi.platformVersion, "ndi.platformVersion truthy OK"); - - t.comment(`apiClient.diagnoseNodeV1() => ${JSON.stringify(diagRes.data)}`); - - const cordappDeploymentConfigs: CordappDeploymentConfig[] = []; - const depReq: DeployContractJarsV1Request = { - jarFiles, - cordappDeploymentConfigs, - }; - const depRes = await apiClient.deployContractJarsV1(depReq); - t.ok(depRes, "Jar deployment response truthy OK"); - t.equal(depRes.status, 200, "Jar deployment status code === 200 OK"); - t.ok(depRes.data, "Jar deployment response body truthy OK"); - t.ok(depRes.data.deployedJarFiles, "Jar deployment body deployedJarFiles OK"); - t.equal( - depRes.data.deployedJarFiles.length, - jarFiles.length, - "Deployed jar file count equals count in request OK", - ); - - const networkMapRes = await apiClient.networkMapV1(); - const partyA = networkMapRes.data.find((it) => - it.legalIdentities.some((it2) => it2.name.organisation === "ParticipantA"), - ); - - const partyB = networkMapRes.data.find((it) => - it.legalIdentities.some((it2) => it2.name.organisation === "ParticipantB"), - ); - - const req: InvokeContractV1Request = { - flowFullClassName: "net.corda.samples.obligation.flows.IOUIssueFlow", - flowInvocationType: FlowInvocationType.TrackedFlowDynamic, - params: [ - { - jvmTypeKind: JvmTypeKind.Reference, - jvmType: { - fqClassName: "net.corda.samples.obligation.states.IOUState", - }, - - jvmCtorArgs: [ - createJvmCordaAmount({ currencyCode: "USD", amount: 42 }), - createJvmCordaIdentityParty({ - party: partyA!.legalIdentities[0], - }), - createJvmCordaIdentityParty({ - party: partyB!.legalIdentities[0], - }), - createJvmCordaAmount({ currencyCode: "USD", amount: 1 }), - createJvmCordaUniqueIdentifier({ - uniqueidentifier: "7fc2161e-f8d0-4c86-a596-08326bdafd56", - }), - ], - }, - ], - timeoutMs: 60000, - } as unknown as InvokeContractV1Request; - - const res = await apiClient.invokeContractV1(req); - t.ok(res, "InvokeContractV1Request truthy OK"); - t.equal(res.status, 200, "InvokeContractV1Request status code === 200 OK"); - - t.end(); -}); diff --git a/tools/docker/corda-all-in-one/Dockerfile b/tools/docker/corda-all-in-one/Dockerfile deleted file mode 100644 index ab71ff3484..0000000000 --- a/tools/docker/corda-all-in-one/Dockerfile +++ /dev/null @@ -1,154 +0,0 @@ -FROM docker:24.0.2-dind - -ARG SAMPLES_KOTLIN_SHA=30fd841dd035934bae75ab8910da3b6e3d5d6ee7 -ARG SAMPLES_KOTLIN_CORDAPP_SUB_DIR_PATH="./Advanced/obligation-cordapp/" -ARG CORDA_TOOLS_SHELL_CLI_VERSION=4.7 - -WORKDIR / - -RUN apk update - -# Install dependencies of Docker Compose -RUN apk add py-pip python3-dev libffi-dev openssl-dev gcc libc-dev make - -# Install git so we can check out the kotlin-samples repo of Corda -RUN apk add --no-cache git - -# Fabric Samples needs bash, sh is not good enough here -RUN apk add --no-cache bash - -# Need curl to run healthchecks -RUN apk add --no-cache curl - -# The file binary is used to inspect exectubles when debugging container image issues -RUN apk add --no-cache file - -RUN apk add --no-cache openjdk8 - -# Need gradle to execute the corda sample app setup commands -RUN apk add --no-cache gradle - -ENV CACTUS_CFG_PATH=/etc/hyperledger/cactus -RUN mkdir -p $CACTUS_CFG_PATH - -# OpenSSH - need to have it so we can shell in and install/instantiate contracts and troubleshoot -RUN apk add --no-cache openssh augeas - -# Configure the OpenSSH server we just installed -RUN augtool 'set /files/etc/ssh/sshd_config/AuthorizedKeysFile ".ssh/authorized_keys /etc/authorized_keys/%u"' -RUN augtool 'set /files/etc/ssh/sshd_config/PermitRootLogin yes' -RUN augtool 'set /files/etc/ssh/sshd_config/PasswordAuthentication yes' -RUN augtool 'set /files/etc/ssh/sshd_config/PermitEmptyPasswords yes' -RUN augtool 'set /files/etc/ssh/sshd_config/Port 22' -RUN augtool 'set /files/etc/ssh/sshd_config/LogLevel DEBUG2' -RUN augtool 'set /files/etc/ssh/sshd_config/LoginGraceTime 10' -# Create the server's key - without this sshd will refuse to start -RUN ssh-keygen -A - -# Generate an RSA keypair on the fly to avoid having to hardcode one in the image -# which technically does not pose a security threat since this is only a development -# image, but we do it like this anyway. -RUN mkdir ~/.ssh -RUN chmod 700 ~/.ssh/ -RUN touch ~/.ssh/authorized_keys -RUN ["/bin/bash", "-c", "ssh-keygen -t rsa -N '' -f $CACTUS_CFG_PATH/corda-aio-image <<< y"] -RUN mv $CACTUS_CFG_PATH/corda-aio-image $CACTUS_CFG_PATH/corda-aio-image.key -RUN cp $CACTUS_CFG_PATH/corda-aio-image.pub ~/.ssh/authorized_keys - -# RUN tr -dc A-Za-z0-9 /root-password.txt -# RUN cat /root-password.txt | chpasswd -RUN echo "root:root" | chpasswd - -RUN curl https://download.corda.net/maven/corda-releases/net/corda/corda-tools-shell-cli/${CORDA_TOOLS_SHELL_CLI_VERSION}/corda-tools-shell-cli-${CORDA_TOOLS_SHELL_CLI_VERSION}-all.jar --output /corda-tools-shell-cli-all.jar -# This is what makes the "corda-shell" alias avaialble on the terminal -RUN java -jar /corda-tools-shell-cli-all.jar install-shell-extensions - -RUN git clone https://github.com/corda/samples-kotlin.git -WORKDIR /samples-kotlin -RUN git checkout ${SAMPLES_KOTLIN_SHA} - -RUN sed -i 's/4.8/4.7/g' Accounts/constants.properties -RUN sed -i 's/=10/=9/g' Accounts/constants.properties -RUN sed -i 's/4.8/4.7/g' Advanced/constants.properties -RUN sed -i 's/=10/=9/g' Advanced/constants.properties -RUN sed -i 's/4.8/4.7/g' Basic/constants.properties -RUN sed -i 's/=10/=9/g' Basic/constants.properties -RUN sed -i 's/4.8/4.7/g' BusinessNetworks/constants.properties -RUN sed -i 's/=10/=9/g' BusinessNetworks/constants.properties -RUN sed -i 's/4.8/4.7/g' Features/constants.properties -RUN sed -i 's/=10/=9/g' Features/constants.properties -RUN sed -i 's/4.8/4.7/g' Tokens/constants.properties -RUN sed -i 's/=10/=9/g' Tokens/constants.properties - -WORKDIR /samples-kotlin/${SAMPLES_KOTLIN_CORDAPP_SUB_DIR_PATH} - -# Install supervisord because we need to run the docker daemon and also the corda network -# meaning that we have multiple processes to run. -RUN apk add --no-cache supervisor - -RUN ./gradlew build deployNodes - -# OpenSSH server -EXPOSE 22 - -# supervisord web ui/dashboard -EXPOSE 9001 - -# Notary RPC -EXPOSE 10003 - -# Party A RPC -EXPOSE 10008 - -# Party B RPC -EXPOSE 10011 - -# Party C RPC -EXPOSE 10014 - -# Corda IOU Web GUIs for Node A,B,C -# EXPOSE 10009 10012 10015 - -# Jolokia for Party A,B,C and Notary -EXPOSE 7005 7006 7007 7008 - -# P2P messaging (localhost bound), RPC, admin RPC -# EXPOSE 10002 10003 10103 -# EXPOSE 10007 10008 10108 -# EXPOSE 10010 10011 10111 -# EXPOSE 10013 10014 10114 - -COPY supervisord.conf /etc/supervisord.conf -COPY run-party-a-server.sh / -COPY run-party-b-server.sh / -COPY run-party-c-server.sh / -COPY run-party-a-node.sh / -COPY run-party-b-node.sh / -COPY run-party-c-node.sh / -COPY run-notary-node.sh / -COPY healthcheck.sh / - -# By default we only run the absolute minimum which is a single party's node. -# For more complex tests everything else can also be enabled via the env vars -# below so that if needed there is 2 parties, a notary and a dedicated web server -# for all 3 of those nodes. -# "Web server" => the same one as in the official corda samples-kotlin repo -ENV PARTY_A_NODE_ENABLED="true" -ENV PARTY_A_WEB_SRV_ENABLED="false" - -ENV PARTY_B_NODE_ENABLED="true" -ENV PARTY_B_WEB_SRV_ENABLED="false" - -ENV PARTY_C_NODE_ENABLED="true" -ENV PARTY_C_WEB_SRV_ENABLED="false" - -ENV NOTARY_NODE_ENABLED="true" - -# Extend the parent image's entrypoint -# https://superuser.com/questions/1459466/can-i-add-an-additional-docker-entrypoint-script -ENTRYPOINT ["/usr/bin/supervisord"] -CMD ["--configuration", "/etc/supervisord.conf", "--nodaemon"] - -# We consider the container healthy once the default example fabcar contract has been deployed -# and is responsive to queries as well -HEALTHCHECK --interval=1s --timeout=5s --start-period=5s --retries=180 CMD /healthcheck.sh diff --git a/tools/docker/corda-all-in-one/README.md b/tools/docker/corda-all-in-one/README.md deleted file mode 100644 index 7ba5dd1331..0000000000 --- a/tools/docker/corda-all-in-one/README.md +++ /dev/null @@ -1,128 +0,0 @@ -# cactus-corda-all-in-one - -> This docker image is for `testing` and `development` only. -> Do NOT use in production! - -## Usage - -### Build and Run Image Locally - -```sh -DOCKER_BUILDKIT=1 docker build ./tools/docker/corda-all-in-one/ -t caio -docker run --rm --privileged caio -``` - -# cactus-corda-4-8-all-in-one - -> This docker image is for `testing` and `development` only. -> Do NOT use in production! - -## Usage - -### Build and Run Image Locally - -```sh -DOCKER_BUILDKIT=1 docker build ./tools/docker/corda-all-in-one/ -f ./tools/docker/corda-all-in-one/corda-v4_8/Dockerfile -t caio48 -docker run --rm --privileged caio48 -``` - -# cactus-corda-4-8-all-in-one-flowdb - -> This docker image is for `testing` and `development` only. -> Do NOT use in production! - -## Customization - -`build.gradle` file from this sample has defined a single node called PartyA. It was modified to deploy the same nodes as in the obligation sample to make it work with our CordaTestLedger: -- Notary -- ParticipantA -- ParticipantB -- ParticipantC - -## Usage - -### Build and Run Image Locally - -```sh -DOCKER_BUILDKIT=1 docker build ./tools/docker/corda-all-in-one/corda-v4_8-flowdb/ -t caio48-flowdb -docker run --rm --privileged caio48-flowdb -``` - -# cactus-corda-4-12-all-in-one - -> This docker image is for `testing` and `development` only. -> Do NOT use in production! - -## Usage - -### Build and Run Image Locally - -```sh -DOCKER_BUILDKIT=1 docker build ./tools/docker/corda-all-in-one/corda-v4_12/ -f ./tools/docker/corda-all-in-one/corda-v4_12/Dockerfile -t caio412 -docker run --rm --privileged caio412 -``` - - -# cactus-corda-5-all-in-one-solar - -> This docker image is for `testing` and `development` only. -> Do NOT use in production! - -## Usage - -### Build and Run Image Locally - -```sh -DOCKER_BUILDKIT=1 docker build ./tools/docker/corda-all-in-one/corda-v5/ -f ./tools/docker/corda-all-in-one/corda-v5/Dockerfile -t caio5 -docker run --privileged caio5 -``` - -### Install Application and Testing - -Open container CLI: - -```sh -docker exec -it /bin/sh -``` - -In container CLI, run this command to install the sample application on the network: - -```sh -/root/bin/corda-cli/bin/corda-cli package install -n solar-system /corda5-solarsystem-contracts-demo/solar-system.cpb -``` - -To check that everything works correctly, start a flow with the following curl command: - -```sh -curl -u earthling:password --insecure -X POST "https://localhost:12112/api/v1/flowstarter/startflow" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"rpcStartFlowRequest\":{\"clientId\":\"launchpad-1\",\"flowName\":\"net.corda.solarsystem.flows.LaunchProbeFlow\",\"parameters\":{\"parametersInJson\":\"{\\\"message\\\": \\\"Hello Mars\\\", \\\"target\\\": \\\"C=GB, L=FOURTH, O=MARS, OU=PLANET\\\", \\\"planetaryOnly\\\":\\\"true\\\"}\"}}}" -``` -If the command is successful, it returns a 200 response, including the flowId (a uuid) and the clientId, like the following: -```json -{ - "flowId":{ - "uuid":"9c8d5b46-be92-4be8-9569-76cb3e41cde9" - }, - "clientId":"launchpad-1" -} -``` -Using the field value ```flowId``` from the answer above, you can check the flow status: -```sh -curl -u earthling:password --insecure -X GET "https://localhost:12112/api/v1/flowstarter/flowoutcome/" -H "accept: application/json" -``` -It returns a 200 response, which includes these items in the response body: - -- Flow status -- Signatures of both parties -- ID of the state - -Sample of response: -```json -{ - "status":"COMPLETED", - "resultJson":"{ \n \"txId\" : \"SHA-256:882FCCFA0CE08FEC4F90A8BBC8B8FBC1DE3CBDA8DBED4D6562E0922234B87E4F\",\n \"outputStates\" : [\"{\\\"message\\\":\\\"Hello Mars\\\",\\\"planetaryOnly\\\":true,\\\"launcher\\\":\\\"OU\\u003dPLANET, O\\u003dEARTH, L\\u003dTHIRD, C\\u003dIE\\\",\\\"target\\\":\\\"OU\\u003dPLANET, O\\u003dMARS, L\\u003dFOURTH, C\\u003dGB\\\",\\\"linearId\\\":\\\"31800d11-b518-4fb7-a18e-18cc1c64a4ff\\\"}\"], \n \"signatures\": [\"ijMOjsLWxihWLnfxw7DoIv1gpHFaSAs+VfGSS5qaI1Z4cZu96riAo1uEFSbeskZTt2eGNwv05IP3dS08AjLRCA==\", \"2yRNwdrqKU6/lrUfgmaiXxdPYHjXxfXIYlEL8RHU2aNGQPUVXmc+jbsaNxbcig7Fs0kck28JreuUwn1lJOZODw==\"]\n}", - "exceptionDigest":null -} -``` - - - diff --git a/tools/docker/corda-all-in-one/corda-v4_8/Dockerfile b/tools/docker/corda-all-in-one/corda-v4_8/Dockerfile deleted file mode 100644 index d6ca3b6125..0000000000 --- a/tools/docker/corda-all-in-one/corda-v4_8/Dockerfile +++ /dev/null @@ -1,147 +0,0 @@ -FROM docker:24.0.5-dind - -# cordaVersion=4.8.5 -# cordaCoreVersion=4.8.5 -ARG SAMPLES_KOTLIN_SHA=8ce33f57ad1dd77f721af4d1f59d72f3d331fd0c -ARG SAMPLES_KOTLIN_CORDAPP_SUB_DIR_PATH="./Advanced/obligation-cordapp/" -ARG CORDA_TOOLS_SHELL_CLI_VERSION=4.8 - -WORKDIR / - -RUN apk update - -# Install dependencies of Docker Compose -RUN apk add docker-cli docker-cli-compose - -# Install git so we can check out the kotlin-samples repo of Corda -RUN apk add --no-cache git - -# Fabric Samples needs bash, sh is not good enough here -RUN apk add --no-cache bash - -# Need curl to run healthchecks -RUN apk add --no-cache curl - -# The file binary is used to inspect exectubles when debugging container image issues -RUN apk add --no-cache file - -RUN apk add openjdk8 - -ENV CACTUS_CFG_PATH=/etc/hyperledger/cactus -RUN mkdir -p $CACTUS_CFG_PATH - -# Need to install augtool for manipulating the SSH configuration files below -RUN apk add --no-cache augeas - -# OpenSSH - need to have it so we can shell in and install/instantiate contracts and troubleshoot -RUN apk del openssh* -RUN apk add --no-cache openssh - -# Configure the OpenSSH server we just installed -RUN augtool 'set /files/etc/ssh/sshd_config/AuthorizedKeysFile ".ssh/authorized_keys /etc/authorized_keys/%u"' -RUN augtool 'set /files/etc/ssh/sshd_config/PermitRootLogin yes' -RUN augtool 'set /files/etc/ssh/sshd_config/PasswordAuthentication yes' -RUN augtool 'set /files/etc/ssh/sshd_config/PermitEmptyPasswords yes' -RUN augtool 'set /files/etc/ssh/sshd_config/Port 22' -RUN augtool 'set /files/etc/ssh/sshd_config/LogLevel DEBUG2' -RUN augtool 'set /files/etc/ssh/sshd_config/LoginGraceTime 10' -# Create the server's key - without this sshd will refuse to start -RUN ssh-keygen -A - -# Generate an RSA keypair on the fly to avoid having to hardcode one in the image -# which technically does not pose a security threat since this is only a development -# image, but we do it like this anyway. -RUN mkdir ~/.ssh -RUN chmod 700 ~/.ssh/ -RUN touch ~/.ssh/authorized_keys -RUN ["/bin/bash", "-c", "ssh-keygen -t rsa -N '' -f $CACTUS_CFG_PATH/corda-aio-image <<< y"] -RUN mv $CACTUS_CFG_PATH/corda-aio-image $CACTUS_CFG_PATH/corda-aio-image.key -RUN cp $CACTUS_CFG_PATH/corda-aio-image.pub ~/.ssh/authorized_keys - -# RUN tr -dc A-Za-z0-9 /root-password.txt -# RUN cat /root-password.txt | chpasswd -RUN echo "root:root" | chpasswd - -RUN curl https://download.corda.net/maven/corda-releases/net/corda/corda-tools-shell-cli/${CORDA_TOOLS_SHELL_CLI_VERSION}/corda-tools-shell-cli-${CORDA_TOOLS_SHELL_CLI_VERSION}-all.jar --output /corda-tools-shell-cli-all.jar -# This is what makes the "corda-shell" alias avaialble on the terminal -RUN java -jar /corda-tools-shell-cli-all.jar install-shell-extensions - -RUN git clone https://github.com/corda/samples-kotlin.git -WORKDIR /samples-kotlin -RUN git checkout ${SAMPLES_KOTLIN_SHA} - -WORKDIR /samples-kotlin/${SAMPLES_KOTLIN_CORDAPP_SUB_DIR_PATH} - -# Set the platform versionn to 11 instead of the default 12 for the basic cordapps -RUN sed -i "s/platformVersion=12/platformVersion=11/g" /samples-kotlin/Basic/constants.properties - -# Install supervisord because we need to run the docker daemon and also the corda network -# meaning that we have multiple processes to run. -RUN apk add --no-cache supervisor - -RUN ./gradlew build deployNodes - -# OpenSSH server -EXPOSE 22 - -# supervisord web ui/dashboard -EXPOSE 9001 - -# Notary RPC -EXPOSE 10003 - -# Party A RPC -EXPOSE 10008 - -# Party B RPC -EXPOSE 10011 - -# Party C RPC -EXPOSE 10014 - -# Corda IOU Web GUIs for Node A,B,C -# EXPOSE 10009 10012 10015 - -# Jolokia for Party A,B,C and Notary -EXPOSE 7005 7006 7007 7008 - -# P2P messaging (localhost bound), RPC, admin RPC -# EXPOSE 10002 10003 10103 -# EXPOSE 10007 10008 10108 -# EXPOSE 10010 10011 10111 -# EXPOSE 10013 10014 10114 - -COPY supervisord.conf /etc/supervisord.conf -COPY run-party-a-server.sh / -COPY run-party-b-server.sh / -COPY run-party-c-server.sh / -COPY run-party-a-node.sh / -COPY run-party-b-node.sh / -COPY run-party-c-node.sh / -COPY run-notary-node.sh / -COPY healthcheck.sh / - -# By default we only run the absolute minimum which is a single party's node. -# For more complex tests everything else can also be enabled via the env vars -# below so that if needed there is 2 parties, a notary and a dedicated web server -# for all 3 of those nodes. -# "Web server" => the same one as in the official corda samples-kotlin repo -ENV PARTY_A_NODE_ENABLED="true" -ENV PARTY_A_WEB_SRV_ENABLED="false" - -ENV PARTY_B_NODE_ENABLED="true" -ENV PARTY_B_WEB_SRV_ENABLED="false" - -ENV PARTY_C_NODE_ENABLED="true" -ENV PARTY_C_WEB_SRV_ENABLED="false" - -ENV NOTARY_NODE_ENABLED="true" - -# Extend the parent image's entrypoint -# https://superuser.com/questions/1459466/can-i-add-an-additional-docker-entrypoint-script -ENTRYPOINT ["/usr/bin/supervisord"] -CMD ["--configuration", "/etc/supervisord.conf", "--nodaemon"] - -# We consider the container healthy once the default example fabcar contract has been deployed -# and is responsive to queries as well -HEALTHCHECK --interval=1s --timeout=5s --start-period=5s --retries=180 CMD /healthcheck.sh diff --git a/tools/docker/corda-all-in-one/healthcheck.sh b/tools/docker/corda-all-in-one/healthcheck.sh deleted file mode 100755 index ea5b904b8e..0000000000 --- a/tools/docker/corda-all-in-one/healthcheck.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -set -e - -if [ "$PARTY_A_WEB_SRV_ENABLED" = "true" ] -then - curl -vv -i -X OPTIONS http://127.0.0.1:10009/web/iou/ -fi - -if [ "$PARTY_B_WEB_SRV_ENABLED" = "true" ] -then - curl -vv -i -X OPTIONS http://127.0.0.1:10012/web/iou/ -fi - -if [ "$PARTY_C_WEB_SRV_ENABLED" = "true" ] -then - curl -vv -i -X OPTIONS http://127.0.0.1:10015/web/iou/ -fi - - -if [ "$PARTY_A_NODE_ENABLED" = "true" ] -then - curl -v 'http://localhost:7005/jolokia/exec/org.apache.activemq.artemis:address=%22rpc.server%22,broker=%22RPC%22,component=addresses,queue=%22rpc.server%22,routing-type=%22multicast%22,subcomponent=queues/countMessages()/' -fi - -if [ "$PARTY_B_NODE_ENABLED" = "true" ] -then - curl -v 'http://localhost:7006/jolokia/exec/org.apache.activemq.artemis:address=%22rpc.server%22,broker=%22RPC%22,component=addresses,queue=%22rpc.server%22,routing-type=%22multicast%22,subcomponent=queues/countMessages()/' -fi - -if [ "$PARTY_C_NODE_ENABLED" = "true" ] -then - curl -v 'http://localhost:7007/jolokia/exec/org.apache.activemq.artemis:address=%22rpc.server%22,broker=%22RPC%22,component=addresses,queue=%22rpc.server%22,routing-type=%22multicast%22,subcomponent=queues/countMessages()/' -fi \ No newline at end of file diff --git a/tools/docker/corda-all-in-one/run-notary-node.sh b/tools/docker/corda-all-in-one/run-notary-node.sh deleted file mode 100755 index 9d9aa6b234..0000000000 --- a/tools/docker/corda-all-in-one/run-notary-node.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -set -e - -if [ "$NOTARY_NODE_ENABLED" = "true" ] -then - java \ - -Dcapsule.jvm.args="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5008 -javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7008,logHandlerClass=net.corda.node.JolokiaSlf4jAdapter" \ - -Dname=Notary \ - -jar \ - /samples-kotlin/Advanced/obligation-cordapp/build/nodes/Notary/corda.jar -else - sleep infinity -fi diff --git a/tools/docker/corda-all-in-one/run-party-a-node.sh b/tools/docker/corda-all-in-one/run-party-a-node.sh deleted file mode 100755 index 0078bb8f5b..0000000000 --- a/tools/docker/corda-all-in-one/run-party-a-node.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -if [ "$PARTY_A_NODE_ENABLED" = "true" ] -then - java -Dcapsule.jvm.args="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7005,logHandlerClass=net.corda.node.JolokiaSlf4jAdapter" -Dname=ParticipantA -jar /samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantA/corda.jar -else - sleep infinity -fi diff --git a/tools/docker/corda-all-in-one/run-party-a-server.sh b/tools/docker/corda-all-in-one/run-party-a-server.sh deleted file mode 100755 index 4eb927bbb9..0000000000 --- a/tools/docker/corda-all-in-one/run-party-a-server.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -if [ "$PARTY_A_WEB_SRV_ENABLED" = "true" ] -then - ./gradlew runPartyAServer -else - sleep infinity -fi diff --git a/tools/docker/corda-all-in-one/run-party-b-node.sh b/tools/docker/corda-all-in-one/run-party-b-node.sh deleted file mode 100755 index a2546ee95a..0000000000 --- a/tools/docker/corda-all-in-one/run-party-b-node.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -if [ "$PARTY_B_NODE_ENABLED" = "true" ] -then - java -Dcapsule.jvm.args="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5006 -javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7006,logHandlerClass=net.corda.node.JolokiaSlf4jAdapter" -Dname=ParticipantB -jar /samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantB/corda.jar -else - sleep infinity -fi diff --git a/tools/docker/corda-all-in-one/run-party-b-server.sh b/tools/docker/corda-all-in-one/run-party-b-server.sh deleted file mode 100755 index 5c44139861..0000000000 --- a/tools/docker/corda-all-in-one/run-party-b-server.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -if [ "$PARTY_B_WEB_SRV_ENABLED" = "true" ] -then - ./gradlew runPartyBServer -else - sleep infinity -fi diff --git a/tools/docker/corda-all-in-one/run-party-c-node.sh b/tools/docker/corda-all-in-one/run-party-c-node.sh deleted file mode 100755 index 8755b78e41..0000000000 --- a/tools/docker/corda-all-in-one/run-party-c-node.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -set -e - -if [ "$PARTY_C_NODE_ENABLED" = "true" ] -then - java \ - -Dcapsule.jvm.args="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5007 -javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7007,logHandlerClass=net.corda.node.JolokiaSlf4jAdapter" \ - -Dname=ParticipantC \ - -jar \ - /samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantC/corda.jar -else - sleep infinity -fi diff --git a/tools/docker/corda-all-in-one/run-party-c-server.sh b/tools/docker/corda-all-in-one/run-party-c-server.sh deleted file mode 100755 index f74b84609c..0000000000 --- a/tools/docker/corda-all-in-one/run-party-c-server.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -if [ "$PARTY_C_WEB_SRV_ENABLED" = "true" ] -then - ./gradlew runPartyCServer -else - sleep infinity -fi diff --git a/tools/docker/corda-all-in-one/supervisord.conf b/tools/docker/corda-all-in-one/supervisord.conf deleted file mode 100644 index ea1da295bf..0000000000 --- a/tools/docker/corda-all-in-one/supervisord.conf +++ /dev/null @@ -1,108 +0,0 @@ -[supervisord] -logfile = /var/log/supervisord.log -logfile_maxbytes = 50MB -logfile_backups=10 -loglevel = info - -[rpcinterface:supervisor] -supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface - -[supervisorctl] -serverurl=http://127.0.0.1:9001 - -[inet_http_server] -port = 0.0.0.0:9001 - -[program:sshd] -command=/usr/sbin/sshd -D -ddd -autostart=true -autorestart=true -stdout_logfile=/var/log/sshd.out.log -stderr_logfile=/var/log/sshd.err.log -# stdout_logfile=/dev/stdout -# stdout_logfile_maxbytes=0 -# stderr_logfile=/dev/stderr -# stderr_logfile_maxbytes=0 - -[program:dockerd] -command=dockerd-entrypoint.sh -autostart=true -autorestart=true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:corda-a] -directory=/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantA/ -command=/run-party-a-node.sh -autostart=true -autorestart=false -exitcodes=0 -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:corda-b] -directory=/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantB -command=/run-party-b-node.sh -autostart=true -autorestart=false -exitcodes=0 -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:corda-c] -directory=/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantC -command=/run-party-c-node.sh -autostart=true -autorestart=false -exitcodes=0 -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:corda-n] -directory=/samples-kotlin/Advanced/obligation-cordapp/build/nodes/Notary -command=/run-notary-node.sh -autostart=true -autorestart=false -exitcodes=0 -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:corda-run-party-a-server] -directory=/samples-kotlin/Advanced/obligation-cordapp/ -command=/run-party-a-server.sh -autostart=true -autorestart=unexpected -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:corda-run-party-b-server] -directory=/samples-kotlin/Advanced/obligation-cordapp/ -command=/run-party-b-server.sh -autostart=true -autorestart=unexpected -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:corda-run-party-c-server] -directory=/samples-kotlin/Advanced/obligation-cordapp/ -command=/run-party-c-server.sh -autostart=true -autorestart=unexpected -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0