Skip to content

Commit

Permalink
Fixing Existing Unit tests and removing an addition (requires org.che…
Browse files Browse the repository at this point in the history
…ckerframework.checker.qual;) on module-info by accident

Signed-off-by: Alfredo Gutierrez <[email protected]>
  • Loading branch information
AlfredoG87 committed Dec 18, 2024
1 parent a90b5df commit 4a59618
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class SignatureVerifierDummy implements SignatureVerifier {

@Inject
// TODO we need to provide the public key (aka LedgerID)
// on actual impl we would need to provide the public key (aka LedgerID)
public SignatureVerifierDummy() {}

@Override
Expand Down
1 change: 0 additions & 1 deletion server/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
requires javax.inject;
requires static com.github.spotbugs.annotations;
requires static com.google.auto.service;
requires org.checkerframework.checker.qual;

provides com.swirlds.config.api.ConfigurationExtension with
BlockNodeConfigExtension;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
import com.hedera.block.server.service.ServiceStatusImpl;
import com.hedera.block.server.util.TestConfigUtil;
import com.hedera.block.server.util.TestUtils;
import com.hedera.block.server.verification.BlockVerificationService;
import com.hedera.block.server.verification.BlockVerificationServiceNoOp;
import com.hedera.block.server.verification.StreamVerificationHandlerImpl;
import com.hedera.hapi.block.Acknowledgement;
import com.hedera.hapi.block.BlockItemUnparsed;
Expand Down Expand Up @@ -273,9 +275,10 @@ private PbjBlockStreamServiceProxy buildBlockStreamService(final Notifier notifi
final var streamMediator = buildStreamMediator(new ConcurrentHashMap<>(32), serviceStatus);
final var blockNodeEventHandler = new StreamPersistenceHandlerImpl(
streamMediator, notifier, blockWriter, blockNodeContext, serviceStatus);
final BlockVerificationService blockVerificationService = new BlockVerificationServiceNoOp();

final var streamVerificationHandler =
new StreamVerificationHandlerImpl(streamMediator, blockNodeContext.metricsService(), serviceStatus);
final var streamVerificationHandler = new StreamVerificationHandlerImpl(
streamMediator, notifier, blockNodeContext.metricsService(), serviceStatus, blockVerificationService);

return new PbjBlockStreamServiceProxy(
streamMediator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
import com.hedera.block.server.service.ServiceStatus;
import com.hedera.block.server.service.ServiceStatusImpl;
import com.hedera.block.server.util.TestConfigUtil;
import com.hedera.block.server.verification.BlockVerificationService;
import com.hedera.block.server.verification.StreamVerificationHandlerImpl;
import com.hedera.hapi.block.Acknowledgement;
import com.hedera.hapi.block.BlockItemSetUnparsed;
import com.hedera.hapi.block.BlockItemUnparsed;
Expand Down Expand Up @@ -392,8 +394,21 @@ public void testSubAndUnsubWhileStreaming() throws InterruptedException {
final var streamMediator = buildStreamMediator(consumers, serviceStatus);
final var blockNodeEventHandler = new StreamPersistenceHandlerImpl(
streamMediator, notifier, blockWriter, blockNodeContext, serviceStatus);

final StreamVerificationHandlerImpl streamVerificationHandler = new StreamVerificationHandlerImpl(
streamMediator,
notifier,
blockNodeContext.metricsService(),
serviceStatus,
mock(BlockVerificationService.class));

final PbjBlockStreamServiceProxy pbjBlockStreamServiceProxy = new PbjBlockStreamServiceProxy(
streamMediator, serviceStatus, blockNodeEventHandler, notifier, blockNodeContext);
streamMediator,
serviceStatus,
blockNodeEventHandler,
streamVerificationHandler,
notifier,
blockNodeContext);

final Pipeline<? super Bytes> producerPipeline = pbjBlockStreamServiceProxy.open(
PbjBlockStreamService.BlockStreamMethod.publishBlockStream, options, helidonPublishStreamObserver1);
Expand Down Expand Up @@ -519,8 +534,21 @@ public void testMediatorExceptionHandlingWhenPersistenceFailure() throws IOExcep
final var notifier = new NotifierImpl(streamMediator, blockNodeContext, serviceStatus);
final var blockNodeEventHandler = new StreamPersistenceHandlerImpl(
streamMediator, notifier, blockWriter, blockNodeContext, serviceStatus);

final StreamVerificationHandlerImpl streamVerificationHandler = new StreamVerificationHandlerImpl(
streamMediator,
notifier,
blockNodeContext.metricsService(),
serviceStatus,
mock(BlockVerificationService.class));

final PbjBlockStreamServiceProxy pbjBlockStreamServiceProxy = new PbjBlockStreamServiceProxy(
streamMediator, serviceStatus, blockNodeEventHandler, notifier, blockNodeContext);
streamMediator,
serviceStatus,
blockNodeEventHandler,
streamVerificationHandler,
notifier,
blockNodeContext);

// Register a producer
final Pipeline<? super Bytes> producerPipeline = pbjBlockStreamServiceProxy.open(
Expand All @@ -539,7 +567,7 @@ public void testMediatorExceptionHandlingWhenPersistenceFailure() throws IOExcep
.onNext(buildEmptySubscribeStreamRequest());

// 3 subscribers + 1 streamPersistenceHandler
assertEquals(4, consumers.size());
assertEquals(5, consumers.size());

// Transmit a BlockItem
final Bytes publishStreamRequest =
Expand Down Expand Up @@ -670,11 +698,24 @@ private PbjBlockStreamServiceProxy buildBlockStreamService(final BlockWriter<Lis
final ServiceStatus serviceStatus = new ServiceStatusImpl(blockNodeContext);
final var streamMediator = buildStreamMediator(new ConcurrentHashMap<>(32), serviceStatus);
final var notifier = new NotifierImpl(streamMediator, blockNodeContext, serviceStatus);

final var blockNodeEventHandler = new StreamPersistenceHandlerImpl(
streamMediator, notifier, blockWriter, blockNodeContext, serviceStatus);

final StreamVerificationHandlerImpl streamVerificationHandler = new StreamVerificationHandlerImpl(
streamMediator,
notifier,
blockNodeContext.metricsService(),
serviceStatus,
mock(BlockVerificationService.class));

return new PbjBlockStreamServiceProxy(
streamMediator, serviceStatus, blockNodeEventHandler, notifier, blockNodeContext);
streamMediator,
serviceStatus,
blockNodeEventHandler,
streamVerificationHandler,
notifier,
blockNodeContext);
}

private LiveStreamMediator buildStreamMediator(
Expand Down

0 comments on commit 4a59618

Please sign in to comment.