@Test(expected = SchemaNotFoundException.class) public void testValidateSchemaWhenNoName() throws SchemaNotFoundException { final SchemaIdentifier schemaIdentifier = SchemaIdentifier.builder().id(1L).build(); final RecordSchema schema = new SimpleRecordSchema(fields, schemaIdentifier); schemaAccessWriter.validateSchema(schema); }
@Override public void validateSchema(final RecordSchema schema) throws SchemaNotFoundException { final SchemaIdentifier schemaId = schema.getIdentifier(); if (schemaId == null) { throw new SchemaNotFoundException("Cannot write Schema Name As Attribute because Schema Identifier is not known"); } if (!schemaId.getName().isPresent()) { throw new SchemaNotFoundException("Cannot write Schema Name As Attribute because the Schema Name is not known"); } }
SchemaNameAsAttribute implements SchemaAccessWriter { @Override public void validateSchema(final RecordSchema schema) throws SchemaNotFoundException { final SchemaIdentifier schemaId = schema.getIdentifier(); if (schemaId == null) { throw new SchemaNotFoundException("Cannot write Schema Name As Attribute because Schema Identifier is not known"); } if (!schemaId.getName().isPresent()) { throw new SchemaNotFoundException("Cannot write Schema Name As Attribute because the Schema Name is not known"); } } }
SchemaNameAsAttribute implements SchemaAccessWriter { @Override public void validateSchema(final RecordSchema schema) throws SchemaNotFoundException { final SchemaIdentifier schemaId = schema.getIdentifier(); if (schemaId == null) { throw new SchemaNotFoundException("Cannot write Schema Name As Attribute because Schema Identifier is not known"); } if (!schemaId.getName().isPresent()) { throw new SchemaNotFoundException("Cannot write Schema Name As Attribute because the Schema Name is not known"); } }  }
SchemaNameAsAttribute implements SchemaAccessWriter { @Override public void validateSchema(final RecordSchema schema) throws SchemaNotFoundException { final SchemaIdentifier schemaId = schema.getIdentifier(); if (schemaId == null) { throw new SchemaNotFoundException("Cannot write Schema Name As Attribute because Schema Identifier is not known"); } if (!schemaId.getName().isPresent()) { throw new SchemaNotFoundException("Cannot write Schema Name As Attribute because the Schema Name is not known"); } }  @Override void writeHeader(final RecordSchema schema, final OutputStream out); @Override Map<String, String> getAttributes(final RecordSchema schema); @Override void validateSchema(final RecordSchema schema); @Override Set<SchemaField> getRequiredSchemaFields(); }
SchemaNameAsAttribute implements SchemaAccessWriter { @Override public void validateSchema(final RecordSchema schema) throws SchemaNotFoundException { final SchemaIdentifier schemaId = schema.getIdentifier(); if (schemaId == null) { throw new SchemaNotFoundException("Cannot write Schema Name As Attribute because Schema Identifier is not known"); } if (!schemaId.getName().isPresent()) { throw new SchemaNotFoundException("Cannot write Schema Name As Attribute because the Schema Name is not known"); } }  @Override void writeHeader(final RecordSchema schema, final OutputStream out); @Override Map<String, String> getAttributes(final RecordSchema schema); @Override void validateSchema(final RecordSchema schema); @Override Set<SchemaField> getRequiredSchemaFields();  }