use of com.apple.foundationdb.record.RecordMetaDataBuilder in project fdb-record-layer by FoundationDB.
the class MetaDataValidatorTest method duplicateIntegralFormerSubspaceKey.
@Test
public void duplicateIntegralFormerSubspaceKey() {
List<Object> alternateKeys = Arrays.asList((byte) 42, (short) 42, 42);
for (Object alternateKey : alternateKeys) {
RecordMetaDataBuilder metaData = RecordMetaData.newBuilder().setRecords(TestRecords1Proto.getDescriptor());
metaData.getIndex("MySimpleRecord$str_value_indexed").setSubspaceKey(42L);
metaData.removeIndex("MySimpleRecord$str_value_indexed");
metaData.getIndex("MySimpleRecord$num_value_3_indexed").setSubspaceKey(alternateKey);
metaData.removeIndex("MySimpleRecord$num_value_3_indexed");
assertInvalid("Same subspace key 42 used by two former indexes", metaData);
}
}
use of com.apple.foundationdb.record.RecordMetaDataBuilder in project fdb-record-layer by FoundationDB.
the class MetaDataValidatorTest method primaryKeyRepeated.
@Test
public void primaryKeyRepeated() {
RecordMetaDataBuilder metaData = RecordMetaData.newBuilder().setRecords(TestRecords1Proto.getDescriptor());
metaData.getRecordType("MySimpleRecord").setPrimaryKey(Key.Expressions.field("repeater", KeyExpression.FanType.FanOut));
assertInvalid("Primary key for MySimpleRecord can generate more than one entry", metaData);
}
use of com.apple.foundationdb.record.RecordMetaDataBuilder in project fdb-record-layer by FoundationDB.
the class MetaDataValidatorTest method duplicateIntegralRecordTypeKey.
@Test
public void duplicateIntegralRecordTypeKey() {
List<Object> alternateKeys = Arrays.asList((byte) 42, (short) 42, 42, BigInteger.valueOf(42L));
for (Object alternateKey : alternateKeys) {
RecordMetaDataBuilder metaData = RecordMetaData.newBuilder().setRecords(TestRecords1Proto.getDescriptor());
metaData.getRecordType("MySimpleRecord").setRecordTypeKey(42L);
metaData.getRecordType("MyOtherRecord").setRecordTypeKey(alternateKey);
assertInvalid("Same record type key 42 used by both", metaData);
}
}
use of com.apple.foundationdb.record.RecordMetaDataBuilder in project fdb-record-layer by FoundationDB.
the class RecordMetaDataBuilderTest method createBuilder.
private RecordMetaDataBuilder createBuilder(@Nonnull Descriptors.FileDescriptor fileDescriptor, boolean useCounterBasedSubspaceKey) {
RecordMetaDataBuilder builder = RecordMetaData.newBuilder();
if (useCounterBasedSubspaceKey) {
builder.enableCounterBasedSubspaceKeys();
}
builder.setRecords(fileDescriptor);
return builder;
}
use of com.apple.foundationdb.record.RecordMetaDataBuilder in project fdb-record-layer by FoundationDB.
the class FDBRecordStoreNullQueryTest method proto3MetaData.
protected static RecordMetaData proto3MetaData() {
RecordMetaDataBuilder metaData = RecordMetaData.newBuilder().setRecords(TestRecordsNulls3Proto.getDescriptor());
metaData.addIndex("MyNullRecord", "int_value");
metaData.addIndex("MyNullRecord", "string_value");
return metaData.getRecordMetaData();
}
Aggregations