Search in sources :

Example 6 with PravegaTablesScope

use of io.pravega.controller.store.PravegaTablesScope in project pravega by pravega.

the class PravegaTablesStreamTest method getStream.

@Override
PersistentStreamBase getStream(String scope, String stream, int chunkSize, int shardSize) {
    PravegaTablesScope pravegaTableScope = new PravegaTablesScope(scope, storeHelper);
    OperationContext context = getContext();
    pravegaTableScope.addStreamToScope(stream, context).join();
    return new PravegaTablesStream(scope, stream, storeHelper, orderer, () -> 0, chunkSize, shardSize, pravegaTableScope::getStreamsInScopeTableName, executor);
}
Also used : PravegaTablesScope(io.pravega.controller.store.PravegaTablesScope)

Example 7 with PravegaTablesScope

use of io.pravega.controller.store.PravegaTablesScope in project pravega by pravega.

the class PravegaTablesStreamMetadataStoreTest method testDeleteScopeRecursive.

@Test
public void testDeleteScopeRecursive() {
    PravegaTablesStreamMetadataStore store = (PravegaTablesStreamMetadataStore) this.store;
    String scopeName = "testDeleteScopeRec";
    OperationContext context = store.createScopeContext(scopeName, 0L);
    Controller.CreateScopeStatus status = store.createScope(scopeName, context, executor).join();
    assertEquals(Controller.CreateScopeStatus.Status.SUCCESS, status.getStatus());
    PravegaTablesScope scope = (PravegaTablesScope) store.getScope(scopeName, context);
    String stream = "stream";
    scope.addStreamToScope(stream, context).join();
    assertEquals(stream, scope.listStreamsInScope(context).join().get(0));
    UUID rgId = UUID.randomUUID();
    String rg = "rg";
    scope.addReaderGroupToScope(rg, rgId, context).join();
    assertEquals(rgId, scope.getReaderGroupId(rg, context).join());
    String kvt = "kvt";
    scope.addKVTableToScope(kvt, UUID.randomUUID(), context).join();
    assertEquals(kvt, scope.listKeyValueTables(10, "", executor, context).join().getKey().get(0));
    // This should have failed at this point as the tables are not empty
    AssertExtensions.assertFutureThrows("delete scope should have failed", scope.deleteScopeRecursive(context), e -> Exceptions.unwrap(e) instanceof StoreException.DataNotEmptyException);
    scope.removeReaderGroupFromScope(rg, context).join();
    scope.removeKVTableFromScope(kvt, context).join();
    scope.removeStreamFromScope(stream, context);
    scope.deleteScopeRecursive(context).join();
}
Also used : PravegaTablesScope(io.pravega.controller.store.PravegaTablesScope) Mockito.anyString(org.mockito.Mockito.anyString) Controller(io.pravega.controller.stream.api.grpc.v1.Controller) UUID(java.util.UUID) Test(org.junit.Test)

Aggregations

PravegaTablesScope (io.pravega.controller.store.PravegaTablesScope)7 Test (org.junit.Test)5 PravegaTablesStoreHelper (io.pravega.controller.store.PravegaTablesStoreHelper)3 Controller (io.pravega.controller.stream.api.grpc.v1.Controller)3 UUID (java.util.UUID)3 Mockito.anyString (org.mockito.Mockito.anyString)3 ScalingPolicy (io.pravega.client.stream.ScalingPolicy)2 StreamConfiguration (io.pravega.client.stream.StreamConfiguration)2 Exceptions (io.pravega.common.Exceptions)2 Futures (io.pravega.common.concurrent.Futures)2 PravegaZkCuratorResource (io.pravega.controller.PravegaZkCuratorResource)2 SegmentHelperMock (io.pravega.controller.mocks.SegmentHelperMock)2 SegmentHelper (io.pravega.controller.server.SegmentHelper)2 GrpcAuthHelper (io.pravega.controller.server.security.auth.GrpcAuthHelper)2 TestOperationContext (io.pravega.controller.store.TestOperationContext)2 VersionedMetadata (io.pravega.controller.store.VersionedMetadata)2 EpochTransitionRecord (io.pravega.controller.store.stream.records.EpochTransitionRecord)2 StreamConfigurationRecord (io.pravega.controller.store.stream.records.StreamConfigurationRecord)2 NameUtils (io.pravega.shared.NameUtils)2 Arrays (java.util.Arrays)2