1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.syncope.fit.core;
20
21 import static org.junit.jupiter.api.Assertions.assertEquals;
22 import static org.junit.jupiter.api.Assertions.assertNotNull;
23 import static org.junit.jupiter.api.Assertions.assertTrue;
24
25 import com.fasterxml.jackson.databind.JsonNode;
26 import java.io.IOException;
27 import java.io.InputStream;
28 import javax.ws.rs.core.MediaType;
29 import javax.ws.rs.core.Response;
30 import org.apache.cxf.jaxrs.client.WebClient;
31 import org.apache.syncope.fit.AbstractITCase;
32 import org.junit.jupiter.api.Test;
33
34 public class OpenAPIITCase extends AbstractITCase {
35
36 @Test
37 public void openapi() throws IOException {
38 WebClient webClient = WebClient.create(ADDRESS + "/openapi.json").accept(MediaType.APPLICATION_JSON_TYPE);
39 Response response = webClient.get();
40 assertEquals(200, response.getStatus());
41
42 JsonNode tree = JSON_MAPPER.readTree((InputStream) response.getEntity());
43 assertNotNull(tree);
44
45 JsonNode info = tree.get("info");
46 assertEquals("Apache Syncope", info.get("title").asText());
47
48 JsonNode paths = tree.get("paths");
49 assertNotNull(paths);
50 assertTrue(paths.isContainerNode());
51
52 JsonNode components = tree.get("components");
53 assertNotNull(components);
54 assertTrue(components.isContainerNode());
55 }
56 }