use of com.devonfw.cobigen.openapiplugin.model.ServerDef in project cobigen by devonfw.
the class OpenAPIInputReader method extractServers.
/**
* @param openApi document root
* @return list of {@link ServerDef}'s
*/
private List<ServerDef> extractServers(OpenApi3 openApi) {
List<ServerDef> servers = new LinkedList<>();
ServerDef serv;
for (Server server : openApi.getServers()) {
serv = new ServerDef();
serv.setDescription(server.getDescription());
serv.setURI(server.getUrl());
servers.add(serv);
}
return servers;
}
use of com.devonfw.cobigen.openapiplugin.model.ServerDef in project cobigen by devonfw.
the class OpenAPIInputReaderTest method testRetrieveHeaderInfo.
@Test
public void testRetrieveHeaderInfo() throws Exception {
List<Object> inputObjects = getInputs("two-components.yaml");
for (Object o : inputObjects) {
if (isEntityDef(o)) {
EntityDef entityDef = (EntityDef) o;
HeaderDef header = entityDef.getHeader();
InfoDef info = header.getInfo();
assertThat(info.getDescription()).isEqualTo("Example of a API definition");
assertThat(info.getTitle()).isEqualTo("Devon Example");
List<ServerDef> servers = header.getServers();
assertThat(servers).hasSize(1);
ServerDef server = servers.get(0);
assertThat(server.getDescription()).isEqualTo("Just some data");
assertThat(server.getURI()).isEqualTo("https://localhost:8081/server/services/rest");
}
}
}
Aggregations