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);
}
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();
}
Aggregations