Skip to content

Commit

Permalink
fix: change back builder to newBuilder
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Peterson <[email protected]>
  • Loading branch information
mattp-swirldslabs committed Aug 11, 2024
1 parent d6629c3 commit 91d7dca
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion server/src/main/java/com/hedera/block/server/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static void main(final String[] args) {

@NonNull
final BlockWriter<BlockItem> blockWriter =
BlockAsDirWriterBuilder.builder(
BlockAsDirWriterBuilder.newBuilder(
BLOCKNODE_STORAGE_ROOT_PATH_KEY, config, blockNodeContext)
.build();
@NonNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private BlockAsDirWriterBuilder(
}

@NonNull
public static BlockAsDirWriterBuilder builder(
public static BlockAsDirWriterBuilder newBuilder(
@NonNull final String key,
@NonNull final Config config,
@NonNull final BlockNodeContext blockNodeContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ private StreamMediator<BlockItem, ObjectEvent<SubscribeStreamResponse>> buildStr

final BlockNodeContext blockNodeContext = BlockNodeContextFactory.create();
final BlockWriter<BlockItem> blockWriter =
BlockAsDirWriterBuilder.builder(JUNIT, testConfig, blockNodeContext)
BlockAsDirWriterBuilder.newBuilder(JUNIT, testConfig, blockNodeContext)
.blockRemover(blockRemover)
.filePerms(filePerms)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void testSingleBlockHappyPath() throws IOException {

// Generate and persist a block
final BlockWriter<BlockItem> blockWriter =
BlockAsDirWriterBuilder.builder(JUNIT, testConfig, blockNodeContext).build();
BlockAsDirWriterBuilder.newBuilder(JUNIT, testConfig, blockNodeContext).build();
final List<BlockItem> blockItems = generateBlockItems(1);
for (BlockItem blockItem : blockItems) {
blockWriter.write(blockItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void testRemoveNonExistentBlock() throws IOException {

final BlockNodeContext blockNodeContext = BlockNodeContextFactory.create();
final BlockWriter<BlockItem> blockWriter =
BlockAsDirWriterBuilder.builder(JUNIT, testConfig, blockNodeContext).build();
BlockAsDirWriterBuilder.newBuilder(JUNIT, testConfig, blockNodeContext).build();
for (final BlockItem blockItem : blockItems) {
blockWriter.write(blockItem);
}
Expand Down Expand Up @@ -103,7 +103,7 @@ public void testRemoveBlockWithPermException() throws IOException {

final BlockNodeContext blockNodeContext = BlockNodeContextFactory.create();
final BlockWriter<BlockItem> blockWriter =
BlockAsDirWriterBuilder.builder(JUNIT, testConfig, blockNodeContext).build();
BlockAsDirWriterBuilder.newBuilder(JUNIT, testConfig, blockNodeContext).build();
for (final BlockItem blockItem : blockItems) {
blockWriter.write(blockItem);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void testReadPermsRepairSucceeded() throws IOException {

final BlockNodeContext blockNodeContext = BlockNodeContextFactory.create();
final BlockWriter<BlockItem> blockWriter =
BlockAsDirWriterBuilder.builder(JUNIT, testConfig, blockNodeContext).build();
BlockAsDirWriterBuilder.newBuilder(JUNIT, testConfig, blockNodeContext).build();
for (BlockItem blockItem : blockItems) {
blockWriter.write(blockItem);
}
Expand All @@ -113,7 +113,7 @@ public void testRemoveBlockReadPermsRepairFailed() throws IOException {

final BlockNodeContext blockNodeContext = BlockNodeContextFactory.create();
final BlockWriter<BlockItem> blockWriter =
BlockAsDirWriterBuilder.builder(JUNIT, testConfig, blockNodeContext).build();
BlockAsDirWriterBuilder.newBuilder(JUNIT, testConfig, blockNodeContext).build();
for (BlockItem blockItem : blockItems) {
blockWriter.write(blockItem);
}
Expand All @@ -137,7 +137,7 @@ public void testRemoveBlockItemReadPerms() throws IOException {

final BlockNodeContext blockNodeContext = BlockNodeContextFactory.create();
final BlockWriter<BlockItem> blockWriter =
BlockAsDirWriterBuilder.builder(JUNIT, testConfig, blockNodeContext).build();
BlockAsDirWriterBuilder.newBuilder(JUNIT, testConfig, blockNodeContext).build();
for (BlockItem blockItem : blockItems) {
blockWriter.write(blockItem);
}
Expand Down Expand Up @@ -171,7 +171,7 @@ public void testRepairReadPermsFails() throws IOException {

final BlockNodeContext blockNodeContext = BlockNodeContextFactory.create();
final BlockWriter<BlockItem> blockWriter =
BlockAsDirWriterBuilder.builder(JUNIT, testConfig, blockNodeContext).build();
BlockAsDirWriterBuilder.newBuilder(JUNIT, testConfig, blockNodeContext).build();
for (final BlockItem blockItem : blockItems) {
blockWriter.write(blockItem);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ public void testConstructorWithInvalidPath() throws IOException {
final BlockNodeContext blockNodeContext = BlockNodeContextFactory.create();
assertThrows(
IllegalArgumentException.class,
() -> BlockAsDirWriterBuilder.builder(JUNIT, testConfig, blockNodeContext).build());
() ->
BlockAsDirWriterBuilder.newBuilder(JUNIT, testConfig, blockNodeContext)
.build());
}

@Test
Expand All @@ -97,7 +99,7 @@ public void testWriterAndReaderHappyPath() throws IOException {

final BlockNodeContext blockNodeContext = BlockNodeContextFactory.create();
final BlockWriter<BlockItem> blockWriter =
BlockAsDirWriterBuilder.builder(JUNIT, testConfig, blockNodeContext).build();
BlockAsDirWriterBuilder.newBuilder(JUNIT, testConfig, blockNodeContext).build();
for (BlockItem blockItem : blockItems) {
blockWriter.write(blockItem);
}
Expand Down Expand Up @@ -135,7 +137,7 @@ public void testRemoveBlockWritePerms() throws IOException {

final BlockNodeContext blockNodeContext = BlockNodeContextFactory.create();
final BlockWriter<BlockItem> blockWriter =
BlockAsDirWriterBuilder.builder(JUNIT, testConfig, blockNodeContext).build();
BlockAsDirWriterBuilder.newBuilder(JUNIT, testConfig, blockNodeContext).build();

// Change the permissions on the block node root directory
removeRootWritePerms(testConfig);
Expand Down Expand Up @@ -186,7 +188,7 @@ public void testUnrecoverableIOExceptionOnWrite() throws IOException {
final BlockNodeContext blockNodeContext = BlockNodeContextFactory.create();
final BlockWriter<BlockItem> blockWriter =
spy(
BlockAsDirWriterBuilder.builder(JUNIT, testConfig, blockNodeContext)
BlockAsDirWriterBuilder.newBuilder(JUNIT, testConfig, blockNodeContext)
.blockRemover(blockRemover)
.build());
doThrow(IOException.class).when(blockWriter).write(blockItems.getFirst());
Expand All @@ -199,7 +201,7 @@ public void testRemoveRootDirReadPerm() throws IOException {

final BlockNodeContext blockNodeContext = BlockNodeContextFactory.create();
final BlockWriter<BlockItem> blockWriter =
BlockAsDirWriterBuilder.builder(JUNIT, testConfig, blockNodeContext).build();
BlockAsDirWriterBuilder.newBuilder(JUNIT, testConfig, blockNodeContext).build();

// Write the first block item to create the block
// directory
Expand Down

0 comments on commit 91d7dca

Please sign in to comment.