Skip to content

Commit d37dd4d

Browse files
committed
update testcase.
1 parent f355845 commit d37dd4d

File tree

5 files changed

+28
-7
lines changed

5 files changed

+28
-7
lines changed

src/test/java/com/aliyun/oss/integrationtests/DownloadFileTest.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,19 @@ public void run() {
460460

461461
@Test
462462
public void testDownloadNot4KAlignment() {
463-
final String key = "obj-download-empty-file-wcp";
463+
final String key = "obj-download-not-4k-aligment";
464464

465465
try {
466+
File file = createSampleFile(key, 1024 * 100);
467+
468+
// upload file
469+
UploadFileRequest uploadFileRequest = new UploadFileRequest(bucketName, key);
470+
uploadFileRequest.setUploadFile(file.getAbsolutePath());
471+
472+
UploadFileResult uploadRes = ossClient.uploadFile(uploadFileRequest);
473+
Assert.assertEquals(uploadRes.getMultipartUploadResult().getBucketName(), bucketName);
474+
Assert.assertEquals(uploadRes.getMultipartUploadResult().getKey(), key);
475+
466476
// download file
467477
String filePathNew = key + "-new.txt";
468478
DownloadFileRequest downloadFileRequest = new DownloadFileRequest(bucketName, key);
@@ -481,9 +491,20 @@ public void testDownloadNot4KAlignment() {
481491

482492
@Test
483493
public void testDownload4KAlignment() {
484-
final String key = "obj-download-empty-file-wcp";
494+
final String key = "obj-download-4k-aligment";
485495

486496
try {
497+
498+
File file = createSampleFile(key, 1024 * 100);
499+
500+
// upload file
501+
UploadFileRequest uploadFileRequest = new UploadFileRequest(bucketName, key);
502+
uploadFileRequest.setUploadFile(file.getAbsolutePath());
503+
504+
UploadFileResult uploadRes = ossClient.uploadFile(uploadFileRequest);
505+
Assert.assertEquals(uploadRes.getMultipartUploadResult().getBucketName(), bucketName);
506+
Assert.assertEquals(uploadRes.getMultipartUploadResult().getKey(), key);
507+
487508
// download file
488509
String filePathNew = key + "-new.txt";
489510
DownloadFileRequest downloadFileRequest = new DownloadFileRequest(bucketName, key);

src/test/java/com/aliyun/oss/integrationtests/GetObjectTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ public void testGetObjectWithSpecialChars() {
529529
@Test
530530
public void testGetObjectByUrlsignature() {
531531
final String key = "put-object-by-urlsignature";
532-
final String expirationString = "Sun, 12 Apr 2022 12:00:00 GMT";
532+
final String expirationString = "Sun, 12 Apr 2025 12:00:00 GMT";
533533
final long inputStreamLength = 128 * 1024; //128KB
534534
final long firstByte= inputStreamLength / 2;
535535
final long lastByte = inputStreamLength - 1;

src/test/java/com/aliyun/oss/integrationtests/ObjectWithPrefixSlashTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void testPutObject() {
5555
public void testPutObjectWithSignedUrl() {
5656
final String key = "/abc中/put-object-prefix-slash-by-urlSignature";
5757

58-
final String expirationString = "Sun, 12 Apr 2022 12:00:00 GMT";
58+
final String expirationString = "Sun, 12 Apr 2025 12:00:00 GMT";
5959
final long inputStreamLength = 1024;
6060

6161
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucketName, key, HttpMethod.PUT);

src/test/java/com/aliyun/oss/integrationtests/PutObjectTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ public void testPutObjectByUrlSignature() throws Exception {
350350
final String key = "put-object-by-urlsignature";
351351
final String metaKey0 = "author";
352352
final String metaValue0 = "aliy";
353-
final String expirationString = "Sun, 12 Apr 2022 12:00:00 GMT";
353+
final String expirationString = "Sun, 12 Apr 2025 12:00:00 GMT";
354354
final long inputStreamLength = 128 * 1024; //128KB
355355

356356
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucketName, key, HttpMethod.PUT);

src/test/java/com/aliyun/oss/integrationtests/SignTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public void testPutObjectByUrlSignature() {
142142
String bucket = TestBase.BUCKET_NAME_PREFIX + ticks;
143143
ossClient.createBucket(bucket);
144144

145-
final String expirationString = "Sun, 12 Apr 2022 12:00:00 GMT";
145+
final String expirationString = "Sun, 12 Apr 2025 12:00:00 GMT";
146146
final long inputStreamLength = 128 * 1024; //128KB
147147

148148
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucket, key, HttpMethod.PUT);
@@ -188,7 +188,7 @@ public void testGetObjectByUrlsignature() {
188188
String bucket = TestBase.BUCKET_NAME_PREFIX + ticks;
189189
ossClient.createBucket(bucket);
190190

191-
final String expirationString = "Sun, 12 Apr 2022 12:00:00 GMT";
191+
final String expirationString = "Sun, 12 Apr 2025 12:00:00 GMT";
192192
final long inputStreamLength = 128 * 1024; //128KB
193193
final long firstByte= inputStreamLength / 2;
194194
final long lastByte = inputStreamLength - 1;

0 commit comments

Comments
 (0)