use of com.google.pubsub.v1.Schema in project ets-ogcapi-edr10 by opengeospatial.
the class CollectionsTime method coordsParameterDefinition.
/**
* <pre>
* Abstract Test 38: Validate that the coords query parameters are constructed correctly. (position)
* Abstract Test 54: Validate that the coords query parameters are constructed correctly. (area)
* Abstract Test 70: Validate that the coords query parameters are constructed correctly. (cube)
* Abstract Test 92: Validate that the coords query parameters are constructed correctly. (trajectory)
* Abstract Test 116: Validate that the coords query parameters are constructed correctly. (corridor)
* </pre>
*
* @param testPoint the testPoint under test, never <code>null</code>
* @param model api definition, never <code>null</code>
*/
public void coordsParameterDefinition(TestPoint testPoint, OpenApi3 model) {
Parameter coords = null;
String paramName = "coords";
boolean hasCoordsParameter = false;
for (Path path : model.getPaths().values()) {
if (path.getPathString().endsWith(testPoint.getPath())) {
for (Operation op : path.getOperations().values()) {
for (Parameter param : op.getParameters()) {
if (hasName(param)) {
if (param.getName().equals(paramName)) {
coords = param;
}
}
}
}
}
}
if (!testPoint.getPath().endsWith("/locations")) {
assertNotNull(coords, "Required " + paramName + " parameter for collections with path '" + testPoint.getPath() + "' in OpenAPI document is missing");
if (coords != null) {
String msg = "Expected property '%s' with value '%s' but was '%s'";
assertEquals(coords.getName(), paramName, String.format(msg, "name", paramName, coords.getName()));
assertEquals(coords.getIn(), "query", String.format(msg, "in", "query", coords.getIn()));
assertTrue(isRequired(coords), String.format(msg, "required", "true", coords.getRequired()));
// assertEquals( coords.getStyle(), "form", String.format( msg, "style","form",
// coords.getStyle() ) ); //TODO SHOULD BE Enabled
assertFalse(isExplode(coords), String.format(msg, "explode", "false", coords.getExplode()));
Schema schema = coords.getSchema();
assertEquals(schema.getType(), "string", String.format(msg, "schema -> type", "string", schema.getType()));
}
}
}
use of com.google.pubsub.v1.Schema in project molgenis-emx2 by molgenis.
the class ZipApi method getZip.
static String getZip(Request request, Response response) throws IOException {
Path tempDir = Files.createTempDirectory(MolgenisWebservice.TEMPFILES_DELETE_ON_EXIT);
tempDir.toFile().deleteOnExit();
try (OutputStream outputStream = response.raw().getOutputStream()) {
Schema schema = getSchema(request);
Path zipFile = tempDir.resolve("download.zip");
MolgenisIO.toZipFile(zipFile, schema);
outputStream.write(Files.readAllBytes(zipFile));
response.type("application/zip");
response.header("Content-Disposition", "attachment; filename=" + schema.getMetadata().getName() + System.currentTimeMillis() + ".zip");
return "Export success";
} finally {
try (Stream<Path> files = Files.walk(tempDir)) {
files.sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
}
}
}
use of com.google.pubsub.v1.Schema in project molgenis-emx2 by molgenis.
the class CatalogueSiteMap method getResourcePids.
private List<String> getResourcePids(Schema schema, String resourceName) {
Table table = schema.getTable(resourceName);
if (table == null) {
return Collections.emptyList();
}
List<Row> rows = table.select(s("pid")).retrieveRows();
return rows.stream().map(row -> row.getString("pid")).toList();
}
use of com.google.pubsub.v1.Schema in project molgenis-emx2 by molgenis.
the class LinkedDataFragmentsApi method jsonld.
private static String jsonld(Request request, Response response) {
Schema schema = getSchema(request);
StringWriter sw = new StringWriter();
LinkedDataService.getJsonLdForSchema(schema, new PrintWriter(sw));
return sw.getBuffer().toString();
}
use of com.google.pubsub.v1.Schema in project molgenis-emx2 by molgenis.
the class LinkedDataFragmentsApi method ttl.
private static String ttl(Request request, Response response) {
Schema schema = getSchema(request);
StringWriter sw = new StringWriter();
LinkedDataService.getTtlForSchema(schema, new PrintWriter(sw));
return sw.getBuffer().toString();
}
Aggregations