use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyUserUsernamePathPut.
private void verifyUserUsernamePathPut(JsonMapObject user, OpenApiConfiguration cfg) {
JsonMapObject userPut = user.getJsonMapProperty("put");
assertEquals(7, userPut.size());
testCommonVerbPropsExceptSec(userPut, "updateUser");
List<Map<String, Object>> parameters = userPut.getListMapProperty("parameters");
assertEquals(1, parameters.size());
JsonMapObject userParam = new JsonMapObject(parameters.get(0));
verifyUserNameParameter(userParam, "username", "path");
if (cfg.isCreateRequestBodies()) {
verifyRequestBodyRef(userPut, "User");
} else {
JsonMapObject requestBody = userPut.getJsonMapProperty("requestBody");
assertEquals(3, requestBody.size());
assertNotNull(requestBody.getProperty("description"));
assertTrue(requestBody.getBooleanProperty("required"));
JsonMapObject content = requestBody.getJsonMapProperty("content");
assertEquals(1, content.size());
verifySimpleContent(content, "application/json", "User");
}
JsonMapObject responses = userPut.getJsonMapProperty("responses");
assertEquals(2, responses.size());
assertNotNull(responses.getProperty("400"));
assertNotNull(responses.getProperty("404"));
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyPathsProperty.
private void verifyPathsProperty(JsonMapObject sw3, OpenApiConfiguration cfg) {
JsonMapObject paths = sw3.getJsonMapProperty("paths");
assertEquals(14, paths.size());
// /pet
verifyPetPath(paths, cfg);
// /pet/findByStatus
verifyPetFindByStatusPath(paths);
// /pet/findByTags
verifyPetFindByTagsPath(paths);
// /pet/{petId}
verifyPetIdPath(paths);
// "/pet/{petId}/uploadImage"
verifyPetIdUploadImagePath(paths);
// "/store/inventory"
verifyStoreInventoryPath(paths);
// "/store/order"
verifyStoreOrderPath(paths, cfg);
// "/store/order/{orderId}"
verifyStoreOrderIdPath(paths);
// "/user"
verifyUserPath(paths, cfg);
// "/user/createWithArray"
verifyUserCreateWithArrayPath(paths, cfg);
// "/user/createWithList"
verifyUserCreateWithListPath(paths, cfg);
// "/user/login"
verifyUserLoginPath(paths);
// "/user/logout"
verifyUserLogoutPath(paths);
// "/user/{username}"
verifyUserUsernamePath(paths, cfg);
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyPetIdPathGet.
private void verifyPetIdPathGet(JsonMapObject pet) {
JsonMapObject petGet = pet.getJsonMapProperty("get");
assertEquals(7, petGet.size());
testCommonVerbProps(petGet, "getPetById");
List<Map<String, Object>> parameters = petGet.getListMapProperty("parameters");
assertEquals(1, parameters.size());
JsonMapObject pathIdParam = new JsonMapObject(parameters.get(0));
verifyPetIdParameter(pathIdParam);
assertNull(petGet.getJsonMapProperty("requestBody"));
JsonMapObject responses = petGet.getJsonMapProperty("responses");
assertEquals(3, responses.size());
JsonMapObject okResp = responses.getJsonMapProperty("200");
assertEquals(2, okResp.size());
JsonMapObject content = okResp.getJsonMapProperty("content");
assertEquals(2, content.size());
verifySimpleContent(content, "application/json", "Pet");
verifySimpleContent(content, "application/xml", "Pet");
assertNotNull(responses.getProperty("400"));
assertNotNull(responses.getProperty("404"));
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyStoreInventoryPath.
private void verifyStoreInventoryPath(JsonMapObject paths) {
// /store/inventory
JsonMapObject store = paths.getJsonMapProperty("/store/inventory");
assertEquals(1, store.size());
verifyStoreInventoryPathGet(store);
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyStoreOrderIdPathDelete.
private void verifyStoreOrderIdPathDelete(JsonMapObject store) {
JsonMapObject storeGet = store.getJsonMapProperty("delete");
assertEquals(6, storeGet.size());
testCommonVerbPropsExceptSec(storeGet, "deleteOrder");
List<Map<String, Object>> parameters = storeGet.getListMapProperty("parameters");
assertEquals(1, parameters.size());
JsonMapObject orderIdParam = new JsonMapObject(parameters.get(0));
verifyOrderIdParameter(orderIdParam, true);
assertNull(storeGet.getJsonMapProperty("requestBody"));
JsonMapObject responses = storeGet.getJsonMapProperty("responses");
assertEquals(2, responses.size());
assertNotNull(responses.getProperty("400"));
assertNotNull(responses.getProperty("404"));
}
Aggregations