Skip to content

Commit 89a9b6e

Browse files
committed
- removes async suffixes
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
1 parent 28abe7e commit 89a9b6e

11 files changed

Lines changed: 35 additions & 107 deletions

src/main/java/com/microsoft/graph/content/BatchRequestContent.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,14 @@ public BatchRequestContent createNewBatchFromFailedRequests (@Nonnull Map<String
160160
* @return The json content of the batch request as an InputStream.
161161
*/
162162
@Nonnull
163-
public InputStream getBatchRequestContentAsync() {
163+
public InputStream getBatchRequestContent() {
164164
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
165165
try (JsonWriter writer = new JsonWriter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8))) {
166166
writer.beginObject();
167167
writer.name(CoreConstants.BatchRequest.REQUESTS);
168168
writer.beginArray();
169169
for (BatchRequestStep requestStep : this.batchRequestSteps.values()) {
170-
writeBatchRequestStepAsync(requestStep, writer);
170+
writeBatchRequestStep(requestStep, writer);
171171
}
172172
writer.endArray();
173173
writer.endObject();
@@ -181,7 +181,7 @@ public InputStream getBatchRequestContentAsync() {
181181
throw new RuntimeException(e);
182182
}
183183
}
184-
private void writeBatchRequestStepAsync(BatchRequestStep requestStep, JsonWriter writer) {
184+
private void writeBatchRequestStep(BatchRequestStep requestStep, JsonWriter writer) {
185185
try {
186186
Request request = requestStep.getRequest();
187187
writer.beginObject();

src/main/java/com/microsoft/graph/content/BatchResponseContentCollection.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private BatchResponseContent getBatchResponseContaining(@Nonnull String requestI
5151
* @return the response for the request with the given id, null if no response was found.
5252
*/
5353
@Nullable
54-
public Response getResponseByIdAsync(@Nonnull String requestId) {
54+
public Response getResponseById(@Nonnull String requestId) {
5555
Objects.requireNonNull(requestId);
5656
BatchResponseContent response = getBatchResponseContaining(requestId);
5757
return response == null ? null : response.getResponseById(requestId);
@@ -64,7 +64,7 @@ public Response getResponseByIdAsync(@Nonnull String requestId) {
6464
* @param <T> the type of the response.
6565
*/
6666
@Nullable
67-
public <T extends Parsable> T getResponseByIdAsync(@Nonnull String requestId, @Nonnull ResponseHandler handler) {
67+
public <T extends Parsable> T getResponseById(@Nonnull String requestId, @Nonnull ResponseHandler handler) {
6868
Objects.requireNonNull(requestId);
6969
BatchResponseContent response = getBatchResponseContaining(requestId);
7070
return response == null ? null : response.getResponseById(requestId, handler);
@@ -77,7 +77,7 @@ public <T extends Parsable> T getResponseByIdAsync(@Nonnull String requestId, @N
7777
* @param <T> the type of the response.
7878
*/
7979
@Nullable
80-
public <T extends Parsable> T getResponseByIdAsync(@Nonnull String requestId, @Nonnull ParsableFactory<T> factory) {
80+
public <T extends Parsable> T getResponseById(@Nonnull String requestId, @Nonnull ParsableFactory<T> factory) {
8181
Objects.requireNonNull(requestId);
8282
BatchResponseContent response = getBatchResponseContaining(requestId);
8383
return response == null ? null : response.getResponseById(requestId, factory);
@@ -88,7 +88,7 @@ public <T extends Parsable> T getResponseByIdAsync(@Nonnull String requestId, @N
8888
* @return the response for the request with the given id, null if no response was found.
8989
*/
9090
@Nullable
91-
public InputStream getResponseStreamByIdAsync(@Nonnull String requestId) {
91+
public InputStream getResponseStreamById(@Nonnull String requestId) {
9292
BatchResponseContent response = getBatchResponseContaining(requestId);
9393
return response == null ? null : response.getResponseStreamById(requestId);
9494
}
@@ -97,7 +97,7 @@ public InputStream getResponseStreamByIdAsync(@Nonnull String requestId) {
9797
* @return the response codes for all the requests in the batch.
9898
*/
9999
@Nonnull
100-
public HashMap<String, Integer> getResponsesStatusCodesAsync() {
100+
public Map<String, Integer> getResponsesStatusCodes() {
101101
HashMap<String, Integer> statusCodes = new HashMap<>();
102102
for(KeyedBatchResponseContent keyedResponse : batchResponses) {
103103
HashMap<String, Integer> responseStatusCodes = keyedResponse.response.getResponsesStatusCode();

src/main/java/com/microsoft/graph/requests/BatchRequestBuilder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public BatchRequestBuilder(@Nonnull RequestAdapter requestAdapter) {
4343
@Nonnull
4444
public BatchResponseContent post(@Nonnull BatchRequestContent requestContent, @Nullable Map<String, ParsableFactory<? extends Parsable>> errorMappings) {
4545
Objects.requireNonNull(requestContent, ErrorConstants.Messages.NULL_PARAMETER + "requestContent");
46-
RequestInformation requestInfo = toPostRequestInformationAsync(requestContent);
46+
RequestInformation requestInfo = toPostRequestInformation(requestContent);
4747
NativeResponseHandler nativeResponseHandler = new NativeResponseHandler();
4848
requestInfo.setResponseHandler(nativeResponseHandler);
4949
requestAdapter.sendPrimitive(requestInfo, InputStream.class, errorMappings == null ? null : new HashMap<>(errorMappings));
@@ -71,12 +71,12 @@ public BatchResponseContentCollection post(@Nonnull BatchRequestContentCollectio
7171
* @return the request information.
7272
*/
7373
@Nonnull
74-
public RequestInformation toPostRequestInformationAsync(@Nonnull BatchRequestContent requestContent) {
74+
public RequestInformation toPostRequestInformation(@Nonnull BatchRequestContent requestContent) {
7575
Objects.requireNonNull(requestContent, ErrorConstants.Messages.NULL_PARAMETER + "requestContent");
7676
RequestInformation requestInfo = new RequestInformation();
7777
requestInfo.httpMethod = HttpMethod.POST;
7878
requestInfo.urlTemplate = "{+baseurl}/$batch";
79-
requestInfo.content = requestContent.getBatchRequestContentAsync();
79+
requestInfo.content = requestContent.getBatchRequestContent();
8080
requestInfo.headers.add("Content-Type", CoreConstants.MimeTypeNames.APPLICATION_JSON);
8181
return requestInfo;
8282
}

src/main/java/com/microsoft/graph/tasks/LargeFileUploadTask.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,23 +103,21 @@ public LargeFileUploadTask(@Nullable final RequestAdapter requestAdapter,
103103
/**
104104
* Perform the upload task.
105105
* @return An UploadResult model containing the information from the server resulting from the upload request.
106-
* @throws InterruptedException can be thrown when updateSessionStatus() or uploadSliceAsync() is invoked.
107106
* May also occur if interruption occurs in .sleep() call.
108107
*/
109108
@Nonnull
110-
public UploadResult<T> upload() throws InterruptedException {
109+
public UploadResult<T> upload() {
111110
return this.upload(3, null);
112111
}
113112
/**
114113
* Perform the upload task.
115114
* @param maxTries Number of times to retry the task before giving up.
116115
* @param progress IProgress interface describing how to report progress.
117116
* @return An UploadResult model containing the information from the server resulting from the upload request.
118-
* @throws InterruptedException can be thrown when updateSessionStatus() or uploadSliceAsync() is invoked.
119117
* May also occur if interruption occurs in .sleep() call.
120118
*/
121119
@Nonnull
122-
public UploadResult<T> upload(int maxTries, @Nullable IProgressCallback progress) throws InterruptedException {
120+
public UploadResult<T> upload(int maxTries, @Nullable IProgressCallback progress) {
123121
int uploadTries = 0;
124122
ArrayList<Throwable> exceptionsList = new ArrayList<>();
125123
while (uploadTries < maxTries) {
@@ -151,21 +149,19 @@ public UploadResult<T> upload(int maxTries, @Nullable IProgressCallback progress
151149
/**
152150
* Resume the upload task.
153151
* @return An UploadResult model containing the information from the server resulting from the upload request.
154-
@throws InterruptedException can be thrown when updateSessionStatus() or uploadAsync() is invoked.
155152
*/
156153
@Nonnull
157-
public UploadResult<T> resume() throws InterruptedException {
154+
public UploadResult<T> resume() {
158155
return this.resume(3, null);
159156
}
160157
/**
161158
* Resume the upload task.
162159
* @param maxTries Number of times to retry the task before giving up.
163160
* @param progress IProgress interface describing how to report progress.
164161
* @return An UploadResult model containing the information from the server resulting from the upload request.
165-
* @throws InterruptedException can be thrown when updateSessionStatus() or uploadAsync() is invoked.
166162
*/
167163
@Nonnull
168-
public UploadResult<T> resume(int maxTries, @Nullable IProgressCallback progress) throws InterruptedException {
164+
public UploadResult<T> resume(int maxTries, @Nullable IProgressCallback progress) {
169165
IUploadSession session;
170166
session = updateSessionStatus();
171167
OffsetDateTime expirationDateTime = Objects.isNull(session.getExpirationDateTime()) ? OffsetDateTime.now() : session.getExpirationDateTime();
@@ -199,7 +195,7 @@ public IUploadSession updateSessionStatus() {
199195
return session;
200196
}
201197
private boolean firstAttempt;
202-
private UploadResult<T> uploadSlice(UploadSliceRequestBuilder<T> uploadSliceRequestBuilder, ArrayList<Throwable> exceptionsList) throws IOException, ServiceException, ExecutionException, InterruptedException {
198+
private UploadResult<T> uploadSlice(UploadSliceRequestBuilder<T> uploadSliceRequestBuilder, ArrayList<Throwable> exceptionsList) throws IOException, ServiceException {
203199
this.firstAttempt = true;
204200
byte[] buffer = chunkInputStream(uploadStream,(int) uploadSliceRequestBuilder.getRangeBegin(), (int)uploadSliceRequestBuilder.getRangeLength());
205201
ByteArrayInputStream chunkStream = new ByteArrayInputStream(buffer);

src/main/java/com/microsoft/graph/tasks/PageIterator.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ public String getNextLink() {
6969
public PageIteratorState getPageIteratorState() {
7070
return state;
7171
}
72-
/**
73-
* Boolean indicating whether the processPageItemCallback is synchronous or asynchronous
74-
*/
75-
protected boolean isProcessPageItemCallbackAsync;
7672
/**
7773
* Sets the request adapter to use for requests in the page iterator.
7874
* @param requestAdapter the request adapter to use for requests.
@@ -107,7 +103,6 @@ protected void setCurrentPage(@Nonnull TCollectionPage currentPage) {
107103
*/
108104
protected void setProcessPageItemCallback(@Nonnull Function<TEntity, Boolean> processPageItemCallback) {
109105
this.processPageItemCallback = Objects.requireNonNull(processPageItemCallback);
110-
isProcessPageItemCallbackAsync = false;
111106
}
112107
/**
113108
* The queue of items in the current page.

src/test/java/com/microsoft/graph/content/BatchRequestContentTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ void BatchRequestContent_GetBatchRequestContentFromStep() throws Exception {
135135
BatchRequestContent batchRequestContent = new BatchRequestContent(client, Arrays.asList(batchRequestStep, batchRequestStep2));
136136

137137
batchRequestContent.removeBatchRequestStepWithId("1");
138-
InputStream requestContent = batchRequestContent.getBatchRequestContentAsync();
138+
InputStream requestContent = batchRequestContent.getBatchRequestContent();
139139
String requestContentString = readInputStream(requestContent);
140140
requestContentString = requestContentString.replace("\n", "").replaceAll("\\s", "");
141141
String expectedContent = "{\"requests\":[{\"id\":\"2\",\"url\":\"/me\",\"method\":\"GET\"}]}";
@@ -145,7 +145,7 @@ void BatchRequestContent_GetBatchRequestContentFromStep() throws Exception {
145145
assertEquals(expectedContent, requestContentString);
146146
}
147147
@Test
148-
void BatchRequestContent_GetBatchRequestContentFromStepAsyncDoesNotModifyDateTimes() throws Exception {
148+
void BatchRequestContent_GetBatchRequestContentFromStepDoesNotModifyDateTimes() throws Exception {
149149
String bodyString = "{\n" +
150150
" \"subject\": \"Lets go for lunch\",\n" +
151151
" \"body\": {\n \"contentType\": \"HTML\",\n" +
@@ -176,7 +176,7 @@ void BatchRequestContent_GetBatchRequestContentFromStepAsyncDoesNotModifyDateTim
176176
BatchRequestStep batchRequestSte2 = new BatchRequestStep("2", eventRequest, Arrays.asList("1"));
177177
BatchRequestContent batchRequestContent = new BatchRequestContent(client, Arrays.asList(batchRequestStep, batchRequestSte2));
178178

179-
InputStream stream = batchRequestContent.getBatchRequestContentAsync();
179+
InputStream stream = batchRequestContent.getBatchRequestContent();
180180
String requestContentString = readInputStream(stream);
181181
String expectedJson = "{\n" +
182182
" \"requests\": [\n" +
@@ -296,7 +296,7 @@ void BatchRequestContent_AddBatchRequestStepWithBaseRequestWithHeaderOptions() t
296296
assertTrue(batchRequestContent.getBatchRequestSteps().get(requestId).getRequest().headers().size() > 0);
297297
assertNotNull(Objects.requireNonNull(batchRequestContent.getBatchRequestSteps().get(requestId).getRequest().body()).contentType());
298298

299-
InputStream stream = batchRequestContent.getBatchRequestContentAsync();
299+
InputStream stream = batchRequestContent.getBatchRequestContent();
300300
String requestContentString = readInputStream(stream);
301301
String expectedJsonSection = " \"url\": \"/me\"," +
302302
" \"method\": \"POST\"," +
@@ -347,7 +347,7 @@ void BatchRequestContent_AddBatchRequestStepWithBaseRequestProperlySetsVersion(A
347347
assertTrue(batchRequestContent.getBatchRequestSteps().isEmpty());
348348

349349
batchRequestContent.addBatchRequestStep(batchRequestStep);
350-
InputStream stream = batchRequestContent.getBatchRequestContentAsync();
350+
InputStream stream = batchRequestContent.getBatchRequestContent();
351351
String requestContentString = readInputStream(stream);
352352
String expectedJson = "{" +
353353
" \"requests\": [" +

src/test/java/com/microsoft/graph/content/BatchResponseContentTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class BatchResponseContentTest {
2323
Response.Builder defaultBuilder = new Response.Builder().protocol(Protocol.HTTP_1_1).message("Message").request(mock(Request.class));
2424

2525
@Test
26-
void BatchResponseContent_InitializeWithNoContentAsync() {
26+
void BatchResponseContent_InitializeWithNoContent() {
2727
Response response = defaultBuilder.code(HttpURLConnection.HTTP_BAD_REQUEST).build();
2828
BatchResponseContent batchResponseContent = new BatchResponseContent(response);
2929
HashMap<String, Response> responses = batchResponseContent.getResponses();
@@ -33,7 +33,7 @@ void BatchResponseContent_InitializeWithNoContentAsync() {
3333
assertEquals(0,responses.size());
3434
}
3535
@Test
36-
void BatchResponseContent_InitializeWithEmptyResponseContentAsync() {
36+
void BatchResponseContent_InitializeWithEmptyResponseContent() {
3737
String jsonResponse = "{ \"responses\": [] }";
3838
ResponseBody responseBody = ResponseBody.create(jsonResponse,MediaType.get("application/json"));
3939
Response response = defaultBuilder.code(HttpURLConnection.HTTP_BAD_REQUEST).body(responseBody).build();
@@ -53,7 +53,7 @@ void BatchResponseContent_InitializeWithNullResponseMessage() {
5353
}
5454
}
5555
@Test
56-
void BatchResponseContent_GetResponsesAsync() {
56+
void BatchResponseContent_GetResponses() {
5757
String responseJSON = "{\"responses\":"
5858
+"[{"
5959
+"\"id\": \"1\","
@@ -87,7 +87,7 @@ void BatchResponseContent_GetResponsesAsync() {
8787
assertEquals(HttpURLConnection.HTTP_CREATED, responses.get("3").code());
8888
}
8989
@Test
90-
void BatchResponseContent_GetResponseByIdAsync() {
90+
void BatchResponseContent_GetResponseById() {
9191
String responseJSON = "{\"responses\":"
9292
+ "[{"
9393
+ "\"id\": \"1\","
@@ -145,7 +145,7 @@ void BatchResponseContent_GetResponseByIdAsync() {
145145
assertNull(batchResponseContent.getResponseById("4").join());
146146
}
147147
@Test
148-
void BatchResponseContent_GetResponseStreamByIdAsync() throws IOException {
148+
void BatchResponseContent_GetResponseStreamById() throws IOException {
149149
String responseJSON = "{"+
150150
"\"responses\": [" +
151151
"{" +
@@ -188,7 +188,7 @@ void BatchResponseContent_GetResponseStreamByIdAsync() throws IOException {
188188
assertTrue(stream.available() > 0);
189189
}
190190
@Test
191-
void BatchResponseContent_GetResponseByIdAsyncWithDeserializer() {
191+
void BatchResponseContent_GetResponseByIdWithDeserializer() {
192192
registry.contentTypeAssociatedFactories.put(CoreConstants.MimeTypeNames.APPLICATION_JSON, new JsonParseNodeFactory());
193193
String responseJSON = "{\"responses\":"
194194
+ "[{"
@@ -246,7 +246,7 @@ void BatchResponseContent_GetResponseByIdAsyncWithDeserializer() {
246246
assertNull(nonExistingNotebook);
247247
}
248248
@Test
249-
void BatchResponseContent_GetResponseByIdAsyncWithDeserializerWorksWithDateTimeOffsets() {
249+
void BatchResponseContent_GetResponseByIdWithDeserializerWorksWithDateTimeOffsets() {
250250
registry.contentTypeAssociatedFactories.put(CoreConstants.MimeTypeNames.APPLICATION_JSON, new JsonParseNodeFactory());
251251
String responseJSON = "{\n" +
252252
" \"responses\": [\n" +

src/test/java/com/microsoft/graph/requests/BatchRequestBuilderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void BatchRequestBuilder_DefaultBuilderTest() {
2929
BatchRequestStep batchRequestStep2 = new BatchRequestStep("2", request2, Arrays.asList("1"));
3030

3131
BatchRequestContent batchRequestContent = new BatchRequestContent(client,Arrays.asList(batchRequestStep, batchRequestStep2));
32-
RequestInformation requestInformation = batchRequestBuilder.toPostRequestInformationAsync(batchRequestContent);
32+
RequestInformation requestInformation = batchRequestBuilder.toPostRequestInformation(batchRequestContent);
3333

3434
assertEquals("{+baseurl}/$batch", requestInformation.urlTemplate);
3535
assertEquals(client.getRequestAdapter(), batchRequestBuilder.getRequestAdapter());

src/test/java/com/microsoft/graph/requests/upload/UploadResponseHandlerTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class UploadResponseHandlerTest {
2424
ParseNodeFactoryRegistry registry = defaultInstance;
2525

2626
@Test
27-
void GetUploadItemOnCompletedUpload() throws ExecutionException, InterruptedException {
27+
void GetUploadItemOnCompletedUpload() {
2828
registry.contentTypeAssociatedFactories.put(CoreConstants.MimeTypeNames.APPLICATION_JSON, new JsonParseNodeFactory());
2929

3030
UploadResponseHandler responseHandler = new UploadResponseHandler(null);
@@ -52,7 +52,7 @@ void GetUploadItemOnCompletedUpload() throws ExecutionException, InterruptedExce
5252
assertEquals(33, item.size);
5353
}
5454
@Test
55-
void GetFileAttachmentLocationOnCompletedUpload() throws ExecutionException, InterruptedException {
55+
void getFileAttachmentLocationOnCompletedUpload() {
5656
registry.contentTypeAssociatedFactories.put(CoreConstants.MimeTypeNames.APPLICATION_JSON, new JsonParseNodeFactory());
5757

5858
UploadResponseHandler responseHandler = new UploadResponseHandler(null);
@@ -73,7 +73,7 @@ void GetFileAttachmentLocationOnCompletedUpload() throws ExecutionException, Int
7373
assertEquals("http://localhost", result.location.toString());
7474
}
7575
@Test
76-
void GetUploadSessionOnProgressingUpload() throws ExecutionException, InterruptedException {
76+
void getUploadSessionOnProgressingUpload() {
7777
registry.contentTypeAssociatedFactories.put(CoreConstants.MimeTypeNames.APPLICATION_JSON, new JsonParseNodeFactory());
7878

7979
UploadResponseHandler responseHandler = new UploadResponseHandler(null);
@@ -106,7 +106,7 @@ void GetUploadSessionOnProgressingUpload() throws ExecutionException, Interrupte
106106
assertEquals(2, session.getNextExpectedRanges().size());
107107
}
108108
@Test
109-
void ThrowsServiceExceptionOnErrorResponse() throws InterruptedException {
109+
void throwsServiceExceptionOnErrorResponse() {
110110
UploadResponseHandler responseHandler = new UploadResponseHandler(null);
111111
ResponseBody body = ResponseBody.create("{\n" +
112112
" \"error\": {\n"+
@@ -137,7 +137,7 @@ void ThrowsServiceExceptionOnErrorResponse() throws InterruptedException {
137137
}
138138
}
139139
@Test
140-
void ThrowsSerializationErrorOnInvalidJson() throws InterruptedException {
140+
void throwsSerializationErrorOnInvalidJson() {
141141
UploadResponseHandler responseHandler = new UploadResponseHandler(null);
142142
String malformedResponse =
143143
" \"error\": {\n"+

0 commit comments

Comments
 (0)