Skip to content

Commit

Permalink
address comment for more readability
Browse files Browse the repository at this point in the history
Signed-off-by: Petar Tonev <[email protected]>
  • Loading branch information
petreze committed Oct 23, 2024
1 parent 14d3e4f commit 95ac65e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ public GrpcBlockItemWriter(@NonNull final BlockStreamConfig blockStreamConfig) {
client = GrpcClient.builder()
.tls(Tls.builder().enabled(false).build())
.baseUri(new URI(
null, null, blockStreamConfig.address(), blockStreamConfig.port(), null, null, null))
null,
null,
blockStreamConfig.grpcAddress(),
blockStreamConfig.grpcPort(),
null,
null,
null))
.protocolConfig(GrpcClientProtocolConfig.builder()
.abortPollTimeExpired(false)
.build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ public class GrpcBlockItemWriterTest {

@Test
public void testGrpcBlockItemWriterConstructor() {
when(blockStreamConfig.address()).thenReturn("localhost");
when(blockStreamConfig.port()).thenReturn(8080);
when(blockStreamConfig.grpcAddress()).thenReturn("localhost");
when(blockStreamConfig.grpcPort()).thenReturn(8080);

final GrpcBlockItemWriter grpcBlockItemWriter = new GrpcBlockItemWriter(blockStreamConfig);
assertThat(grpcBlockItemWriter).isNotNull();
}

@Test
public void testOpenBlockNegativeBlockNumber() {
when(blockStreamConfig.address()).thenReturn("localhost");
when(blockStreamConfig.port()).thenReturn(8080);
when(blockStreamConfig.grpcAddress()).thenReturn("localhost");
when(blockStreamConfig.grpcPort()).thenReturn(8080);

GrpcBlockItemWriter grpcBlockItemWriter = new GrpcBlockItemWriter(blockStreamConfig);

Expand All @@ -58,8 +58,8 @@ public void testOpenBlockNegativeBlockNumber() {

@Test
public void testWriteItemBeforeOpen() {
when(blockStreamConfig.address()).thenReturn("localhost");
when(blockStreamConfig.port()).thenReturn(8080);
when(blockStreamConfig.grpcAddress()).thenReturn("localhost");
when(blockStreamConfig.grpcPort()).thenReturn(8080);

GrpcBlockItemWriter grpcBlockItemWriter = new GrpcBlockItemWriter(blockStreamConfig);

Expand All @@ -76,8 +76,8 @@ public void testWriteItemBeforeOpen() {

@Test
public void testCloseBlockNotOpen() {
when(blockStreamConfig.address()).thenReturn("localhost");
when(blockStreamConfig.port()).thenReturn(8080);
when(blockStreamConfig.grpcAddress()).thenReturn("localhost");
when(blockStreamConfig.grpcPort()).thenReturn(8080);

GrpcBlockItemWriter grpcBlockItemWriter = new GrpcBlockItemWriter(blockStreamConfig);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
* @param writerMode if we are writing to a file or gRPC stream
* @param blockFileDir directory to store block files
* @param compressFilesOnCreation whether to compress files on creation
* @param address the address of the gRPC server
* @param port the port of the gRPC server
* @param grpcAddress the address of the gRPC server
* @param grpcPort the port of the gRPC server
*/
@ConfigData("blockStream")
public record BlockStreamConfig(
Expand All @@ -43,5 +43,5 @@ public record BlockStreamConfig(
@ConfigProperty(defaultValue = "32") @NetworkProperty int serializationBatchSize,
@ConfigProperty(defaultValue = "32") @NetworkProperty int hashCombineBatchSize,
@ConfigProperty(defaultValue = "1") @NetworkProperty int roundsPerBlock,
@ConfigProperty(defaultValue = "localhost") String address,
@ConfigProperty(defaultValue = "8080") @Min(0) @Max(65535) int port) {}
@ConfigProperty(defaultValue = "localhost") String grpcAddress,
@ConfigProperty(defaultValue = "8080") @Min(0) @Max(65535) int grpcPort) {}

0 comments on commit 95ac65e

Please sign in to comment.