Search in sources :

Example 1 with AdminRequestProcessor

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)));
}
Also used : ExtendedChunkInfo(io.pravega.segmentstore.contracts.ExtendedChunkInfo) InOrder(org.mockito.InOrder) ExtendedChunkInfo(io.pravega.segmentstore.contracts.ExtendedChunkInfo) TableStore(io.pravega.segmentstore.contracts.tables.TableStore) StreamSegmentStore(io.pravega.segmentstore.contracts.StreamSegmentStore) AdminRequestProcessor(io.pravega.shared.protocol.netty.AdminRequestProcessor) WireCommands(io.pravega.shared.protocol.netty.WireCommands) Test(org.junit.Test)

Example 2 with AdminRequestProcessor

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));
}
Also used : StreamSegmentStore(io.pravega.segmentstore.contracts.StreamSegmentStore) InOrder(org.mockito.InOrder) AdminRequestProcessor(io.pravega.shared.protocol.netty.AdminRequestProcessor) WireCommands(io.pravega.shared.protocol.netty.WireCommands) Cleanup(lombok.Cleanup) ServiceBuilder(io.pravega.segmentstore.server.store.ServiceBuilder) TableStore(io.pravega.segmentstore.contracts.tables.TableStore) Test(org.junit.Test)

Aggregations

StreamSegmentStore (io.pravega.segmentstore.contracts.StreamSegmentStore)2 TableStore (io.pravega.segmentstore.contracts.tables.TableStore)2 AdminRequestProcessor (io.pravega.shared.protocol.netty.AdminRequestProcessor)2 WireCommands (io.pravega.shared.protocol.netty.WireCommands)2 Test (org.junit.Test)2 InOrder (org.mockito.InOrder)2 ExtendedChunkInfo (io.pravega.segmentstore.contracts.ExtendedChunkInfo)1 ServiceBuilder (io.pravega.segmentstore.server.store.ServiceBuilder)1 Cleanup (lombok.Cleanup)1