private OAuth2Accessor getAccessorInternal() { OAuth2Accessor ret = null; if (this.fetcherConfig != null) { final GadgetOAuth2TokenStore tokenStore = this.fetcherConfig.getTokenStore(); if (tokenStore != null) { ret = tokenStore.getOAuth2Accessor(this.securityToken, this.arguments, this.realRequest.getGadget()); } } return ret; }
/** * @return the store with persisted client and token information */ public OAuth2Store getOAuth2Store() { return this.tokenStore.getOAuth2Store(); }
@Test public void testIsViewerAccessTokensEnabled_2() throws Exception { final OAuth2FetcherConfig fixture = new OAuth2FetcherConfig(new GadgetOAuth2TokenStore( EasyMock.createNiceMock(OAuth2Store.class), EasyMock.createNiceMock(GadgetSpecFactory.class)), false); final boolean result = fixture.isViewerAccessTokensEnabled(); Assert.assertEquals(false, result); } }
final GadgetSpec spec = this.findSpec(securityToken, arguments, gadgetUri); final OAuth2Spec oauthSpec = spec.getModulePrefs().getOAuth2Spec(); if (oauthSpec == null) {
specInfo = this.lookupSpecInfo(securityToken, arguments, gadgetUri); } catch (final OAuth2RequestException e1) { if (isLogging) {
@Test public void testIsViewerAccessTokensEnabled_2() throws Exception { final OAuth2FetcherConfig fixture = new OAuth2FetcherConfig(new GadgetOAuth2TokenStore( EasyMock.createNiceMock(OAuth2Store.class), EasyMock.createNiceMock(GadgetSpecFactory.class)), false); final boolean result = fixture.isViewerAccessTokensEnabled(); Assert.assertEquals(false, result); } }
@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 testGetTokenStore_1() throws Exception { final OAuth2FetcherConfig fixture = new OAuth2FetcherConfig(new GadgetOAuth2TokenStore( EasyMock.createNiceMock(OAuth2Store.class), EasyMock.createNiceMock(GadgetSpecFactory.class)), true); final GadgetOAuth2TokenStore result = fixture.getTokenStore(); Assert.assertNotNull(result); }
@Test public void testGetOAuth2Store_1() throws Exception { final OAuth2Store result = GadgetOAuth2TokenStoreTest.gts.getOAuth2Store(); Assert.assertNotNull(result); Assert.assertEquals(MockUtils.getDummyStore(), result); }
@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 testGetTokenStore_1() throws Exception { final OAuth2FetcherConfig fixture = new OAuth2FetcherConfig(new GadgetOAuth2TokenStore( EasyMock.createNiceMock(OAuth2Store.class), EasyMock.createNiceMock(GadgetSpecFactory.class)), true); final GadgetOAuth2TokenStore result = fixture.getTokenStore(); Assert.assertNotNull(result); }
@Test public void testGetOAuth2Store_1() throws Exception { final OAuth2Store result = GadgetOAuth2TokenStoreTest.gts.getOAuth2Store(); Assert.assertNotNull(result); Assert.assertEquals(MockUtils.getDummyStore(), result); }
@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 testIsViewerAccessTokensEnabled_1() throws Exception { final OAuth2FetcherConfig fixture = new OAuth2FetcherConfig(new GadgetOAuth2TokenStore( EasyMock.createNiceMock(OAuth2Store.class), EasyMock.createNiceMock(GadgetSpecFactory.class)), true); final boolean result = fixture.isViewerAccessTokensEnabled(); Assert.assertEquals(true, result); }
@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 testIsViewerAccessTokensEnabled_1() throws Exception { final OAuth2FetcherConfig fixture = new OAuth2FetcherConfig(new GadgetOAuth2TokenStore( EasyMock.createNiceMock(OAuth2Store.class), EasyMock.createNiceMock(GadgetSpecFactory.class)), true); final boolean result = fixture.isViewerAccessTokensEnabled(); Assert.assertEquals(true, result); }
@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 testGetOAuth2Store_1() throws Exception { final OAuth2FetcherConfig fixture = new OAuth2FetcherConfig(new GadgetOAuth2TokenStore( EasyMock.createNiceMock(OAuth2Store.class), EasyMock.createNiceMock(GadgetSpecFactory.class)), true); final OAuth2Store result = fixture.getOAuth2Store(); Assert.assertNotNull(result); Assert.assertEquals(false, result.clearCache()); }
@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 testGetOAuth2Store_1() throws Exception { final OAuth2FetcherConfig fixture = new OAuth2FetcherConfig(new GadgetOAuth2TokenStore( EasyMock.createNiceMock(OAuth2Store.class), EasyMock.createNiceMock(GadgetSpecFactory.class)), true); final OAuth2Store result = fixture.getOAuth2Store(); Assert.assertNotNull(result); Assert.assertEquals(false, result.clearCache()); }