[OLINGO-684] Try a local client for the OAuth test
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/0090e020 Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/0090e020 Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/0090e020 Branch: refs/heads/OLINGO-642_OSGi-Sample Commit: 0090e02075e69378d8c6aa9495a682f4f6277b49 Parents: 7ce457d Author: Christian Amend <[email protected]> Authored: Wed Jun 3 15:45:15 2015 +0200 Committer: Christian Amend <[email protected]> Committed: Wed Jun 3 15:45:15 2015 +0200 ---------------------------------------------------------------------- .../org/apache/olingo/fit/v4/OAuth2TestITCase.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0090e020/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java index d42fc03..f7730e1 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -59,6 +59,13 @@ public class OAuth2TestITCase extends AbstractTestITCase { client.getConfiguration().setHttpClientFactory(new DefaultHttpClientFactory()); } + protected ODataClient getLocalClient() { + ODataClient localClient = ODataClientFactory.getClient(); + localClient.getConfiguration().setHttpClientFactory( + new CXFOAuth2HttpClientFactory(OAUTH2_GRANT_SERVICE_URI, OAUTH2_TOKEN_SERVICE_URI)); + return localClient; + } + protected EdmEnabledODataClient getEdmClient() { if (_edmClient == null) { _edmClient = ODataClientFactory.getEdmEnabledClient(testOAuth2ServiceRootURL); @@ -94,12 +101,12 @@ public class OAuth2TestITCase extends AbstractTestITCase { @Test public void readAsAtom() { - read(client, ODataFormat.ATOM); + read(getLocalClient(), ODataFormat.ATOM); } @Test public void readAsFullJSON() { - read(client, ODataFormat.JSON_FULL_METADATA); + read(getLocalClient(), ODataFormat.JSON_FULL_METADATA); } @Test
