Skip to content

Commit e94766d

Browse files
committed
fixing progress listener tests
1 parent 6aa3c95 commit e94766d

File tree

4 files changed

+25
-31
lines changed

4 files changed

+25
-31
lines changed

sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -816,12 +816,12 @@ private Mono<Response<BlockBlobItem>> uploadInChunks(BlockBlobAsyncClient blockB
816816
})
817817
// We only care about the stageBlock insofar as it was successful, but we need to collect the ids.
818818
.map(x -> {
819-
// String headerV = x.getHeaders().getValue("test_context_key");
820-
// if (Objects.equals(headerV, "-1")) {
821-
// System.out.println("does not have context key");
822-
// } else {
823-
// System.out.println("has context key: " + headerV);
824-
// }
819+
// String headerV = x.getHeaders().getValue("test_context_key");
820+
// if (Objects.equals(headerV, "-1")) {
821+
// System.out.println("does not have context key");
822+
// } else {
823+
// System.out.println("has context key: " + headerV);
824+
// }
825825
return blockId;
826826
});
827827
}, parallelTransferOptions.getMaxConcurrency(), 1)

sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/contentValidation/BlobMessageEncoderUploadTests.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ public void uploadBinaryDataChunkedStructMessProgressListener() {
9494
byte[] data = getRandomByteArray((int) size);
9595
long blockSize = (long) Constants.MB * 2;
9696

97-
Listener uploadListenerChecksum = new Listener(blockSize);
97+
Listener uploadListenerChecksum = new Listener();
9898

99-
Listener uploadListenerNoChecksum = new Listener(blockSize);
99+
Listener uploadListenerNoChecksum = new Listener();
100100

101101
BlobParallelUploadOptions optionsChecksum = new BlobParallelUploadOptions(BinaryData.fromBytes(data))
102102
.setStorageChecksumAlgorithm(StorageChecksumAlgorithm.AUTO)
@@ -106,7 +106,7 @@ public void uploadBinaryDataChunkedStructMessProgressListener() {
106106
.setProgressListener(uploadListenerChecksum));
107107

108108
BlobParallelUploadOptions optionsNoChecksum = new BlobParallelUploadOptions(BinaryData.fromBytes(data))
109-
.setStorageChecksumAlgorithm(StorageChecksumAlgorithm.AUTO)
109+
.setStorageChecksumAlgorithm(StorageChecksumAlgorithm.NONE)
110110
.setParallelTransferOptions(
111111
new ParallelTransferOptions().setMaxSingleUploadSizeLong((long) Constants.MB * 2)
112112
.setBlockSizeLong(blockSize)
@@ -118,9 +118,6 @@ public void uploadBinaryDataChunkedStructMessProgressListener() {
118118
assertTrue(uploadListenerChecksum.getReportingCount() >= (size / blockSize));
119119
assertTrue(uploadListenerNoChecksum.getReportingCount() >= (size / blockSize));
120120

121-
assertEquals(uploadListenerNoChecksum.getReportingCount(), uploadListenerChecksum.getReportingCount());
122-
assertEquals(uploadListenerNoChecksum.getReportedByteCount(), uploadListenerChecksum.getReportedByteCount());
123-
124121
System.out.println(
125122
uploadListenerChecksum.getReportingCount() + " " + uploadListenerChecksum.getReportedByteCount() + " "
126123
+ uploadListenerNoChecksum.getReportingCount() + " " + uploadListenerNoChecksum.getReportedByteCount());
@@ -220,17 +217,14 @@ public void uploadFluxChunkedStructMess() {
220217
}
221218

222219
static class Listener implements ProgressListener {
223-
private final long blockSize;
224220
private long reportingCount;
225221
private long reportedByteCount;
226222

227-
Listener(long blockSize) {
228-
this.blockSize = blockSize;
223+
Listener() {
229224
}
230225

231226
@Override
232227
public void handleProgress(long bytesTransferred) {
233-
assertEquals(0, bytesTransferred % blockSize);
234228
this.reportingCount += 1;
235229
this.reportedByteCount = bytesTransferred;
236230
}

sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/structuredmessage/StructuredMessageEncoder.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,12 @@ public String getEncodedMessageLength() {
262262
return String.valueOf(messageLength);
263263
}
264264

265-
// /**
266-
// * Returns the CRC64 of the message
267-
// *
268-
// * @return The CRC64 of the message
269-
// */
270-
// public long getMessageCRC64() {
271-
// return messageCRC64;
272-
// }
265+
// /**
266+
// * Returns the CRC64 of the message
267+
// *
268+
// * @return The CRC64 of the message
269+
// */
270+
// public long getMessageCRC64() {
271+
// return messageCRC64;
272+
// }
273273
}

sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/StorageContentValidationPolicy.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineN
6262
applyContentValidation(context);
6363
return next.process();
6464

65-
// long messageCRC64 = applyContentValidation(context);
66-
// return next.process().map(response -> {
67-
// if (messageCRC64 != -1) {
68-
// response.getHeaders().add("test_context_key", String.valueOf(messageCRC64));
69-
// }
70-
// return response;
71-
// });
65+
// long messageCRC64 = applyContentValidation(context);
66+
// return next.process().map(response -> {
67+
// if (messageCRC64 != -1) {
68+
// response.getHeaders().add("test_context_key", String.valueOf(messageCRC64));
69+
// }
70+
// return response;
71+
// });
7272
}
7373

7474
private void applyContentValidation(HttpPipelineCallContext context) {

0 commit comments

Comments
 (0)