Skip to content

Commit 5191007

Browse files
committed
Release 0.7.9
- Fix variable resolution by prepending dynamic environment - Add @JvmSynthetic to hide internal methods Signed-off-by: Gopal S Akshintala <[email protected]>
1 parent 5b139fd commit 5191007

File tree

15 files changed

+72
-78
lines changed

15 files changed

+72
-78
lines changed

README.adoc

Lines changed: 23 additions & 23 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.7.8.1
21+
:revoman-version: 0.7.9
2222

2323
'''
2424

@@ -128,25 +128,7 @@ ____
128128
==== Why Postman Templates?
129129

130130
The exported Postman collection JSON file is referred to as a Postman template, as it contains some placeholders/variables in the `+{{variable-key}}+` pattern. You can read more about it https://learning.postman.com/docs/sending-requests/variables/[here].
131-
This is a popular and proven pattern that interconnects multiple requests like a Graph. This is not unique to Postman, but Postman is popular and familiar in the dev community and has a full-blown UI, which makes it an attractive choice to support Postman templates. But that said, ReṼoman is modular, and the implementation is not coupled with any Postman related contracts. *In the future, we can think of supporting more template formats*
132-
133-
==== Variable support in ReṼoman
134-
135-
* Variables, e.g., `+{{variable-key}}+`
136-
* Nested variables, e.g., `+{{variable-key{{nested-variable-key}}}}+`
137-
* link:{sourcedir}/com/salesforce/revoman/internal/postman/DynamicVariableGenerator.kt[Dynamic variables],
138-
e.g., `{{$randomUUID}}`, `{{$randomEmail}}`
139-
* <<Custom Dynamic variables>>
140-
141-
[#_variable_resolution_precedence]
142-
==== Variable resolution precedence
143-
In the case of collision between variable keys, the precedence order to derive a value to replace any key is:
144-
145-
* Custom Dynamic variables
146-
* Generated Dynamic variables
147-
* Dynamic Environment supplied through config + Environment built during execution + Postman environment supplied as a file through config
148-
149-
TIP: For Dynamic variables, which gets populated from Java code, use $ sign within a variable to indicate it needs to be populated during manual testing.E.g.: `{{$unitPrice}}`
131+
This is a popular and proven pattern that interconnects multiple endpoint requests like a Graph. This is not unique to Postman, but Postman is popular and familiar in the dev community and has a full-blown UI, which makes it an attractive choice to start with supporting Postman templates. But that said, ReṼoman is modular, and the implementation is not coupled with any Postman related contracts. *In the future, we can think of supporting more template formats*
150132

151133
[.lead]
152134
You can _kick off_ this *Template-Driven Testing* by invoking `ReVoman.revUp()`,
@@ -362,7 +344,26 @@ include::{integrationtestdir}/com/salesforce/revoman/integration/core/pq/PQE2EWi
362344
<14> Run more assertions on the <<Rundown>>
363345
endif::[]
364346

365-
== Config
347+
=== Variables
348+
349+
* Variables, e.g., `+{{variable-key}}+`
350+
* Nested variables, e.g., `+{{variable-key{{nested-variable-key}}}}+`
351+
* link:{sourcedir}/com/salesforce/revoman/internal/postman/DynamicVariableGenerator.kt[Dynamic variables],
352+
e.g., `{{$randomUUID}}`, `{{$randomEmail}}`
353+
* <<Custom Dynamic variables>>
354+
355+
==== Variable resolution precedence
356+
In the case of collision between variable keys, the precedence order to derive a value to replace any key is:
357+
358+
* <<Custom Dynamic variables>>
359+
* link:{sourcedir}/com/salesforce/revoman/internal/postman/DynamicVariableGenerator.kt[Dynamic variables]
360+
* Environment built during execution
361+
* Dynamic Environment supplied through config
362+
* Postman Environment supplied as a file path through config
363+
364+
TIP: Variable naming Convention: For Dynamic variables, which gets populated from Java code, use `$` sign within a variable to indicate it needs to be populated during manual testing, e.g.: `{{$unitPrice}}`.
365+
366+
=== Config management
366367

367368
[.lead]
368369
Config built using `Kick.configure()` is *Immutable*.
@@ -377,7 +378,7 @@ CAUTION: The new instance created from common config using `override...()` repla
377378

378379
[source,java,indent=0,tabsize=2,options="nowrap"]
379380
----
380-
POKEMON_COMMON_CONFIG.overrideHooks(kotlin.collections.CollectionsKt.plus(POKEMON_COMMON_CONFIG.hooks(), post(.../*My Hooks*/))
381+
COMMON_CONFIG.overrideHooks(kotlin.collections.CollectionsKt.plus(COMMON_CONFIG.hooks(), post(.../*My Hooks*/))
381382
----
382383

383384
* You can also construct a new instance by accumulating attributes from other instances using `from()` method, like below:
@@ -389,7 +390,6 @@ Kick.configure().from(configInstance1).from(configInstance2)...off();
389390

390391
CAUTION: Iterable attributes (like `List`, `Map` etc) accept an `Iterable`. If you are particular about the order, make sure to pass an Ordered instance of `Iterable` (like `ArrayList`)
391392

392-
[#_debugging_dx]
393393
== Troubleshooting DX
394394

395395
[#_ide_debugger_view]

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.7.8.1"
9+
const val VERSION = "0.7.9"
1010
const val ARTIFACT_ID = "revoman"
1111
const val STAGING_PROFILE_ID = "1ea0a23e61ba7d"

src/integrationTest/kotlin/com/salesforce/revoman/integration/restfulapidev/RestfulAPIDevKtTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ class RestfulAPIDevKtTest {
1616
@Test
1717
fun `execute restful-api dev pm collection`() {
1818
val rundown =
19-
ReVoman.revUp( // <1>
19+
ReVoman.revUp(
20+
// <1>
2021
Kick.configure()
2122
.templatePath(PM_COLLECTION_PATH) // <2>
2223
.environmentPath(PM_ENVIRONMENT_PATH) // <3>

src/integrationTest/resources/pm-templates/core/milestone/env.postman_environment.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
"values": [
55
{
66
"key" : "baseUrl",
7-
"value" : "https://localhost:6101/",
7+
"value" : "https://orgfarm-fe6a79aee6.test1.my.pc-rnd.salesforce.com/",
88
"type" : "default",
99
"enabled" : true
1010
},
1111
{
1212
"key" : "username",
13-
"value" : "[email protected]",
13+
"value" : "[email protected]",
1414
"type" : "default",
1515
"enabled" : true
1616
},
1717
{
1818
"key" : "password",
19-
"value" : "123456",
19+
"value" : "orgfarm1234",
2020
"type" : "default",
2121
"enabled" : true
2222
},

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import com.salesforce.revoman.internal.postman.Info
3131
import com.salesforce.revoman.internal.postman.PostmanSDK
3232
import com.salesforce.revoman.internal.postman.RegexReplacer
3333
import com.salesforce.revoman.internal.postman.dynamicVariableGenerator
34-
import com.salesforce.revoman.internal.postman.mergeEnvs
34+
import com.salesforce.revoman.internal.postman.template.Environment.Companion.mergeEnvs
3535
import com.salesforce.revoman.internal.postman.template.Template
3636
import com.salesforce.revoman.output.Rundown
3737
import com.salesforce.revoman.output.report.Step

src/main/kotlin/com/salesforce/revoman/internal/exe/HttpRequest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import org.http4k.core.then
3232
import org.http4k.filter.ClientFilters
3333
import org.http4k.filter.DebuggingFilters
3434

35+
@JvmSynthetic
3536
internal fun fireHttpRequest(
3637
currentStep: Step,
3738
auth: Auth?,
@@ -54,7 +55,7 @@ private fun prepareHttpClient(bearerToken: String?, insecureHttp: Boolean): Http
5455
.then(if (insecureHttp) ApacheClient(client = insecureApacheHttpClient()) else ApacheClient())
5556

5657
/** Only for Testing. DO NOT USE IN PROD */
57-
fun insecureApacheHttpClient(): CloseableHttpClient =
58+
private fun insecureApacheHttpClient(): CloseableHttpClient =
5859
SSLContextBuilder()
5960
.loadTrustMaterial(null) { _, _ -> true }
6061
.build()

src/main/kotlin/com/salesforce/revoman/internal/exe/PmJsEval.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import com.salesforce.revoman.output.report.StepReport
1919
import com.salesforce.revoman.output.report.failure.RequestFailure.PreReqJSFailure
2020
import com.salesforce.revoman.output.report.failure.ResponseFailure.PostResJSFailure
2121

22+
@JvmSynthetic
2223
internal fun executePreReqJS(
2324
currentStep: Step,
2425
itemWithRegex: Item,
@@ -41,6 +42,7 @@ private fun executePreReqJSWithPolyglot(preReqJS: String, pmRequest: Request, pm
4142
pm.evaluateJS(preReqJS)
4243
}
4344

45+
@JvmSynthetic
4446
internal fun executePostResJS(
4547
currentStep: Step,
4648
item: Item,

src/main/kotlin/com/salesforce/revoman/internal/exe/PostStepHook.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import com.salesforce.revoman.output.report.StepReport
1818
import com.salesforce.revoman.output.report.failure.HookFailure.PostStepHookFailure
1919
import io.github.oshai.kotlinlogging.KotlinLogging
2020

21+
@JvmSynthetic
2122
internal fun postStepHookExe(kick: Kick, pm: PostmanSDK): PostStepHookFailure? =
2223
pickPostStepHooks(kick.postStepHooks(), pm.currentStepReport, pm.rundown)
2324
.map { postStepHook ->

src/main/kotlin/com/salesforce/revoman/internal/exe/PreStepHook.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import com.salesforce.revoman.output.report.failure.HookFailure.PreStepHookFailu
2020
import io.github.oshai.kotlinlogging.KotlinLogging
2121
import org.http4k.core.Request
2222

23+
@JvmSynthetic
2324
internal fun preStepHookExe(
2425
currentStep: Step,
2526
kick: Kick,
@@ -36,6 +37,7 @@ internal fun preStepHookExe(
3637
.firstOrNull { it.isLeft() }
3738
?.leftOrNull()
3839

40+
@JvmSynthetic
3941
private fun pickPreStepHooks(
4042
preStepHooks: List<HookConfig>,
4143
currentStep: Step,

src/main/kotlin/com/salesforce/revoman/internal/exe/UnmarshallRequest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import org.http4k.core.ContentType.Companion.APPLICATION_JSON
2323
import org.http4k.core.Request
2424
import org.http4k.lens.contentType
2525

26+
@JvmSynthetic
2627
internal fun unmarshallRequest(
2728
currentStep: Step,
2829
pmRequest: com.salesforce.revoman.internal.postman.template.Request,

0 commit comments

Comments
 (0)