Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8f4383a
- removes defaulthttpprovider
baywet Sep 8, 2020
2f89eb2
- adds mockito
baywet Sep 8, 2020
8a1978d
- removes useless mock objects
baywet Sep 9, 2020
7abc520
- removes useless interface
baywet Sep 9, 2020
76a86ac
Merge branch 'dev' into bugfix/http-provider-disambiguation
baywet Sep 9, 2020
0bdacc8
Merge remote-tracking branch 'origin/dev' into bugfix/http-provider-d…
baywet Sep 9, 2020
45ad44e
- typo fix
baywet Sep 9, 2020
e9bc9db
Merge branch 'dev' into bugfix/http-provider-disambiguation
baywet Sep 14, 2020
29d474a
- merges latest dev changes
baywet Sep 15, 2020
3fd2e0e
Merge branch 'dev' into bugfix/http-provider-disambiguation
baywet Sep 21, 2020
6336f3c
Merge branch 'dev' into bugfix/http-provider-disambiguation
baywet Sep 24, 2020
398ec57
Merge branch 'feature/v3' into bugfix/http-provider-disambiguation
baywet Oct 5, 2020
8e5dad1
- removes IauthenticationProvider from codebase
baywet Oct 5, 2020
29546cd
- replaces reference to defaultHttpProvider
baywet Oct 6, 2020
703c5ca
- removes IClientConfig infrastructure
baywet Oct 6, 2020
50e918b
- replaces stream to string implementation by existing one
baywet Oct 6, 2020
440d6e9
- linting
baywet Oct 6, 2020
0a56450
Merge branch 'feature/v3' into bugfix/http-provider-disambiguation
baywet Oct 6, 2020
0df9e36
- moves non code gen files outside of generation directories
baywet Oct 6, 2020
ad6ef9f
- moves manually created chunk upload files outside of generation folder
baywet Oct 7, 2020
5cd2043
- moves custom request builder outside of code-gen folders
baywet Oct 7, 2020
d32edfb
- moves dateonly, timeoftheday and multipart outside of codegen paths
baywet Oct 7, 2020
88e27de
- code-gen updates dateOnly and timeofday references
baywet Oct 7, 2020
de563bd
- updates unit tests after moving multipart, dateonly and timeofday
baywet Oct 7, 2020
f69f030
Update src/main/java/com/microsoft/graph/http/CoreHttpProvider.java
baywet Oct 7, 2020
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
4 changes: 1 addition & 3 deletions 4 .azure-pipelines/generate-v1.0-models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,9 @@ steps:
$mainDir = Join-Path $env:repoDir "\src\main\"
$extensionsAndGeneratedDirectories = Get-ChildItem $mainDir -Include extensions,generated -Recurse -Directory

