Skip to content

Commit 98e731d

Browse files
committed
Release 0.40.2
Add KotlinJsonAdapterFactory to MoshiReVoman Signed-off-by: Gopal S Akshintala <[email protected]>
1 parent 187b898 commit 98e731d

File tree

10 files changed

+1475
-1465
lines changed

10 files changed

+1475
-1465
lines changed

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ endif::[]
1616
:pmtemplates: src/integrationTest/resources/pm-templates
1717
:imagesdir: docs/images
1818
:prewrap!:
19-
:revoman-version: 0.40.1
19+
:revoman-version: 0.40.2
2020

2121
'''
2222

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

docs/revoman.exe.log

Lines changed: 1348 additions & 1348 deletions
Large diffs are not rendered by default.

src/integrationTest/java/com/salesforce/revoman/integration/restfulapidev/RestfulAPIDevTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ void restfulApiDev() {
2929
Kick.configure()
3030
.templatePath(PM_COLLECTION_PATH) // <2>
3131
.environmentPath(PM_ENVIRONMENT_PATH) // <3>
32+
.nodeModulesResourceRelativePath("js")
3233
.off());
3334
assertThat(rundown.stepReports).hasSize(3);
3435
}

src/integrationTest/resources/pm-templates/pq/[sm] pq.postman_collection.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
"var futureDateTime = moment().add(365, 'days');",
150150
"pm.environment.set('$randomFutureDate', futureDateTime.format('YYYY-MM-DD'));",
151151
"",
152-
"pm.environment.set(\"$pricingPref\", \"skip\")",
152+
"pm.environment.set(\"$pricingPref\", \"system\")",
153153
"pm.environment.set(\"$quantity\", _.random(1, 10));",
154154
"pm.environment.set(\"$requestName\", pm.info.requestName)"
155155
],
@@ -282,7 +282,7 @@
282282
"var futureDateTime = moment().add(365, 'days');",
283283
"pm.environment.set('$randomFutureDate', futureDateTime.format('YYYY-MM-DD'));",
284284
"",
285-
"pm.environment.set(\"$pricingPref\", \"skip\")",
285+
"pm.environment.set(\"$pricingPref\", \"system\")",
286286
"pm.environment.set(\"$quantity\", _.random(1, 10));",
287287
"pm.environment.set(\"$requestName\", pm.info.requestName)"
288288
],
@@ -346,7 +346,7 @@
346346
"var futureDateTime = moment().add(365, 'days');",
347347
"pm.environment.set('$randomFutureDate', futureDateTime.format('YYYY-MM-DD'));",
348348
"",
349-
"pm.environment.set(\"$pricingPref\", \"skip\")",
349+
"pm.environment.set(\"$pricingPref\", \"system\")",
350350
"pm.environment.set(\"$quantity\", _.random(1, 10));",
351351
"pm.environment.set(\"$requestName\", pm.info.requestName)"
352352
],
@@ -410,7 +410,7 @@
410410
"var futureDateTime = moment().add(365, 'days');",
411411
"pm.environment.set('$randomFutureDate', futureDateTime.format('YYYY-MM-DD'));",
412412
"",
413-
"pm.environment.set(\"$pricingPref\", \"skip\")",
413+
"pm.environment.set(\"$pricingPref\", \"system\")",
414414
"pm.environment.set(\"$quantity\", _.random(1, 10));",
415415
"pm.environment.set(\"$requestName\", pm.info.requestName)"
416416
],
@@ -474,7 +474,7 @@
474474
"var futureDateTime = moment().add(365, 'days');",
475475
"pm.environment.set('$randomFutureDate', futureDateTime.format('YYYY-MM-DD'));",
476476
"",
477-
"pm.environment.set(\"$pricingPref\", \"skip\")",
477+
"pm.environment.set(\"$pricingPref\", \"system\")",
478478
"pm.environment.set(\"$quantity\", _.random(1, 10));",
479479
"pm.environment.set(\"$requestName\", pm.info.requestName)"
480480
],
@@ -538,7 +538,7 @@
538538
"var futureDateTime = moment().add(365, 'days');",
539539
"pm.environment.set('$randomFutureDate', futureDateTime.format('YYYY-MM-DD'));",
540540
"",
541-
"pm.environment.set(\"$pricingPref\", \"skip\")",
541+
"pm.environment.set(\"$pricingPref\", \"system\")",
542542
"pm.environment.set(\"$quantity\", _.random(1, 10));",
543543
"pm.environment.set(\"$requestName\", pm.info.requestName)"
544544
],
@@ -602,7 +602,7 @@
602602
"var futureDateTime = moment().add(365, 'days');",
603603
"pm.environment.set('$randomFutureDate', futureDateTime.format('YYYY-MM-DD'));",
604604
"",
605-
"pm.environment.set(\"$pricingPref\", \"skip\")",
605+
"pm.environment.set(\"$pricingPref\", \"system\")",
606606
"pm.environment.set(\"$quantity\", _.random(1, 10));",
607607
"pm.environment.set(\"$requestName\", pm.info.requestName)"
608608
],
@@ -666,7 +666,7 @@
666666
"var futureDateTime = moment().add(365, 'days');",
667667
"pm.environment.set('$randomFutureDate', futureDateTime.format('YYYY-MM-DD'));",
668668
"",
669-
"pm.environment.set(\"$pricingPref\", \"skip\")",
669+
"pm.environment.set(\"$pricingPref\", \"system\")",
670670
"pm.environment.set(\"$quantity\", _.random(1, 10));",
671671
"pm.environment.set(\"$requestName\", pm.info.requestName)"
672672
],
@@ -730,7 +730,7 @@
730730
"var futureDateTime = moment().add(365, 'days');",
731731
"pm.environment.set('$randomFutureDate', futureDateTime.format('YYYY-MM-DD'));",
732732
"",
733-
"pm.environment.set(\"$pricingPref\", \"skip\")",
733+
"pm.environment.set(\"$pricingPref\", \"system\")",
734734
"pm.environment.set(\"$quantity\", _.random(1, 10));",
735735
"pm.environment.set(\"$requestName\", pm.info.requestName)"
736736
],
@@ -851,7 +851,7 @@
851851
"var futureDateTime = moment().add(365, 'days');",
852852
"pm.environment.set('$randomFutureDate', futureDateTime.format('YYYY-MM-DD'));",
853853
"",
854-
"pm.environment.set(\"$pricingPref\", \"skip\")",
854+
"pm.environment.set(\"$pricingPref\", \"system\")",
855855
"pm.environment.set(\"$quantity\", _.random(1, 10));",
856856
"pm.environment.set(\"$requestName\", pm.info.requestName)"
857857
],
@@ -919,7 +919,7 @@
919919
"var futureDateTime = moment().add(365, 'days');",
920920
"pm.environment.set('$randomFutureDate', futureDateTime.format('YYYY-MM-DD'));",
921921
"",
922-
"pm.environment.set(\"$pricingPref\", \"skip\")",
922+
"pm.environment.set(\"$pricingPref\", \"system\")",
923923
"pm.environment.set(\"$quantity\", _.random(1, 10));",
924924
"pm.environment.set(\"$requestName\", pm.info.requestName)"
925925
],
@@ -987,7 +987,7 @@
987987
"var futureDateTime = moment().add(365, 'days');",
988988
"pm.environment.set('$randomFutureDate', futureDateTime.format('YYYY-MM-DD'));",
989989
"",
990-
"pm.environment.set(\"$pricingPref\", \"skip\")",
990+
"pm.environment.set(\"$pricingPref\", \"system\")",
991991
"pm.environment.set(\"$quantity\", _.random(1, 10));",
992992
"pm.environment.set(\"$requestName\", pm.info.requestName)"
993993
],
Lines changed: 108 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,109 @@
11
{
2-
"info" : {
3-
"_postman_id" : "8e2843e3-f3e9-4c55-a49d-89429fd02a83",
4-
"name" : "restful-api.dev",
5-
"schema" : "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
6-
"_exporter_id" : "23827434"
7-
},
8-
"item" : [
9-
{
10-
"name" : "all-objects",
11-
"request" : {
12-
"method" : "GET",
13-
"header" : [],
14-
"url" : {
15-
"raw" : "https://{{uri}}/objects",
16-
"protocol" : "https",
17-
"host" : [
18-
"{{uri}}"
19-
],
20-
"path" : [
21-
"objects"
22-
]
23-
}
24-
},
25-
"response" : []
26-
},
27-
{
28-
"name" : "add-object",
29-
"event" : [
30-
{
31-
"listen" : "test",
32-
"script" : {
33-
"exec" : [
34-
"var responseJson = pm.response.json();",
35-
"pm.environment.set(\"objId\", responseJson.id);",
36-
""
37-
],
38-
"type" : "text/javascript"
39-
}
40-
}
41-
],
42-
"request" : {
43-
"method" : "POST",
44-
"header" : [
45-
{
46-
"key" : "currentRequestName",
47-
"value" : "{{$currentRequestName}}",
48-
"type" : "text"
49-
}
50-
],
51-
"body" : {
52-
"mode" : "raw",
53-
"raw" : "{\n \"name\": \"Samsung S20\",\n \"data\": {\n \"year\": 2019,\n \"price\": 799.99\n }\n}",
54-
"options" : {
55-
"raw" : {
56-
"language" : "json"
57-
}
58-
}
59-
},
60-
"url" : {
61-
"raw" : "https://{{uri}}/objects",
62-
"protocol" : "https",
63-
"host" : [
64-
"{{uri}}"
65-
],
66-
"path" : [
67-
"objects"
68-
]
69-
}
70-
},
71-
"response" : []
72-
},
73-
{
74-
"name" : "get-object-by-id",
75-
"request" : {
76-
"method" : "GET",
77-
"header" : [],
78-
"url" : {
79-
"raw" : "https://{{uri}}/objects/{{objId}}",
80-
"protocol" : "https",
81-
"host" : [
82-
"{{uri}}"
83-
],
84-
"path" : [
85-
"objects",
86-
"{{objId}}"
87-
]
88-
}
89-
},
90-
"response" : []
91-
}
92-
]
93-
}
2+
"info": {
3+
"_postman_id": "8e2843e3-f3e9-4c55-a49d-89429fd02a83",
4+
"name": "restful-api.dev",
5+
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
6+
"_exporter_id": "23827434"
7+
},
8+
"item": [
9+
{
10+
"name": "all-objects",
11+
"event": [
12+
{
13+
"listen": "prerequest",
14+
"script": {
15+
"exec": [
16+
""
17+
],
18+
"type": "text/javascript"
19+
}
20+
}
21+
],
22+
"request": {
23+
"method": "GET",
24+
"header": [],
25+
"url": {
26+
"raw": "https://{{uri}}/objects",
27+
"protocol": "https",
28+
"host": [
29+
"{{uri}}"
30+
],
31+
"path": [
32+
"objects"
33+
]
34+
}
35+
},
36+
"response": []
37+
},
38+
{
39+
"name": "add-object",
40+
"event": [
41+
{
42+
"listen": "test",
43+
"script": {
44+
"exec": [
45+
"var responseJson = pm.response.json();",
46+
"pm.environment.set(\"objId\", responseJson.id);",
47+
""
48+
],
49+
"type": "text/javascript"
50+
}
51+
},
52+
{
53+
"listen": "prerequest",
54+
"script": {
55+
"exec": [
56+
"var moment = require('moment')",
57+
"pm.environment.set(\"$currentYear\", moment().year())",
58+
"pm.environment.set(\"$randomPrice\", _.random(1, 1000))"
59+
],
60+
"type": "text/javascript"
61+
}
62+
}
63+
],
64+
"request": {
65+
"method": "POST",
66+
"header": [],
67+
"body": {
68+
"mode": "raw",
69+
"raw": "{\n \"name\": \"AI Phone\",\n \"data\": {\n \"year\": {{$currentYear}},\n \"price\": {{$randomPrice}}\n }\n}",
70+
"options": {
71+
"raw": {
72+
"language": "json"
73+
}
74+
}
75+
},
76+
"url": {
77+
"raw": "https://{{uri}}/objects",
78+
"protocol": "https",
79+
"host": [
80+
"{{uri}}"
81+
],
82+
"path": [
83+
"objects"
84+
]
85+
}
86+
},
87+
"response": []
88+
},
89+
{
90+
"name": "get-object-by-id",
91+
"request": {
92+
"method": "GET",
93+
"header": [],
94+
"url": {
95+
"raw": "https://{{uri}}/objects/{{objId}}",
96+
"protocol": "https",
97+
"host": [
98+
"{{uri}}"
99+
],
100+
"path": [
101+
"objects",
102+
"{{objId}}"
103+
]
104+
}
105+
},
106+
"response": []
107+
}
108+
]
109+
}

src/integrationTest/resources/pm-templates/restfulapidev/restful-api.dev.postman_environment.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
"value" : "api.restful-api.dev",
88
"type" : "default",
99
"enabled" : true
10-
},
11-
{
12-
"key" : "objId",
13-
"value" : "",
14-
"type" : "any",
15-
"enabled" : true
1610
}
1711
],
1812
"_postman_variable_scope" : "environment",

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ internal fun initJSContext(nodeModulesRelativePath: String?) {
4343
val contextBindings = it.getBindings("js")
4444
contextBindings.putMember("pm", pm)
4545
contextBindings.putMember("xml2Json", pm.xml2Json)
46-
contextBindings.putMember("xml2Json", pm.xml2Json)
4746
}
4847
}
4948

src/main/kotlin/com/salesforce/revoman/internal/json/MoshiReVoman.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import com.squareup.moshi.JsonAdapter
1919
import com.squareup.moshi.JsonAdapter.Factory
2020
import com.squareup.moshi.Moshi
2121
import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter
22+
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
2223
import dev.zacsweers.moshix.adapters.AdaptedBy
2324
import dev.zacsweers.moshix.adapters.JsonString
2425
import io.vavr.control.Either
@@ -60,6 +61,7 @@ internal fun buildMoshi(
6061
.add(UUIDAdapter)
6162
.add(EpochAdapter)
6263
.add(Date::class.java, Rfc3339DateJsonAdapter())
64+
.add(KotlinJsonAdapterFactory())
6365
.addLast(CaseInsensitiveEnumAdapter.FACTORY)
6466
.addLast(EventAdapter)
6567
.addLast(ThrowableAdapter)

src/main/kotlin/com/salesforce/revoman/output/postman/PostmanEnvironment.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@ data class PostmanEnvironment<ValueT : Any?>(
1919

2020
fun set(key: String, value: ValueT) {
2121
mutableEnv[key] = value
22-
logger.info {
23-
"pm environment variable set through Tests JS - key : $key, value: ${pprint(value)}"
24-
}
22+
logger.info { "pm environment variable set through JS - key: $key, value: ${pprint(value)}" }
2523
}
2624

2725
@Suppress("unused")
2826
fun unset(key: String) {
2927
mutableEnv.remove(key)
30-
logger.info { "pm environment variable unset through Tests JS - key : $key" }
28+
logger.info { "pm environment variable unset through JS - key: $key" }
3129
}
3230

3331
// ! TODO 24/06/23 gopala.akshintala: Support for Regex while querying environment

0 commit comments

Comments
 (0)