@Test public void testValidateWithValidSchema() throws SchemaNotFoundException { final SchemaIdentifier schemaIdentifier = SchemaIdentifier.builder().id(123456L).version(2).build(); final RecordSchema recordSchema = createRecordSchema(schemaIdentifier); final SchemaAccessWriter schemaAccessWriter = new HortonworksAttributeSchemaReferenceWriter(); schemaAccessWriter.validateSchema(recordSchema); }
@Override public void validateSchema(final RecordSchema schema) throws SchemaNotFoundException { final SchemaIdentifier id = schema.getIdentifier(); if (!id.getIdentifier().isPresent()) { throw new SchemaNotFoundException("Cannot write Schema Reference as Attributes because it does not contain a Schema Identifier"); } if (!id.getVersion().isPresent()) { throw new SchemaNotFoundException("Cannot write Schema Reference as Attributes because it does not contain a Schema Version"); } }
HortonworksAttributeSchemaReferenceWriter implements SchemaAccessWriter { @Override public void validateSchema(final RecordSchema schema) throws SchemaNotFoundException { final SchemaIdentifier id = schema.getIdentifier(); if (!id.getIdentifier().isPresent()) { throw new SchemaNotFoundException("Cannot write Schema Reference as Attributes because it does not contain a Schema Identifier"); } if (!id.getVersion().isPresent()) { throw new SchemaNotFoundException("Cannot write Schema Reference as Attributes because it does not contain a Schema Version"); } } }
HortonworksAttributeSchemaReferenceWriter implements SchemaAccessWriter { @Override public void validateSchema(final RecordSchema schema) throws SchemaNotFoundException { final SchemaIdentifier id = schema.getIdentifier(); if (!id.getIdentifier().isPresent()) { throw new SchemaNotFoundException("Cannot write Schema Reference as Attributes because it does not contain a Schema Identifier"); } if (!id.getVersion().isPresent()) { throw new SchemaNotFoundException("Cannot write Schema Reference as Attributes because it does not contain a Schema Version"); } }  }
HortonworksAttributeSchemaReferenceWriter implements SchemaAccessWriter { @Override public void validateSchema(final RecordSchema schema) throws SchemaNotFoundException { final SchemaIdentifier id = schema.getIdentifier(); if (!id.getIdentifier().isPresent()) { throw new SchemaNotFoundException("Cannot write Schema Reference as Attributes because it does not contain a Schema Identifier"); } if (!id.getVersion().isPresent()) { throw new SchemaNotFoundException("Cannot write Schema Reference as Attributes because it does not contain a Schema Version"); } }  @Override void writeHeader(RecordSchema schema, OutputStream out); @Override Map<String, String> getAttributes(final RecordSchema schema); @Override void validateSchema(final RecordSchema schema); @Override Set<SchemaField> getRequiredSchemaFields(); }
HortonworksAttributeSchemaReferenceWriter implements SchemaAccessWriter { @Override public void validateSchema(final RecordSchema schema) throws SchemaNotFoundException { final SchemaIdentifier id = schema.getIdentifier(); if (!id.getIdentifier().isPresent()) { throw new SchemaNotFoundException("Cannot write Schema Reference as Attributes because it does not contain a Schema Identifier"); } if (!id.getVersion().isPresent()) { throw new SchemaNotFoundException("Cannot write Schema Reference as Attributes because it does not contain a Schema Version"); } }  @Override void writeHeader(RecordSchema schema, OutputStream out); @Override Map<String, String> getAttributes(final RecordSchema schema); @Override void validateSchema(final RecordSchema schema); @Override Set<SchemaField> getRequiredSchemaFields();  }