@@ -931,24 +931,30 @@ public SeekableByteChannel buildChannel(final String key) throws IOException {
931931
932932 @ Test
933933 public void partialGetWithBookOverChunkBoundry () throws IOException , URISyntaxException {
934+ final String DIR_NAME = "largeFiles/" ;
935+ final String FILE_NAME = "lesmis-copies.txt" ;
936+
937+ final Path objPath = ResourceUtils .loadFileResource (DIR_NAME + FILE_NAME );
938+ final long bookSize = Files .size (objPath );
939+
934940 final String bucketName = "partialGetOnBook" ;
935- final Path filePath = Files .createTempFile ("ds3" , "lesmis-copies.txt" );
941+ final Path filePath = Files .createTempFile ("ds3" , FILE_NAME );
936942 LOG .info ("TempFile for partial get of book: " + filePath .toAbsolutePath ().toString ());
937943
938944 try {
939945
940946 HELPERS .ensureBucketExists (bucketName , envDataPolicyId );
941947
942- final List <Ds3Object > putObjects = Lists .newArrayList (new Ds3Object ("lesmis-copies.txt" , 13290604 ));
948+ final List <Ds3Object > putObjects = Lists .newArrayList (new Ds3Object (FILE_NAME , bookSize ));
943949
944950 final Ds3ClientHelpers .Job putJob = HELPERS
945951 .startWriteJob (bucketName , putObjects , WriteJobOptions .create ()
946952 .withMaxUploadSize (PutBulkJobSpectraS3Request .MIN_UPLOAD_SIZE_IN_BYTES ));
947953
948- putJob .transfer (new ResourceObjectPutter ("largeFiles/" ));
954+ putJob .transfer (new ResourceObjectPutter (DIR_NAME ));
949955
950956 final List <Ds3Object > getObjects = Lists .newArrayList ();
951- getObjects .add (new PartialDs3Object ("lesmis-copies.txt" , Range .byLength (1048476 , 200 )));
957+ getObjects .add (new PartialDs3Object (FILE_NAME , Range .byLength (1048476 , 200 )));
952958
953959 final Ds3ClientHelpers .Job getJob = HELPERS .startReadJob (bucketName , getObjects );
954960
@@ -964,7 +970,7 @@ public SeekableByteChannel buildChannel(final String key) throws IOException {
964970 assertThat (Files .size (filePath ), is (200L ));
965971 final String partialFile = new String (Files .readAllBytes (filePath ), Charset .forName ("UTF-8" ));
966972 final String expectedResult = new String (Files .readAllBytes (expectedResultPath ), Charset .forName ("UTF-8" ));
967- assertThat (partialFile , is (expectedResult .substring (0 , expectedResult .length () - 1 ))); // need the trim to remove a newline that is added by the os
973+ assertThat (partialFile , is (expectedResult .substring (0 , expectedResult .length ())));
968974 } finally {
969975 deleteAllContents (client , bucketName );
970976 Files .delete (filePath );
0 commit comments