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 b2e4cde commit d6629c3
Show file tree
Hide file tree
Showing 7 changed files with 18 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 @@ -80,7 +80,7 @@ public static void main(final String[] args) {

@NonNull
final BlockReader<Block> blockReader =
BlockAsDirReaderBuilder.builder(BLOCKNODE_STORAGE_ROOT_PATH_KEY, config)
BlockAsDirReaderBuilder.newBuilder(BLOCKNODE_STORAGE_ROOT_PATH_KEY, config)
.build();

@NonNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private BlockAsDirReaderBuilder(@NonNull final String key, @NonNull final Config
}

@NonNull
public static BlockAsDirReaderBuilder builder(
public static BlockAsDirReaderBuilder newBuilder(
@NonNull final String key, @NonNull final Config config) {
return new BlockAsDirReaderBuilder(key, config);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ public void testMediatorExceptionHandlingWhenPersistenceFailure() throws IOExcep

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public void testProto() throws IOException, NoSuchAlgorithmException {
void testSingleBlockHappyPath() throws IOException {

final BlockReader<Block> blockReader =
BlockAsDirReaderBuilder.builder(JUNIT, testConfig).build();
BlockAsDirReaderBuilder.newBuilder(JUNIT, testConfig).build();
final BlockNodeContext blockNodeContext = BlockNodeContextFactory.create();
final BlockStreamService blockStreamService =
new BlockStreamService(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void testRemoveNonExistentBlock() throws IOException {

// Verify the block was not removed
final BlockReader<Block> blockReader =
BlockAsDirReaderBuilder.builder(JUNIT, testConfig).build();
BlockAsDirReaderBuilder.newBuilder(JUNIT, testConfig).build();
Optional<Block> blockOpt = blockReader.read(1);
assert (blockOpt.isPresent());
assertEquals(
Expand Down Expand Up @@ -114,7 +114,7 @@ public void testRemoveBlockWithPermException() throws IOException {

// Verify the block was not removed
final BlockReader<Block> blockReader =
BlockAsDirReaderBuilder.builder(JUNIT, testConfig).build();
BlockAsDirReaderBuilder.newBuilder(JUNIT, testConfig).build();
Optional<Block> blockOpt = blockReader.read(1);
assert (blockOpt.isPresent());
assertEquals(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void tearDown() {
@Test
public void testReadBlockDoesNotExist() throws IOException {
final BlockReader<Block> blockReader =
BlockAsDirReaderBuilder.builder(JUNIT, testConfig).build();
BlockAsDirReaderBuilder.newBuilder(JUNIT, testConfig).build();
final Optional<Block> blockOpt = blockReader.read(10000);
assertTrue(blockOpt.isEmpty());
}
Expand All @@ -101,7 +101,7 @@ public void testReadPermsRepairSucceeded() throws IOException {

// The default BlockReader will attempt to repair the permissions and should succeed
final BlockReader<Block> blockReader =
BlockAsDirReaderBuilder.builder(JUNIT, testConfig).build();
BlockAsDirReaderBuilder.newBuilder(JUNIT, testConfig).build();
final Optional<Block> blockOpt = blockReader.read(1);
assertFalse(blockOpt.isEmpty());
assertEquals(10, blockOpt.get().getBlockItemsList().size());
Expand All @@ -124,7 +124,7 @@ public void testRemoveBlockReadPermsRepairFailed() throws IOException {
// For this test, build the Reader with ineffective repair permissions to
// simulate a failed repair (root changed the perms, etc.)
final BlockReader<Block> blockReader =
BlockAsDirReaderBuilder.builder(JUNIT, testConfig)
BlockAsDirReaderBuilder.newBuilder(JUNIT, testConfig)
.filePerms(TestUtils.getNoPerms())
.build();
final Optional<Block> blockOpt = blockReader.read(1);
Expand All @@ -145,7 +145,7 @@ public void testRemoveBlockItemReadPerms() throws IOException {
removeBlockItemReadPerms(1, 1, testConfig);

final BlockReader<Block> blockReader =
BlockAsDirReaderBuilder.builder(JUNIT, testConfig).build();
BlockAsDirReaderBuilder.newBuilder(JUNIT, testConfig).build();
assertThrows(IOException.class, () -> blockReader.read(1));
}

Expand All @@ -159,7 +159,7 @@ public void testPathIsNotDirectory() throws IOException {

// Should return empty because the path is not a directory
final BlockReader<Block> blockReader =
BlockAsDirReaderBuilder.builder(JUNIT, testConfig).build();
BlockAsDirReaderBuilder.newBuilder(JUNIT, testConfig).build();
final Optional<Block> blockOpt = blockReader.read(1);
assertTrue(blockOpt.isEmpty());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ public void testWriterAndReaderHappyPath() throws IOException {
}

// Confirm the block
BlockReader<Block> blockReader = BlockAsDirReaderBuilder.builder(JUNIT, testConfig).build();
BlockReader<Block> blockReader =
BlockAsDirReaderBuilder.newBuilder(JUNIT, testConfig).build();
Optional<Block> blockOpt = blockReader.read(1);
assertFalse(blockOpt.isEmpty());

Expand Down Expand Up @@ -144,7 +145,8 @@ public void testRemoveBlockWritePerms() throws IOException {
blockWriter.write(blockItems.getFirst());

// Confirm we're able to read 1 block item
BlockReader<Block> blockReader = BlockAsDirReaderBuilder.builder(JUNIT, testConfig).build();
BlockReader<Block> blockReader =
BlockAsDirReaderBuilder.newBuilder(JUNIT, testConfig).build();
Optional<Block> blockOpt = blockReader.read(1);
assertFalse(blockOpt.isEmpty());
assertEquals(1, blockOpt.get().getBlockItemsList().size());
Expand Down Expand Up @@ -214,7 +216,8 @@ public void testRemoveRootDirReadPerm() throws IOException {
blockWriter.write(blockItems.get(i));
}

BlockReader<Block> blockReader = BlockAsDirReaderBuilder.builder(JUNIT, testConfig).build();
BlockReader<Block> blockReader =
BlockAsDirReaderBuilder.newBuilder(JUNIT, testConfig).build();
Optional<Block> blockOpt = blockReader.read(1);
assertFalse(blockOpt.isEmpty());
assertEquals(10, blockOpt.get().getBlockItemsList().size());
Expand Down Expand Up @@ -261,7 +264,7 @@ public void testPartialBlockRemoval() throws IOException {

// Verify the partially written block was removed
final BlockReader<Block> blockReader =
BlockAsDirReaderBuilder.builder(JUNIT, testConfig).build();
BlockAsDirReaderBuilder.newBuilder(JUNIT, testConfig).build();
Optional<Block> blockOpt = blockReader.read(3);
assertTrue(blockOpt.isEmpty());

Expand Down

0 comments on commit d6629c3

Please sign in to comment.