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
17 changes: 16 additions & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,24 @@ on:
- feature/v2
pull_request:
types: [opened, synchronize, reopened]

env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

jobs:
checksecret:
name: check if SONAR_TOKEN is set in github secrets
runs-on: ubuntu-latest
outputs:
is_SONAR_TOKEN_set: ${{ steps.checksecret_job.outputs.is_SONAR_TOKEN_set }}
steps:
- name: Check whether unity activation requests should be done
id: checksecret_job
run: |
echo "is_SONAR_TOKEN_set=${{ env.SONAR_TOKEN != '' }}" >> $GITHUB_OUTPUT
build:
needs: [checksecret]
if: needs.checksecret.outputs.is_SONAR_TOKEN_set == 'true'
name: Build
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -37,5 +53,4 @@ jobs:
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew build sonarqube --info
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

### Changed

## [2.0.21] - 2023-11-08

### Changed

- Changed CoreHttpProvider dependency from OkHttpClient to Call.Factory (parent interface implemented by OkHttpClient). This make usage of OpenTelemetry tracing possible.
https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/okhttp/okhttp-3.0/library/README.md

```java
private Call.Factory createTracedClient(OpenTelemetry openTelemetry, @Nonnull final IAuthenticationProvider auth) {
return OkHttpTelemetry.builder(openTelemetry).build().newCallFactory(createClient(auth));
}

private OkHttpClient createClient(@Nonnull final IAuthenticationProvider auth) {
return HttpClients.createDefault(auth);
}

// then create the GraphServiceClient
IAuthenticationProvider authenticationProvider = ...;
GraphServiceClient
.builder(Call.Factory.class, Request.class)
.httpClient(createTracedClient(openTelemetry, authenticationProvider))
.authenticationProvider(authenticationProvider)
.buildClient();
```

## [2.0.20] - 2023-10-23

### Changed
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mavenGroupId = com.microsoft.graph
mavenArtifactId = microsoft-graph-core
mavenMajorVersion = 2
mavenMinorVersion = 0
mavenPatchVersion = 20
mavenPatchVersion = 21
mavenArtifactSuffix =

#These values are used to run functional tests
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/microsoft/graph/core/BaseClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import javax.annotation.Nonnull;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import okhttp3.Call;
import okhttp3.OkHttpClient;
import okhttp3.Request;

Expand Down Expand Up @@ -185,7 +186,7 @@ private httpClientType getHttpClient() {
@SuppressWarnings("unchecked")
private IHttpProvider<nativeRequestType> getHttpProvider() {
if(httpProvider == null) {
return (IHttpProvider<nativeRequestType>)new CoreHttpProvider(getSerializer(), getLogger(), (OkHttpClient)getHttpClient());
return (IHttpProvider<nativeRequestType>)new CoreHttpProvider(getSerializer(), getLogger(), (Call.Factory) getHttpClient());
} else {
return httpProvider;
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/microsoft/graph/http/CoreHttpProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ public class CoreHttpProvider implements IHttpProvider<Request> {
private final ILogger logger;

/**
* The OkHttpClient that handles all requests
* The OkHttpClient(Call.Factory) that handles all requests
*/
private OkHttpClient corehttpClient;
private Call.Factory corehttpClient;

/**
* Creates the CoreHttpProvider
Expand All @@ -112,7 +112,7 @@ public class CoreHttpProvider implements IHttpProvider<Request> {
@SuppressFBWarnings
public CoreHttpProvider(@Nonnull final ISerializer serializer,
@Nonnull final ILogger logger,
@Nonnull final OkHttpClient httpClient) {
@Nonnull final Call.Factory httpClient) {
Objects.requireNonNull(logger, "parameter logger cannot be null");
Objects.requireNonNull(serializer, "parameter serializer cannot be null");
Objects.requireNonNull(httpClient, "parameter httpClient cannot be null");
Expand Down