Search in sources :

Example 56 with RecordMetaDataBuilder

use of com.apple.foundationdb.record.RecordMetaDataBuilder in project fdb-record-layer by FoundationDB.

the class QueryHashTest method setupTextStore.

protected void setupTextStore(FDBRecordContext context, RecordMetaDataHook hook) {
    RecordMetaDataBuilder metaDataBuilder = RecordMetaData.newBuilder().setRecords(TestRecordsTextProto.getDescriptor());
    metaDataBuilder.getRecordType(TextIndexTestUtils.COMPLEX_DOC).setPrimaryKey(concatenateFields("group", "doc_id"));
    hook.apply(metaDataBuilder);
    recordStore = getStoreBuilder(context, metaDataBuilder.getRecordMetaData()).setSerializer(TextIndexTestUtils.COMPRESSING_SERIALIZER).uncheckedOpen();
    setupPlanner(null);
}
Also used : RecordMetaDataBuilder(com.apple.foundationdb.record.RecordMetaDataBuilder)

Example 57 with RecordMetaDataBuilder

use of com.apple.foundationdb.record.RecordMetaDataBuilder in project fdb-record-layer by FoundationDB.

the class QueryPlanHashTest method setupTextStore.

protected void setupTextStore(FDBRecordContext context, RecordMetaDataHook hook) {
    RecordMetaDataBuilder metaDataBuilder = RecordMetaData.newBuilder().setRecords(TestRecordsTextProto.getDescriptor());
    metaDataBuilder.getRecordType(TextIndexTestUtils.COMPLEX_DOC).setPrimaryKey(concatenateFields("group", "doc_id"));
    hook.apply(metaDataBuilder);
    recordStore = getStoreBuilder(context, metaDataBuilder.getRecordMetaData()).setSerializer(TextIndexTestUtils.COMPRESSING_SERIALIZER).uncheckedOpen();
    setupPlanner(null);
}
Also used : RecordMetaDataBuilder(com.apple.foundationdb.record.RecordMetaDataBuilder)

Example 58 with RecordMetaDataBuilder

use of com.apple.foundationdb.record.RecordMetaDataBuilder in project fdb-record-layer by FoundationDB.

the class MetaDataEvolutionValidatorTestV3 method proto2ToProto3.

/**
 * Validate that if the syntax is changed, then the meta-data evolution is invalidated.
 */
@Test
public void proto2ToProto3() {
    assertInvalid("message descriptor proto syntax changed", TestRecords3Proto.UnionDescriptor.getDescriptor(), TestRecords3ProtoV3.UnionDescriptor.getDescriptor());
    assertInvalid("message descriptor proto syntax changed", TestRecords3ProtoV3.UnionDescriptor.getDescriptor(), TestRecords3Proto.UnionDescriptor.getDescriptor());
    RecordMetaDataBuilder metaDataBuilder = RecordMetaData.newBuilder().setRecords(TestRecords3Proto.getDescriptor());
    metaDataBuilder.getRecordType("MyHierarchicalRecord").setPrimaryKey(Key.Expressions.concatenateFields("parent_path", "child_name"));
    RecordMetaData metaData1 = metaDataBuilder.getRecordMetaData();
    RecordMetaData metaData2 = replaceRecordsDescriptor(metaData1, TestRecords3ProtoV3.getDescriptor());
    assertInvalid("message descriptor proto syntax changed", metaData1, metaData2);
}
Also used : RecordMetaData(com.apple.foundationdb.record.RecordMetaData) RecordMetaDataBuilder(com.apple.foundationdb.record.RecordMetaDataBuilder) Test(org.junit.jupiter.api.Test)

Example 59 with RecordMetaDataBuilder

use of com.apple.foundationdb.record.RecordMetaDataBuilder in project fdb-record-layer by FoundationDB.

the class FDBRecordStoreByteLimitTest method openTextRecordStore.

private void openTextRecordStore(FDBRecordContext context, RecordMetaDataHook hook) {
    RecordMetaDataBuilder metaDataBuilder = RecordMetaData.newBuilder().setRecords(TestRecordsTextProto.getDescriptor());
    metaDataBuilder.getRecordType(COMPLEX_DOC).setPrimaryKey(concatenateFields("group", "doc_id"));
    hook.apply(metaDataBuilder);
    recordStore = getStoreBuilder(context, metaDataBuilder.getRecordMetaData()).setSerializer(COMPRESSING_SERIALIZER).setPipelineSizer(pipelineOperation -> 1).uncheckedOpen();
    setupPlanner(null);
}
Also used : RecordMetaDataBuilder(com.apple.foundationdb.record.RecordMetaDataBuilder)

Example 60 with RecordMetaDataBuilder

use of com.apple.foundationdb.record.RecordMetaDataBuilder in project fdb-record-layer by FoundationDB.

the class LuceneIndexTest method openRecordStore.

protected void openRecordStore(FDBRecordContext context, FDBRecordStoreTestBase.RecordMetaDataHook hook) {
    RecordMetaDataBuilder metaDataBuilder = RecordMetaData.newBuilder().setRecords(TestRecordsTextProto.getDescriptor());
    metaDataBuilder.getRecordType(COMPLEX_DOC).setPrimaryKey(concatenateFields("group", "doc_id"));
    hook.apply(metaDataBuilder);
    recordStore = getStoreBuilder(context, metaDataBuilder.getRecordMetaData()).setSerializer(TextIndexTestUtils.COMPRESSING_SERIALIZER).uncheckedOpen();
    setupPlanner(null);
}
Also used : RecordMetaDataBuilder(com.apple.foundationdb.record.RecordMetaDataBuilder)

Aggregations

RecordMetaDataBuilder (com.apple.foundationdb.record.RecordMetaDataBuilder)150 Test (org.junit.jupiter.api.Test)91 RecordMetaData (com.apple.foundationdb.record.RecordMetaData)69 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)43 Nonnull (javax.annotation.Nonnull)22 Index (com.apple.foundationdb.record.metadata.Index)21 Descriptors (com.google.protobuf.Descriptors)15 TestRecords1Proto (com.apple.foundationdb.record.TestRecords1Proto)14 KeyExpression (com.apple.foundationdb.record.metadata.expressions.KeyExpression)14 RecordMetaDataProto (com.apple.foundationdb.record.RecordMetaDataProto)13 ByteString (com.google.protobuf.ByteString)13 Tuple (com.apple.foundationdb.tuple.Tuple)12 Collections (java.util.Collections)12 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)11 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)11 Assertions.assertNotNull (org.junit.jupiter.api.Assertions.assertNotNull)11 Assertions.assertNull (org.junit.jupiter.api.Assertions.assertNull)11 Assertions.assertThrows (org.junit.jupiter.api.Assertions.assertThrows)11 RecordCoreException (com.apple.foundationdb.record.RecordCoreException)10 BooleanSource (com.apple.test.BooleanSource)10