You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2018/02/13 16:01:59 UTC
[4/7] syncope git commit: [SYNCOPE-1262] Adapting test to OpenAPI
[SYNCOPE-1262] Adapting test to OpenAPI
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/b0b0e329
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/b0b0e329
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/b0b0e329
Branch: refs/heads/master
Commit: b0b0e3294dd893d44845295f6a0f570d33fcc607
Parents: 0e93bec
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Feb 13 16:20:10 2018 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Feb 13 16:20:10 2018 +0100
----------------------------------------------------------------------
.../apache/syncope/fit/core/OpenAPIITCase.java | 58 ++++++++++++++++++++
1 file changed, 58 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/b0b0e329/fit/core-reference/src/test/java/org/apache/syncope/fit/core/OpenAPIITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/OpenAPIITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/OpenAPIITCase.java
new file mode 100644
index 0000000..d2141f7
--- /dev/null
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/OpenAPIITCase.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.fit.core;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.io.InputStream;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.syncope.fit.AbstractITCase;
+import org.junit.jupiter.api.Test;
+
+public class OpenAPIITCase extends AbstractITCase {
+
+ @Test
+ public void openapi() throws IOException {
+ WebClient webClient = WebClient.create(ADDRESS + "/openapi.json").accept(MediaType.APPLICATION_JSON_TYPE);
+ Response response = webClient.get();
+ assumeTrue(response.getStatus() == 200);
+
+ JsonNode tree = new ObjectMapper().readTree((InputStream) response.getEntity());
+ assertNotNull(tree);
+
+ JsonNode info = tree.get("info");
+ assertEquals("Apache Syncope", info.get("title").asText());
+
+ JsonNode paths = tree.get("paths");
+ assertNotNull(paths);
+ assertTrue(paths.isContainerNode());
+
+ JsonNode components = tree.get("components");
+ assertNotNull(components);
+ assertTrue(components.isContainerNode());
+ }
+}