@Test public void simpleTest() { final String id = "1"; SchemaRegistryMultiple registry = createSchemaRegistry(); // Get schema for ads Schema tempAdsSchema = registry.getSchema(SCHEMA_ADS_KEYS); Assert.assertEquals(SCHEMA_ADS_KEYS, tempAdsSchema.getSchemaKeys()); // Get schema for sales Schema tempSalesSchema = registry.getSchema(SCHEMA_SALES_KEYS); Assert.assertEquals(SCHEMA_SALES_KEYS, tempSalesSchema.getSchemaKeys()); // Query schema for ads SchemaQuery schemaQueryAds = new SchemaQuery(id, SCHEMA_ADS_KEYS); SchemaResult result = registry.getSchemaResult(schemaQueryAds); Assert.assertEquals(1, result.getGenericSchemas().length); Assert.assertEquals(SCHEMA_ADS_KEYS, result.getGenericSchemas()[0].getSchemaKeys()); // Query schema for sales SchemaQuery schemaQuerySales = new SchemaQuery(id, SCHEMA_SALES_KEYS); result = registry.getSchemaResult(schemaQuerySales); Assert.assertEquals(1, result.getGenericSchemas().length); Assert.assertEquals(SCHEMA_SALES_KEYS, result.getGenericSchemas()[0].getSchemaKeys()); }
@Override public void registerSchema(Schema schema) { Map<String, String> schemaKeys = schema.getSchemaKeys(); table.appendRow(schema, schemaKeys); }