use of com.devonfw.cobigen.openapiplugin.model.EntityDef in project cobigen by devonfw.
the class OpenAPIInputReaderTest method testResponse.
@Test
public void testResponse() throws Exception {
List<Object> inputObjects = getInputs("componentResponseType.yaml");
boolean found = false;
for (Object o : inputObjects) {
if (isEntityDef(o)) {
EntityDef e = (EntityDef) o;
ComponentDef c = e.getComponent();
for (PathDef p : c.getPaths()) {
if (p.getPathURI().equals("/sampledata/customSearch/")) {
for (OperationDef op : p.getOperations()) {
for (ResponseDef r : op.getResponses()) {
assertThat(r.getType()).isEqualTo("SampleData");
found = true;
}
}
}
}
}
}
assertThat(found).isTrue();
}
use of com.devonfw.cobigen.openapiplugin.model.EntityDef 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