You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: simulator-samples/sample-bank-service/src/main/java/org/citrusframework/simulator/sample/config/HttpClientConfig.java
+17-14Lines changed: 17 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -41,6 +41,8 @@
41
41
importjava.security.NoSuchAlgorithmException;
42
42
importjava.security.cert.CertificateException;
43
43
44
+
importstaticjava.lang.String.format;
45
+
44
46
@Configuration
45
47
publicclassHttpClientConfig {
46
48
@@ -62,32 +64,33 @@ public HttpClientConfig(SimulatorConfigurationProperties simulatorConfigurationP
.body(newMarshallingPayloadBuilder(payloadHelper.generateFaxStatusMessage(referenceId.getValue(), FaxStatusEnumType.QUEUED, "The fax message has been queued and will be send shortly"),
104
-
payloadHelper.getMarshaller())));
103
+
.message()
104
+
.body(newMarshallingPayloadBuilder(payloadHelper.generateFaxStatusMessage(referenceId.getValue(), FaxStatusEnumType.QUEUED, "The fax message has been queued and will be send shortly"),
105
+
payloadHelper.getMarshaller())));
105
106
106
107
// check no other status messages are sent; the default scenario only sends one status message
107
108
$(receiveTimeout(simulatorStatusEndpoint)
108
-
.timeout(3000));
109
+
.timeout(3000));
109
110
}
110
111
111
112
/**
@@ -118,21 +119,21 @@ public void testFaxSentScenario() {
118
119
FaxTypefax = payloadHelper.createFaxType("Joe Bloggs", "Testing the FaxSent scenario", "01-223344", "01-556677");
.body(newMarshallingPayloadBuilder(payloadHelper.generateFaxStatusMessage(referenceId.getValue(), FaxStatusEnumType.QUEUED, "The fax message has been queued and will be send shortly"),
128
-
payloadHelper.getMarshaller())));
127
+
.message()
128
+
.body(newMarshallingPayloadBuilder(payloadHelper.generateFaxStatusMessage(referenceId.getValue(), FaxStatusEnumType.QUEUED, "The fax message has been queued and will be send shortly"),
129
+
payloadHelper.getMarshaller())));
129
130
130
131
$(sleep().milliseconds(2000L));
131
132
132
133
$(receive(simulatorStatusEndpoint)
133
-
.message()
134
-
.body(newMarshallingPayloadBuilder(payloadHelper.generateFaxStatusMessage(referenceId.getValue(), FaxStatusEnumType.SUCCESS, "The fax message has been successfully sent"),
135
-
payloadHelper.getMarshaller())));
134
+
.message()
135
+
.body(newMarshallingPayloadBuilder(payloadHelper.generateFaxStatusMessage(referenceId.getValue(), FaxStatusEnumType.SUCCESS, "The fax message has been successfully sent"),
136
+
payloadHelper.getMarshaller())));
136
137
}
137
138
138
139
/**
@@ -145,24 +146,24 @@ public void testFaxCancelledScenario() {
145
146
FaxTypefax = payloadHelper.createFaxType("Joe Bloggs", "Testing the FaxCancelled scenario", "01-223344", "01-556677");
.body(newMarshallingPayloadBuilder(payloadHelper.generateFaxStatusMessage(referenceId.getValue(), FaxStatusEnumType.QUEUED, "The fax message has been queued and will be send shortly"),
155
-
payloadHelper.getMarshaller())));
154
+
.message()
155
+
.body(newMarshallingPayloadBuilder(payloadHelper.generateFaxStatusMessage(referenceId.getValue(), FaxStatusEnumType.QUEUED, "The fax message has been queued and will be send shortly"),
.body(newMarshallingPayloadBuilder(payloadHelper.generateFaxStatusMessage(referenceId.getValue(), FaxStatusEnumType.CANCELLED, "The fax message has been cancelled"),
165
-
payloadHelper.getMarshaller())));
164
+
.message()
165
+
.body(newMarshallingPayloadBuilder(payloadHelper.generateFaxStatusMessage(referenceId.getValue(), FaxStatusEnumType.CANCELLED, "The fax message has been cancelled"),
166
+
payloadHelper.getMarshaller())));
166
167
}
167
168
168
169
/**
@@ -175,19 +176,19 @@ public void testFaxBusyScenario() {
175
176
FaxTypefax = payloadHelper.createFaxType("Joe Bloggs", "Testing the FaxBusy scenario", "01-223344", "01-556677");
.body(newMarshallingPayloadBuilder(payloadHelper.generateFaxStatusMessage(referenceId.getValue(), FaxStatusEnumType.QUEUED, "The fax message has been queued and will be send shortly"),
185
-
payloadHelper.getMarshaller())));
184
+
.message()
185
+
.body(newMarshallingPayloadBuilder(payloadHelper.generateFaxStatusMessage(referenceId.getValue(), FaxStatusEnumType.QUEUED, "The fax message has been queued and will be send shortly"),
186
+
payloadHelper.getMarshaller())));
186
187
187
188
$(receive(simulatorStatusEndpoint)
188
-
.message()
189
-
.body(newMarshallingPayloadBuilder(payloadHelper.generateFaxStatusMessage(referenceId.getValue(), FaxStatusEnumType.ERROR, "Error transmitting fax: The receiving fax was busy"),
190
-
payloadHelper.getMarshaller())));
189
+
.message()
190
+
.body(newMarshallingPayloadBuilder(payloadHelper.generateFaxStatusMessage(referenceId.getValue(), FaxStatusEnumType.ERROR, "Error transmitting fax: The receiving fax was busy"),
191
+
payloadHelper.getMarshaller())));
191
192
}
192
193
193
194
/**
@@ -200,19 +201,19 @@ public void testFaxNoAnswerScenario() {
200
201
FaxTypefax = payloadHelper.createFaxType("Joe Bloggs", "Testing the FaxNoAnswer scenario", "01-223344", "01-556677");
.body(newMarshallingPayloadBuilder(payloadHelper.generateFaxStatusMessage(referenceId.getValue(), FaxStatusEnumType.QUEUED, "The fax message has been queued and will be send shortly"),
210
-
payloadHelper.getMarshaller())));
209
+
.message()
210
+
.body(newMarshallingPayloadBuilder(payloadHelper.generateFaxStatusMessage(referenceId.getValue(), FaxStatusEnumType.QUEUED, "The fax message has been queued and will be send shortly"),
211
+
payloadHelper.getMarshaller())));
211
212
212
213
$(receive(simulatorStatusEndpoint)
213
-
.message()
214
-
.body(newMarshallingPayloadBuilder(payloadHelper.generateFaxStatusMessage(referenceId.getValue(), FaxStatusEnumType.ERROR, "Error transmitting fax: No answer from the receiving fax"),
215
-
payloadHelper.getMarshaller())));
214
+
.message()
215
+
.body(newMarshallingPayloadBuilder(payloadHelper.generateFaxStatusMessage(referenceId.getValue(), FaxStatusEnumType.ERROR, "Error transmitting fax: No answer from the receiving fax"),
216
+
payloadHelper.getMarshaller())));
216
217
}
217
218
218
219
/**
@@ -230,10 +231,10 @@ public void testUpdateFaxStatusStarter() {
230
231
.send()
231
232
.post("/api/scenarios/UpdateFaxStatus/launch")
232
233
.message()
233
-
.contentType(MediaType.APPLICATION_JSON_VALUE)
234
+
.contentType(APPLICATION_JSON_VALUE)
234
235
.body(asJson(referenceId.asScenarioParameter(),
235
-
status.asScenarioParameter(),
236
-
statusMessage.asScenarioParameter())
236
+
status.asScenarioParameter(),
237
+
statusMessage.asScenarioParameter())
237
238
));
238
239
239
240
$(http()
@@ -242,9 +243,9 @@ public void testUpdateFaxStatusStarter() {
0 commit comments