@Test public void testEmptyRecordType() throws Exception { QName name = new QName("aNamespace", "aName"); SchemaId id = new SchemaIdImpl(UUID.randomUUID()); RecordType recordType = new RecordTypeImpl(id, name); typeManager.newRecordType(id, name); expectLastCall().andReturn(recordType); control.replay(); converter = new AvroConverter(); AvroRecordType avroRecordType = new AvroRecordType(); AvroSchemaId avroSchemaId = new AvroSchemaId(); avroSchemaId.idBytes = ByteBuffer.wrap(id.getBytes()); avroRecordType.id = avroSchemaId; AvroQName avroQName = new AvroQName(); avroQName.namespace = "aNamespace"; avroQName.name = "aName"; avroRecordType.name = avroQName; avroRecordType.fieldTypeEntries = new GenericData.Array<AvroFieldTypeEntry>(0, Schema.createArray(AvroFieldTypeEntry.SCHEMA$)); avroRecordType.supertypes = new GenericData.Array<AvroSupertype>(0, Schema.createArray(AvroSupertype.SCHEMA$)); assertEquals(recordType, converter.convert(avroRecordType, typeManager)); assertEquals(avroRecordType, converter.convert(recordType)); control.verify(); }
public AuthorizationContext convert(AvroAuthzContext authzContext) { if (authzContext == null) return null; Set<String> roles = new HashSet<String>(); for (String role : authzContext.getRoles()) { roles.add(role); } return new AuthorizationContext(authzContext.getName(), authzContext.getTenant(), roles); }
AvroConverter { public AuthorizationContext convert(AvroAuthzContext authzContext) { if (authzContext == null) return null; Set<String> roles = new HashSet<String>(); for (String role : authzContext.getRoles()) { roles.add(role); } return new AuthorizationContext(authzContext.getName(), authzContext.getTenant(), roles); } }
AvroConverter { public AuthorizationContext convert(AvroAuthzContext authzContext) { if (authzContext == null) return null; Set<String> roles = new HashSet<String>(); for (String role : authzContext.getRoles()) { roles.add(role); } return new AuthorizationContext(authzContext.getName(), authzContext.getTenant(), roles); } AvroConverter(); }
AvroConverter { public AuthorizationContext convert(AvroAuthzContext authzContext) { if (authzContext == null) return null; Set<String> roles = new HashSet<String>(); for (String role : authzContext.getRoles()) { roles.add(role); } return new AuthorizationContext(authzContext.getName(), authzContext.getTenant(), roles); } AvroConverter(); AuthorizationContext convert(AvroAuthzContext authzContext); AvroAuthzContext convert(AuthorizationContext authzContext); ByteBuffer convert(Record record, LRepository repository); ByteBuffer convert(IdRecord idRecord, LRepository repository); Record convertRecord(ByteBuffer recordData, LRepository repository); IdRecord convertIdRecord(ByteBuffer avroIdRecord, LRepository repository); List<AvroMutationCondition> convert(Record parentRecord, List<MutationCondition> conditions,
            LRepository repository); List<Record> convertAvroRecords(List<ByteBuffer> avroRecords, LRepository repository); List<ByteBuffer> convertRecords(Collection<Record> records, LRepository repository); FieldType convert(AvroFieldType avroFieldType, TypeManager typeManager); Scope convert(AvroScope scope); AvroFieldType convert(FieldType fieldType); AvroScope convert(Scope scope); RecordType convert(AvroRecordType avroRecordType, TypeManager typeManager); AvroRecordType convert(RecordType recordType); AvroFieldAndRecordTypes convertFieldAndRecordTypes(Pair<List<FieldType>, List<RecordType>> types); Pair<List<FieldType>, List<RecordType>> convertAvroFieldAndRecordTypes(AvroFieldAndRecordTypes types,
            TypeManager typeManager); AvroTypeBucket convertTypeBucket(TypeBucket typeBucket); TypeBucket convertAvroTypeBucket(AvroTypeBucket avroTypeBucket, TypeManager  typeManager); ValueType convert(AvroValueType valueType, TypeManager typeManager); AvroValueType convert(ValueType valueType); QName convert(AvroQName name); AvroQName convert(QName name); AvroSupertype convert(Entry<SchemaId, Long> supertypeEntry); FieldTypeEntry convert(AvroFieldTypeEntry avroFieldTypeEntry, TypeManager typeManager); AvroFieldTypeEntry convert(FieldTypeEntry fieldTypeEntry); static AvroGenericException convertOtherException(Throwable throwable); RuntimeException convert(AvroGenericException avroException); RemoteException convert(AvroRemoteException exception); AvroRepositoryException convert(RepositoryException exception); RepositoryException convert(AvroRepositoryException avroException); AvroInterruptedException convert(InterruptedException exception); AvroIOException convert(IOException exception); IOException convert(AvroIOException avroException); ByteBuffer convert(RecordId recordId); Long convertAvroVersion(long avroVersion); long convertVersion(Long version); List<FieldType> convertAvroFieldTypes(List<AvroFieldType> avroFieldTypes, TypeManager typeManager); List<RecordType> convertAvroRecordTypes(List<AvroRecordType> avroRecordTypes, TypeManager typeManager); List<AvroFieldType> convertFieldTypes(Collection<FieldType> fieldTypes); List<AvroRecordType> convertRecordTypes(Collection<RecordType> recordTypes); SchemaId convert(AvroSchemaId avroSchemaId); AvroSchemaId convert(SchemaId schemaId); QName[] convert(List<AvroQName> avroNames); List<String> convert(Set<RecordId> recordIds); CompareOp convert(AvroCompareOp op); List<MutationCondition> convertFromAvro(List<AvroMutationCondition> avroConditions, LRepository repository); AvroTableCreateDescriptor convert(TableCreateDescriptor descriptor); TableCreateDescriptor convert(AvroTableCreateDescriptor avroDescriptor); AvroCompareOp convert(CompareOp op); RecordId convertAvroRecordId(ByteBuffer recordId, LRepository repository); Set<RecordId> convertAvroRecordIds(List<String> avroRecordIds, LRepository repository); }
