cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [cxf] branch master updated: [CXF-7525] Adjusting failing test to https://github.com/swagger-api/swagger-core/issues/2646
Date Thu, 01 Feb 2018 14:59:40 GMT
This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 9ec8ff0  [CXF-7525] Adjusting failing test to https://github.com/swagger-api/swagger-core/issues/2646
9ec8ff0 is described below

commit 9ec8ff0c2978596c8c7715e76ae4460359ed1f8f
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
AuthorDate: Thu Feb 1 15:59:29 2018 +0100

    [CXF-7525] Adjusting failing test to https://github.com/swagger-api/swagger-core/issues/2646
---
 .../group1/BookStoreStylesheetsOpenApi.java        | 37 ++++++++++++++++++++++
 .../AbstractOpenApiServiceDescriptionTest.java     | 11 ++++---
 .../OpenApiNonAnnotatedServiceDescriptionTest.java |  1 +
 3 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/group1/BookStoreStylesheetsOpenApi.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/group1/BookStoreStylesheetsOpenApi.java
new file mode 100644
index 0000000..b48957b
--- /dev/null
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/group1/BookStoreStylesheetsOpenApi.java
@@ -0,0 +1,37 @@
+/**
+ * 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.cxf.systest.jaxrs.description.group1;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+import io.swagger.v3.oas.annotations.Operation;
+
+@Path("/")
+public class BookStoreStylesheetsOpenApi {
+    @Operation(hidden = true)
+    @Produces({ "text/css" })
+    @Path("/css/book.css")
+    @GET
+    public String getCss() {
+        return "body { background-color: lightblue; }"; 
+    }
+}
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/openapi/AbstractOpenApiServiceDescriptionTest.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/openapi/AbstractOpenApiServiceDescriptionTest.java
index ee89fe0..25517ef 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/openapi/AbstractOpenApiServiceDescriptionTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/openapi/AbstractOpenApiServiceDescriptionTest.java
@@ -156,16 +156,17 @@ public abstract class AbstractOpenApiServiceDescriptionTest extends
AbstractBusC
             
             Map<String, UserOperation> map = r.getOperationsAsMap();
             assertEquals(3, map.size());
-            // see https://github.com/swagger-api/swagger-core/issues/2643
-            UserOperation getBooksOp = map.containsKey("getBooks") ? map.get("getBooks")
: map.get("getBooks_1");
+            UserOperation getBooksOp = map.get("getBooks");
             assertEquals(HttpMethod.GET, getBooksOp.getVerb());
             assertEquals("/bookstore", getBooksOp.getPath());
-            assertEquals(MediaType.APPLICATION_JSON, getBooksOp.getProduces());
+            // see https://github.com/swagger-api/swagger-core/issues/2646
+            if (getBooksOp.getProduces() != null) {
+                assertEquals(MediaType.APPLICATION_JSON, getBooksOp.getProduces());
+            }
             List<Parameter> getBooksOpParams = getBooksOp.getParameters();
             assertEquals(1, getBooksOpParams.size());
             assertEquals(ParameterType.QUERY, getBooksOpParams.get(0).getType());
-            // see https://github.com/swagger-api/swagger-core/issues/2643
-            UserOperation getBookOp = map.containsKey("getBook") ? map.get("getBook") : map.get("getBook_1");
+            UserOperation getBookOp = map.get("getBook");
             assertEquals(HttpMethod.GET, getBookOp.getVerb());
             assertEquals("/bookstore/{id}", getBookOp.getPath());
             assertEquals(MediaType.APPLICATION_JSON, getBookOp.getProduces());
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/openapi/OpenApiNonAnnotatedServiceDescriptionTest.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/openapi/OpenApiNonAnnotatedServiceDescriptionTest.java
index 93866fa..7abcd84 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/openapi/OpenApiNonAnnotatedServiceDescriptionTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/description/openapi/OpenApiNonAnnotatedServiceDescriptionTest.java
@@ -27,6 +27,7 @@ import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
 import org.apache.cxf.jaxrs.openapi.OpenApiFeature;
 import org.apache.cxf.systest.jaxrs.description.group1.BookStore;
+import org.apache.cxf.systest.jaxrs.description.group1.BookStoreStylesheetsOpenApi;
 
 import org.junit.BeforeClass;
 import org.junit.Test;

-- 
To stop receiving notification emails like this one, please contact
ilgrosso@apache.org.

Mime
View raw message