Skip to content

Commit c68ce05

Browse files
committed
Release 0.41.1
Rename config builder methods Signed-off-by: Gopal S Akshintala <[email protected]>
1 parent 9c1394e commit c68ce05

File tree

7 files changed

+43
-40
lines changed

7 files changed

+43
-40
lines changed

README.adoc

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ endif::[]
1818
:pmtemplates: src/integrationTest/resources/pm-templates
1919
:imagesdir: docs/images
2020
:prewrap!:
21-
:revoman-version: 0.41.0
21+
:revoman-version: 0.41.1
2222

2323
'''
2424

@@ -272,7 +272,7 @@ final var pqRundown =
272272
post(
273273
afterStepName("query-quote-and-related-records"),
274274
(ignore, rundown) -> assertAfterPQCreate(rundown.mutableEnv)))
275-
.customAdapters(new IDAdapter()) // <12>
275+
.globalCustomTypeAdapter(new IDAdapter()) // <12>
276276
.insecureHttp(true) // <13>
277277
.off()); // Kick-off
278278
assertThat(pqRundown.firstUnIgnoredUnsuccessfulStepReport()).isNull(); // <14>
@@ -294,7 +294,7 @@ assertThat(pqRundown.mutableEnv)
294294
<9> <<#_type_safety_with_flexible_json_pojo_marshallingserialization_and_unmarshallingdeserialization, Response Config>>
295295
<10> <<#_pre_and_post_hooks>>
296296
<11> <<Response Validations>>
297-
<12> <<#_type_safety_with_flexible_json_pojo_marshallingserialization_and_unmarshallingdeserialization, Custom Adapters>>
297+
<12> <<#_type_safety_with_flexible_json_pojo_marshallingserialization_and_unmarshallingdeserialization, Global Custom Type Adapters>>
298298
<13> Ignore Java cert issues when firing HTTP calls
299299
<14> Run more assertions on the <<Rundown>>
300300

@@ -317,7 +317,7 @@ include::{integrationtestdir}/com/salesforce/revoman/integration/core/pq/PQE2EWi
317317
<9> <<#_type_safety_with_flexible_json_pojo_marshallingserialization_and_unmarshallingdeserialization, Response Config>>
318318
<10> <<#_pre_and_post_hooks>>
319319
<11> <<Response Validations>>
320-
<12> <<#_type_safety_with_flexible_json_pojo_marshallingserialization_and_unmarshallingdeserialization, Custom Adapters>>
320+
<12> <<#_type_safety_with_flexible_json_pojo_marshallingserialization_and_unmarshallingdeserialization, Global Custom Type Adapters>>
321321
<13> Ignore Java cert issues when firing HTTP calls
322322
<14> Run more assertions on the <<Rundown>>
323323
endif::[]
@@ -363,8 +363,11 @@ image:pq-exe-logging.gif[Monitor Execution]
363363
=== Type Safety with flexible JSON <- -> POJO marshalling/serialization and unmarshalling/deserialization
364364

365365
* ReṼoman internally uses a modern JSON library called https://github.com/square/moshi[**Moshi**]
366-
* There may be a POJO that inherits or contains legacy classes which are hard or impossible to serialize. ReṼoman lets you serialize such a legacy POJO by letting you pass `skipTypes`, where you can filter-out these legacy class types.
367-
* The payload may not map to POJO, and you may need a custom adapter for Conversion. Moshi has it covered for you with its advanced adapter mechanism and ReṼoman accepts Moshi adapters via `requestConfig`, `responseConfig` and `customAdapters`
366+
* There may be a POJO that inherits or contains legacy types which are hard or impossible to serialize. ReṼoman lets you serialize such types through `globalSkipTypes`, where you can filter-out these legacy types from Marshalling/Unmarshalling, only focussing on fields that matter.
367+
* The payload may not map to POJO, and you may need a custom types adapter for Marshalling/Unmarshalling. Moshi has it covered for you with its advanced adapter mechanism and ReṼoman accepts Moshi adapters via
368+
** `requestConfig` — For types present as part of request payload for qualified Steps
369+
** `responseConfig` — For types present as part of response payload for qualified Steps
370+
** `globalCustomTypeAdapters` — For types present as part of request payload anywhere
368371
* ReṼoman also comes bundled with link:{sourcedir}/com/salesforce/revoman/input/json/JsonReaderUtils.kt[JSON Reader utils] and link:{sourcedir}/com/salesforce/revoman/input/json/JsonWriterUtils.kt[JSON Writer utils] to help build Moshi adapters.
369372

370373
TIP: Refer link:{integrationtestdir}/com/salesforce/revoman/integration/core/pq/adapters/ConnectInputRepWithGraphAdapter.java[ConnectInputRepWithGraphAdapter]
@@ -433,7 +436,7 @@ so the later steps can pick up value for `+{{xyzId}}+` variable from the environ
433436
==== Response Validations
434437

435438
* Post-Hooks are the best place to validate response right after the step.
436-
* If you have configured a strong type for your response through `responseConfig`, you can write type-safe validations by extracting your Strong type Object using `stepReport.responseInfo.get().<TypeT>getTypedTxnObj()` (if you have configured `responseConfig()` or `customAdapters()`) or use `JsonPojoUtils.jsonToPojo(TypeT, stepReport.responseInfo.get().httpMsg.bodyString())` to convert it inline.
439+
* If you have configured a strong type for your response through `responseConfig`, you can write type-safe validations by extracting your Strong type Object using `stepReport.responseInfo.get().<TypeT>getTypedTxnObj()` (if you have configured `responseConfig()` or `globalCustomTypeAdapters()`) or use `JsonPojoUtils.jsonToPojo(TypeT, stepReport.responseInfo.get().httpMsg.bodyString())` to convert it inline.
437440
* If your response data structure is non-trivial and have requirements to execute validations with different strategies like `fail-fast` or `error-accumulation`, consider using a library like https://github.com/salesforce-misc/Vador[*Vador*]
438441

439442
=== Pre-req and Tests scripts

buildSrc/src/main/kotlin/Config.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
* ************************************************************************************************
77
*/
88
const val GROUP_ID = "com.salesforce.revoman"
9-
const val VERSION = "0.41.0"
9+
const val VERSION = "0.41.1"
1010
const val ARTIFACT_ID = "revoman"
1111
const val STAGING_PROFILE_ID = "1ea0a23e61ba7d"

src/integrationTest/java/com/salesforce/revoman/integration/core/pq/PQE2EWithSMTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void revUpPQ() {
122122
post(
123123
afterStepName("query-quote-and-related-records"),
124124
(ignore, rundown) -> assertAfterPQCreate(rundown.mutableEnv)))
125-
.customAdapters(new IDAdapter()) // <12>
125+
.globalCustomTypeAdapter(new IDAdapter()) // <12>
126126
.insecureHttp(true) // <13>
127127
.off()); // Kick-off
128128
assertThat(pqRundown.firstUnIgnoredUnsuccessfulStepReport()).isNull(); // <14>

src/main/kotlin/com/salesforce/revoman/ReVoman.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ object ReVoman {
6262
RegexReplacer(kick.customDynamicVariableGenerators(), ::dynamicVariableGenerator)
6363
val moshiReVoman =
6464
initMoshi(
65-
kick.customAdapters(),
66-
kick.customAdaptersFromRequestConfig() + kick.customAdaptersFromResponseConfig(),
67-
kick.skipTypes()
65+
kick.globalCustomTypeAdapters(),
66+
kick.customTypeAdaptersFromRequestConfig() + kick.customTypeAdaptersFromResponseConfig(),
67+
kick.globalSkipTypes()
6868
)
6969
val environment = mergeEnvs(kick.environmentPaths(), kick.dynamicEnvironmentsFlattened())
7070
val pm =

src/main/kotlin/com/salesforce/revoman/input/config/KickDef.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ internal interface KickDef {
5555
@Value.Derived fun postHooks(): List<HookConfig> = hooks().filter { it.pick is PostTxnStepPick }
5656

5757
// * NOTE 29/10/23 gopala.akshintala: requestConfig/responseConfig are decoupled from pre- /
58-
// post-hook to allow setting up unmarshalling to strong types, on the final rundown,
59-
// agnostic of whether the step has any hook
58+
// post-hook to allow setting up unmarshalling to strong types on the final rundown for
59+
// post-execution assertions agnostic of whether the step has any hooks
6060

6161
fun requestConfig(): Set<RequestConfig>
6262

6363
@Value.Derived
64-
fun customAdaptersFromRequestConfig(): Map<Type, List<Either<JsonAdapter<Any>, Factory>>> =
64+
fun customTypeAdaptersFromRequestConfig(): Map<Type, List<Either<JsonAdapter<Any>, Factory>>> =
6565
requestConfig()
66-
.filter { it.customAdapter != null }
67-
.groupBy({ it.objType }, { it.customAdapter!! })
66+
.filter { it.customTypeAdapter != null }
67+
.groupBy({ it.objType }, { it.customTypeAdapter!! })
6868

6969
fun responseConfig(): Set<ResponseConfig>
7070

@@ -73,14 +73,14 @@ internal interface KickDef {
7373
responseConfig().groupBy { it.ifSuccess }
7474

7575
@Value.Derived
76-
fun customAdaptersFromResponseConfig(): Map<Type, List<Either<JsonAdapter<Any>, Factory>>> =
76+
fun customTypeAdaptersFromResponseConfig(): Map<Type, List<Either<JsonAdapter<Any>, Factory>>> =
7777
responseConfig()
78-
.filter { it.customAdapter != null }
79-
.groupBy({ it.objType }, { it.customAdapter!! })
78+
.filter { it.customTypeAdapter != null }
79+
.groupBy({ it.objType }, { it.customTypeAdapter!! })
8080

81-
fun customAdapters(): List<Any>
81+
fun globalCustomTypeAdapters(): List<Any>
8282

83-
fun skipTypes(): Set<Class<out Any>>
83+
fun globalSkipTypes(): Set<Class<out Any>>
8484

8585
@Value.Default fun insecureHttp(): Boolean = false
8686

src/main/kotlin/com/salesforce/revoman/input/config/RequestConfig.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ data class RequestConfig
1818
private constructor(
1919
val preTxnStepPick: PreTxnStepPick,
2020
val objType: Type,
21-
val customAdapter: Either<JsonAdapter<Any>, JsonAdapter.Factory>? = null
21+
val customTypeAdapter: Either<JsonAdapter<Any>, JsonAdapter.Factory>? = null
2222
) {
2323
companion object {
2424
@JvmStatic
@@ -31,14 +31,14 @@ private constructor(
3131
fun unmarshallRequest(
3232
preTxnStepPick: PreTxnStepPick,
3333
requestType: Type,
34-
customAdapter: JsonAdapter<Any>
35-
): RequestConfig = RequestConfig(preTxnStepPick, requestType, left(customAdapter))
34+
customTypeAdapter: JsonAdapter<Any>
35+
): RequestConfig = RequestConfig(preTxnStepPick, requestType, left(customTypeAdapter))
3636

3737
@JvmStatic
3838
fun unmarshallRequest(
3939
preTxnStepPick: PreTxnStepPick,
4040
requestType: Type,
41-
customAdapterFactory: JsonAdapter.Factory
42-
): RequestConfig = RequestConfig(preTxnStepPick, requestType, right(customAdapterFactory))
41+
customTypeAdapterFactory: JsonAdapter.Factory
42+
): RequestConfig = RequestConfig(preTxnStepPick, requestType, right(customTypeAdapterFactory))
4343
}
4444
}

src/main/kotlin/com/salesforce/revoman/input/config/ResponseConfig.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ private constructor(
1919
val postTxnStepPick: PostTxnStepPick,
2020
val ifSuccess: Boolean?,
2121
val objType: Type,
22-
val customAdapter: Either<JsonAdapter<Any>, JsonAdapter.Factory>? = null,
22+
val customTypeAdapter: Either<JsonAdapter<Any>, JsonAdapter.Factory>? = null,
2323
) {
2424
companion object {
2525
@JvmStatic
@@ -32,16 +32,16 @@ private constructor(
3232
fun unmarshallResponse(
3333
postTxnStepPick: PostTxnStepPick,
3434
successType: Type,
35-
customAdapter: JsonAdapter<Any>
36-
): ResponseConfig = ResponseConfig(postTxnStepPick, null, successType, left(customAdapter))
35+
customTypeAdapter: JsonAdapter<Any>
36+
): ResponseConfig = ResponseConfig(postTxnStepPick, null, successType, left(customTypeAdapter))
3737

3838
@JvmStatic
3939
fun unmarshallResponse(
4040
postTxnStepPick: PostTxnStepPick,
4141
successType: Type,
42-
customAdapterFactory: JsonAdapter.Factory
42+
customTypeAdapterFactory: JsonAdapter.Factory
4343
): ResponseConfig =
44-
ResponseConfig(postTxnStepPick, null, successType, right(customAdapterFactory))
44+
ResponseConfig(postTxnStepPick, null, successType, right(customTypeAdapterFactory))
4545

4646
@JvmStatic
4747
fun unmarshallSuccessResponse(
@@ -53,16 +53,16 @@ private constructor(
5353
fun unmarshallSuccessResponse(
5454
postTxnStepPick: PostTxnStepPick,
5555
successType: Type,
56-
customAdapter: JsonAdapter<Any>
57-
): ResponseConfig = ResponseConfig(postTxnStepPick, true, successType, left(customAdapter))
56+
customTypeAdapter: JsonAdapter<Any>
57+
): ResponseConfig = ResponseConfig(postTxnStepPick, true, successType, left(customTypeAdapter))
5858

5959
@JvmStatic
6060
fun unmarshallSuccessResponse(
6161
postTxnStepPick: PostTxnStepPick,
6262
successType: Type,
63-
customAdapterFactory: JsonAdapter.Factory
63+
customTypeAdapterFactory: JsonAdapter.Factory
6464
): ResponseConfig =
65-
ResponseConfig(postTxnStepPick, true, successType, right(customAdapterFactory))
65+
ResponseConfig(postTxnStepPick, true, successType, right(customTypeAdapterFactory))
6666

6767
@JvmStatic
6868
fun unmarshallErrorResponse(
@@ -74,15 +74,15 @@ private constructor(
7474
fun unmarshallErrorResponse(
7575
postTxnStepPick: PostTxnStepPick,
7676
successType: Type,
77-
customAdapter: JsonAdapter<Any>
78-
): ResponseConfig = ResponseConfig(postTxnStepPick, false, successType, left(customAdapter))
77+
customTypeAdapter: JsonAdapter<Any>
78+
): ResponseConfig = ResponseConfig(postTxnStepPick, false, successType, left(customTypeAdapter))
7979

8080
@JvmStatic
8181
fun unmarshallErrorResponse(
8282
postTxnStepPick: PostTxnStepPick,
8383
successType: Type,
84-
customAdapterFactory: JsonAdapter.Factory
84+
customTypeAdapterFactory: JsonAdapter.Factory
8585
): ResponseConfig =
86-
ResponseConfig(postTxnStepPick, false, successType, right(customAdapterFactory))
86+
ResponseConfig(postTxnStepPick, false, successType, right(customTypeAdapterFactory))
8787
}
8888
}

0 commit comments

Comments
 (0)