use of io.pravega.shared.protocol.netty.AdminRequestProcessor in project pravega by pravega.
the class AdminRequestProcessorImplTest method testListStorageChunks.
@Test(timeout = 60000)
public void testListStorageChunks() {
String segmentName = "dummy";
ExtendedChunkInfo chunk = ExtendedChunkInfo.builder().lengthInMetadata(10).lengthInStorage(10).startOffset(10).chunkName("chunk").existsInStorage(false).build();
WireCommands.ChunkInfo chunkInfo = new WireCommands.ChunkInfo(10, 10, 10, "chunk", false);
StreamSegmentStore store = mock(StreamSegmentStore.class);
when(store.getExtendedChunkInfo(segmentName, TIMEOUT)).thenReturn(CompletableFuture.completedFuture(List.of(chunk)));
ServerConnection connection = mock(ServerConnection.class);
InOrder order = inOrder(connection);
AdminRequestProcessor processor = new AdminRequestProcessorImpl(store, mock(TableStore.class), connection);
processor.listStorageChunks(new WireCommands.ListStorageChunks("dummy", "", 1));
order.verify(connection).send(new WireCommands.StorageChunksListed(1, List.of(chunkInfo)));
}
use of io.pravega.shared.protocol.netty.AdminRequestProcessor in project pravega by pravega.
the class AdminRequestProcessorImplTest method testFlushToStorage.
@Test(timeout = 60000)
public void testFlushToStorage() throws Exception {
@Cleanup ServiceBuilder serviceBuilder = newInlineExecutionInMemoryBuilder(getBuilderConfig());
serviceBuilder.initialize();
StreamSegmentStore store = spy(serviceBuilder.createStreamSegmentService());
ServerConnection connection = mock(ServerConnection.class);
InOrder order = inOrder(connection);
AdminRequestProcessor processor = new AdminRequestProcessorImpl(store, mock(TableStore.class), connection);
processor.flushToStorage(new WireCommands.FlushToStorage(0, "", 1));
order.verify(connection).send(new WireCommands.StorageFlushed(1));
}
Aggregations