Search in sources :

Example 56 with JsonMapObject

use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.

the class SwaggerToOpenApiConversionUtilsTest method verifyUserCreateWithListOrArrayPathPost.

private void verifyUserCreateWithListOrArrayPathPost(JsonMapObject store, String opId, OpenApiConfiguration cfg) {
    JsonMapObject userPost = store.getJsonMapProperty("post");
    assertEquals(6, userPost.size());
    testCommonVerbPropsExceptSec(userPost, opId);
    assertNull(userPost.getProperty("parameters"));
    if (cfg.isCreateRequestBodies()) {
        verifyRequestBodyRef(userPost, "UserArray");
    } else {
        JsonMapObject contentIn = verifyRequestBodyContent(userPost);
        assertEquals(1, contentIn.size());
        verifyArrayContent(contentIn, "application/json", "User");
    }
    testDefaultResponse(userPost);
}
Also used : JsonMapObject(org.apache.cxf.jaxrs.json.basic.JsonMapObject)

Example 57 with JsonMapObject

use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.

the class SwaggerToOpenApiConversionUtilsTest method verifyPetIdPathDelete.

private void verifyPetIdPathDelete(JsonMapObject pet) {
    JsonMapObject petDel = pet.getJsonMapProperty("delete");
    assertEquals(7, petDel.size());
    testCommonVerbProps(petDel, "deletePet");
    List<Map<String, Object>> parameters = petDel.getListMapProperty("parameters");
    assertEquals(2, parameters.size());
    JsonMapObject apiKeyParam = new JsonMapObject(parameters.get(0));
    assertEquals("api_key", apiKeyParam.getProperty("name"));
    assertEquals("header", apiKeyParam.getProperty("in"));
    assertNull(apiKeyParam.getProperty("type"));
    assertNull(apiKeyParam.getProperty("format"));
    assertFalse(apiKeyParam.getBooleanProperty("required"));
    JsonMapObject schema = apiKeyParam.getJsonMapProperty("schema");
    assertEquals(1, schema.size());
    assertEquals("string", schema.getProperty("type"));
    JsonMapObject pathIdParam = new JsonMapObject(parameters.get(1));
    verifyPetIdParameter(pathIdParam);
    assertNull(petDel.getJsonMapProperty("requestBody"));
    JsonMapObject responses = petDel.getJsonMapProperty("responses");
    assertEquals(2, responses.size());
    assertNotNull(responses.getProperty("400"));
    assertNotNull(responses.getProperty("404"));
}
Also used : Map(java.util.Map) JsonMapObject(org.apache.cxf.jaxrs.json.basic.JsonMapObject)

Example 58 with JsonMapObject

use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.

the class SwaggerToOpenApiConversionUtilsTest method verifyUserLogoutPathGet.

private void verifyUserLogoutPathGet(JsonMapObject user) {
    JsonMapObject userGet = user.getJsonMapProperty("get");
    assertEquals(5, userGet.size());
    testCommonVerbPropsExceptSec(userGet, "logoutUser");
    assertNull(userGet.getListMapProperty("parameters"));
    assertNull(userGet.getProperty("requestBody"));
    JsonMapObject responses = userGet.getJsonMapProperty("responses");
    assertEquals(1, responses.size());
    testDefaultResponse(userGet);
}
Also used : JsonMapObject(org.apache.cxf.jaxrs.json.basic.JsonMapObject)

Example 59 with JsonMapObject

use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.

the class SwaggerToOpenApiConversionUtilsTest method verifyUserLogoutPath.

private void verifyUserLogoutPath(JsonMapObject paths) {
    // /user/logout
    JsonMapObject user = paths.getJsonMapProperty("/user/logout");
    assertEquals(1, user.size());
    verifyUserLogoutPathGet(user);
}
Also used : JsonMapObject(org.apache.cxf.jaxrs.json.basic.JsonMapObject)

Example 60 with JsonMapObject

use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.

the class SwaggerToOpenApiConversionUtilsTest method verifyUserUsernamePath.

private void verifyUserUsernamePath(JsonMapObject paths, OpenApiConfiguration cfg) {
    // /user/{username}
    JsonMapObject user = paths.getJsonMapProperty("/user/{username}");
    assertEquals(3, user.size());
    verifyUserUsernamePathGet(user);
    verifyUserUsernamePathPut(user, cfg);
    verifyUserUsernamePathDelete(user);
}
Also used : JsonMapObject(org.apache.cxf.jaxrs.json.basic.JsonMapObject)

Aggregations

JsonMapObject (org.apache.cxf.jaxrs.json.basic.JsonMapObject)63 Map (java.util.Map)23 LinkedHashMap (java.util.LinkedHashMap)5 JsonMapObjectReaderWriter (org.apache.cxf.jaxrs.json.basic.JsonMapObjectReaderWriter)5 Test (org.junit.Test)3 LinkedList (java.util.LinkedList)2 IOException (java.io.IOException)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 WebClient (org.apache.cxf.jaxrs.client.WebClient)1