Search in sources :

Example 1 with MockAuthenticationProvider

use of com.microsoft.graph.authentication.MockAuthenticationProvider in project msgraph-sdk-java by microsoftgraph.

the class BaseRequestTests method setUp.

@Before
public void setUp() throws Exception {
    mAuthenticationProvider = new MockAuthenticationProvider();
    mBaseClient = new MockBaseClient();
    final ITestConnectionData data = new ITestConnectionData() {

        @Override
        public int getRequestCode() {
            return 200;
        }

        @Override
        public String getJsonResponse() {
            return "{ \"id\": \"zzz\" }";
        }

        @Override
        public Map<String, String> getHeaders() {
            final HashMap<String, String> map = new HashMap<>();
            map.put("Content-Type", "application/json");
            return map;
        }
    };
    MockHttpProvider mProvider = new MockHttpProvider(new MockSerializer(null, ""), mAuthenticationProvider, new MockExecutors(), new MockLogger());
    mProvider.setConnectionFactory(new MockConnectionFactory(new MockConnection(data)));
    mBaseClient.setHttpProvider(mProvider);
    request = new BaseRequest("https://a.b.c", mBaseClient, null, null) {
    };
}
Also used : MockSerializer(com.microsoft.graph.serializer.MockSerializer) HashMap(java.util.HashMap) MockBaseClient(com.microsoft.graph.core.MockBaseClient) MockExecutors(com.microsoft.graph.concurrency.MockExecutors) MockLogger(com.microsoft.graph.logger.MockLogger) MockAuthenticationProvider(com.microsoft.graph.authentication.MockAuthenticationProvider) Before(org.junit.Before)

Example 2 with MockAuthenticationProvider

use of com.microsoft.graph.authentication.MockAuthenticationProvider in project msgraph-sdk-java by microsoftgraph.

the class DefaultClientConfigTests method setUp.

@Before
public void setUp() throws Exception {
    mAuthenticationProvider = new MockAuthenticationProvider();
    mClientConfig = DefaultClientConfig.createWithAuthenticationProvider(mAuthenticationProvider);
}
Also used : MockAuthenticationProvider(com.microsoft.graph.authentication.MockAuthenticationProvider) Before(org.junit.Before)

Example 3 with MockAuthenticationProvider

use of com.microsoft.graph.authentication.MockAuthenticationProvider in project msgraph-sdk-java by microsoftgraph.

the class BaseStreamRequestTests method setUp.

@Before
public void setUp() throws Exception {
    mAuthenticationProvider = new MockAuthenticationProvider();
    mBaseClient = new MockBaseClient();
}
Also used : MockAuthenticationProvider(com.microsoft.graph.authentication.MockAuthenticationProvider) MockBaseClient(com.microsoft.graph.core.MockBaseClient) Before(org.junit.Before)

Example 4 with MockAuthenticationProvider

use of com.microsoft.graph.authentication.MockAuthenticationProvider in project msgraph-sdk-java by microsoftgraph.

the class BaseCollectionRequestTests method setUp.

@Before
public void setUp() throws Exception {
    mAuthenticationProvider = new MockAuthenticationProvider();
    mBaseClient = new MockBaseClient();
    final ITestConnectionData data = new ITestConnectionData() {

        @Override
        public int getRequestCode() {
            return 200;
        }

        @Override
        public String getJsonResponse() {
            return "{ \"id\": \"zzz\" }";
        }

        @Override
        public Map<String, String> getHeaders() {
            final HashMap<String, String> map = new HashMap<>();
            map.put("Content-Type", "application/json");
            return map;
        }
    };
    MockHttpProvider mProvider = new MockHttpProvider(new MockSerializer(null, ""), mAuthenticationProvider, new MockExecutors(), new MockLogger());
    mProvider.setConnectionFactory(new MockConnectionFactory(new MockConnection(data)));
    mBaseClient.setHttpProvider(mProvider);
    request = new BaseCollectionRequest<JsonObject, String>("https://a.b.c", mBaseClient, null, JsonObject.class, null) {
    };
}
Also used : MockSerializer(com.microsoft.graph.serializer.MockSerializer) HashMap(java.util.HashMap) MockBaseClient(com.microsoft.graph.core.MockBaseClient) MockExecutors(com.microsoft.graph.concurrency.MockExecutors) JsonObject(com.google.gson.JsonObject) MockLogger(com.microsoft.graph.logger.MockLogger) MockAuthenticationProvider(com.microsoft.graph.authentication.MockAuthenticationProvider) Before(org.junit.Before)

Example 5 with MockAuthenticationProvider

use of com.microsoft.graph.authentication.MockAuthenticationProvider in project msgraph-sdk-java by microsoftgraph.

the class BaseClientTests method setUp.

@Before
public void setUp() throws Exception {
    baseClient = new BaseClient() {

        @Override
        public String getServiceRoot() {
            return mEndpoint;
        }

        @Override
        public void setServiceRoot(String value) {
            mEndpoint = value;
        }
    };
    mAuthenticationProvider = new MockAuthenticationProvider();
    mExecutors = new MockExecutors();
    mHttpProvider = new MockHttpProvider();
    mLogger = new MockLogger();
    mSerializer = new MockSerializer(null, "");
}
Also used : MockSerializer(com.microsoft.graph.serializer.MockSerializer) MockLogger(com.microsoft.graph.logger.MockLogger) MockAuthenticationProvider(com.microsoft.graph.authentication.MockAuthenticationProvider) MockExecutors(com.microsoft.graph.concurrency.MockExecutors) MockHttpProvider(com.microsoft.graph.http.MockHttpProvider) Before(org.junit.Before)

Aggregations

MockAuthenticationProvider (com.microsoft.graph.authentication.MockAuthenticationProvider)7 Before (org.junit.Before)5 MockExecutors (com.microsoft.graph.concurrency.MockExecutors)4 MockLogger (com.microsoft.graph.logger.MockLogger)4 MockSerializer (com.microsoft.graph.serializer.MockSerializer)4 MockBaseClient (com.microsoft.graph.core.MockBaseClient)3 HashMap (java.util.HashMap)3 JsonObject (com.google.gson.JsonObject)2 Test (org.junit.Test)2 JsonPrimitive (com.google.gson.JsonPrimitive)1 GraphErrorCodes (com.microsoft.graph.core.GraphErrorCodes)1 MockHttpProvider (com.microsoft.graph.http.MockHttpProvider)1 DefaultLogger (com.microsoft.graph.logger.DefaultLogger)1 ILogger (com.microsoft.graph.logger.ILogger)1