use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyPetIdPath.
private void verifyPetIdPath(JsonMapObject paths) {
// /pet/{petId}
JsonMapObject pet = paths.getJsonMapProperty("/pet/{petId}");
assertEquals(3, pet.size());
verifyPetIdPathPost(pet);
verifyPetIdPathGet(pet);
verifyPetIdPathDelete(pet);
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyUserLoginPath.
private void verifyUserLoginPath(JsonMapObject paths) {
// /user/login
JsonMapObject user = paths.getJsonMapProperty("/user/login");
assertEquals(1, user.size());
verifyUserLoginPathPost(user);
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyUserUsernamePathDelete.
private void verifyUserUsernamePathDelete(JsonMapObject user) {
JsonMapObject usetDelete = user.getJsonMapProperty("delete");
assertEquals(6, usetDelete.size());
testCommonVerbPropsExceptSec(usetDelete, "deleteUser");
List<Map<String, Object>> parameters = usetDelete.getListMapProperty("parameters");
assertEquals(1, parameters.size());
JsonMapObject userParam = new JsonMapObject(parameters.get(0));
verifyUserNameParameter(userParam, "username", "path");
assertNull(usetDelete.getJsonMapProperty("requestBody"));
JsonMapObject responses = usetDelete.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 testConvertFromSwaggerToOpenApi.
@Test
public void testConvertFromSwaggerToOpenApi() {
OpenApiConfiguration cfg = new OpenApiConfiguration();
String s = SwaggerToOpenApiConversionUtils.getOpenApiFromSwaggerLoc("/swagger2petShop.json");
JsonMapObjectReaderWriter readerWriter = new JsonMapObjectReaderWriter();
JsonMapObject sw3 = readerWriter.fromJsonToJsonObject(s);
assertEquals("3.0.0", sw3.getStringProperty("openapi"));
verifyServersProperty(sw3);
verifyInfoProperty(sw3);
verifyTagsProperty(sw3);
verifyPathsProperty(sw3, cfg);
verifyComponentsProperty(sw3, cfg);
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyUserLoginPathPost.
private void verifyUserLoginPathPost(JsonMapObject user) {
JsonMapObject userPost = user.getJsonMapProperty("get");
assertEquals(6, userPost.size());
testCommonVerbPropsExceptSec(userPost, "loginUser");
assertNull(userPost.getProperty("requestBody"));
List<Map<String, Object>> parameters = userPost.getListMapProperty("parameters");
assertEquals(2, parameters.size());
verifyUserNameParameter(new JsonMapObject(parameters.get(0)), "username", "query");
verifyPasswordParameter(new JsonMapObject(parameters.get(1)), "password");
JsonMapObject responses = userPost.getJsonMapProperty("responses");
assertEquals(2, responses.size());
assertNotNull(responses.getJsonMapProperty("400"));
JsonMapObject okResp = responses.getJsonMapProperty("200");
assertEquals(3, okResp.size());
assertNotNull(okResp.getProperty("description"));
assertNotNull(okResp.getProperty("headers"));
JsonMapObject content = okResp.getJsonMapProperty("content");
assertEquals(2, content.size());
verifySimpleStringContent(content, "application/json");
verifySimpleStringContent(content, "application/xml");
}
Aggregations