Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions docs/upgrade-to-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 intent 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<DriveItem> 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
13 changes: 7 additions & 6 deletions src/test/java/com/microsoft/graph/functional/OneDriveTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -60,14 +61,14 @@ public void testLargeFileUpload() throws IOException, InterruptedException {
.createUploadSession(DriveItemCreateUploadSessionParameterSet.newBuilder().withItem(new DriveItemUploadableProperties()).build())
.buildRequest()
.post();
ChunkedUploadProvider<DriveItem> chunkedUploadProvider = new ChunkedUploadProvider<DriveItem>(
LargeFileUploadTask<DriveItem> chunkedUploadProvider = new LargeFileUploadTask<DriveItem>(
uploadSession,
testBase.graphClient,
uploadFile,
fileSize,
DriveItem.class);

final DriveItem result = chunkedUploadProvider.upload(0, null, callback);
final LargeFileUploadResult<DriveItem> result = chunkedUploadProvider.upload(0, null, callback);
assertNotNull(result);
}
@Test
Expand Down Expand Up @@ -95,14 +96,14 @@ public void downloadJsonFileFromOneDrive() throws Exception {
.buildRequest()
.post();

ChunkedUploadProvider<DriveItem> chunkedUploadProvider = new ChunkedUploadProvider<DriveItem>(
LargeFileUploadTask<DriveItem> chunkedUploadProvider = new LargeFileUploadTask<DriveItem>(
session,
testBase.graphClient,
uploadFile,
fileSize,
DriveItem.class);

final DriveItem result = chunkedUploadProvider.upload(0, null, callback);
final LargeFileUploadResult<DriveItem> result = chunkedUploadProvider.upload(0, null, callback);
assertNotNull(result);

final InputStream stream = testBase.graphClient.me()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -320,11 +321,11 @@ public void testSendDraftWithLargeAttachements() throws FileNotFoundException, I
.buildRequest()
.post();

ChunkedUploadProvider<AttachmentItem> chunkedUploadProvider = new ChunkedUploadProvider<>(uploadSession, testBase.graphClient, fileStream,
LargeFileUploadTask<AttachmentItem> chunkedUploadProvider = new LargeFileUploadTask<>(uploadSession, testBase.graphClient, fileStream,
streamSize, AttachmentItem.class);

// Do the upload
final AttachmentItem result = chunkedUploadProvider.upload(0, null, callback);
final LargeFileUploadResult<AttachmentItem> result = chunkedUploadProvider.upload(0, null, callback);
assertNotNull(result);

//Send the drafted message
Expand Down