Skip to content

Commit af8ffbc

Browse files
committed
Release 0.40.3
- Rename on Kick, customAdaptersForMarshalling to customAdapters - Make evaluateJS internal Signed-off-by: Gopal S Akshintala <[email protected]>
1 parent 8c076f4 commit af8ffbc

File tree

6 files changed

+31
-21
lines changed

6 files changed

+31
-21
lines changed

README.adoc

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ endif::[]
1212
:toc:
1313
:toc-placement!:
1414
:sourcedir: src/main/kotlin
15-
:testdir: src/integrationTest/java
15+
:testdir: src/test/java
16+
:integrationtestdir: src/integrationTest/java
1617
:pmtemplates: src/integrationTest/resources/pm-templates
1718
:imagesdir: docs/images
1819
:prewrap!:
19-
:revoman-version: 0.40.2
20+
:revoman-version: 0.40.3
2021

2122
'''
2223

@@ -130,13 +131,13 @@ You can import and manually test this collection through the `Run collection` bu
130131
image::resfulapi-dev-pm.png[]
131132

132133
You can automate the same
133-
using ReṼoman in a link:{testdir}/com/salesforce/revoman/integration/restfulapidev/RestfulAPIDevTest.java[Junit test]
134+
using ReṼoman in a link:{integrationtestdir}/com/salesforce/revoman/integration/restfulapidev/RestfulAPIDevTest.java[Junit test]
134135
by supplying the template and environment path:
135136

136137
ifdef::env-github[]
137138

138139
[source,java,indent=0,options="nowrap"]
139-
.link:{testdir}/com/salesforce/revoman/integration/restfulapidev/RestfulAPIDevTest.java[RestfulAPIDevTest.java, tag=revoman-simple-demo]
140+
.link:{integrationtestdir}/com/salesforce/revoman/integration/restfulapidev/RestfulAPIDevTest.java[RestfulAPIDevTest.java, tag=revoman-simple-demo]
140141
----
141142
@Test
142143
@DisplayName("restful-api.dev")
@@ -158,9 +159,9 @@ endif::[]
158159
ifndef::env-github[]
159160

160161
[source,java,indent=0,options="nowrap"]
161-
.link:{testdir}/com/salesforce/revoman/integration/restfulapidev/RestfulAPIDevTest.java[RestfulAPIDevTest.java,tag=revoman-simple-demo]
162+
.link:{integrationtestdir}/com/salesforce/revoman/integration/restfulapidev/RestfulAPIDevTest.java[RestfulAPIDevTest.java,tag=revoman-simple-demo]
162163
----
163-
include::{testdir}/com/salesforce/revoman/integration/restfulapidev/RestfulAPIDevTest.java[tag=revoman-simple-demo]
164+
include::{integrationtestdir}/com/salesforce/revoman/integration/restfulapidev/RestfulAPIDevTest.java[tag=revoman-simple-demo]
164165
----
165166
<1> `revUp` is the method to call passing a configuration, built as below
166167
<2> Supply an exported Postman collection JSON file path
@@ -197,7 +198,7 @@ StepReport(
197198
`Rundown` has many convenience methods to ease applying further assertions on top of it.
198199

199200
TIP:
200-
Other simple examples to see in Action: link:{testdir}/com/salesforce/revoman/integration/pokemon/PokemonTest.java[PokemonTest.java]
201+
Other simple examples to see in Action: link:{integrationtestdir}/com/salesforce/revoman/integration/pokemon/PokemonTest.java[PokemonTest.java]
201202

202203
=== Advanced Example
203204

@@ -208,7 +209,7 @@ you can add more _bells & whistles_:
208209
ifdef::env-github[]
209210

210211
[source,java,indent=0,options="nowrap"]
211-
.link:{testdir}/com/salesforce/revoman/integration/core/pq/PQE2EWithSMTest.java[PQE2EWithSMTest.java, tag=pq-e2e-with-revoman-config-demo]
212+
.link:{integrationtestdir}/com/salesforce/revoman/integration/core/pq/PQE2EWithSMTest.java[PQE2EWithSMTest.java, tag=pq-e2e-with-revoman-config-demo]
212213
----
213214
final var pqRundown =
214215
ReVoman.revUp( // <1>
@@ -269,7 +270,7 @@ final var pqRundown =
269270
post(
270271
afterStepName("query-quote-and-related-records"),
271272
(ignore, rundown) -> assertAfterPQCreate(rundown.mutableEnv)))
272-
.customAdaptersForMarshalling(new IDAdapter()) // <12>
273+
.customAdapters(new IDAdapter()) // <12>
273274
.insecureHttp(true) // <13>
274275
.off()); // Kick-off
275276
assertThat(pqRundown.firstUnIgnoredUnsuccessfulStepReport()).isNull(); // <14>
@@ -299,9 +300,9 @@ endif::[]
299300
ifndef::env-github[]
300301

301302
[source,java,indent=0,options="nowrap"]
302-
.link:{testdir}/com/salesforce/revoman/integration/core/pq/PQE2EWithSMTest.java[PQE2ETest.java, tag=pq-e2e-with-revoman-config-demo]
303+
.link:{integrationtestdir}/com/salesforce/revoman/integration/core/pq/PQE2EWithSMTest.java[PQE2ETest.java, tag=pq-e2e-with-revoman-config-demo]
303304
----
304-
include::{testdir}/com/salesforce/revoman/integration/core/pq/PQE2EWithSMTest.java[tag=pq-e2e-with-revoman-config-demo]
305+
include::{integrationtestdir}/com/salesforce/revoman/integration/core/pq/PQE2EWithSMTest.java[tag=pq-e2e-with-revoman-config-demo]
305306
----
306307
<1> `revUp` is the method to call passing a configuration, built as below
307308
<2> Supply the path (relative to resources) to the Template Collection JSON file
@@ -364,13 +365,22 @@ image:pq-exe-logging.gif[Monitor Execution]
364365

365366
* ReṼoman internally uses a modern JSON library called https://github.com/square/moshi[**Moshi**]
366367
* 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 `customAdaptersForMarshalling`
368+
* 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`
368369
* 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.
369370

370-
TIP: Refer link:{testdir}/com/salesforce/revoman/integration/core/pq/adapters/ConnectInputRepWithGraphAdapter.java[ConnectInputRepWithGraphAdapter]
371+
TIP: Refer link:{integrationtestdir}/com/salesforce/revoman/integration/core/pq/adapters/ConnectInputRepWithGraphAdapter.java[ConnectInputRepWithGraphAdapter]
371372
for an advanced adapter use-case
372373

373-
* It also has link:{sourcedir}/com/salesforce/revoman/input/json/JsonPojoUtils.kt[JSON POJO Utils], which you can use to directly convert JSON to POJO and vice versa.
374+
==== JSON POJO Utils
375+
376+
link:{sourcedir}/com/salesforce/revoman/input/json/JsonPojoUtils.kt[JSON POJO Utils] can be used to directly convert JSON to POJO and vice versa.
377+
378+
[TIP]
379+
====
380+
Examples to refer:
381+
* link:{testdir}/com/salesforce/revoman/input/json/JsonPojoUtilsTest.java[JsonPojoUtilsTest]
382+
* link:{integrationtestdir}/com/salesforce/revoman/input/json/JsonPojoUtils2Test.java[JsonPojoUtils2Test]
383+
====
374384

375385
=== Execution Control
376386

@@ -481,7 +491,7 @@ to be invoked to generate a value for your custom variable-key in the template a
481491

482492
=== Low-code
483493

484-
TIP: Here is an example of a low-code link:{testdir}/com/salesforce/revoman/integration/core/pq/PQE2EWithSMTest.java[**E2E test**] that automates *~75 steps*
494+
TIP: Here is an example of a low-code link:{integrationtestdir}/com/salesforce/revoman/integration/core/pq/PQE2EWithSMTest.java[**E2E test**] that automates *~75 steps*
485495

486496
[.lead]
487497
Compared to a traditional Integration/Functional or E2E test, approximately, the amount of code needed is *89%* less using ReṼoman.

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.40.3-SNAPSHOT"
9+
const val VERSION = "0.40.3"
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-
.customAdaptersForMarshalling(new IDAdapter()) // <12>
125+
.customAdapters(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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ object ReVoman {
6868
environment,
6969
kick,
7070
initMoshi(
71-
kick.customAdaptersForMarshalling(),
71+
kick.customAdapters(),
7272
kick.customAdaptersFromRequestConfig() + kick.customAdaptersFromResponseConfig(),
7373
kick.skipTypes()
7474
)

src/main/kotlin/com/salesforce/revoman/input/JSUtils.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import org.graalvm.polyglot.Context
1414
import org.graalvm.polyglot.HostAccess
1515
import org.graalvm.polyglot.Source
1616
import org.graalvm.polyglot.Value
17-
17+
// ! TODO 01 Apr 2024 gopala.akshintala: Refactor this into a Class with DI
1818
/** Refer: https://www.graalvm.org/22.3/reference-manual/embed-languages/ */
1919
private lateinit var jsContext: Context
2020

@@ -46,7 +46,7 @@ internal fun initJSContext(nodeModulesRelativePath: String?) {
4646
}
4747
}
4848

49-
fun evaluateJS(js: String, bindings: Map<String, Any> = emptyMap()): Value? {
49+
internal fun evaluateJS(js: String, bindings: Map<String, Any> = emptyMap()): Value? {
5050
val contextBindings = jsContext.getBindings("js")
5151
bindings.forEach { (key, value) -> contextBindings.putMember(key, value) }
5252
val jsSource = Source.newBuilder("js", imports + js, "script.js").build()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ internal interface KickDef {
7878
.filter { it.customAdapter != null }
7979
.groupBy({ it.objType }, { it.customAdapter!! })
8080

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

8383
fun skipTypes(): Set<Class<out Any>>
8484

0 commit comments

Comments
 (0)