Skip to content

Commit c067ac7

Browse files
authored
Merge pull request #496 from fjtirado/Star_wars_2_star_trek
Star Wars api is down
2 parents 2a50dc4 + 170a64e commit c067ac7

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

impl/http/src/test/java/io/serverlessworkflow/impl/HTTPWorkflowDefinitionTest.java

+10-9
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,17 @@ void testWrongSchema(String fileName) {
6464

6565
private static Stream<Arguments> provideParameters() {
6666
Map<String, Object> petInput = Map.of("petId", 10);
67+
Map<String, Object> starTrekInput = Map.of("uid", "MOMA0000092393");
6768
Condition<Object> petCondition =
6869
new Condition<>(
6970
o -> ((Map<String, Object>) o).containsKey("photoUrls"), "callHttpCondition");
71+
Condition<Object> starTrekCondition =
72+
new Condition<>(
73+
o ->
74+
((Map<String, Object>) ((Map<String, Object>) o).get("movie"))
75+
.get("title")
76+
.equals("Star Trek"),
77+
"StartTrek");
7078
return Stream.of(
7179
Arguments.of("callGetHttp.yaml", petInput, petCondition),
7280
Arguments.of(
@@ -75,16 +83,9 @@ private static Stream<Arguments> provideParameters() {
7583
new Condition<>(
7684
o -> ((Map<String, Object>) o).containsKey("petId"), "notFoundCondition")),
7785
Arguments.of("call-http-endpoint-interpolation.yaml", petInput, petCondition),
86+
Arguments.of("call-http-query-parameters.yaml", starTrekInput, starTrekCondition),
7887
Arguments.of(
79-
"call-http-query-parameters.yaml",
80-
Map.of("searchQuery", "R2-D2"),
81-
new Condition<>(
82-
o -> ((Map<String, Object>) o).get("count").equals(1), "R2D2Condition")),
83-
Arguments.of(
84-
"call-http-query-parameters-external-schema.yaml",
85-
Map.of("searchQuery", "Luke Skywalker"),
86-
new Condition<>(
87-
o -> ((Map<String, Object>) o).get("count").equals(1), "TheRealJediCondition")),
88+
"call-http-query-parameters-external-schema.yaml", starTrekInput, starTrekCondition),
8889
Arguments.of(
8990
"callPostHttp.yaml",
9091
Map.of("name", "Javierito", "status", "available"),

impl/http/src/test/resources/call-http-query-parameters-external-schema.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ input:
88
resource:
99
endpoint: schema/searchquery.yaml
1010
do:
11-
- searchStarWarsCharacters:
11+
- searchStarTrekMovies:
1212
call: http
1313
with:
1414
method: get
15-
endpoint: https://swapi.dev/api/people/
15+
endpoint: https://stapi.co/api/v1/rest/movie
1616
query:
17-
search: ${.searchQuery}
17+
uid: ${.uid}
1818

impl/http/src/test/resources/call-http-query-parameters.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ input:
88
document:
99
type: object
1010
required:
11-
- searchQuery
11+
- uid
1212
properties:
13-
searchQuery:
13+
uid:
1414
type: string
1515
do:
16-
- searchStarWarsCharacters:
16+
- searchStarTrekMovies:
1717
call: http
1818
with:
1919
method: get
20-
endpoint: https://swapi.dev/api/people/
20+
endpoint: https://stapi.co/api/v1/rest/movie
2121
query:
22-
search: ${.searchQuery}
22+
uid: ${.uid}
2323

Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
type: object
22
required:
3-
- searchQuery
3+
- uid
44
properties:
5-
searchQuery:
5+
uid:
66
type: string

0 commit comments

Comments
 (0)