Package org.scribe.model

Examples of org.scribe.model.Token


        verify(oAuthRequestTokenDao,times(0)).removeToken(anyString());
    }

    @Test
    public void testRetrieveAndRemoveToken() throws Exception {
        Token retrievedToken = mongoDbOAuthTokenCacheService.retrieveAndRemoveToken("access");
        verify(oAuthRequestTokenDao,times(1)).findByToken("access");
        verify(oAuthRequestTokenDao,times(1)).removeToken("access");
        Assert.assertNotNull(retrievedToken);
    }
View Full Code Here


        Assert.assertNotNull(retrievedToken);
    }

    @Test
    public void testRetrieveAndRemoveToken_NonExistentKey() throws Exception {
        Token retrievedToken = mongoDbOAuthTokenCacheService.retrieveAndRemoveToken("not here");
        verify(oAuthRequestTokenDao,times(1)).findByToken("not here");
        verify(oAuthRequestTokenDao,times(0)).removeToken(anyString());
        assertNull(retrievedToken);
    }
View Full Code Here

        assertNull(retrievedToken);
    }

    @Test
    public void testRetrieveAndRemoveToken_NullKey() throws Exception {
        Token retrievedToken = mongoDbOAuthTokenCacheService.retrieveAndRemoveToken(null);
        verify(oAuthRequestTokenDao,times(0)).findByToken(anyString());
        verify(oAuthRequestTokenDao,times(0)).removeToken(anyString());
        assertNull(retrievedToken);
    }
View Full Code Here

public class OAuthRequestTokenTest {

    @Test
    public void testToScribeToken() throws Exception {
        Token token = new Token("access","secret");
        OAuthRequestToken  requestToken = new OAuthRequestToken(token);
        assertEquals(token.getToken(), requestToken.toScribeToken().getToken());
        assertEquals(token.getSecret(), requestToken.toScribeToken().getSecret());
    }
View Full Code Here

    @Before
    public void setUp() throws Exception {
        super.setUp();
        oAuthTokenCacheService = new MongoDbOAuthTokenCacheService(dao);
        Token testToken = new Token("access","secret");
        oAuthTokenCacheService.cacheToken(testToken);
    }
View Full Code Here

    }

    @Test
    @Ignore("Integration Tests depended on sensitive account keys, ignoring until better harness is in place.")
    public void testRetrieveToken() throws Exception {
        Token retrievedToken = oAuthTokenCacheService.retrieveToken("access");
        assertEquals("access",retrievedToken.getToken());
        assertEquals("secret",retrievedToken.getSecret());

    }
View Full Code Here

    }

    @Test
    @Ignore("Integration Tests depended on sensitive account keys, ignoring until better harness is in place.")
    public void testCacheTokenWithSameKey() throws Exception {
        Token newToken = new Token("access","anotherSecret");
        oAuthTokenCacheService.cacheToken(newToken);

        Token retrievedToken = oAuthTokenCacheService.retrieveToken("access");
        assertEquals("anotherSecret", retrievedToken.getSecret());
    }
View Full Code Here

    }

    @Test
    @Ignore("Integration Tests depended on sensitive account keys, ignoring until better harness is in place.")
    public void testRetrieveTokenNullKey() throws Exception {
        Token retrievedToken = oAuthTokenCacheService.retrieveToken(null);
        assertEquals(null,retrievedToken);
    }
View Full Code Here

    @Test
    @Ignore("Integration Tests depended on sensitive account keys, ignoring until better harness is in place.")
    public void testRemoveToken() throws Exception {
        oAuthTokenCacheService.removeToken("access");
        Token retrievedToken = oAuthTokenCacheService.retrieveToken("access");
        assertNull(retrievedToken);
    }
View Full Code Here

    }

    @Test
    @Ignore("Integration Tests depended on sensitive account keys, ignoring until better harness is in place.")
    public void testRetrieveAndRemoveToken() throws Exception {
        Token retrievedToken = oAuthTokenCacheService.retrieveAndRemoveToken("access");
        assertEquals("access",retrievedToken.getToken());
        assertEquals("secret",retrievedToken.getSecret());
        Token retrievedTokenAfterRemoval = oAuthTokenCacheService.retrieveToken("access");
        assertNull(retrievedTokenAfterRemoval);
    }
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.