Search in sources :

Example 1 with IExecutors

use of com.microsoft.graph.concurrency.IExecutors 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());
}
Also used : ICallback(com.microsoft.graph.concurrency.ICallback) IExecutors(com.microsoft.graph.concurrency.IExecutors) ClientException(com.microsoft.graph.core.ClientException) IProgressCallback(com.microsoft.graph.concurrency.IProgressCallback) IGraphServiceClient(com.microsoft.graph.models.extensions.IGraphServiceClient) Test(org.junit.Test)

Aggregations

ICallback (com.microsoft.graph.concurrency.ICallback)1 IExecutors (com.microsoft.graph.concurrency.IExecutors)1 IProgressCallback (com.microsoft.graph.concurrency.IProgressCallback)1 ClientException (com.microsoft.graph.core.ClientException)1 IGraphServiceClient (com.microsoft.graph.models.extensions.IGraphServiceClient)1 Test (org.junit.Test)1