AvroConverter { public AuthorizationContext convert(AvroAuthzContext authzContext) { if (authzContext == null) return null; Set<String> roles = new HashSet<String>(); for (String role : authzContext.getRoles()) { roles.add(role); } return new AuthorizationContext(authzContext.getName(), authzContext.getTenant(), roles); } AvroConverter(); AuthorizationContext convert(AvroAuthzContext authzContext); AvroAuthzContext convert(AuthorizationContext authzContext); ByteBuffer convert(Record record, LRepository repository); ByteBuffer convert(IdRecord idRecord, LRepository repository); Record convertRecord(ByteBuffer recordData, LRepository repository); IdRecord convertIdRecord(ByteBuffer avroIdRecord, LRepository repository); List<AvroMutationCondition> convert(Record parentRecord, List<MutationCondition> conditions,
            LRepository repository); List<Record> convertAvroRecords(List<ByteBuffer> avroRecords, LRepository repository); List<ByteBuffer> convertRecords(Collection<Record> records, LRepository repository); FieldType convert(AvroFieldType avroFieldType, TypeManager typeManager); Scope convert(AvroScope scope); AvroFieldType convert(FieldType fieldType); AvroScope convert(Scope scope); RecordType convert(AvroRecordType avroRecordType, TypeManager typeManager); AvroRecordType convert(RecordType recordType); AvroFieldAndRecordTypes convertFieldAndRecordTypes(Pair<List<FieldType>, List<RecordType>> types); Pair<List<FieldType>, List<RecordType>> convertAvroFieldAndRecordTypes(AvroFieldAndRecordTypes types,
            TypeManager typeManager); AvroTypeBucket convertTypeBucket(TypeBucket typeBucket); TypeBucket convertAvroTypeBucket(AvroTypeBucket avroTypeBucket, TypeManager  typeManager); ValueType convert(AvroValueType valueType, TypeManager typeManager); AvroValueType convert(ValueType valueType); QName convert(AvroQName name); AvroQName convert(QName name); AvroSupertype convert(Entry<SchemaId, Long> supertypeEntry); FieldTypeEntry convert(AvroFieldTypeEntry avroFieldTypeEntry, TypeManager typeManager); AvroFieldTypeEntry convert(FieldTypeEntry fieldTypeEntry); static AvroGenericException convertOtherException(Throwable throwable); RuntimeException convert(AvroGenericException avroException); RemoteException convert(AvroRemoteException exception); AvroRepositoryException convert(RepositoryException exception); RepositoryException convert(AvroRepositoryException avroException); AvroInterruptedException convert(InterruptedException exception); AvroIOException convert(IOException exception); IOException convert(AvroIOException avroException); ByteBuffer convert(RecordId recordId); Long convertAvroVersion(long avroVersion); long convertVersion(Long version); List<FieldType> convertAvroFieldTypes(List<AvroFieldType> avroFieldTypes, TypeManager typeManager); List<RecordType> convertAvroRecordTypes(List<AvroRecordType> avroRecordTypes, TypeManager typeManager); List<AvroFieldType> convertFieldTypes(Collection<FieldType> fieldTypes); List<AvroRecordType> convertRecordTypes(Collection<RecordType> recordTypes); SchemaId convert(AvroSchemaId avroSchemaId); AvroSchemaId convert(SchemaId schemaId); QName[] convert(List<AvroQName> avroNames); List<String> convert(Set<RecordId> recordIds); CompareOp convert(AvroCompareOp op); List<MutationCondition> convertFromAvro(List<AvroMutationCondition> avroConditions, LRepository repository); AvroTableCreateDescriptor convert(TableCreateDescriptor descriptor); TableCreateDescriptor convert(AvroTableCreateDescriptor avroDescriptor); AvroCompareOp convert(CompareOp op); RecordId convertAvroRecordId(ByteBuffer recordId, LRepository repository); Set<RecordId> convertAvroRecordIds(List<String> avroRecordIds, LRepository repository);  }