4949[source,xml,subs=attributes+]
5050----
5151<dependency>
52- <groupId>com.salesforce.revoman</groupId>
53- <artifactId>revoman</artifactId>
54- <version>{revoman-version}</version>
52+ <groupId>com.salesforce.revoman</groupId>
53+ <artifactId>revoman</artifactId>
54+ <version>{revoman-version}</version>
5555</dependency>
5656----
5757[.lead]
@@ -130,10 +130,10 @@ supplying your Postman templates and environments, and all your customizations t
130130[source,java,indent=0,options="nowrap"]
131131----
132132final var rundown =
133- ReVoman.revUp(
134- Kick.configure()
135- ...
136- .off())
133+ ReVoman.revUp(
134+ Kick.configure()
135+ ...
136+ .off())
137137----
138138
139139=== A Simple Example
@@ -156,13 +156,13 @@ ifdef::env-github[]
156156@Test
157157@DisplayName("restful-api.dev")
158158void restfulApiDev() {
159- final var rundown =
160- ReVoman.revUp( // <1>
161- Kick.configure()
162- .templatePath(PM_COLLECTION_PATH) // <2>
163- .environmentPath(PM_ENVIRONMENT_PATH) // <3>
164- .off());
165- assertThat(rundown.stepReports).hasSize(3); // <4>
159+ final var rundown =
160+ ReVoman.revUp( // <1>
161+ Kick.configure()
162+ .templatePath(PM_COLLECTION_PATH) // <2>
163+ .environmentPath(PM_ENVIRONMENT_PATH) // <3>
164+ .off());
165+ assertThat(rundown.stepReports).hasSize(3); // <4>
166166}
167167----
168168<1> `revUp` is the method to call passing a configuration, built as below
@@ -194,16 +194,16 @@ such that you can seamlessly run more assertions on top of the run.
194194[source,kotlin,indent=0,options="nowrap"]
195195----
196196Rundown(
197- val stepReports: List<StepReport>,
198- val mutableEnv: PostmanEnvironment<Any?>)
197+ val stepReports: List<StepReport>,
198+ val mutableEnv: PostmanEnvironment<Any?>)
199199
200200StepReport(
201- step: Step,
202- requestInfo: Either<RequestFailure, TxnInfo<Request>>? = null, // <1>
203- preStepHookFailure: PreStepHookFailure? = null,
204- responseInfo: Either<ResponseFailure, TxnInfo<Response>>? = null,
205- postStepHookFailure: PostStepHookFailure? = null,
206- envSnapshot: PostmanEnvironment<Any?> // <2>
201+ step: Step,
202+ requestInfo: Either<RequestFailure, TxnInfo<Request>>? = null, // <1>
203+ preStepHookFailure: PreStepHookFailure? = null,
204+ responseInfo: Either<ResponseFailure, TxnInfo<Response>>? = null,
205+ postStepHookFailure: PostStepHookFailure? = null,
206+ envSnapshot: PostmanEnvironment<Any?> // <2>
207207)
208208----
209209<1> https://docs.vavr.io/#_either[`Either` type from the VAVR] library represents either of the two states, error or success
@@ -226,74 +226,74 @@ ifdef::env-github[]
226226.link:{integrationtestdir}/com/salesforce/revoman/integration/core/pq/PQE2EWithSMTest.java[PQE2EWithSMTest.java, tag=pq-e2e-with-revoman-config-demo]
227227----
228228final var pqRundown =
229- ReVoman.revUp( // <1>
230- Kick.configure()
231- .templatePaths(PQ_TEMPLATE_PATHS) // <2>
232- .environmentPath(PQ_ENV_PATH) // <3>
233- .dynamicEnvironment( // <4>
234- Map.of(
235- "$quoteFieldsToQuery", "LineItemCount, CalculationStatus",
236- "$qliFieldsToQuery", "Id, Product2Id",
237- "$qlrFieldsToQuery", "Id, QuoteId, MainQuoteLineId, AssociatedQuoteLineId"))
238- .customDynamicVariableGenerator( // <5>
239- "$unitPrice",
240- (ignore1, ignore2, ignore3) -> String.valueOf(Random.Default.nextInt(999) + 1))
241- .nodeModulesRelativePath("js") // <6>
242- .haltOnFailureOfTypeExcept(
243- HTTP_STATUS,
244- afterAllStepsContainingHeader("ignoreHTTPStatusUnsuccessful")) // <7>
245- .requestConfig( // <8>
246- unmarshallRequest(
247- beforeStepContainingURIPathOfAny(PQ_URI_PATH),
248- PlaceQuoteInputRepresentation.class,
249- adapter(PlaceQuoteInputRepresentation.class)))
250- .responseConfig( // <9>
251- unmarshallResponse(
252- afterStepContainingURIPathOfAny(PQ_URI_PATH),
253- PlaceQuoteOutputRepresentation.class),
254- unmarshallResponse(
255- afterStepContainingURIPathOfAny(COMPOSITE_GRAPH_URI_PATH),
256- CompositeGraphResponse.class,
257- CompositeGraphResponse.ADAPTER))
258- .hooks( // <10>
259- pre(
260- beforeStepContainingURIPathOfAny(PQ_URI_PATH),
261- (step, requestInfo, rundown) -> {
262- if (requestInfo.containsHeader(IS_SYNC_HEADER)) {
263- LOGGER.info("This is a Sync step: {}", step);
264- }
265- }),
266- post(
267- afterStepContainingURIPathOfAny(PQ_URI_PATH),
268- (stepReport, ignore) -> {
269- validatePQResponse(stepReport); // <11>
270- final var isSyncStep =
271- stepReport.responseInfo.get().containsHeader(IS_SYNC_HEADER);
272- if (!isSyncStep) {
273- LOGGER.info(
274- "Waiting in PostHook of the Async Step: {}, for the Quote's Asynchronous processing to finish",
275- stepReport.step);
276- // ! CAUTION 10/09/23 gopala.akshintala: This can be flaky until
277- // polling is implemented
278- Thread.sleep(5000);
279- }
280- }),
281- post(
282- afterStepContainingURIPathOfAny(COMPOSITE_GRAPH_URI_PATH),
283- (stepReport, ignore) -> validateCompositeGraphResponse(stepReport)),
284- post(
285- afterStepName("query-quote-and-related-records"),
286- (ignore, rundown) -> assertAfterPQCreate(rundown.mutableEnv)))
287- .globalCustomTypeAdapter(new IDAdapter()) // <12>
288- .insecureHttp(true) // <13>
289- .off()); // Kick-off
229+ ReVoman.revUp( // <1>
230+ Kick.configure()
231+ .templatePaths(PQ_TEMPLATE_PATHS) // <2>
232+ .environmentPath(PQ_ENV_PATH) // <3>
233+ .dynamicEnvironment( // <4>
234+ Map.of(
235+ "$quoteFieldsToQuery", "LineItemCount, CalculationStatus",
236+ "$qliFieldsToQuery", "Id, Product2Id",
237+ "$qlrFieldsToQuery", "Id, QuoteId, MainQuoteLineId, AssociatedQuoteLineId"))
238+ .customDynamicVariableGenerator( // <5>
239+ "$unitPrice",
240+ (ignore1, ignore2, ignore3) -> String.valueOf(Random.Default.nextInt(999) + 1))
241+ .nodeModulesRelativePath("js") // <6>
242+ .haltOnFailureOfTypeExcept(
243+ HTTP_STATUS,
244+ afterAllStepsContainingHeader("ignoreHTTPStatusUnsuccessful")) // <7>
245+ .requestConfig( // <8>
246+ unmarshallRequest(
247+ beforeStepContainingURIPathOfAny(PQ_URI_PATH),
248+ PlaceQuoteInputRepresentation.class,
249+ adapter(PlaceQuoteInputRepresentation.class)))
250+ .responseConfig( // <9>
251+ unmarshallResponse(
252+ afterStepContainingURIPathOfAny(PQ_URI_PATH),
253+ PlaceQuoteOutputRepresentation.class),
254+ unmarshallResponse(
255+ afterStepContainingURIPathOfAny(COMPOSITE_GRAPH_URI_PATH),
256+ CompositeGraphResponse.class,
257+ CompositeGraphResponse.ADAPTER))
258+ .hooks( // <10>
259+ pre(
260+ beforeStepContainingURIPathOfAny(PQ_URI_PATH),
261+ (step, requestInfo, rundown) -> {
262+ if (requestInfo.containsHeader(IS_SYNC_HEADER)) {
263+ LOGGER.info("This is a Sync step: {}", step);
264+ }
265+ }),
266+ post(
267+ afterStepContainingURIPathOfAny(PQ_URI_PATH),
268+ (stepReport, ignore) -> {
269+ validatePQResponse(stepReport); // <11>
270+ final var isSyncStep =
271+ stepReport.responseInfo.get().containsHeader(IS_SYNC_HEADER);
272+ if (!isSyncStep) {
273+ LOGGER.info(
274+ "Waiting in PostHook of the Async Step: {}, for the Quote's Asynchronous processing to finish",
275+ stepReport.step);
276+ // ! CAUTION 10/09/23 gopala.akshintala: This can be flaky until
277+ // polling is implemented
278+ Thread.sleep(5000);
279+ }
280+ }),
281+ post(
282+ afterStepContainingURIPathOfAny(COMPOSITE_GRAPH_URI_PATH),
283+ (stepReport, ignore) -> validateCompositeGraphResponse(stepReport)),
284+ post(
285+ afterStepName("query-quote-and-related-records"),
286+ (ignore, rundown) -> assertAfterPQCreate(rundown.mutableEnv)))
287+ .globalCustomTypeAdapter(new IDAdapter()) // <12>
288+ .insecureHttp(true) // <13>
289+ .off()); // Kick-off
290290assertThat(pqRundown.firstUnIgnoredUnsuccessfulStepReport()).isNull(); // <14>
291291assertThat(pqRundown.mutableEnv)
292- .containsAtLeastEntriesIn(
293- Map.of(
294- "quoteCalculationStatusForSkipPricing", PricingPref.Skip.completeStatus,
295- "quoteCalculationStatus", PricingPref.System.completeStatus,
296- "quoteCalculationStatusAfterAllUpdates", PricingPref.System.completeStatus));
292+ .containsAtLeastEntriesIn(
293+ Map.of(
294+ "quoteCalculationStatusForSkipPricing", PricingPref.Skip.completeStatus,
295+ "quoteCalculationStatus", PricingPref.System.completeStatus,
296+ "quoteCalculationStatusAfterAllUpdates", PricingPref.System.completeStatus));
297297----
298298<1> `revUp()` is the method to call passing a configuration, built as below
299299<2> Supply the path (relative to resources) to the Template Collection JSON file/files
@@ -417,16 +417,16 @@ You can pass a `PreTxnStepPick/PostTxnStepPick` which is a `Predicate` used to q
417417[source,java,indent=0,options="nowrap"]
418418----
419419.hooks(
420- pre(
421- PreTxnStepPick,
422- (currentStepName, requestInfo, rundown) -> {
423- //...callback-code...
424- }),
425- post(
426- PostTxnStepPick,
427- (currentStepName, rundown) -> {
428- //...callback-code...
429- })
420+ pre(
421+ PreTxnStepPick,
422+ (currentStepName, requestInfo, rundown) -> {
423+ //...callback-code...
424+ }),
425+ post(
426+ PostTxnStepPick,
427+ (currentStepName, rundown) -> {
428+ //...callback-code...
429+ })
430430)
431431----
432432
0 commit comments