Skip to content

Commit

Permalink
fix: spotless clean up
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Peterson <[email protected]>
  • Loading branch information
mattp-swirldslabs committed Sep 11, 2024
1 parent 41abb9b commit 750b0f0
Showing 1 changed file with 7 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ public class BlockStreamServiceIntegrationTest {
private StreamObserver<com.hedera.hapi.block.protoc.PublishStreamResponse>
publishStreamResponseObserver3;

// @Mock
// private StreamObserver<com.hedera.hapi.block.protoc.PublishStreamResponse>
// publishStreamResponseObserver3;

@Mock
private StreamObserver<com.hedera.hapi.block.protoc.SingleBlockResponse>
singleBlockResponseStreamObserver;
Expand Down Expand Up @@ -131,7 +127,6 @@ public class BlockStreamServiceIntegrationTest {
subscribeStreamObserver6;

@Mock private WebServer webServer;
@Mock private ServiceStatus serviceStatus;

@Mock private BlockReader<Block> blockReader;
@Mock private BlockWriter<BlockItem> blockWriter;
Expand Down Expand Up @@ -529,10 +524,7 @@ public void testMediatorExceptionHandlingWhenPersistenceFailure() throws IOExcep
BatchEventProcessor<ObjectEvent<SubscribeStreamResponse>>>
consumers = new ConcurrentHashMap<>();

// Initialize the underlying BlockReader and BlockWriter with ineffective
// permissions to repair the file system. The BlockWriter will not be able
// to write the BlockItem or fix the permissions causing the BlockReader to
// throw an IOException.
// Use a spy to use the real object but also verify the behavior.
final ServiceStatus serviceStatus = spy(new ServiceStatusImpl(blockNodeContext));
doCallRealMethod().when(serviceStatus).setWebServer(webServer);
doCallRealMethod().when(serviceStatus).isRunning();
Expand Down Expand Up @@ -599,10 +591,10 @@ public void testMediatorExceptionHandlingWhenPersistenceFailure() throws IOExcep

// Build a request to invoke the subscribeBlockStream service
final SubscribeStreamRequest subscribeStreamRequest =
SubscribeStreamRequest.newBuilder().startBlockNumber(1).build();
SubscribeStreamRequest.newBuilder().startBlockNumber(1).build();
// Simulate a consumer attempting to connect to the Block Node after the exception.
blockStreamService.protocSubscribeBlockStream(
fromPbj(subscribeStreamRequest), subscribeStreamObserver4);
fromPbj(subscribeStreamRequest), subscribeStreamObserver4);

// The BlockItem expected to pass through since it was published
// before the IOException was thrown.
Expand Down Expand Up @@ -639,12 +631,6 @@ public void testMediatorExceptionHandlingWhenPersistenceFailure() throws IOExcep
// the built-in delay.
verify(webServer, timeout(2000).times(1)).stop();

// Now verify the block was removed from the file system.
// final BlockReader<Block> blockReader =
// BlockAsDirReaderBuilder.newBuilder(persistenceStorageConfig).build();
// final Optional<Block> blockOpt = blockReader.read(1);
// assertTrue(blockOpt.isEmpty());

// Verify the singleBlock service returned the expected
// error code indicating the service is not available.
final SingleBlockResponse expectedSingleBlockNotAvailable =
Expand All @@ -657,10 +643,11 @@ public void testMediatorExceptionHandlingWhenPersistenceFailure() throws IOExcep

// TODO: Fix the response code when it's available
final SubscribeStreamResponse expectedSubscriberStreamNotAvailable =
SubscribeStreamResponse.newBuilder().status(SubscribeStreamResponseCode.READ_STREAM_SUCCESS)
.build();
SubscribeStreamResponse.newBuilder()
.status(SubscribeStreamResponseCode.READ_STREAM_SUCCESS)
.build();
verify(subscribeStreamObserver4, timeout(testTimeout).times(1))
.onNext(fromPbj(expectedSubscriberStreamNotAvailable));
.onNext(fromPbj(expectedSubscriberStreamNotAvailable));
}

private static void verifySubscribeStreamResponse(
Expand Down

0 comments on commit 750b0f0

Please sign in to comment.