Skip to content

Commit a37e0e8

Browse files
committed
refactor!: Replace runExample / runRejectingExample / runThrowingExample with runInteraction / runRejectingInteraction / runThrowingInteraction
1 parent 6841bef commit a37e0e8

52 files changed

Lines changed: 385 additions & 396 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/maintainers/AddingDsl.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,14 @@ Create a `ContractDefiner` class. It must:
131131
1. Have a constructor that takes a `ContractCaseConfig`, and instantiates a private
132132
`BoundaryContractDefiner`, with a mapped version of the config. See the boundary
133133
mappings section below.
134-
2. Expose a `runExample` method
135-
- This method delegates to the BoundaryContractDefiner.runExample
134+
2. Expose a `runInteraction` method
135+
- This method delegates to the BoundaryContractDefiner.runInteraction
136136
- Map the returned `BoundaryResult` into an error (if appropriate). See the error mappings section below.
137137
- TODO: Describe how to map trigger / testResponse - this is the only place where you may throw a `CaseConfigurationError`
138-
3. Expose a `runRejectingExample` method.
139-
-You may change the name of `runRejectingExample` to `runXXXExample` where `XXX` is an idiomatic word for `rejecting` in your language.
140-
- This method delegates to the `BoundaryContractDefiner.runRejectingExample`
141-
- Map the `BoundaryResult` the same way as the `runExample` method.
138+
3. Expose a `runRejectingInteraction` method.
139+
-You may change the name of `runRejectingInteraction` to `runXXXExample` where `XXX` is an idiomatic word for `rejecting` in your language.
140+
- This method delegates to the `BoundaryContractDefiner.runRejectingInteraction`
141+
- Map the `BoundaryResult` the same way as the `runInteraction` method.
142142
- TODO: Describe how to map trigger / testErrorResponse - this is the only place where you may throw a `CaseConfigurationError`
143143

144144
### Unmarshalling a `BoundaryFailure`

docs/maintainers/todo.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Document
4040

4141
- [ ] `namedLookup` for looking up a named segment
4242
- [ ] Automatically named request / response pairs
43-
- [ ] stateHandlers and Config in the runExample or the main contract call
43+
- [ ] stateHandlers and Config in the runInteraction or the main contract call
4444

4545
Java:
4646

@@ -372,7 +372,7 @@ Cool features
372372
- [ ] Write documentation for every single CaseConfigurationError
373373
- [ ] Annotate code generally with maintainer debug info
374374
- [ ] Make raw errors on matcher save print a diff
375-
- [ ] Make it an error to specify a different consumerName in runExample and defineContract
375+
- [ ] Make it an error to specify a different consumerName in runInteraction and defineContract
376376
- [ ] Warn when an autogenerated name is used directly in a test
377377
- [ ] Debug logs should include state variables
378378
- [ ] Error collapsers, so if the same spot produces the same errors for different reasons it will only be reported once.

