Skip to content

Commit f0391cc

Browse files
committed
SpotlessApply
Signed-off-by: Gopal S Akshintala <[email protected]>
1 parent 9b13774 commit f0391cc

File tree

32 files changed

+95
-105
lines changed

32 files changed

+95
-105
lines changed

src/integrationTest/java/com/salesforce/revoman/integration/pokemon/PokemonTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import static com.salesforce.revoman.input.config.StepPick.PostTxnStepPick.afterStepContainingURIPathOfAny;
1515
import static com.salesforce.revoman.input.config.StepPick.PostTxnStepPick.afterStepName;
1616
import static com.salesforce.revoman.input.config.StepPick.PreTxnStepPick.beforeStepContainingHeader;
17-
import static com.salesforce.revoman.input.config.StepPick.PreTxnStepPick.beforeStepContainingURIPathOfAny;
1817
import static com.salesforce.revoman.input.config.StepPick.PreTxnStepPick.beforeStepName;
1918
import static org.mockito.ArgumentMatchers.any;
2019
import static org.mockito.Mockito.times;
@@ -70,8 +69,7 @@ public void accept(
7069
new PostHook() {
7170
@Override
7271
public void accept(@NotNull StepReport stepReport, @NotNull Rundown rundown) {
73-
LOGGER.info(
74-
"Picked `postLogHook` after stepName: {}", stepReport.step.displayName);
72+
LOGGER.info("Picked `postLogHook` after stepName: {}", stepReport.step.displayName);
7573
}
7674
});
7775
//noinspection Convert2Lambda
@@ -103,7 +101,9 @@ public void accept(@NotNull StepReport ignore2, @NotNull Rundown rundown) {
103101
@Override
104102
public void accept(@NotNull StepReport stepReport, @NotNull Rundown ignore) {
105103
LOGGER.info(
106-
"Picked `postHookAfterURIPath` after stepName: {} with raw URI: {}", stepReport.step.displayName, stepReport.step.rawPMStep.getRequest().url);
104+
"Picked `postHookAfterURIPath` after stepName: {} with raw URI: {}",
105+
stepReport.step.displayName,
106+
stepReport.step.rawPMStep.getRequest().url);
107107
}
108108
});
109109
final var pokeRundown =

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ object ReVoman {
4848
@JvmOverloads
4949
fun revUp(
5050
dynamicEnvironment: Map<String, String> = mapOf<String, String>(),
51-
vararg kicks: Kick
51+
vararg kicks: Kick,
5252
): List<Rundown> =
5353
kicks
5454
.fold(dynamicEnvironment to listOf<Rundown>()) { (accumulatedMutableEnv, rundowns), kick ->
5555
val rundown =
5656
revUp(
5757
kick.overrideDynamicEnvironments(
5858
kick.dynamicEnvironmentsFlattened(),
59-
accumulatedMutableEnv
59+
accumulatedMutableEnv,
6060
)
6161
)
6262
rundown.mutableEnv.mutableEnvCopyWithValuesOfType<String>() to (rundowns + rundown)
@@ -90,7 +90,7 @@ object ReVoman {
9090
initMoshi(
9191
kick.globalCustomTypeAdapters(),
9292
kick.customTypeAdaptersFromRequestConfig() + kick.customTypeAdaptersFromResponseConfig(),
93-
kick.globalSkipTypes()
93+
kick.globalSkipTypes(),
9494
)
9595
val environment = mergeEnvs(kick.environmentPaths(), kick.dynamicEnvironmentsFlattened())
9696
val pm =
@@ -110,7 +110,7 @@ object ReVoman {
110110
kick: Kick,
111111
moshiReVoman: ConfigurableMoshi,
112112
regexReplacer: RegexReplacer,
113-
pm: PostmanSDK
113+
pm: PostmanSDK,
114114
): List<StepReport> {
115115
var haltExecution = false
116116
return pmStepsFlattened
@@ -129,7 +129,7 @@ object ReVoman {
129129
stepReports + preStepReport,
130130
pm.environment,
131131
kick.haltOnFailureOfTypeExcept(),
132-
moshiReVoman
132+
moshiReVoman,
133133
)
134134
pm.environment.putAll(regexReplacer.replaceVariablesInEnv(pm))
135135
val currentStepReport: StepReport = // --------### PRE-REQ-JS ###--------

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ internal interface KickDef {
8686

8787
@Value.Check
8888
fun validateConfig() {
89-
require(
90-
!haltOnAnyFailure() || (haltOnAnyFailure() && haltOnFailureOfTypeExcept() == null),
91-
) {
89+
require(!haltOnAnyFailure() || (haltOnAnyFailure() && haltOnFailureOfTypeExcept() == null)) {
9290
"`haltOnAnyFailureExcept` should NOT be set when `haltOnAnyFailure` is set to `True`"
9391
}
9492
require(disjoint(runOnlySteps(), skipSteps())) {

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,25 @@ data class RequestConfig
1818
internal constructor(
1919
val preTxnStepPick: PreTxnStepPick,
2020
val objType: Type,
21-
val customTypeAdapter: Either<JsonAdapter<Any>, JsonAdapter.Factory>? = null
21+
val customTypeAdapter: Either<JsonAdapter<Any>, JsonAdapter.Factory>? = null,
2222
) {
2323
companion object {
2424
@JvmStatic
25-
fun unmarshallRequest(
26-
preTxnStepPick: PreTxnStepPick,
27-
requestType: Type,
28-
): RequestConfig = RequestConfig(preTxnStepPick, requestType)
25+
fun unmarshallRequest(preTxnStepPick: PreTxnStepPick, requestType: Type): RequestConfig =
26+
RequestConfig(preTxnStepPick, requestType)
2927

3028
@JvmStatic
3129
fun unmarshallRequest(
3230
preTxnStepPick: PreTxnStepPick,
3331
requestType: Type,
34-
customTypeAdapter: JsonAdapter<Any>
32+
customTypeAdapter: JsonAdapter<Any>,
3533
): RequestConfig = RequestConfig(preTxnStepPick, requestType, left(customTypeAdapter))
3634

3735
@JvmStatic
3836
fun unmarshallRequest(
3937
preTxnStepPick: PreTxnStepPick,
4038
requestType: Type,
41-
customTypeAdapterFactory: JsonAdapter.Factory
39+
customTypeAdapterFactory: JsonAdapter.Factory,
4240
): RequestConfig = RequestConfig(preTxnStepPick, requestType, right(customTypeAdapterFactory))
4341
}
4442
}

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,21 @@ internal constructor(
2323
) {
2424
companion object {
2525
@JvmStatic
26-
fun unmarshallResponse(
27-
postTxnStepPick: PostTxnStepPick,
28-
successType: Type,
29-
): ResponseConfig = ResponseConfig(postTxnStepPick, null, successType)
26+
fun unmarshallResponse(postTxnStepPick: PostTxnStepPick, successType: Type): ResponseConfig =
27+
ResponseConfig(postTxnStepPick, null, successType)
3028

3129
@JvmStatic
3230
fun unmarshallResponse(
3331
postTxnStepPick: PostTxnStepPick,
3432
successType: Type,
35-
customTypeAdapter: JsonAdapter<Any>
33+
customTypeAdapter: JsonAdapter<Any>,
3634
): ResponseConfig = ResponseConfig(postTxnStepPick, null, successType, left(customTypeAdapter))
3735

3836
@JvmStatic
3937
fun unmarshallResponse(
4038
postTxnStepPick: PostTxnStepPick,
4139
successType: Type,
42-
customTypeAdapterFactory: JsonAdapter.Factory
40+
customTypeAdapterFactory: JsonAdapter.Factory,
4341
): ResponseConfig =
4442
ResponseConfig(postTxnStepPick, null, successType, right(customTypeAdapterFactory))
4543

@@ -53,14 +51,14 @@ internal constructor(
5351
fun unmarshallSuccessResponse(
5452
postTxnStepPick: PostTxnStepPick,
5553
successType: Type,
56-
customTypeAdapter: JsonAdapter<Any>
54+
customTypeAdapter: JsonAdapter<Any>,
5755
): ResponseConfig = ResponseConfig(postTxnStepPick, true, successType, left(customTypeAdapter))
5856

5957
@JvmStatic
6058
fun unmarshallSuccessResponse(
6159
postTxnStepPick: PostTxnStepPick,
6260
successType: Type,
63-
customTypeAdapterFactory: JsonAdapter.Factory
61+
customTypeAdapterFactory: JsonAdapter.Factory,
6462
): ResponseConfig =
6563
ResponseConfig(postTxnStepPick, true, successType, right(customTypeAdapterFactory))
6664

@@ -74,14 +72,14 @@ internal constructor(
7472
fun unmarshallErrorResponse(
7573
postTxnStepPick: PostTxnStepPick,
7674
successType: Type,
77-
customTypeAdapter: JsonAdapter<Any>
75+
customTypeAdapter: JsonAdapter<Any>,
7876
): ResponseConfig = ResponseConfig(postTxnStepPick, false, successType, left(customTypeAdapter))
7977

8078
@JvmStatic
8179
fun unmarshallErrorResponse(
8280
postTxnStepPick: PostTxnStepPick,
8381
successType: Type,
84-
customTypeAdapterFactory: JsonAdapter.Factory
82+
customTypeAdapterFactory: JsonAdapter.Factory,
8583
): ResponseConfig =
8684
ResponseConfig(postTxnStepPick, false, successType, right(customTypeAdapterFactory))
8785
}

src/main/kotlin/com/salesforce/revoman/input/json/JsonPojoUtils.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fun <PojoT : Any> jsonFileToPojo(
3434
jsonFilePath: String,
3535
customAdapters: List<Any> = emptyList(),
3636
customAdaptersWithType: Map<Type, List<Either<JsonAdapter<Any>, Factory>>> = emptyMap(),
37-
skipTypes: Set<Class<out Any>> = emptySet()
37+
skipTypes: Set<Class<out Any>> = emptySet(),
3838
): PojoT? {
3939
val jsonAdapter = initMoshi<PojoT>(customAdapters, customAdaptersWithType, skipTypes, pojoType)
4040
return jsonAdapter.fromJson(bufferFileInResources(jsonFilePath))
@@ -46,14 +46,14 @@ fun <PojoT : Any> jsonFileToPojo(jsonFile: JsonFile<PojoT>): PojoT? =
4646
jsonFile.jsonFilePath(),
4747
jsonFile.customAdapters(),
4848
jsonFile.customAdaptersWithType(),
49-
jsonFile.skipTypes()
49+
jsonFile.skipTypes(),
5050
)
5151

5252
inline fun <reified PojoT : Any> jsonFileToPojo(
5353
jsonFilePath: String,
5454
customAdapters: List<Any> = emptyList(),
5555
customAdaptersWithType: Map<Type, List<Either<JsonAdapter<Any>, Factory>>> = emptyMap(),
56-
skipTypes: Set<Class<out Any>> = emptySet()
56+
skipTypes: Set<Class<out Any>> = emptySet(),
5757
): PojoT? =
5858
jsonFileToPojo(PojoT::class.java, jsonFilePath, customAdapters, customAdaptersWithType, skipTypes)
5959

@@ -74,7 +74,7 @@ fun <PojoT : Any> jsonToPojo(
7474
jsonStr: String,
7575
customAdapters: List<Any> = emptyList(),
7676
customAdaptersWithType: Map<Type, List<Either<JsonAdapter<Any>, Factory>>> = emptyMap(),
77-
skipTypes: Set<Class<out Any>> = emptySet()
77+
skipTypes: Set<Class<out Any>> = emptySet(),
7878
): PojoT? {
7979
val jsonAdapter = initMoshi<PojoT>(customAdapters, customAdaptersWithType, skipTypes, pojoType)
8080
return jsonAdapter.fromJson(jsonStr)
@@ -86,14 +86,14 @@ fun <PojoT : Any> jsonToPojo(jsonString: JsonString<PojoT>): PojoT? =
8686
jsonString.jsonString(),
8787
jsonString.customAdapters(),
8888
jsonString.customAdaptersWithType(),
89-
jsonString.skipTypes()
89+
jsonString.skipTypes(),
9090
)
9191

9292
inline fun <reified PojoT : Any> jsonToPojo(
9393
jsonStr: String,
9494
customAdapters: List<Any> = emptyList(),
9595
customAdaptersWithType: Map<Type, List<Either<JsonAdapter<Any>, Factory>>> = emptyMap(),
96-
skipTypes: Set<Class<out Any>> = emptySet()
96+
skipTypes: Set<Class<out Any>> = emptySet(),
9797
): PojoT? =
9898
jsonToPojo(PojoT::class.java, jsonStr, customAdapters, customAdaptersWithType, skipTypes)
9999

@@ -116,7 +116,7 @@ fun <PojoT : Any> pojoToJson(
116116
customAdapters: List<Any> = emptyList(),
117117
customAdaptersWithType: Map<Type, List<Either<JsonAdapter<Any>, Factory>>> = emptyMap(),
118118
skipTypes: Set<Class<out Any>> = emptySet(),
119-
indent: String? = " "
119+
indent: String? = " ",
120120
): String? {
121121
val jsonAdapter = initMoshi<PojoT>(customAdapters, customAdaptersWithType, skipTypes, pojoType)
122122
return (indent?.let { jsonAdapter.indent(indent) } ?: jsonAdapter).toJson(pojo)
@@ -129,15 +129,15 @@ fun <PojoT : Any> pojoToJson(config: Pojo<PojoT>): String? =
129129
config.customAdapters(),
130130
config.customAdaptersWithType(),
131131
config.skipTypes(),
132-
config.indent()
132+
config.indent(),
133133
)
134134

135135
inline fun <reified PojoT : Any> pojoToJson(
136136
pojo: PojoT,
137137
customAdapters: List<Any> = emptyList(),
138138
customAdaptersWithType: Map<Type, List<Either<JsonAdapter<Any>, Factory>>> = emptyMap(),
139139
skipTypes: Set<Class<out Any>> = emptySet(),
140-
indent: String? = " "
140+
indent: String? = " ",
141141
): String? =
142142
pojoToJson(PojoT::class.java, pojo, customAdapters, customAdaptersWithType, skipTypes, indent)
143143

@@ -146,7 +146,7 @@ private fun <PojoT : Any> initMoshi(
146146
customAdapters: List<Any> = emptyList(),
147147
customAdaptersWithType: Map<Type, List<Either<JsonAdapter<Any>, Factory>>> = emptyMap(),
148148
skipTypes: Set<Class<out Any>> = emptySet(),
149-
pojoType: Type
149+
pojoType: Type,
150150
): JsonAdapter<PojoT> =
151151
buildMoshi(customAdapters, customAdaptersWithType, skipTypes).build().adapter(pojoType)
152152

src/main/kotlin/com/salesforce/revoman/input/json/JsonWriterUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fun <T> listW(
7373
name: String,
7474
list: List<T>?,
7575
writer: JsonWriter,
76-
block: NestedNodeWriter<T>
76+
block: NestedNodeWriter<T>,
7777
): JsonWriter =
7878
with(writer) {
7979
name(name)

src/main/kotlin/com/salesforce/revoman/input/json/adapters/CompositeGraphResponse.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ data class CompositeGraphResponse(val graphs: List<Graph>) {
2323
data class SuccessGraph(
2424
override val graphId: String,
2525
val graphResponse: GraphResponse,
26-
override val isSuccessful: Boolean
26+
override val isSuccessful: Boolean,
2727
) : Graph {
2828
@JsonClass(generateAdapter = true)
2929
data class GraphResponse(val compositeResponse: List<CompositeResponse>) {
@@ -32,7 +32,7 @@ data class CompositeGraphResponse(val graphs: List<Graph>) {
3232
val body: Body,
3333
val httpHeaders: HttpHeaders,
3434
val httpStatusCode: Int,
35-
val referenceId: String
35+
val referenceId: String,
3636
) {
3737
@JsonClass(generateAdapter = true)
3838
data class Body(val errors: List<Any>, val id: String, val success: Boolean)
@@ -47,7 +47,7 @@ data class CompositeGraphResponse(val graphs: List<Graph>) {
4747
data class ErrorGraph(
4848
override val graphId: String,
4949
val graphResponse: GraphErrorResponse,
50-
override val isSuccessful: Boolean
50+
override val isSuccessful: Boolean,
5151
) : Graph {
5252
@Json(ignore = true)
5353
@JvmField
@@ -75,7 +75,7 @@ data class CompositeGraphResponse(val graphs: List<Graph>) {
7575
val body: List<Body>,
7676
val httpHeaders: HttpHeaders,
7777
val httpStatusCode: Int,
78-
val referenceId: String
78+
val referenceId: String,
7979
) {
8080
@JsonClass(generateAdapter = true)
8181
data class Body(val errorCode: String, val fields: List<Any>?, val message: String)
@@ -94,7 +94,7 @@ data class CompositeGraphResponse(val graphs: List<Graph>) {
9494
"isSuccessful",
9595
true,
9696
SuccessGraph::class.java,
97-
ErrorGraph::class.java
97+
ErrorGraph::class.java,
9898
)
9999
}
100100
}

src/main/kotlin/com/salesforce/revoman/input/json/factories/DiMorphicAdapter.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,21 @@ private constructor(
5858
labelKey: String,
5959
labelValueForSuccess: Boolean,
6060
successType: Type,
61-
errorType: Type
61+
errorType: Type,
6262
): Factory =
6363
object : Factory {
6464
override fun create(
6565
type: Type,
6666
annotations: Set<Annotation>,
67-
moshi: Moshi
67+
moshi: Moshi,
6868
): JsonAdapter<*>? {
6969
if (type.rawType != baseType || annotations.isNotEmpty()) {
7070
return null
7171
}
7272
return DiMorphicAdapter(
7373
labelKey,
7474
Triple(labelValueForSuccess, successType, moshi.adapter(successType)),
75-
errorType to moshi.adapter(errorType)
75+
errorType to moshi.adapter(errorType),
7676
)
7777
.nullSafe()
7878
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ internal fun deepFlattenItems(
5959
internal fun shouldStepBePicked(
6060
currentStep: Step,
6161
runOnlySteps: List<ExeStepPick>,
62-
skipSteps: List<ExeStepPick>
62+
skipSteps: List<ExeStepPick>,
6363
): Boolean {
6464
if (runOnlySteps.isEmpty() && skipSteps.isEmpty()) {
6565
return true
@@ -78,7 +78,7 @@ internal fun shouldStepBePicked(
7878
internal fun <T> runChecked(
7979
currentStep: Step,
8080
exeType: ExeType,
81-
fn: () -> T
81+
fn: () -> T,
8282
): Either<Throwable, T> {
8383
logger.info { "$currentStep Executing $exeType" }
8484
return runCatching(fn)
@@ -94,7 +94,7 @@ internal fun <T> runChecked(
9494
internal fun shouldHaltExecution(
9595
currentStepReport: StepReport,
9696
kick: Kick,
97-
pm: PostmanSDK
97+
pm: PostmanSDK,
9898
): Boolean =
9999
when {
100100
currentStepReport.isSuccessful -> false
@@ -112,7 +112,7 @@ internal fun shouldHaltExecution(
112112
currentStepReport.exeTypeForFailure == exeType &&
113113
postTxnPick.pick(
114114
currentStepReport,
115-
pm.rundown.copy(stepReports = pm.rundown.stepReports + currentStepReport)
115+
pm.rundown.copy(stepReports = pm.rundown.stepReports + currentStepReport),
116116
)
117117
}
118118
?.any { it }

0 commit comments

Comments
 (0)