Assert.assertEquals("myvalue", doc.get("a_string").getValue());
}
public Result encodeRecord(Record record) throws InterruptedException, RepositoryException {
TypeManager typeManager = repositoryManager.getDefaultRepository().getTypeManager();
List<KeyValue> kvs = Lists.newArrayList();
RecordEvent event = new RecordEvent();
event.setType(RecordEvent.Type.CREATE);
event.setTableName(LilyHBaseSchema.Table.RECORD.name);
event.setVersionCreated(record.getVersion());
byte[] rowKey = record.getId().toBytes();
byte[] family = LilyHBaseSchema.RecordCf.DATA.bytes;
kvs.add(new KeyValue(rowKey, family, LilyHBaseSchema.RecordColumn.VERSION.bytes, 1L, Bytes.toBytes(record.getVersion())));
kvs.add(new KeyValue(rowKey, family, LilyHBaseSchema.RecordColumn.NON_VERSIONED_RT_ID.bytes,
1L, typeManager.getRecordTypeByName(record.getRecordTypeName(Scope.NON_VERSIONED),
record.getRecordTypeVersion(Scope.NON_VERSIONED)).getId().getBytes()));
kvs.add(new KeyValue(rowKey, family, LilyHBaseSchema.RecordColumn.NON_VERSIONED_RT_VERSION.bytes,
1L, Bytes.toBytes(record.getRecordTypeVersion(Scope.NON_VERSIONED))));
/*
kvs.add(new KeyValue(rowKey, family, LilyHBaseSchema.RecordColumn.VERSIONED_RT_ID.bytes,
typeManager.getRecordTypeByName(record.getRecordTypeName(Scope.VERSIONED),
record.getRecordTypeVersion(Scope.VERSIONED)).getId().getBytes()));
kvs.add(new KeyValue(rowKey, family, LilyHBaseSchema.RecordColumn.VERSIONED_RT_VERSION.bytes,
Bytes.toBytes(record.getRecordTypeVersion(Scope.VERSIONED))));
kvs.add(new KeyValue(rowKey, family, LilyHBaseSchema.RecordColumn.VERSIONED_MUTABLE_RT_ID.bytes,
typeManager.getRecordTypeByName(record.getRecordTypeName(Scope.VERSIONED_MUTABLE),
record.getRecordTypeVersion(Scope.VERSIONED_MUTABLE)).getId().getBytes()));
kvs.add(new KeyValue(rowKey, family, LilyHBaseSchema.RecordColumn.NON_VERSIONED_RT_VERSION.bytes,
Bytes.toBytes(record.getRecordTypeVersion(Scope.VERSIONED_MUTABLE))));
*/
for (QName fieldName : record.getFields().keySet()) {
FieldType fieldType = typeManager.getFieldTypeByName(fieldName);
Metadata metadata = record.getMetadata(fieldName);
boolean hasMetadata = metadata != null && !metadata.getMap().isEmpty();
DataOutput output = new DataOutputImpl();