From 296da52229eb29753cc7487193740a2df5d8736a Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 1 Mar 2021 14:48:52 -0500 Subject: [PATCH 1/4] - code-gen update: large file upload rename --- src/main/java/com/microsoft/graph/models/UploadSession.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/microsoft/graph/models/UploadSession.java b/src/main/java/com/microsoft/graph/models/UploadSession.java index 82941ede77a..2aae3bc60be 100644 --- a/src/main/java/com/microsoft/graph/models/UploadSession.java +++ b/src/main/java/com/microsoft/graph/models/UploadSession.java @@ -22,7 +22,7 @@ /** * The class for the Upload Session. */ -public class UploadSession implements IJsonBackedObject, com.microsoft.graph.concurrency.IUploadSession { +public class UploadSession implements IJsonBackedObject, com.microsoft.graph.tasks.IUploadSession { /** the OData type of the object as returned by the service */ @SerializedName("@odata.type") From e9c03c8ec8a2226be704af3ce2bc70678e0312d3 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 1 Mar 2021 14:49:28 -0500 Subject: [PATCH 2/4] - renames references to large file upload tasks --- .../microsoft/graph/functional/OneDriveTests.java | 13 +++++++------ .../microsoft/graph/functional/OutlookTests.java | 9 +++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/test/java/com/microsoft/graph/functional/OneDriveTests.java b/src/test/java/com/microsoft/graph/functional/OneDriveTests.java index 5420ccd2a82..e9901fbfc28 100644 --- a/src/test/java/com/microsoft/graph/functional/OneDriveTests.java +++ b/src/test/java/com/microsoft/graph/functional/OneDriveTests.java @@ -14,8 +14,9 @@ import org.junit.jupiter.api.Test; import com.google.gson.JsonPrimitive; -import com.microsoft.graph.concurrency.ChunkedUploadProvider; -import com.microsoft.graph.concurrency.IProgressCallback; +import com.microsoft.graph.tasks.LargeFileUploadTask; +import com.microsoft.graph.tasks.LargeFileUploadResult; +import com.microsoft.graph.tasks.IProgressCallback; import com.microsoft.graph.core.ClientException; import com.microsoft.graph.http.CoreHttpProvider; import com.microsoft.graph.models.DriveItem; @@ -60,14 +61,14 @@ public void testLargeFileUpload() throws IOException, InterruptedException { .createUploadSession(DriveItemCreateUploadSessionParameterSet.newBuilder().withItem(new DriveItemUploadableProperties()).build()) .buildRequest() .post(); - ChunkedUploadProvider chunkedUploadProvider = new ChunkedUploadProvider( + LargeFileUploadTask chunkedUploadProvider = new LargeFileUploadTask( uploadSession, testBase.graphClient, uploadFile, fileSize, DriveItem.class); - final DriveItem result = chunkedUploadProvider.upload(0, null, callback); + final LargeFileUploadResult result = chunkedUploadProvider.upload(0, null, callback); assertNotNull(result); } @Test @@ -95,14 +96,14 @@ public void downloadJsonFileFromOneDrive() throws Exception { .buildRequest() .post(); - ChunkedUploadProvider chunkedUploadProvider = new ChunkedUploadProvider( + LargeFileUploadTask chunkedUploadProvider = new LargeFileUploadTask( session, testBase.graphClient, uploadFile, fileSize, DriveItem.class); - final DriveItem result = chunkedUploadProvider.upload(0, null, callback); + final LargeFileUploadResult result = chunkedUploadProvider.upload(0, null, callback); assertNotNull(result); final InputStream stream = testBase.graphClient.me() diff --git a/src/test/java/com/microsoft/graph/functional/OutlookTests.java b/src/test/java/com/microsoft/graph/functional/OutlookTests.java index 5828c07404d..2e01bce790f 100644 --- a/src/test/java/com/microsoft/graph/functional/OutlookTests.java +++ b/src/test/java/com/microsoft/graph/functional/OutlookTests.java @@ -27,8 +27,9 @@ import com.google.gson.JsonObject; -import com.microsoft.graph.concurrency.ChunkedUploadProvider; -import com.microsoft.graph.concurrency.IProgressCallback; +import com.microsoft.graph.tasks.LargeFileUploadTask; +import com.microsoft.graph.tasks.LargeFileUploadResult; +import com.microsoft.graph.tasks.IProgressCallback; import com.microsoft.graph.core.ClientException; import com.microsoft.graph.http.BaseCollectionPage; import com.microsoft.graph.models.Attachment; @@ -320,11 +321,11 @@ public void testSendDraftWithLargeAttachements() throws FileNotFoundException, I .buildRequest() .post(); - ChunkedUploadProvider chunkedUploadProvider = new ChunkedUploadProvider<>(uploadSession, testBase.graphClient, fileStream, + LargeFileUploadTask chunkedUploadProvider = new LargeFileUploadTask<>(uploadSession, testBase.graphClient, fileStream, streamSize, AttachmentItem.class); // Do the upload - final AttachmentItem result = chunkedUploadProvider.upload(0, null, callback); + final LargeFileUploadResult result = chunkedUploadProvider.upload(0, null, callback); assertNotNull(result); //Send the drafted message From f584ead15fd656b6df4332a17ed63b57882baabe Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 1 Mar 2021 15:11:13 -0500 Subject: [PATCH 3/4] - adds upgrade notes for the large file upload task rename --- docs/upgrade-to-v3.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/upgrade-to-v3.md b/docs/upgrade-to-v3.md index 70eb19e7842..346e33c5eac 100644 --- a/docs/upgrade-to-v3.md +++ b/docs/upgrade-to-v3.md @@ -224,6 +224,36 @@ This new version improves the Java API provided to developers. To upgrade your a > Note: the `DeltaCollectionPage` also offers a `getNextPage` method which simplifies iterating through results and removes the need for consumers to directly handle the next link themselves. +### ChunkedUploadProvider renamed to LargeFileUploadTask + +The chunked upload provider has been renamed to larg file upload task and moved from the concurrency package to the tasks package in order to align with SDK design specifications and to clarify the intend of the class. To upgrade your application do the following. + +- Replace any of the following + + ```Java + import com.microsoft.graph.concurrency.ChunkedUploadProvider; + ``` + + By + + ```Java + import com.microsoft.graph.tasks.LargeFileUploadTask; + ``` + +- Replace any of the following + + ```Java + final DriveItem result = chunkedUploadProvider.upload(); + ``` + + By + + ```Java + final LargeFileUploadResult result = largeFileUploadTask.upload(); + ``` + +> Note: The **LargeFileUploadTask** now also provides an **uploadAsync** method to perform uploads in the background. + ## Upgrade guide for non-breaking improvments This section lists out other improvements which are not considered as breaking changes. SDK users are strongly encouraged to take advantage of those new improvements to simplify their code. From c8efc9979b01685d2b89ad1868bdc4d574c9af3a Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 2 Mar 2021 08:29:26 -0500 Subject: [PATCH 4/4] Update docs/upgrade-to-v3.md --- docs/upgrade-to-v3.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/upgrade-to-v3.md b/docs/upgrade-to-v3.md index 346e33c5eac..36a81ac41b9 100644 --- a/docs/upgrade-to-v3.md +++ b/docs/upgrade-to-v3.md @@ -226,7 +226,7 @@ This new version improves the Java API provided to developers. To upgrade your a ### ChunkedUploadProvider renamed to LargeFileUploadTask -The chunked upload provider has been renamed to larg file upload task and moved from the concurrency package to the tasks package in order to align with SDK design specifications and to clarify the intend of the class. To upgrade your application do the following. +The chunked upload provider has been renamed to larg file upload task and moved from the concurrency package to the tasks package in order to align with SDK design specifications and to clarify the intent of the class. To upgrade your application do the following. - Replace any of the following