|  | 
| 38 | 38 | import software.amazon.awssdk.services.s3.model.HeadBucketResponse; | 
| 39 | 39 | 
 | 
| 40 | 40 | import org.apache.hadoop.conf.Configuration; | 
|  | 41 | +import org.apache.hadoop.fs.FSDataInputStream; | 
| 41 | 42 | import org.apache.hadoop.fs.FSDataOutputStream; | 
| 42 | 43 | import org.apache.hadoop.fs.Path; | 
| 43 |  | -import org.apache.hadoop.fs.contract.ContractTestUtils; | 
| 44 | 44 | import org.apache.hadoop.fs.s3a.statistics.impl.EmptyS3AStatisticsContext; | 
| 45 | 45 | import org.apache.hadoop.fs.s3a.test.PublicDatasetTestUtils; | 
| 46 | 46 | 
 | 
| @@ -282,7 +282,7 @@ public void testWithVPCE() throws Throwable { | 
| 282 | 282 |   } | 
| 283 | 283 | 
 | 
| 284 | 284 |   @Test | 
| 285 |  | -  public void testCentralEndpointAndDifferentRegion() throws Throwable { | 
|  | 285 | +  public void testCentralEndpointAndDifferentRegionThanBucket() throws Throwable { | 
| 286 | 286 |     describe("Access public bucket using central endpoint and region " | 
| 287 | 287 |         + "different than that of the public bucket"); | 
| 288 | 288 |     final Configuration conf = getConfiguration(); | 
| @@ -318,7 +318,7 @@ public void testCentralEndpointAndDifferentRegion() throws Throwable { | 
| 318 | 318 |   } | 
| 319 | 319 | 
 | 
| 320 | 320 |   @Test | 
| 321 |  | -  public void testCentralEndpointAndSameRegion() throws Throwable { | 
|  | 321 | +  public void testCentralEndpointAndSameRegionAsBucket() throws Throwable { | 
| 322 | 322 |     describe("Access public bucket using central endpoint and region " | 
| 323 | 323 |         + "same as that of the public bucket"); | 
| 324 | 324 |     final Configuration conf = getConfiguration(); | 
| @@ -354,9 +354,9 @@ public void testCentralEndpointAndSameRegion() throws Throwable { | 
| 354 | 354 |   } | 
| 355 | 355 | 
 | 
| 356 | 356 |   @Test | 
| 357 |  | -  public void testCentralEndpointWithNullRegion() throws Throwable { | 
| 358 |  | -    describe("Create bucket on different region and access it using" | 
| 359 |  | -        + " central endpoint and null region"); | 
|  | 357 | +  public void testCentralEndpointAndNullRegionWithCRUD() throws Throwable { | 
|  | 358 | +    describe("Access the test bucket using central endpoint and" | 
|  | 359 | +        + " null region, perform file system CRUD operations"); | 
| 360 | 360 |     final Configuration conf = getConfiguration(); | 
| 361 | 361 | 
 | 
| 362 | 362 |     final Configuration newConf = new Configuration(conf); | 
| @@ -385,8 +385,27 @@ private void assertOpsUsingNewFs() throws IOException { | 
| 385 | 385 |       out.write(new byte[] {1, 2, 3}); | 
| 386 | 386 |     } | 
| 387 | 387 | 
 | 
| 388 |  | -    ContractTestUtils.assertIsFile(getFileSystem(), srcFilePath); | 
| 389 |  | -    ContractTestUtils.assertIsFile(newFS, srcFilePath); | 
|  | 388 | +    Assertions | 
|  | 389 | +        .assertThat(newFS.exists(srcFilePath)) | 
|  | 390 | +        .describedAs("Existence of file: " + srcFilePath) | 
|  | 391 | +        .isTrue(); | 
|  | 392 | +    Assertions | 
|  | 393 | +        .assertThat(getFileSystem().exists(srcFilePath)) | 
|  | 394 | +        .describedAs("Existence of file: " + srcFilePath) | 
|  | 395 | +        .isTrue(); | 
|  | 396 | + | 
|  | 397 | +    byte[] buffer = new byte[3]; | 
|  | 398 | + | 
|  | 399 | +    try (FSDataInputStream in = newFS.open(srcFilePath)) { | 
|  | 400 | +      Assertions | 
|  | 401 | +          .assertThat(in.read(buffer, 0, 3)) | 
|  | 402 | +          .describedAs("Total bytes read from " + srcFilePath) | 
|  | 403 | +          .isEqualTo(3); | 
|  | 404 | +      Assertions | 
|  | 405 | +          .assertThat(buffer) | 
|  | 406 | +          .describedAs("Contents read from " + srcFilePath) | 
|  | 407 | +          .containsExactly(1, 2, 3); | 
|  | 408 | +    } | 
| 390 | 409 | 
 | 
| 391 | 410 |     newFS.delete(srcDir, true); | 
| 392 | 411 | 
 | 
|  | 
0 commit comments