Skip to content

Commit

Permalink
test(test-tooling): add negotiation-cordapp support from kotlin-samples
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
petermetz committed Jun 24, 2024
1 parent 969bdac commit 08bc75e
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,20 +341,28 @@ export class CordaTestLedger implements ITestLedger {
return Containers.getPublicPort(22, aContainerInfo);
}

public async getCorDappsDirPartyA(): Promise<string> {
return "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantA/cordapps";
public async getCorDappsDirPartyA(
sampleCordapp: SampleCordappEnum = SampleCordappEnum.ADVANCED_OBLIGATION,
): Promise<string> {
return SAMPLE_CORDAPP_DATA[sampleCordapp].cordappDirPartyA;
}

public async getCorDappsDirPartyB(): Promise<string> {
return "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantB/cordapps";
public async getCorDappsDirPartyB(
sampleCordapp: SampleCordappEnum = SampleCordappEnum.ADVANCED_OBLIGATION,
): Promise<string> {
return SAMPLE_CORDAPP_DATA[sampleCordapp].cordappDirPartyB;
}

public async getCorDappsDirPartyC(): Promise<string> {
return "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantC/cordapps";
public async getCorDappsDirPartyC(
sampleCordapp: SampleCordappEnum = SampleCordappEnum.ADVANCED_OBLIGATION,
): Promise<string> {
return SAMPLE_CORDAPP_DATA[sampleCordapp].cordappDirPartyC;
}

public async getCorDappsDirPartyNotary(): Promise<string> {
return "/samples-kotlin/Advanced/obligation-cordapp/build/nodes/Notary/cordapps";
public async getCorDappsDirPartyNotary(
sampleCordapp: SampleCordappEnum = SampleCordappEnum.ADVANCED_OBLIGATION,
): Promise<string> {
return SAMPLE_CORDAPP_DATA[sampleCordapp].cordappDirNotary;
}

public async getSshConfig(): Promise<SshConfig> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
export const enum SampleCordappEnum {
ADVANCED_OBLIGATION = "ADVANCED_OBLIGATION",
ADVANCED_NEGOTIATION = "ADVANCED_NEGOTIATION",
BASIC_CORDAPP = "BASIC_CORDAPP",
BASIC_FLOW = "BASIC_FLOW",
}
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 08bc75e

Please sign in to comment.