Skip to content

Commit e3ca627

Browse files
committed
Update tests.
1 parent 1bf37c2 commit e3ca627

10 files changed

Lines changed: 550 additions & 7 deletions

File tree

kilo-test/src/test/java/org/httprpc/kilo/test/DocumentationTest.java

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,53 @@ public class DocumentationTest {
2929
private static final URI baseURI = URI.create("http://localhost:8080/kilo-test/");
3030

3131
@Test
32-
public void testDocumentation() throws IOException {
32+
public void testBulkUploadService() throws IOException {
3333
testDocumentation("bulk-upload");
34+
}
35+
36+
@Test
37+
public void testCatalogService() throws IOException {
3438
testDocumentation("catalog");
39+
}
40+
41+
@Test
42+
public void testEmployeeService() throws IOException {
3543
testDocumentation("employees");
44+
}
45+
46+
@Test
47+
public void testFilmService() throws IOException {
48+
testDocumentation("films");
49+
}
50+
51+
@Test
52+
public void testMathService() throws IOException {
3653
testDocumentation("math");
54+
}
55+
56+
@Test
57+
public void testMemberService() throws IOException {
3758
testDocumentation("members");
59+
}
60+
61+
@Test
62+
public void testPetService() throws IOException {
63+
testDocumentation("pets");
64+
}
65+
66+
@Test
67+
public void testSalaryService() throws IOException {
3868
testDocumentation("salaries");
69+
}
70+
71+
@Test
72+
public void testTestService() throws IOException {
3973
testDocumentation("test");
4074
}
4175

4276
private void testDocumentation(String name) throws IOException {
4377
Map<?, ?> expected;
44-
try (var inputStream = getClass().getResourceAsStream(String.format("%s.json", name))) {
78+
try (var inputStream = getClass().getResourceAsStream(String.format("api/%s.json", name))) {
4579
var jsonDecoder = new JSONDecoder();
4680

4781
expected = (Map<?, ?>)jsonDecoder.read(inputStream);

kilo-test/src/test/resources/org/httprpc/kilo/test/bulk-upload.json renamed to kilo-test/src/test/resources/org/httprpc/kilo/test/api/bulk-upload.json

File renamed without changes.

kilo-test/src/test/resources/org/httprpc/kilo/test/catalog.json renamed to kilo-test/src/test/resources/org/httprpc/kilo/test/api/catalog.json

File renamed without changes.

kilo-test/src/test/resources/org/httprpc/kilo/test/employees.json renamed to kilo-test/src/test/resources/org/httprpc/kilo/test/api/employees.json

File renamed without changes.
Lines changed: 319 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,319 @@
1+
{
2+
"description": "Film service.",
3+
"endpoints": [
4+
{
5+
"operations": [
6+
{
7+
"deprecated": false,
8+
"description": "Returns a list of all films.",
9+
"formData": false,
10+
"method": "GET",
11+
"parameters": true,
12+
"pathParameters": [
13+
],
14+
"produces": {
15+
"elementType": {
16+
"intrinsic": false,
17+
"iterable": false,
18+
"map": false,
19+
"name": "Film"
20+
},
21+
"intrinsic": true,
22+
"iterable": true,
23+
"map": false,
24+
"name": "Iterable"
25+
},
26+
"queryParameters": [
27+
{
28+
"description": "An optional name pattern to match. An asterisk may be used as a wildcard.",
29+
"name": "match",
30+
"required": false,
31+
"type": {
32+
"intrinsic": true,
33+
"iterable": false,
34+
"map": false,
35+
"name": "String"
36+
}
37+
}
38+
]
39+
}
40+
],
41+
"path": "/films"
42+
},
43+
{
44+
"operations": [
45+
{
46+
"deprecated": false,
47+
"description": "Returns detailed information about a specific film.",
48+
"formData": false,
49+
"method": "GET",
50+
"parameters": true,
51+
"pathParameters": [
52+
{
53+
"description": "The film ID.",
54+
"name": "filmID",
55+
"required": true,
56+
"type": {
57+
"intrinsic": true,
58+
"iterable": false,
59+
"map": false,
60+
"name": "Integer"
61+
}
62+
}
63+
],
64+
"produces": {
65+
"intrinsic": false,
66+
"iterable": false,
67+
"map": false,
68+
"name": "FilmDetail"
69+
},
70+
"queryParameters": [
71+
]
72+
}
73+
],
74+
"path": "/films/?"
75+
}
76+
],
77+
"enumerations": [
78+
{
79+
"description": "Represents a film rating.",
80+
"name": "Rating",
81+
"values": [
82+
{
83+
"deprecated": false,
84+
"description": "A \"G\" rating.",
85+
"name": "G"
86+
},
87+
{
88+
"deprecated": false,
89+
"description": "A \"PG\" rating.",
90+
"name": "PG"
91+
},
92+
{
93+
"deprecated": false,
94+
"description": "A \"PG-13\" rating.",
95+
"name": "PG-13"
96+
},
97+
{
98+
"deprecated": false,
99+
"description": "An \"R\" rating.",
100+
"name": "R"
101+
},
102+
{
103+
"deprecated": false,
104+
"description": "An \"NC-17\" rating.",
105+
"name": "NC-17"
106+
}
107+
]
108+
}
109+
],
110+
"path": "/films",
111+
"structures": [
112+
{
113+
"description": "Represents a film actor.",
114+
"name": "Actor",
115+
"properties": [
116+
{
117+
"deprecated": false,
118+
"description": "The actor's first name.",
119+
"name": "firstName",
120+
"required": false,
121+
"type": {
122+
"intrinsic": true,
123+
"iterable": false,
124+
"map": false,
125+
"name": "String"
126+
}
127+
},
128+
{
129+
"deprecated": false,
130+
"description": "The actor's ID.",
131+
"name": "id",
132+
"required": false,
133+
"type": {
134+
"intrinsic": true,
135+
"iterable": false,
136+
"map": false,
137+
"name": "Integer"
138+
}
139+
},
140+
{
141+
"deprecated": false,
142+
"description": "The actor's last name.",
143+
"name": "lastName",
144+
"required": false,
145+
"type": {
146+
"intrinsic": true,
147+
"iterable": false,
148+
"map": false,
149+
"name": "String"
150+
}
151+
}
152+
],
153+
"supertypes": [
154+
]
155+
},
156+
{
157+
"description": "Represents a film category.",
158+
"name": "Category",
159+
"properties": [
160+
{
161+
"deprecated": false,
162+
"description": "The category's ID.",
163+
"name": "id",
164+
"required": false,
165+
"type": {
166+
"intrinsic": true,
167+
"iterable": false,
168+
"map": false,
169+
"name": "Integer"
170+
}
171+
},
172+
{
173+
"deprecated": false,
174+
"description": "The name of the category.",
175+
"name": "name",
176+
"required": false,
177+
"type": {
178+
"intrinsic": true,
179+
"iterable": false,
180+
"map": false,
181+
"name": "String"
182+
}
183+
}
184+
],
185+
"supertypes": [
186+
]
187+
},
188+
{
189+
"description": "Represents a film.",
190+
"name": "Film",
191+
"properties": [
192+
{
193+
"deprecated": false,
194+
"description": "The film's ID.",
195+
"name": "id",
196+
"required": false,
197+
"type": {
198+
"intrinsic": true,
199+
"iterable": false,
200+
"map": false,
201+
"name": "Integer"
202+
}
203+
},
204+
{
205+
"deprecated": false,
206+
"description": "The film's rating.",
207+
"name": "rating",
208+
"required": false,
209+
"type": {
210+
"intrinsic": false,
211+
"iterable": false,
212+
"map": false,
213+
"name": "Rating"
214+
}
215+
},
216+
{
217+
"deprecated": false,
218+
"description": "The date the film was released.",
219+
"name": "releaseDate",
220+
"required": false,
221+
"type": {
222+
"intrinsic": true,
223+
"iterable": false,
224+
"map": false,
225+
"name": "LocalDate"
226+
}
227+
},
228+
{
229+
"deprecated": false,
230+
"description": "The title of the film.",
231+
"name": "title",
232+
"required": true,
233+
"type": {
234+
"intrinsic": true,
235+
"iterable": false,
236+
"map": false,
237+
"name": "String"
238+
}
239+
}
240+
],
241+
"supertypes": [
242+
]
243+
},
244+
{
245+
"description": "Represents detailed information about a film.",
246+
"name": "FilmDetail",
247+
"properties": [
248+
{
249+
"deprecated": false,
250+
"description": "The actors that appeared in the film.",
251+
"name": "actors",
252+
"required": false,
253+
"type": {
254+
"elementType": {
255+
"intrinsic": false,
256+
"iterable": false,
257+
"map": false,
258+
"name": "Actor"
259+
},
260+
"intrinsic": true,
261+
"iterable": true,
262+
"map": false,
263+
"name": "Iterable"
264+
}
265+
},
266+
{
267+
"deprecated": false,
268+
"description": "The categories associated with the film.",
269+
"name": "categories",
270+
"required": false,
271+
"type": {
272+
"elementType": {
273+
"intrinsic": false,
274+
"iterable": false,
275+
"map": false,
276+
"name": "Category"
277+
},
278+
"intrinsic": true,
279+
"iterable": true,
280+
"map": false,
281+
"name": "Iterable"
282+
}
283+
},
284+
{
285+
"deprecated": false,
286+
"description": "A description of the film.",
287+
"name": "description",
288+
"required": false,
289+
"type": {
290+
"intrinsic": true,
291+
"iterable": false,
292+
"map": false,
293+
"name": "String"
294+
}
295+
},
296+
{
297+
"deprecated": false,
298+
"description": "The length of the film, in minutes.",
299+
"name": "length",
300+
"required": false,
301+
"type": {
302+
"intrinsic": true,
303+
"iterable": false,
304+
"map": false,
305+
"name": "Integer"
306+
}
307+
}
308+
],
309+
"supertypes": [
310+
{
311+
"intrinsic": false,
312+
"iterable": false,
313+
"map": false,
314+
"name": "Film"
315+
}
316+
]
317+
}
318+
]
319+
}

kilo-test/src/test/resources/org/httprpc/kilo/test/math.json renamed to kilo-test/src/test/resources/org/httprpc/kilo/test/api/math.json

File renamed without changes.

kilo-test/src/test/resources/org/httprpc/kilo/test/members.json renamed to kilo-test/src/test/resources/org/httprpc/kilo/test/api/members.json

File renamed without changes.

0 commit comments

Comments
 (0)