use of com.google.pubsub.v1.Schema in project divolte-collector by divolte.
the class GoogleCloudPubSubFlusherTest method testMessagesHaveSchemaFingerprint.
@Test
public void testMessagesHaveSchemaFingerprint() {
processSingleMessage();
// Reminder: fingerprint is the SHA-256 hash of the normalized schema,
// base-64 encoded using the URL-safe encoding,
// with trailing padding stripped.
final String expectedFingerPrint = BaseEncoding.base64Url().encode(Hashing.sha256().hashString(SchemaNormalization.toParsingForm(MINIMAL_SCHEMA), StandardCharsets.UTF_8).asBytes()).replace("=", "");
final PubsubMessage deliveredMessage = getFirstPublishedMessage();
assertEquals(expectedFingerPrint, deliveredMessage.getAttributesOrThrow("schemaFingerprint"));
}
use of com.google.pubsub.v1.Schema in project ets-ogcapi-edr10 by opengeospatial.
the class OpenApiUtils method collectTemplateReplacements.
private static List<Map<String, String>> collectTemplateReplacements(PathItemAndServer pathItemAndServer, UriTemplate uriTemplate) {
List<Map<String, String>> templateReplacements = new ArrayList<>();
Collection<Parameter> parameters = pathItemAndServer.operationObject.getParameters();
for (String templateVariable : uriTemplate.getTemplateVariables()) {
for (Parameter parameter : parameters) {
if (templateVariable.equals(parameter.getName())) {
Schema schema = parameter.getSchema();
if (schema.hasEnums()) {
addEnumTemplateValues(templateReplacements, templateVariable, schema);
} else if (schema.getDefault() != null) {
addDefaultTemplateValue(templateReplacements, templateVariable, schema);
} else {
// TODO: What should be done if the parameter does not have a default value and
// no
// enumerated set of valid values?
}
}
}
}
return templateReplacements;
}
use of com.google.pubsub.v1.Schema in project molgenis-emx2 by molgenis.
the class DataCatalogueLoader method load.
@Override
public void load(Schema schema, boolean includeDemoData) {
// create ontology schema
Database db = schema.getDatabase();
Schema ontologySchema = db.getSchema(CATALOGUE_ONTOLOGIES);
if (ontologySchema == null) {
ontologySchema = db.createSchema(CATALOGUE_ONTOLOGIES);
}
// create catalogue schema (which will create tables in ontology schema)
createSchema(schema, "datacatalogue/molgenis.csv");
// load data into ontology schema
MolgenisIO.fromClasspathDirectory("datacatalogue/CatalogueOntologies", ontologySchema, false);
// optionally, load demo data
if (includeDemoData) {
MolgenisIO.fromClasspathDirectory("datacatalogue/Cohorts", schema, false);
}
}
use of com.google.pubsub.v1.Schema in project molgenis-emx2 by molgenis.
the class DataCatalogueStagingLoader method load.
@Override
public void load(Schema schema, boolean includeDemoData) {
// create ontology schema
Database db = schema.getDatabase();
Schema ontologySchema = db.getSchema(CATALOGUE_ONTOLOGIES);
if (ontologySchema == null) {
ontologySchema = db.createSchema(CATALOGUE_ONTOLOGIES);
}
// create the schema
createSchema(schema, "datacatalogue/Catalogue_cdm/molgenis.csv");
// load data into ontology schema
MolgenisIO.fromClasspathDirectory("datacatalogue/CatalogueOntologies", ontologySchema, false);
}
use of com.google.pubsub.v1.Schema in project geo-platform by geosdi.
the class WFSDescribeFeatureTest method c_describeSiteTrTest.
@Ignore(value = "Geoserver is Down")
@Test
public void c_describeSiteTrTest() throws Exception {
WFSDescribeFeatureTypeRequest<Schema> request = newConnector().withServerUrl(new URL("http://150.145.141.241/geoserver/wfs")).build().createDescribeFeatureTypeRequest();
String localPart = siteTRCom.getLocalPart();
request.setTypeName(Arrays.asList(siteTRCom));
logger.debug("#########################SCHEMA_AS_STRING : \n{}\n", request.formatResponseAsString(2));
Schema s = request.getResponse();
String name = localPart.substring(localPart.indexOf(":") + 1);
StringWriter writer = new StringWriter();
gpJAXBContextBuilder.marshal(schemaReader.getFeature(s, name), writer);
logger.info("######################LAYER_SCHEMA_SITE_COM_XML : \n{}\n", writer);
}
Aggregations