Search in sources :

Example 6 with ScopedInterningLayer

use of com.apple.foundationdb.record.provider.foundationdb.layers.interning.ScopedInterningLayer in project fdb-record-layer by FoundationDB.

the class ResolverMappingDigestTest method testInterningLayerAndExtendedLayer.

@Test
public void testInterningLayerAndExtendedLayer() throws Exception {
    LocatableResolver primary;
    LocatableResolver replica;
    try (FDBRecordContext context = database.openContext()) {
        primary = new ScopedInterningLayer(database, keySpace.path("test-path").add("to").add("primary").toResolvedPath(context));
        replica = new ExtendedDirectoryLayer(database, keySpace.path("test-path").add("to").add("replica").toResolvedPath(context));
    }
    testComputeDigest(primary, replica, false);
}
Also used : FDBRecordContext(com.apple.foundationdb.record.provider.foundationdb.FDBRecordContext) ScopedInterningLayer(com.apple.foundationdb.record.provider.foundationdb.layers.interning.ScopedInterningLayer) Test(org.junit.jupiter.api.Test)

Example 7 with ScopedInterningLayer

use of com.apple.foundationdb.record.provider.foundationdb.layers.interning.ScopedInterningLayer in project fdb-record-layer by FoundationDB.

the class ResolverMappingDigestTest method testDirectoryLayerAndInterningLayer.

@Test
public void testDirectoryLayerAndInterningLayer() throws Exception {
    LocatableResolver primary;
    LocatableResolver replica;
    try (FDBRecordContext context = database.openContext()) {
        primary = new ScopedDirectoryLayer(database, keySpace.path("test-path").add("to").add("primary").toResolvedPath(context));
        replica = new ScopedInterningLayer(database, keySpace.path("test-path").add("to").add("replica").toResolvedPath(context));
    }
    testComputeDigest(primary, replica, false);
}
Also used : FDBRecordContext(com.apple.foundationdb.record.provider.foundationdb.FDBRecordContext) ScopedInterningLayer(com.apple.foundationdb.record.provider.foundationdb.layers.interning.ScopedInterningLayer) Test(org.junit.jupiter.api.Test)

Example 8 with ScopedInterningLayer

use of com.apple.foundationdb.record.provider.foundationdb.layers.interning.ScopedInterningLayer in project fdb-record-layer by FoundationDB.

the class ResolverMappingReplicatorTest method testCopyInSameDatabase.

@Test
public void testCopyInSameDatabase() {
    ResolverMappingReplicator replicator = new ResolverMappingReplicator(primary, 10);
    FDBDatabase differentDB = new FDBDatabase(FDBDatabaseFactory.instance(), null);
    KeySpacePath path = keySpace.path("test-path").add("to").add("replica");
    try (FDBRecordContext context = differentDB.openContext()) {
        LocatableResolver resolverInDifferentDB = new ScopedInterningLayer(differentDB, path.toResolvedPath(context));
        replicator.copyTo(resolverInDifferentDB);
        fail("should throw IllegalArgumentException");
    } catch (IllegalArgumentException ex) {
        assertThat(ex, hasMessageContaining("copy must be within same database"));
    }
}
Also used : FDBRecordContext(com.apple.foundationdb.record.provider.foundationdb.FDBRecordContext) ScopedInterningLayer(com.apple.foundationdb.record.provider.foundationdb.layers.interning.ScopedInterningLayer) FDBDatabase(com.apple.foundationdb.record.provider.foundationdb.FDBDatabase) Test(org.junit.jupiter.api.Test)

Example 9 with ScopedInterningLayer

use of com.apple.foundationdb.record.provider.foundationdb.layers.interning.ScopedInterningLayer in project fdb-record-layer by FoundationDB.

the class DirectoryLayerToInterningLayerReplicaTest method setup.

@BeforeEach
public void setup() {
    try (FDBRecordContext context = database.openContext()) {
        primary = new ScopedDirectoryLayer(database, keySpace.path("test-path").add("to").add("primary").toResolvedPath(context));
        replica = new ScopedInterningLayer(database, keySpace.path("test-path").add("to").add("replica").toResolvedPath(context));
    }
}
Also used : FDBRecordContext(com.apple.foundationdb.record.provider.foundationdb.FDBRecordContext) ScopedInterningLayer(com.apple.foundationdb.record.provider.foundationdb.layers.interning.ScopedInterningLayer) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 10 with ScopedInterningLayer

use of com.apple.foundationdb.record.provider.foundationdb.layers.interning.ScopedInterningLayer in project fdb-record-layer by FoundationDB.

the class InterningLayerToExtendedDirectoryLayerReplicaTest method setup.

@BeforeEach
public void setup() {
    try (FDBRecordContext context = database.openContext()) {
        primary = new ScopedInterningLayer(database, keySpace.path("test-path").add("to").add("primary").toResolvedPath(context));
        replica = new ExtendedDirectoryLayer(database, keySpace.path("test-path").add("to").add("replica").toResolvedPath(context));
    }
    seedWithMetadata = true;
}
Also used : FDBRecordContext(com.apple.foundationdb.record.provider.foundationdb.FDBRecordContext) ScopedInterningLayer(com.apple.foundationdb.record.provider.foundationdb.layers.interning.ScopedInterningLayer) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

FDBRecordContext (com.apple.foundationdb.record.provider.foundationdb.FDBRecordContext)11 ScopedInterningLayer (com.apple.foundationdb.record.provider.foundationdb.layers.interning.ScopedInterningLayer)11 Test (org.junit.jupiter.api.Test)8 BeforeEach (org.junit.jupiter.api.BeforeEach)4 FDBDatabase (com.apple.foundationdb.record.provider.foundationdb.FDBDatabase)3 FDBDatabaseFactory (com.apple.foundationdb.record.provider.foundationdb.FDBDatabaseFactory)2 FDBTestBase (com.apple.foundationdb.record.provider.foundationdb.FDBTestBase)2 Tuple (com.apple.foundationdb.tuple.Tuple)2 Tags (com.apple.test.Tags)2 List (java.util.List)2 Random (java.util.Random)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 Transaction (com.apple.foundationdb.Transaction)1 AsyncUtil (com.apple.foundationdb.async.AsyncUtil)1 EndpointType (com.apple.foundationdb.record.EndpointType)1 ExecuteProperties (com.apple.foundationdb.record.ExecuteProperties)1 RecordCoreArgumentException (com.apple.foundationdb.record.RecordCoreArgumentException)1 RecordCursor (com.apple.foundationdb.record.RecordCursor)1 ScanProperties (com.apple.foundationdb.record.ScanProperties)1 TestHelpers.assertThrows (com.apple.foundationdb.record.TestHelpers.assertThrows)1