@Test public void testGetOAuth2Accessor_1() throws Exception { final OAuth2Accessor result = GadgetOAuth2TokenStoreTest.gts.getOAuth2Accessor(null, GadgetOAuth2TokenStoreTest.arguments, GadgetOAuth2TokenStoreTest.gadgetUri); Assert.assertNotNull(result); Assert.assertTrue(result.isErrorResponse()); Assert.assertEquals(OAuth2Error.GET_OAUTH2_ACCESSOR_PROBLEM, result.getError()); Assert.assertTrue(result.getErrorContextMessage().startsWith( "OAuth2Accessor missing a param")); }
@Test public void testGetOAuth2Accessor_1() throws Exception { final OAuth2Accessor result = GadgetOAuth2TokenStoreTest.gts.getOAuth2Accessor(null, GadgetOAuth2TokenStoreTest.arguments, GadgetOAuth2TokenStoreTest.gadgetUri); Assert.assertNotNull(result); Assert.assertTrue(result.isErrorResponse()); Assert.assertEquals(OAuth2Error.GET_OAUTH2_ACCESSOR_PROBLEM, result.getError()); Assert.assertTrue(result.getErrorContextMessage().startsWith( "OAuth2Accessor missing a param")); }
@Test public void testGetOAuth2Accessor_2() throws Exception { final OAuth2Accessor result = GadgetOAuth2TokenStoreTest.gts.getOAuth2Accessor( GadgetOAuth2TokenStoreTest.securityToken, GadgetOAuth2TokenStoreTest.arguments, null); Assert.assertNotNull(result); Assert.assertTrue(result.isErrorResponse()); Assert.assertEquals(OAuth2Error.GET_OAUTH2_ACCESSOR_PROBLEM, result.getError()); Assert.assertTrue(result.getErrorContextMessage().startsWith( "OAuth2Accessor missing a param")); }
@Test public void testGetOAuth2Accessor_2() throws Exception { final OAuth2Accessor result = GadgetOAuth2TokenStoreTest.gts.getOAuth2Accessor( GadgetOAuth2TokenStoreTest.securityToken, GadgetOAuth2TokenStoreTest.arguments, null); Assert.assertNotNull(result); Assert.assertTrue(result.isErrorResponse()); Assert.assertEquals(OAuth2Error.GET_OAUTH2_ACCESSOR_PROBLEM, result.getError()); Assert.assertTrue(result.getErrorContextMessage().startsWith( "OAuth2Accessor missing a param")); }
@Test public void testGetOAuth2Accessor_3() throws Exception { final OAuth2Accessor result = GadgetOAuth2TokenStoreTest.gts.getOAuth2Accessor( GadgetOAuth2TokenStoreTest.securityToken, GadgetOAuth2TokenStoreTest.arguments, Uri.parse("bad")); Assert.assertNotNull(result); Assert.assertTrue(result.isErrorResponse()); Assert.assertEquals(OAuth2Error.NO_GADGET_SPEC, result.getError()); Assert.assertTrue(result.getErrorContextMessage().startsWith("gadgetUri =")); }
@Test public void testGetOAuth2Accessor_3() throws Exception { final OAuth2Accessor result = GadgetOAuth2TokenStoreTest.gts.getOAuth2Accessor( GadgetOAuth2TokenStoreTest.securityToken, GadgetOAuth2TokenStoreTest.arguments, Uri.parse("bad")); Assert.assertNotNull(result); Assert.assertTrue(result.isErrorResponse()); Assert.assertEquals(OAuth2Error.NO_GADGET_SPEC, result.getError()); Assert.assertTrue(result.getErrorContextMessage().startsWith("gadgetUri =")); }
private HttpResponse processResponse(final OAuth2Accessor accessor, final HttpResponseBuilder responseBuilder) { final boolean isLogging = BasicOAuth2Request.LOG.isLoggable(); if (isLogging) { BasicOAuth2Request.LOG.entering(BasicOAuth2Request.LOG_CLASS, "processResponse", new Object[] { accessor, responseBuilder == null }); } if (accessor.isErrorResponse() || responseBuilder == null) { return this.sendErrorResponse(accessor.getErrorException(), accessor.getError(), accessor.getErrorContextMessage(), accessor.getErrorUri(), ""); } if (this.responseParams.getAuthorizationUrl() != null) { responseBuilder.setMetadata(OAuth2ResponseParams.APPROVAL_URL, this.responseParams.getAuthorizationUrl()); accessor.setRedirecting(true); } else { accessor.setRedirecting(false); } final HttpResponse ret = responseBuilder.create(); if (isLogging) { BasicOAuth2Request.LOG.exiting(BasicOAuth2Request.LOG_CLASS, "processResponse", "response logged in fetch()"); } return ret; }
accessor.getErrorContextMessage(), accessor.getErrorUri(), accessor, resp, accessor.getErrorException(), this.sendTraceToClient);
this.redirecting = accessor.isRedirecting(); this.error = accessor.getError(); this.errorContextMessage = accessor.getErrorContextMessage(); this.errorException = accessor.getErrorException(); this.errorUri = accessor.getErrorUri();
accessor.getErrorContextMessage(), accessor.getErrorUri(), accessor.getErrorContextMessage()); } else { if (BasicOAuth2Request.haveAccessToken(accessor) != null) {
if (BasicOAuth2Request.LOG.isLoggable()) { BasicOAuth2Request.LOG.log("accessor isErrorResponse", accessor.getErrorContextMessage());