packages/case-connector-proto/proto/contract_case_stream.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ message BeginDefinitionRequest {
9191

9292
// From Host to Core, instructs the core to run a particular example as part of
9393
// contract definition
94-
message RunExampleRequest {
94+
message RunInteractionRequest {
9595
google.protobuf.Struct example_definition = 2;
9696
ContractCaseConfig config = 3;
9797
}
9898

9999
// From host to core, instructs the core to run a particular example, that we
100100
// expect to fail. This is part of contract definition
101-
message RunRejectingExampleRequest {
101+
message RunRejectingInteractionRequest {
102102
google.protobuf.Struct example_definition = 2;
103103
ContractCaseConfig config = 3;
104104
}
@@ -346,9 +346,9 @@ message DefinitionRequest {
346346
// Host language wants to begin a definition
347347
BeginDefinitionRequest begin_definition = 2;
348348
// Host language wants to run an example that returns success
349-
RunExampleRequest run_example = 3;
349+
RunInteractionRequest run_interaction = 3;
350350
// Host language wants to run an example that returns a failure
351-
RunRejectingExampleRequest run_rejecting_example = 4;
351+
RunRejectingInteractionRequest run_rejecting_interaction = 4;
352352
// Host language wants to strip the matchers from a defintion
353353
StripMatchersRequest strip_matchers = 5;
354354
// Host langauge has finished the definition

packages/case-connector-proto/src/grpc/proto/contract_case_stream_pb.d.ts

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -527,82 +527,82 @@ export namespace BeginDefinitionRequest {
527527
};
528528
}
529529

530-
export class RunExampleRequest extends jspb.Message {
530+
export class RunInteractionRequest extends jspb.Message {
531531
hasExampleDefinition(): boolean;
532532
clearExampleDefinition(): void;
533533
getExampleDefinition(): google_protobuf_struct_pb.Struct | undefined;
534534
setExampleDefinition(
535535
value?: google_protobuf_struct_pb.Struct,
536-
): RunExampleRequest;
536+
): RunInteractionRequest;
537537

538538
hasConfig(): boolean;
539539
clearConfig(): void;
540540
getConfig(): ContractCaseConfig | undefined;
541-
setConfig(value?: ContractCaseConfig): RunExampleRequest;
541+
setConfig(value?: ContractCaseConfig): RunInteractionRequest;
542542

543543
serializeBinary(): Uint8Array;
544-
toObject(includeInstance?: boolean): RunExampleRequest.AsObject;
544+
toObject(includeInstance?: boolean): RunInteractionRequest.AsObject;
545545
static toObject(
546546
includeInstance: boolean,
547-
msg: RunExampleRequest,
548-
): RunExampleRequest.AsObject;
547+
msg: RunInteractionRequest,
548+
): RunInteractionRequest.AsObject;
549549
static extensions: { [key: number]: jspb.ExtensionFieldInfo<jspb.Message> };
550550
static extensionsBinary: {
551551
[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>;
552552
};
553553
static serializeBinaryToWriter(
554-
message: RunExampleRequest,
554+
message: RunInteractionRequest,
555555
writer: jspb.BinaryWriter,
556556
): void;
557-
static deserializeBinary(bytes: Uint8Array): RunExampleRequest;
557+
static deserializeBinary(bytes: Uint8Array): RunInteractionRequest;
558558
static deserializeBinaryFromReader(
559-
message: RunExampleRequest,
559+
message: RunInteractionRequest,
560560
reader: jspb.BinaryReader,
561-
): RunExampleRequest;
561+
): RunInteractionRequest;
562562
}
563563

564-
export namespace RunExampleRequest {
564+
export namespace RunInteractionRequest {
565565
export type AsObject = {
566566
exampleDefinition?: google_protobuf_struct_pb.Struct.AsObject;
567567
config?: ContractCaseConfig.AsObject;
568568
};
569569
}
570570

571-
export class RunRejectingExampleRequest extends jspb.Message {
571+
export class RunRejectingInteractionRequest extends jspb.Message {
572572
hasExampleDefinition(): boolean;
573573
clearExampleDefinition(): void;
574574
getExampleDefinition(): google_protobuf_struct_pb.Struct | undefined;
575575
setExampleDefinition(
576576
value?: google_protobuf_struct_pb.Struct,
577-
): RunRejectingExampleRequest;
577+
): RunRejectingInteractionRequest;
578578

579579
hasConfig(): boolean;
580580
clearConfig(): void;
581581
getConfig(): ContractCaseConfig | undefined;
582-
setConfig(value?: ContractCaseConfig): RunRejectingExampleRequest;
582+
setConfig(value?: ContractCaseConfig): RunRejectingInteractionRequest;
583583

584584
serializeBinary(): Uint8Array;
585-
toObject(includeInstance?: boolean): RunRejectingExampleRequest.AsObject;
585+
toObject(includeInstance?: boolean): RunRejectingInteractionRequest.AsObject;
586586
static toObject(
587587
includeInstance: boolean,
588-
msg: RunRejectingExampleRequest,
589-
): RunRejectingExampleRequest.AsObject;
588+
msg: RunRejectingInteractionRequest,
589+
): RunRejectingInteractionRequest.AsObject;
590590
static extensions: { [key: number]: jspb.ExtensionFieldInfo<jspb.Message> };
591591
static extensionsBinary: {
592592
[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>;
593593
};
594594
static serializeBinaryToWriter(
595-
message: RunRejectingExampleRequest,
595+
message: RunRejectingInteractionRequest,
596596
writer: jspb.BinaryWriter,
597597
): void;
598-
static deserializeBinary(bytes: Uint8Array): RunRejectingExampleRequest;
598+
static deserializeBinary(bytes: Uint8Array): RunRejectingInteractionRequest;
599599
static deserializeBinaryFromReader(
600-
message: RunRejectingExampleRequest,
600+
message: RunRejectingInteractionRequest,
601601
reader: jspb.BinaryReader,
602-
): RunRejectingExampleRequest;
602+
): RunRejectingInteractionRequest;
603603
}
604604

605-
export namespace RunRejectingExampleRequest {
605+
export namespace RunRejectingInteractionRequest {
606606
export type AsObject = {
607607
exampleDefinition?: google_protobuf_struct_pb.Struct.AsObject;
608608
config?: ContractCaseConfig.AsObject;
@@ -832,11 +832,11 @@ export namespace CoreFunctionHandle {
832832
}
833833

834834
export class SetupInfo extends jspb.Message {
835-
getStatevariablesMap(): jspb.Map<
835+
getStateVariablesMap(): jspb.Map<
836836
string,
837837
google_protobuf_wrappers_pb.StringValue
838838
>;
839-
clearStatevariablesMap(): void;
839+
clearStateVariablesMap(): void;
840840

841841
getMockMap(): jspb.Map<string, google_protobuf_wrappers_pb.StringValue>;
842842
clearMockMap(): void;
@@ -864,7 +864,7 @@ export class SetupInfo extends jspb.Message {
864864

865865
export namespace SetupInfo {
866866
export type AsObject = {
867-
statevariablesMap: Array<
867+
stateVariablesMap: Array<
868868
[string, google_protobuf_wrappers_pb.StringValue.AsObject]
869869
>;
870870

@@ -1446,15 +1446,17 @@ export class DefinitionRequest extends jspb.Message {
14461446
getBeginDefinition(): BeginDefinitionRequest | undefined;
14471447
setBeginDefinition(value?: BeginDefinitionRequest): DefinitionRequest;
14481448

1449-
hasRunExample(): boolean;
1450-
clearRunExample(): void;
1451-
getRunExample(): RunExampleRequest | undefined;
1452-
setRunExample(value?: RunExampleRequest): DefinitionRequest;
1449+
hasRunInteraction(): boolean;
1450+
clearRunInteraction(): void;
1451+
getRunInteraction(): RunInteractionRequest | undefined;
1452+
setRunInteraction(value?: RunInteractionRequest): DefinitionRequest;
14531453

1454-
hasRunRejectingExample(): boolean;
1455-
clearRunRejectingExample(): void;
1456-
getRunRejectingExample(): RunRejectingExampleRequest | undefined;
1457-
setRunRejectingExample(value?: RunRejectingExampleRequest): DefinitionRequest;
1454+
hasRunRejectingInteraction(): boolean;
1455+
clearRunRejectingInteraction(): void;
1456+
getRunRejectingInteraction(): RunRejectingInteractionRequest | undefined;
1457+
setRunRejectingInteraction(
1458+
value?: RunRejectingInteractionRequest,
1459+
): DefinitionRequest;
14581460

14591461
hasStripMatchers(): boolean;
14601462
clearStripMatchers(): void;
@@ -1513,8 +1515,8 @@ export namespace DefinitionRequest {
15131515
export type AsObject = {
15141516
id?: google_protobuf_wrappers_pb.StringValue.AsObject;
15151517
beginDefinition?: BeginDefinitionRequest.AsObject;
1516-
runExample?: RunExampleRequest.AsObject;
1517-
runRejectingExample?: RunRejectingExampleRequest.AsObject;
1518+
runInteraction?: RunInteractionRequest.AsObject;
1519+
runRejectingInteraction?: RunRejectingInteractionRequest.AsObject;
15181520
stripMatchers?: StripMatchersRequest.AsObject;
15191521
endDefinition?: EndDefinitionRequest.AsObject;
15201522
resultResponse?: ResultResponse.AsObject;
@@ -1526,8 +1528,8 @@ export namespace DefinitionRequest {
15261528
export enum KindCase {
15271529
KIND_NOT_SET = 0,
15281530
BEGIN_DEFINITION = 2,
1529-
RUN_EXAMPLE = 3,
1530-
RUN_REJECTING_EXAMPLE = 4,
1531+
RUN_INTERACTION = 3,
1532+
RUN_REJECTING_INTERACTION = 4,
15311533
STRIP_MATCHERS = 5,
15321534
END_DEFINITION = 6,
15331535
RESULT_RESPONSE = 7,

0 commit comments

Comments
 (0)