Skip to content

Commit d008c2c

Browse files
committed
restore testing / coverage
1 parent e506830 commit d008c2c

31 files changed

+191
-195
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,12 @@
249249
<limit>
250250
<counter>INSTRUCTION</counter>
251251
<value>COVEREDRATIO</value>
252-
<minimum>0</minimum>
252+
<minimum>0.8</minimum>
253253
</limit>
254254
<limit>
255255
<counter>BRANCH</counter>
256256
<value>COVEREDRATIO</value>
257-
<minimum>0</minimum>
257+
<minimum>0.5</minimum>
258258
</limit>
259259
</limits>
260260
</rule>

src/main/java/software/amazon/encryption/s3/internal/CipherSubscriber.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,13 @@ public class CipherSubscriber implements Subscriber<ByteBuffer> {
1818
private final Subscriber<? super ByteBuffer> wrappedSubscriber;
1919
private Cipher cipher;
2020
private final Long contentLength;
21-
private final CryptographicMaterials materials;
22-
private byte[] iv;
2321
private boolean isLastPart;
2422

2523
private byte[] outputBuffer;
2624

2725
CipherSubscriber(Subscriber<? super ByteBuffer> wrappedSubscriber, Long contentLength, CryptographicMaterials materials, byte[] iv, boolean isLastPart) {
2826
this.wrappedSubscriber = wrappedSubscriber;
2927
this.contentLength = contentLength;
30-
this.materials = materials;
31-
this.iv = iv;
3228
cipher = materials.getCipher(iv);
3329
this.isLastPart = isLastPart;
3430
}

src/test/java/software/amazon/encryption/s3/ParameterMalleabilityTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static void setUp() throws NoSuchAlgorithmException {
2929
AES_KEY = keyGen.generateKey();
3030
}
3131

32-
//@Test
32+
@Test
3333
public void contentEncryptionDowngradeAttackFails() {
3434
final String objectKey = appendTestSuffix("content-downgrade-attack-fails");
3535
S3Client v3Client = S3EncryptionClient.builder()
@@ -68,7 +68,7 @@ public void contentEncryptionDowngradeAttackFails() {
6868
v3Client.close();
6969
}
7070

71-
//@Test
71+
@Test
7272
public void keyWrapRemovalAttackFails() {
7373
final String objectKey = appendTestSuffix("keywrap-removal-attack-fails");
7474
S3Client v3Client = S3EncryptionClient.builder()
@@ -106,7 +106,7 @@ public void keyWrapRemovalAttackFails() {
106106
v3Client.close();
107107
}
108108

109-
//@Test
109+
@Test
110110
public void keyWrapDowngradeAesWrapAttackFails() {
111111
final String objectKey = appendTestSuffix("keywrap-downgrade-aeswrap-attack-fails");
112112
S3Client v3Client = S3EncryptionClient.builder()
@@ -145,7 +145,7 @@ public void keyWrapDowngradeAesWrapAttackFails() {
145145
v3Client.close();
146146
}
147147

148-
//@Test
148+
@Test
149149
public void keyWrapDowngradeAesAttackFails() {
150150
final String objectKey = appendTestSuffix("keywrap-downgrade-aes-attack-fails");
151151
S3Client v3Client = S3EncryptionClient.builder()

src/test/java/software/amazon/encryption/s3/S3AsyncEncryptionClientTest.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public static void setUp() throws NoSuchAlgorithmException {
9292
PROVIDER = Security.getProvider("BC");
9393
}
9494

95-
//@Test
95+
@Test
9696
public void asyncCustomConfiguration() {
9797
final String objectKey = appendTestSuffix("wrapped-s3-client-with-custom-credentials-async");
9898

@@ -141,7 +141,7 @@ public void asyncCustomConfiguration() {
141141
s3Client.close();
142142
}
143143

144-
//@Test
144+
@Test
145145
public void asyncTopLevelConfigurationAllOptions() {
146146
final String objectKey = appendTestSuffix("async-top-level-all-options");
147147
AwsCredentialsProvider creds = DefaultCredentialsProvider.create();
@@ -188,7 +188,7 @@ public void asyncTopLevelConfigurationAllOptions() {
188188
s3Client.close();
189189
}
190190

191-
//@Test
191+
@Test
192192
public void asyncTopLevelConfiguration() {
193193
final String objectKey = appendTestSuffix("wrapped-s3-client-with-top-level-credentials-async");
194194

@@ -221,7 +221,7 @@ public void asyncTopLevelConfiguration() {
221221
s3Client.close();
222222
}
223223

224-
//@Test
224+
@Test
225225
public void s3AsyncEncryptionClientTopLevelAlternateCredentials() {
226226
final String objectKey = appendTestSuffix("wrapped-s3-async-client-with-top-level-alternate-credentials");
227227
final String input = "S3EncryptionClientTopLevelAlternateCredsTest";
@@ -275,7 +275,7 @@ public void s3AsyncEncryptionClientTopLevelAlternateCredentials() {
275275
s3ClientAltCreds.close();
276276
}
277277

278-
//@Test
278+
@Test
279279
public void s3AsyncEncryptionClientMixedCredentials() {
280280
final String objectKey = appendTestSuffix("wrapped-s3-client-with-mixed-credentials");
281281
final String input = "S3EncryptionClientTopLevelAlternateCredsTest";
@@ -317,7 +317,7 @@ public void s3AsyncEncryptionClientMixedCredentials() {
317317
kmsClient.close();
318318
}
319319

320-
//@Test
320+
@Test
321321
public void asyncTopLevelConfigurationWrongRegion() {
322322
final String objectKey = appendTestSuffix("wrapped-s3-client-with-wrong-region-credentials-async");
323323

@@ -345,7 +345,7 @@ public void asyncTopLevelConfigurationWrongRegion() {
345345
}
346346
}
347347

348-
//@Test
348+
@Test
349349
public void asyncTopLevelConfigurationNullCreds() {
350350
final String objectKey = appendTestSuffix("wrapped-s3-client-with-null-credentials-async");
351351

@@ -373,7 +373,7 @@ public void asyncTopLevelConfigurationNullCreds() {
373373
}
374374
}
375375

376-
//@Test
376+
@Test
377377
public void putAsyncGetDefault() {
378378
final String objectKey = appendTestSuffix("put-async-get-default");
379379

@@ -406,7 +406,7 @@ public void putAsyncGetDefault() {
406406
v3AsyncClient.close();
407407
}
408408

409-
//@Test
409+
@Test
410410
public void putDefaultGetAsync() {
411411
final String objectKey = appendTestSuffix("put-default-get-async");
412412

@@ -439,7 +439,7 @@ public void putDefaultGetAsync() {
439439
v3AsyncClient.close();
440440
}
441441

442-
//@Test
442+
@Test
443443
public void putAsyncGetAsync() {
444444
final String objectKey = appendTestSuffix("put-async-get-async");
445445

@@ -469,7 +469,7 @@ public void putAsyncGetAsync() {
469469
v3AsyncClient.close();
470470
}
471471

472-
//@Test
472+
@Test
473473
public void aesCbcV1toV3Async() {
474474
final String objectKey = appendTestSuffix("aes-cbc-v1-to-v3-async");
475475

@@ -506,7 +506,7 @@ public void aesCbcV1toV3Async() {
506506
v3Client.close();
507507
}
508508

509-
//@Test
509+
@Test
510510
public void failAesCbcV1toV3AsyncWhenDisabled() {
511511
final String objectKey = appendTestSuffix("fail-aes-cbc-v1-to-v3-async-when-disabled");
512512

@@ -543,7 +543,7 @@ public void failAesCbcV1toV3AsyncWhenDisabled() {
543543
v3Client.close();
544544
}
545545

546-
//@Test
546+
@Test
547547
public void AsyncAesGcmV2toV3WithInstructionFile() {
548548
final String objectKey = appendTestSuffix("async-aes-gcm-v2-to-v3-with-instruction-file");
549549

@@ -580,7 +580,7 @@ public void AsyncAesGcmV2toV3WithInstructionFile() {
580580
v3AsyncClient.close();
581581
}
582582

583-
//@Test
583+
@Test
584584
public void deleteObjectWithInstructionFileSuccessAsync() {
585585
final String objectKey = appendTestSuffix("async-delete-object-with-instruction-file");
586586

@@ -623,7 +623,7 @@ public void deleteObjectWithInstructionFileSuccessAsync() {
623623
s3Client.close();
624624
}
625625

626-
//@Test
626+
@Test
627627
public void deleteObjectsWithInstructionFilesSuccessAsync() {
628628
final String[] objectKeys = {appendTestSuffix("async-delete-object-with-instruction-file-1"),
629629
appendTestSuffix("async-delete-object-with-instruction-file-2"),
@@ -672,7 +672,7 @@ public void deleteObjectsWithInstructionFilesSuccessAsync() {
672672
s3Client.close();
673673
}
674674

675-
//@Test
675+
@Test
676676
public void deleteObjectWithWrongObjectKeySuccessAsync() {
677677
// V3 Client
678678
S3AsyncClient v3Client = S3AsyncEncryptionClient.builder()
@@ -684,7 +684,7 @@ public void deleteObjectWithWrongObjectKeySuccessAsync() {
684684
v3Client.close();
685685
}
686686

687-
//@Test
687+
@Test
688688
public void copyObjectTransparentlyAsync() {
689689
final String objectKey = appendTestSuffix("copy-object-from-here-async");
690690
final String newObjectKey = appendTestSuffix("copy-object-to-here-async");
@@ -731,7 +731,7 @@ public void copyObjectTransparentlyAsync() {
731731
* the cipher's block size.
732732
* @throws IOException
733733
*/
734-
//@Test
734+
@Test
735735
public void tinyBufferTest() throws IOException {
736736
// BouncyCastle actually returns null buffers, unlike ACCP and SunJCE, which return empty buffers
737737
Security.addProvider(new BouncyCastleProvider());
@@ -771,7 +771,7 @@ public void tinyBufferTest() throws IOException {
771771
exec.shutdown();
772772
}
773773

774-
//@Test
774+
@Test
775775
public void testAsyncInstructionFileConfig() {
776776
final String objectKey = appendTestSuffix("async-instruction-file-config");
777777
final String input = "SimpleTestOfV3EncryptionClient";
@@ -828,7 +828,7 @@ public void testAsyncInstructionFileConfig() {
828828
s3Client.close();
829829
}
830830

831-
//@Test
831+
@Test
832832
public void wrappedClientMultipartUploadThrowsException() throws IOException {
833833
final String objectKey = appendTestSuffix("multipart-put-object-async-wrapped-client");
834834

@@ -907,14 +907,14 @@ public void wrappedClientMultipartUploadThrowsException() throws IOException {
907907
v3Client.close();
908908
}
909909

910-
//@Test
910+
@Test
911911
public void S3AsyncClientBuilderForbidsMultipartEnabled() throws IOException {
912912
assertThrows(
913913
UnsupportedOperationException.class,
914914
() -> S3AsyncEncryptionClient.builder().multipartEnabled(Boolean.TRUE));
915915
}
916916

917-
//@Test
917+
@Test
918918
public void S3AsyncClientBuilderForbidsMultipartConfiguration() throws IOException {
919919
assertThrows(
920920
UnsupportedOperationException.class,

src/test/java/software/amazon/encryption/s3/S3EncryptionClientCRTTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public static void setUp() throws NoSuchAlgorithmException {
6161
PROVIDER = Security.getProvider("BC");
6262
}
6363

64-
//@Test
64+
@Test
6565
public void AsyncAesGcmV3toV3RangedGet() {
6666
final String objectKey = appendTestSuffix("async-aes-gcm-v3-to-v3-ranged-get");
6767

@@ -127,7 +127,7 @@ public void AsyncAesGcmV3toV3RangedGet() {
127127
asyncClient.close();
128128
}
129129

130-
//@Test
130+
@Test
131131
public void AsyncFailsOnRangeWhenLegacyModeDisabled() {
132132
final String objectKey = appendTestSuffix("fails-when-on-range-when-legacy-disabled");
133133
final String input = "0bcdefghijklmnopqrst0BCDEFGHIJKLMNOPQRST" +
@@ -157,7 +157,7 @@ public void AsyncFailsOnRangeWhenLegacyModeDisabled() {
157157
asyncClient.close();
158158
}
159159

160-
//@Test
160+
@Test
161161
public void AsyncAesCbcV1toV3RangedGet() {
162162
final String objectKey = appendTestSuffix("aes-cbc-v1-to-v3-ranged-get-async");
163163

@@ -236,7 +236,7 @@ public void AsyncAesCbcV1toV3RangedGet() {
236236
}
237237

238238

239-
//@Test
239+
@Test
240240
public void failsOnRangeWhenLegacyModeDisabled() {
241241
final String objectKey = appendTestSuffix("fails-when-on-range-when-legacy-disabled");
242242
final String input = "0bcdefghijklmnopqrst0BCDEFGHIJKLMNOPQRST" +
@@ -267,7 +267,7 @@ public void failsOnRangeWhenLegacyModeDisabled() {
267267
v3Client.close();
268268
}
269269

270-
//@Test
270+
@Test
271271
public void AesGcmV3toV3RangedGet() {
272272
final String objectKey = appendTestSuffix("aes-gcm-v3-to-v3-ranged-get");
273273

@@ -333,7 +333,7 @@ public void AesGcmV3toV3RangedGet() {
333333
v3Client.close();
334334
}
335335

336-
//@Test
336+
@Test
337337
public void AesGcmV3toV3FailsRangeExceededObjectLength() {
338338
final String objectKey = appendTestSuffix("aes-gcm-v3-to-v3-ranged-get-out-of-range");
339339

@@ -366,7 +366,7 @@ public void AesGcmV3toV3FailsRangeExceededObjectLength() {
366366
v3Client.close();
367367
}
368368

369-
//@Test
369+
@Test
370370
public void AsyncAesGcmV3toV3FailsRangeExceededObjectLength() {
371371
final String objectKey = appendTestSuffix("aes-gcm-v3-to-v3-ranged-get-out-of-range");
372372

@@ -400,7 +400,7 @@ public void AsyncAesGcmV3toV3FailsRangeExceededObjectLength() {
400400
asyncClient.close();
401401
}
402402

403-
//@Test
403+
@Test
404404
public void AesCbcV1toV3RangedGet() {
405405
final String objectKey = appendTestSuffix("aes-cbc-v1-to-v3-ranged-get");
406406

@@ -488,7 +488,7 @@ public void AesCbcV1toV3RangedGet() {
488488
v3Client.close();
489489
}
490490

491-
//@Test
491+
@Test
492492
public void AesCbcV1toV3FailsRangeExceededObjectLength() {
493493
final String objectKey = appendTestSuffix("aes-cbc-v1-to-v3-ranged-get-out-of-range");
494494

@@ -529,7 +529,7 @@ public void AesCbcV1toV3FailsRangeExceededObjectLength() {
529529
v3Client.close();
530530
}
531531

532-
//@Test
532+
@Test
533533
public void AsyncAesGcmV3toV3LargeObjectCRT() throws IOException {
534534
final String objectKey = appendTestSuffix("async-aes-gcm-v3-to-v3-large-object-crt");
535535

0 commit comments

Comments
 (0)