# this list should be updated if a new hand-crafted extension is added to one of the extensions/ directories
$filesThatShouldNotBeDeleted = "UploadSession.java","DateOnly.java","TimeOfDay.java","Multipart.java","ChunkedUploadRequest.java","ChunkedUploadResult.java","CustomRequestBuilder.java"
foreach ($directory in $extensionsAndGeneratedDirectories)
{
Remove-Item $directory.FullName -Recurse -Force -Exclude $filesThatShouldNotBeDeleted
Remove-Item $directory.FullName -Recurse -Force
}
Write-Host "Removed the existing generated files in the repo's main directory: $mainDir" -ForegroundColor Green
enabled: true # The old GUI pipeline wasn't doing this. I recall that there was a reason
Expand Down
1 change: 1 addition & 0 deletions 1 build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ dependencies {

// Use JUnit test framework
testImplementation 'junit:junit:4.13'
testImplementation 'org.mockito:mockito-inline:+'

api 'com.google.code.gson:gson:2.8.6'

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

import com.microsoft.graph.concurrency.ChunkedUploadResponseHandler;
import com.microsoft.graph.concurrency.IProgressCallback;
import com.microsoft.graph.requests.extensions.ChunkedUploadRequest;
import com.microsoft.graph.requests.extensions.ChunkedUploadResult;
import com.microsoft.graph.models.extensions.IGraphServiceClient;
import com.microsoft.graph.concurrency.ChunkedUploadRequest;
import com.microsoft.graph.concurrency.ChunkedUploadResult;
import com.microsoft.graph.core.IGraphServiceClient;
import com.microsoft.graph.models.extensions.UploadSession;
import com.microsoft.graph.options.Option;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------

package com.microsoft.graph.requests.extensions;
package com.microsoft.graph.concurrency;

import java.util.List;

import com.microsoft.graph.concurrency.ChunkedUploadResponseHandler;
import com.microsoft.graph.core.ClientException;
import com.microsoft.graph.http.BaseRequest;
import com.microsoft.graph.http.HttpMethod;
import com.microsoft.graph.models.extensions.IGraphServiceClient;
import com.microsoft.graph.core.IGraphServiceClient;
import com.microsoft.graph.options.Option;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,17 @@
import java.io.InputStream;
import java.util.Map;

import com.microsoft.graph.http.CoreHttpProvider;
import com.microsoft.graph.core.Constants;
import com.microsoft.graph.http.DefaultHttpProvider;
import com.microsoft.graph.http.GraphServiceException;
import com.microsoft.graph.core.ClientException;
import com.microsoft.graph.http.HttpResponseCode;
import com.microsoft.graph.http.HttpResponseHeadersHelper;
import com.microsoft.graph.http.IConnection;
import com.microsoft.graph.http.IHttpRequest;
import com.microsoft.graph.http.IStatefulResponseHandler;
import com.microsoft.graph.logger.ILogger;
import com.microsoft.graph.models.extensions.UploadSession;
import com.microsoft.graph.requests.extensions.ChunkedUploadResult;
import com.microsoft.graph.concurrency.ChunkedUploadResult;
import com.microsoft.graph.serializer.ISerializer;

import okhttp3.Response;
Expand Down Expand Up @@ -66,16 +65,6 @@ public ChunkedUploadResponseHandler(final Class<UploadType> uploadType) {
this.deserializeTypeClass = uploadType;
}

/**
* Do nothing before getting the response
*
* @param connection the connection
*/
@Override
public void configConnection(final IConnection connection) {
return;
}

/**
* Do nothing before getting the response
*
Expand All @@ -85,62 +74,6 @@ public void configConnection(final IConnection connection) {
public void configConnection(final Response response) {
return;
}

/**
* Generate the chunked upload response result
*
* @param request the HTTP request
* @param connection the HTTP connection
* @param serializer the serializer
* @param logger the system logger
* @return the chunked upload result, which could be either an uploaded item or error
* @throws Exception an exception occurs if the request was unable to complete for any reason
*/
@Override
public ChunkedUploadResult<UploadType> generateResult(
final IHttpRequest request,
final IConnection connection,
final ISerializer serializer,
final ILogger logger) throws Exception {
InputStream in = null;

try {
if (connection.getResponseCode() == HttpResponseCode.HTTP_ACCEPTED) {
logger.logDebug("Chunk bytes has been accepted by the server.");
in = new BufferedInputStream(connection.getInputStream());
final UploadSession session = serializer.deserializeObject(
DefaultHttpProvider.streamToString(in), UploadSession.class);

return new ChunkedUploadResult<UploadType>(session);

} else if (connection.getResponseCode() == HttpResponseCode.HTTP_CREATED
|| connection.getResponseCode() == HttpResponseCode.HTTP_OK) {
logger.logDebug("Upload session is completed, uploaded item returned.");
in = new BufferedInputStream(connection.getInputStream());
String rawJson = DefaultHttpProvider.streamToString(in);
UploadType uploadedItem = serializer.deserializeObject(rawJson,
this.deserializeTypeClass);

return new ChunkedUploadResult<UploadType>(uploadedItem);
} else if (connection.getResponseCode() >= HttpResponseCode.HTTP_CLIENT_ERROR) {
logger.logDebug("Receiving error during upload, see detail on result error");

return new ChunkedUploadResult<UploadType>(
GraphServiceException.createFromConnection(request, null, serializer,
connection, logger));
}
} finally {
if (in != null) {
try{
in.close();
} catch(IOException e) {
logger.logError(e.getMessage(), e);
}
}
}

return null;
}

/**
* Generate the chunked upload response result
Expand All @@ -158,23 +91,21 @@ public ChunkedUploadResult<UploadType> generateResult(
final Response response,
final ISerializer serializer,
final ILogger logger) throws Exception {
InputStream in = null;
try {
if (response.code() >= HttpResponseCode.HTTP_CLIENT_ERROR) {
logger.logDebug("Receiving error during upload, see detail on result error");

return new ChunkedUploadResult<UploadType>(
GraphServiceException.createFromConnection(request, null, serializer,
response, logger));
} else if (response.code() >= HttpResponseCode.HTTP_OK
&& response.code() < HttpResponseCode.HTTP_MULTIPLE_CHOICES) {
final Map<String, String> headers = responseHeadersHelper.getResponseHeadersAsMapStringString(response);
final String contentType = headers.get(Constants.CONTENT_TYPE_HEADER_NAME);
final String location = headers.get("Location");
if(contentType != null
&& contentType.contains(Constants.JSON_CONTENT_TYPE)) {
in = new BufferedInputStream(response.body().byteStream());
final String rawJson = DefaultHttpProvider.streamToString(in);
if (response.code() >= HttpResponseCode.HTTP_CLIENT_ERROR) {
logger.logDebug("Receiving error during upload, see detail on result error");

return new ChunkedUploadResult<UploadType>(
GraphServiceException.createFromResponse(request, null, serializer,
response, logger));
} else if (response.code() >= HttpResponseCode.HTTP_OK
&& response.code() < HttpResponseCode.HTTP_MULTIPLE_CHOICES) {
final Map<String, String> headers = responseHeadersHelper.getResponseHeadersAsMapStringString(response);
final String contentType = headers.get(Constants.CONTENT_TYPE_HEADER_NAME);
final String location = headers.get("Location");
if(contentType != null
&& contentType.contains(Constants.JSON_CONTENT_TYPE)) {
try (final InputStream in = new BufferedInputStream(response.body().byteStream())) {
final String rawJson = CoreHttpProvider.streamToString(in);
final UploadSession session = serializer.deserializeObject(rawJson, UploadSession.class);
if(session == null || session.nextExpectedRanges == null) {
logger.logDebug("Upload session is completed (ODSP), uploaded item returned.");
Expand All @@ -184,20 +115,12 @@ public ChunkedUploadResult<UploadType> generateResult(
logger.logDebug("Chunk bytes has been accepted by the server.");
return new ChunkedUploadResult<UploadType>(session);
}
} else if(location != null) {
logger.logDebug("Upload session is completed (Outlook), uploaded item returned.");
return new ChunkedUploadResult<UploadType>(this.deserializeTypeClass.getDeclaredConstructor().newInstance());
} else {
logger.logDebug("Upload session returned an unexpected response");
}
}
} finally {
if (in != null) {
try{
in.close();
} catch(IOException e) {
logger.logError(e.getMessage(), e);
}
} else if(location != null) {
logger.logDebug("Upload session is completed (Outlook), uploaded item returned.");
return new ChunkedUploadResult<UploadType>(this.deserializeTypeClass.getDeclaredConstructor().newInstance());
} else {
logger.logDebug("Upload session returned an unexpected response");
}
}
return new ChunkedUploadResult<UploadType>(new ClientException("Received an unexpected response from the service, response code: " + response.code(), null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------

package com.microsoft.graph.requests.extensions;
package com.microsoft.graph.concurrency;

import com.microsoft.graph.core.ClientException;
import com.microsoft.graph.http.GraphServiceException;
Expand Down
30 changes: 0 additions & 30 deletions 30 src/main/java/com/microsoft/graph/core/BaseClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

package com.microsoft.graph.core;

import com.microsoft.graph.authentication.IAuthenticationProvider;
import com.microsoft.graph.concurrency.IExecutors;
import com.microsoft.graph.http.IHttpProvider;
import com.microsoft.graph.logger.ILogger;
Expand All @@ -32,12 +31,6 @@
* A client that communications with an OData service
*/
public abstract class BaseClient implements IBaseClient {

/**
* The authentication provider instance
*/
private IAuthenticationProvider authenticationProvider;

/**
* The executors instance
*/
Expand All @@ -58,16 +51,6 @@ public abstract class BaseClient implements IBaseClient {
*/
private ISerializer serializer;

/**
* Gets the authentication provider
*
* @return The authentication provider
*/
@Override
public IAuthenticationProvider getAuthenticationProvider() {
return authenticationProvider;
}

/**
* Gets the executors
*
Expand Down Expand Up @@ -112,10 +95,6 @@ public ISerializer getSerializer() {
*/
@Override
public void validate() {
if (authenticationProvider == null) {
throw new NullPointerException("AuthenticationProvider");
}

if (executors == null) {
throw new NullPointerException("Executors");
}
Expand Down Expand Up @@ -147,15 +126,6 @@ protected void setExecutors(final IExecutors executors) {
this.executors = executors;
}

/**
* Sets the authentication provider
*
* @param authenticationProvider The authentication provider
*/
protected void setAuthenticationProvider(final IAuthenticationProvider authenticationProvider) {
this.authenticationProvider = authenticationProvider;
}

/**
* Sets the HTTP provider
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.microsoft.graph.requests.extensions;
package com.microsoft.graph.core;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.microsoft.graph.models.extensions;
package com.microsoft.graph.core;


import java.text.ParseException;
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.