From 08bc75e0ae23c8db98387273defa9dbca7b8d2f4 Mon Sep 17 00:00:00 2001 From: Peter Somogyvari Date: Fri, 21 Jun 2024 22:31:52 +0000 Subject: [PATCH] test(test-tooling): add negotiation-cordapp support from kotlin-samples 1. This way we can have examples and test cases developed that use either the negotiation or the obligation cordapps. Earlier we could only use the obligation cordapp as it was the hardcoded directory path for contract deployments. 2. Not an actual feature just an extension to the testing infrastructure that we have and we need the additional possibilities here because of the new Harmonia Labs examples coming up. Signed-off-by: Peter Somogyvari --- .../typescript/corda/corda-test-ledger.ts | 24 ++++++---- .../typescript/corda/sample-cordapp-enum.ts | 45 +++++++++++++++++++ 2 files changed, 61 insertions(+), 8 deletions(-) diff --git a/packages/cactus-test-tooling/src/main/typescript/corda/corda-test-ledger.ts b/packages/cactus-test-tooling/src/main/typescript/corda/corda-test-ledger.ts index be12dbed74..d633ccada9 100644 --- a/packages/cactus-test-tooling/src/main/typescript/corda/corda-test-ledger.ts +++ b/packages/cactus-test-tooling/src/main/typescript/corda/corda-test-ledger.ts @@ -341,20 +341,28 @@ export class CordaTestLedger implements ITestLedger { return Containers.getPublicPort(22, aContainerInfo); } - public async getCorDappsDirPartyA(): Promise { - return "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantA/cordapps"; + public async getCorDappsDirPartyA( + sampleCordapp: SampleCordappEnum = SampleCordappEnum.ADVANCED_OBLIGATION, + ): Promise { + return SAMPLE_CORDAPP_DATA[sampleCordapp].cordappDirPartyA; } - public async getCorDappsDirPartyB(): Promise { - return "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantB/cordapps"; + public async getCorDappsDirPartyB( + sampleCordapp: SampleCordappEnum = SampleCordappEnum.ADVANCED_OBLIGATION, + ): Promise { + return SAMPLE_CORDAPP_DATA[sampleCordapp].cordappDirPartyB; } - public async getCorDappsDirPartyC(): Promise { - return "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantC/cordapps"; + public async getCorDappsDirPartyC( + sampleCordapp: SampleCordappEnum = SampleCordappEnum.ADVANCED_OBLIGATION, + ): Promise { + return SAMPLE_CORDAPP_DATA[sampleCordapp].cordappDirPartyC; } - public async getCorDappsDirPartyNotary(): Promise { - return "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/Notary/cordapps"; + public async getCorDappsDirPartyNotary( + sampleCordapp: SampleCordappEnum = SampleCordappEnum.ADVANCED_OBLIGATION, + ): Promise { + return SAMPLE_CORDAPP_DATA[sampleCordapp].cordappDirNotary; } public async getSshConfig(): Promise { diff --git a/packages/cactus-test-tooling/src/main/typescript/corda/sample-cordapp-enum.ts b/packages/cactus-test-tooling/src/main/typescript/corda/sample-cordapp-enum.ts index 873b796451..bbc4a6ea97 100644 --- a/packages/cactus-test-tooling/src/main/typescript/corda/sample-cordapp-enum.ts +++ b/packages/cactus-test-tooling/src/main/typescript/corda/sample-cordapp-enum.ts @@ -6,6 +6,7 @@ */ export const enum SampleCordappEnum { ADVANCED_OBLIGATION = "ADVANCED_OBLIGATION", + ADVANCED_NEGOTIATION = "ADVANCED_NEGOTIATION", BASIC_CORDAPP = "BASIC_CORDAPP", BASIC_FLOW = "BASIC_FLOW", } @@ -19,6 +20,14 @@ export const enum SampleCordappEnum { export const SAMPLE_CORDAPP_DATA = Object.freeze({ [SampleCordappEnum.ADVANCED_OBLIGATION]: { rootDir: "/samples-kotlin/Advanced/obligation-cordapp/", + cordappDirPartyA: + "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantA/cordapps", + cordappDirPartyB: + "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantB/cordapps", + cordappDirPartyC: + "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantC/cordapps", + cordappDirNotary: + "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/Notary/cordapps", jars: [ { jarRelativePath: "contracts/build/libs/contracts-1.0.jar", @@ -30,8 +39,36 @@ export const SAMPLE_CORDAPP_DATA = Object.freeze({ }, ], }, + [SampleCordappEnum.ADVANCED_NEGOTIATION]: { + rootDir: "/samples-kotlin/Advanced/negotiation-cordapp/", + cordappDirPartyA: + "/samples-kotlin/Advanced/negotiation-cordapp/build/nodes/ParticipantA/cordapps", + cordappDirPartyB: + "/samples-kotlin/Advanced/negotiation-cordapp/build/nodes/ParticipantB/cordapps", + cordappDirPartyC: "NOT_APPLICABLE__THIS_SAMPLE_ONLY_HAS_A_AND_B_PARTIES", + cordappDirNotary: + "/samples-kotlin/Advanced/negotiation-cordapp/build/nodes/Notary/cordapps", + jars: [ + { + jarRelativePath: "contracts/build/libs/contracts-0.2.jar", + fileName: "_contracts-0.2.jar", + }, + { + jarRelativePath: "workflows/build/libs/workflows-0.2.jar", + fileName: "_workflows-0.2.jar", + }, + ], + }, [SampleCordappEnum.BASIC_CORDAPP]: { rootDir: "/samples-kotlin/Basic/cordapp-example/", + cordappDirPartyA: + "/samples-kotlin/Basic/cordapp-example/build/nodes/ParticipantA/cordapps", + cordappDirPartyB: + "/samples-kotlin/Basic/cordapp-example/build/nodes/ParticipantB/cordapps", + cordappDirPartyC: + "/samples-kotlin/Basic/cordapp-example/build/nodes/ParticipantC/cordapps", + cordappDirNotary: + "/samples-kotlin/Basic/cordapp-example/build/nodes/Notary/cordapps", jars: [ { jarRelativePath: "contracts/build/libs/contracts-1.0.jar", @@ -45,6 +82,14 @@ export const SAMPLE_CORDAPP_DATA = Object.freeze({ }, [SampleCordappEnum.BASIC_FLOW]: { rootDir: "/samples-kotlin/Basic/flow-database-access/", + cordappDirPartyA: + "/samples-kotlin/Basic/flow-database-access/build/nodes/ParticipantA/cordapps", + cordappDirPartyB: + "/samples-kotlin/Basic/flow-database-access/build/nodes/ParticipantB/cordapps", + cordappDirPartyC: + "/samples-kotlin/Basic/flow-database-access/build/nodes/ParticipantC/cordapps", + cordappDirNotary: + "/samples-kotlin/Basic/flow-database-access/build/nodes/Notary/cordapps", jars: [ { jarRelativePath: "workflows/build/libs/workflows-0.1.jar",