use of com.microsoft.graph.models.extensions.IGraphServiceClient in project msgraph-sdk-java by microsoftgraph.
the class GraphServiceClientTest method testOverrideOfHttpSerializer.
@Test
public void testOverrideOfHttpSerializer() {
IHttpProvider hp = new IHttpProvider() {
@Override
public ISerializer getSerializer() {
return null;
}
@Override
public <Result, BodyType> void send(IHttpRequest request, ICallback<Result> callback, Class<Result> resultClass, BodyType serializable) {
// do nothing
}
@Override
public <Result, BodyType> Result send(IHttpRequest request, Class<Result> resultClass, BodyType serializable) throws ClientException {
return null;
}
@Override
public <Result, BodyType, DeserializeType> Result send(IHttpRequest request, Class<Result> resultClass, BodyType serializable, IStatefulResponseHandler<Result, DeserializeType> handler) throws ClientException {
return null;
}
};
IGraphServiceClient client = //
GraphServiceClient.builder().authenticationProvider(//
auth).httpProvider(//
hp).buildClient();
assertEquals(hp, client.getHttpProvider());
assertEquals(auth, client.getAuthenticationProvider());
assertNotNull(client.getSerializer());
assertNotNull(client.getLogger());
assertNotNull(client.getExecutors());
}
use of com.microsoft.graph.models.extensions.IGraphServiceClient in project msgraph-sdk-java by microsoftgraph.
the class GraphServiceClientTest method testOverrideOfDefaultLogger.
@Test
public void testOverrideOfDefaultLogger() {
ILogger logger = createLogger();
IGraphServiceClient client = //
GraphServiceClient.builder().authenticationProvider(//
auth).logger(//
logger).buildClient();
assertEquals(auth, client.getAuthenticationProvider());
assertNotNull(client.getExecutors());
assertNotNull(client.getHttpProvider());
assertNotNull(client.getLogger());
assertNotNull(client.getSerializer());
assertEquals(logger, ((DefaultHttpProvider) client.getHttpProvider()).getLogger());
assertEquals(logger, ((DefaultSerializer) client.getSerializer()).getLogger());
assertEquals(logger, ((DefaultExecutors) client.getExecutors()).getLogger());
assertEquals(logger, client.getLogger());
}
use of com.microsoft.graph.models.extensions.IGraphServiceClient in project msgraph-sdk-java by microsoftgraph.
the class GraphServiceClientTest method testOverrideOfSerializer.
@Test
public void testOverrideOfSerializer() {
ISerializer serializer = new ISerializer() {
@Override
public <T> String serializeObject(T serializableObject) {
return null;
}
@Override
public <T> T deserializeObject(String inputString, Class<T> clazz, Map<String, List<String>> responseHeaders) {
return null;
}
@Override
public <T> T deserializeObject(String inputString, Class<T> clazz) {
return null;
}
};
IGraphServiceClient client = //
GraphServiceClient.builder().authenticationProvider(//
auth).serializer(//
serializer).buildClient();
assertEquals(serializer, client.getSerializer());
assertEquals(auth, client.getAuthenticationProvider());
assertNotNull(client.getHttpProvider());
assertNotNull(client.getLogger());
assertNotNull(client.getExecutors());
assertEquals(serializer, ((DefaultHttpProvider) client.getHttpProvider()).getSerializer());
}
use of com.microsoft.graph.models.extensions.IGraphServiceClient in project msgraph-sdk-java by microsoftgraph.
the class GraphServiceClientTest method testClientMethodsReturnStuff.
@Test
public void testClientMethodsReturnStuff() {
IGraphServiceClient client = GraphServiceClient.fromConfig(new DefaultClientConfig() {
@Override
public IAuthenticationProvider getAuthenticationProvider() {
return auth;
}
});
assertEquals(auth, client.getAuthenticationProvider());
assertNotNull(client.getExecutors());
assertNotNull(client.getHttpProvider());
assertNotNull(client.getLogger());
assertNotNull(client.getSerializer());
}
use of com.microsoft.graph.models.extensions.IGraphServiceClient in project msgraph-sdk-java by microsoftgraph.
the class GraphServiceClientTest method testOverrideOfDefaultExecutors.
@Test
public void testOverrideOfDefaultExecutors() {
IExecutors ex = new IExecutors() {
@Override
public void performOnBackground(Runnable runnable) {
// do nothing
}
@Override
public <Result> void performOnForeground(Result result, ICallback<Result> callback) {
// do nothing
}
@Override
public <Result> void performOnForeground(int progress, int progressMax, IProgressCallback<Result> callback) {
// do nothing
}
@Override
public <Result> void performOnForeground(ClientException exception, ICallback<Result> callback) {
// do nothing
}
};
IGraphServiceClient client = //
GraphServiceClient.builder().authenticationProvider(//
auth).executors(//
ex).buildClient();
assertEquals(ex, client.getExecutors());
assertEquals(auth, client.getAuthenticationProvider());
assertNotNull(client.getHttpProvider());
assertNotNull(client.getLogger());
assertNotNull(client.getSerializer());
assertEquals(ex, ((DefaultHttpProvider) client.getHttpProvider()).getExecutors());
}
Aggregations