Skip to content

Commit

Permalink
refactor: minor reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jeqo committed Sep 27, 2023
1 parent a42eeb5 commit 41c681c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,14 @@ public InputStream chunksContent(final String objectKeyPath,
final Optional<SegmentEncryptionMetadata> encryptionMetadata = manifest.encryption();
if (encryptionMetadata.isPresent()) {
detransformEnum = new DecryptionChunkEnumeration(
detransformEnum,
encryptionMetadata.get().ivSize(),
encryptedChunk -> aesEncryptionProvider.decryptionCipher(encryptedChunk, encryptionMetadata.get())
detransformEnum,
encryptionMetadata.get().ivSize(),
encryptedChunk -> aesEncryptionProvider.decryptionCipher(encryptedChunk, encryptionMetadata.get())
);
}
if (manifest.compression()) {
detransformEnum = new DecompressionChunkEnumeration(detransformEnum);
}
final DetransformFinisher detransformFinisher = new DetransformFinisher(detransformEnum);
return detransformFinisher.toInputStream();
return new DetransformFinisher(detransformEnum).toInputStream();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ void setUp() throws Exception {
@Test
void noEviction() throws IOException, StorageBackendException {
chunkCache.configure(Map.of(
"retention.ms", "-1",
"size", "-1"
"retention.ms", "-1",
"size", "-1"
));

final InputStream chunk0 = chunkCache.chunksContent(SEGMENT_KEY, SEGMENT_MANIFEST, firstPart);
Expand All @@ -128,8 +128,8 @@ void noEviction() throws IOException, StorageBackendException {
@Test
void timeBasedEviction() throws IOException, StorageBackendException, InterruptedException {
chunkCache.configure(Map.of(
"retention.ms", "100",
"size", "-1"
"retention.ms", "100",
"size", "-1"
));

assertThat(chunkCache.chunksContent(SEGMENT_KEY, SEGMENT_MANIFEST, firstPart))
Expand All @@ -149,13 +149,13 @@ void timeBasedEviction() throws IOException, StorageBackendException, Interrupte
verifyNoMoreInteractions(chunkManager);

await().atMost(Duration.ofMillis(5000)).pollInterval(Duration.ofMillis(100))
.until(() -> !mockingDetails(removalListener).getInvocations().isEmpty());
.until(() -> !mockingDetails(removalListener).getInvocations().isEmpty());

verify(removalListener)
.onRemoval(
argThat(argument -> argument.chunkId == 0),
any(),
eq(RemovalCause.EXPIRED));
.onRemoval(
argThat(argument -> argument.chunkId == 0),
any(),
eq(RemovalCause.EXPIRED));

assertThat(chunkCache.chunksContent(SEGMENT_KEY, SEGMENT_MANIFEST, firstPart))
.hasBinaryContent(CHUNK_0);
Expand All @@ -181,9 +181,9 @@ void sizeBasedEviction() throws IOException, StorageBackendException {
verify(chunkManager).chunksContent(SEGMENT_KEY, SEGMENT_MANIFEST, nextPart);

await().atMost(Duration.ofMillis(5000))
.pollDelay(Duration.ofSeconds(2))
.pollInterval(Duration.ofMillis(10))
.until(() -> !mockingDetails(removalListener).getInvocations().isEmpty());
.pollDelay(Duration.ofSeconds(2))
.pollInterval(Duration.ofMillis(10))
.until(() -> !mockingDetails(removalListener).getInvocations().isEmpty());

verify(removalListener).onRemoval(any(ChunkKey.class), any(), eq(RemovalCause.SIZE));

Expand All @@ -202,8 +202,8 @@ class ErrorHandlingTests {
Part nextPart;

private final Map<String, String> configs = Map.of(
"retention.ms", "-1",
"size", "-1"
"retention.ms", "-1",
"size", "-1"
);

@BeforeEach
Expand Down

0 comments on commit 41c681c

Please sign in to comment.