Search in sources :

Example 1 with ILogger

use of com.microsoft.graph.logger.ILogger 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());
}
Also used : ILogger(com.microsoft.graph.logger.ILogger) IGraphServiceClient(com.microsoft.graph.models.extensions.IGraphServiceClient) Test(org.junit.Test)

Example 2 with ILogger

use of com.microsoft.graph.logger.ILogger in project msgraph-sdk-java by microsoftgraph.

the class DefaultClientConfigTests method testOverrideLoggerShouldNotThrow.

@Test
public void testOverrideLoggerShouldNotThrow() {
    final ILogger logger = new DefaultLogger();
    DefaultClientConfig config = new DefaultClientConfig() {

        @Override
        public ILogger getLogger() {
            return logger;
        }

        @Override
        public IAuthenticationProvider getAuthenticationProvider() {
            return new MockAuthenticationProvider();
        }
    };
    config.getExecutors();
    config.getAuthenticationProvider();
    config.getHttpProvider();
    config.getSerializer();
    config.getLogger();
}
Also used : MockAuthenticationProvider(com.microsoft.graph.authentication.MockAuthenticationProvider) ILogger(com.microsoft.graph.logger.ILogger) DefaultLogger(com.microsoft.graph.logger.DefaultLogger) Test(org.junit.Test)

Aggregations

ILogger (com.microsoft.graph.logger.ILogger)2 Test (org.junit.Test)2 MockAuthenticationProvider (com.microsoft.graph.authentication.MockAuthenticationProvider)1 DefaultLogger (com.microsoft.graph.logger.DefaultLogger)1 IGraphServiceClient (com.microsoft.graph.models.extensions.IGraphServiceClient)1