Package org.scribe.model

Examples of org.scribe.model.Token


        assertEquals(1, oAuthTokenCacheService.tokenCache.size());
    }

    @Test
    public void testRetrieveAndRemoveToken() throws Exception {
        Token retrievedToken = oAuthTokenCacheService.retrieveAndRemoveToken("access");
        assertEquals(0,oAuthTokenCacheService.tokenCache.size());
        assertNotNull(retrievedToken);
    }
View Full Code Here


        assertNotNull(retrievedToken);
    }

    @Test
    public void testRetrieveAndRemoveToken_NonExistentKey() throws Exception {
        Token retrievedToken = oAuthTokenCacheService.retrieveAndRemoveToken("not here");
        assertEquals(1,oAuthTokenCacheService.tokenCache.size());
        assertNull(retrievedToken);
    }
View Full Code Here

        assertNull(retrievedToken);
    }

    @Test
    public void testRetrieveAndRemoveToken_NullKey() throws Exception {
        Token retrievedToken = oAuthTokenCacheService.retrieveAndRemoveToken(null);
        assertEquals(1,oAuthTokenCacheService.tokenCache.size());
        assertNull(retrievedToken);
    }
View Full Code Here

    OAuthRequestTokenDao oAuthRequestTokenDao;

    @Before
    public void setUp() throws Exception {
        MockitoAnnotations.initMocks(this);
        OAuthRequestToken testToken = new OAuthRequestToken(new Token("access", "secret"));
        when(oAuthRequestTokenDao.findByToken("access")).thenReturn(testToken);
        mongoDbOAuthTokenCacheService = new MongoDbOAuthTokenCacheService(oAuthRequestTokenDao);
    }
View Full Code Here

        mongoDbOAuthTokenCacheService = new MongoDbOAuthTokenCacheService(oAuthRequestTokenDao);
    }

    @Test
    public void testCacheToken() throws Exception {
        Token t = new Token("foo", "bar");
        mongoDbOAuthTokenCacheService.cacheToken(t);
        verify(oAuthRequestTokenDao).save(any(OAuthRequestToken.class));
    }
View Full Code Here

        verify(oAuthRequestTokenDao, times(0)).save(any(OAuthRequestToken.class));
    }

    @Test
    public void testCacheToken_OauthTokenNull() throws Exception {
        mongoDbOAuthTokenCacheService.cacheToken(new Token(null,"whatever"));
        verify(oAuthRequestTokenDao, times(0)).save(any(OAuthRequestToken.class));
    }
View Full Code Here

*/
public class GoogleAnalyticsProviderTest {

    @Test
    public void testUpdateCredentials() throws Exception {
        Token mockToken = Mockito.mock(Token.class);
        Mockito.when(mockToken.getRawResponse()).thenReturn("{\n" +
                "  \"access_token\" : \"ya29.AHES6ZS2UHOclj7rSPx8lAKbQo2Z6AOPmGeSlaeGA5eMxhe5nO6pAg\",\n" +
                "  \"token_type\" : \"Bearer\",\n" +
                "  \"expires_in\" : 3600,\n" +
                "  \"refresh_token\" : \"1/1B3mzvdzu7dEpQKa2PHoBigmhu-Jefuj-a90Cs7AsEw\"\n" +
                "}");
View Full Code Here

        verify(oAuthRequestTokenDao, times(0)).save(any(OAuthRequestToken.class));
    }

    @Test
    public void testRetrieveToken() throws Exception {
        Token expected = new Token("access","secret");
        Token actual = mongoDbOAuthTokenCacheService.retrieveToken("access");
        assertEquals(expected.getToken(),actual.getToken());
        assertEquals(expected.getSecret(),actual.getSecret());
    }
View Full Code Here

        assertEquals(expected.getSecret(),actual.getSecret());
    }

    @Test
    public void testRetrieveToken_Null() throws Exception {
        Token actual = mongoDbOAuthTokenCacheService.retrieveToken(null);
        assertNull(actual);
    }
View Full Code Here

        assertNull(actual);
    }

    @Test
    public void testRetrieveToken_CacheMiss() throws Exception {
        Token actual = mongoDbOAuthTokenCacheService.retrieveToken("not here, really");
        assertNull(actual);
    }
View Full Code Here

TOP

Related Classes of org.scribe.model.Token

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.