Package org.apache.rave.gadgets.oauth.model

Examples of org.apache.rave.gadgets.oauth.model.OAuthTokenInfo


    @Test
    public void testGetTokenInfo() throws Exception {
        final String testTokenName = "testTokenName";

        OAuthTokenInfo oAuthTokenInfo = new OAuthTokenInfo();
        oAuthTokenInfo.setTokenName(testTokenName);
        oAuthTokenInfo.setTokenSecret(CONSUMER_SECRET);
        OAuthStore.ConsumerInfo consumerInfo = createMock(OAuthStore.ConsumerInfo.class);

        expect(tokenInfoService.findOAuthTokenInfo(token.getViewerId(), token.getAppUrl(),
                OAuthTokenInfo.MODULE_ID, testTokenName,
                SERVICE_NAME)).andReturn(oAuthTokenInfo);
View Full Code Here


    @Autowired
    OAuthTokenInfoRepository repository;

    @Test
    public void testFindOAuthTokenInfo() throws Exception {
        OAuthTokenInfo tokenInfo = repository.findOAuthTokenInfo(VALID_USER,
                APP_URL, OAuthTokenInfo.MODULE_ID, TOKEN_NAME, SERVICE_NAME);
        assertNotNull(tokenInfo);
        assertEquals("accessToken", tokenInfo.getAccessToken());
    }
View Full Code Here

        assertEquals("accessToken", tokenInfo.getAccessToken());
    }

    @Test
    public void testFindOAuthTokenInfo_nullValue() throws Exception {
        OAuthTokenInfo tokenInfo = repository.findOAuthTokenInfo(INVALID_USER,
                APP_URL, OAuthTokenInfo.MODULE_ID, TOKEN_NAME, SERVICE_NAME);
        assertNull(tokenInfo);
    }
View Full Code Here

    }

    @Test
    public void testFindOAuthTokenInfo() throws Exception {
        OAuthTokenInfo dbOAuthTokenInfo = getOAuthTokenInfo();
        expect(repository.findOAuthTokenInfo(VALID_USER, APP_URL, NOT_USED, TOKEN_NAME, SERVICE_NAME))
                .andReturn(dbOAuthTokenInfo);
        replay(repository);
        OAuthTokenInfo oAuthTokenInfo = service.findOAuthTokenInfo(VALID_USER, APP_URL, NOT_USED,
                TOKEN_NAME, SERVICE_NAME);
        assertNotNull(oAuthTokenInfo);
        assertEquals(APP_URL, oAuthTokenInfo.getAppUrl());

    }
View Full Code Here

    public void testFindOAuthTokenInfo_nullValue() throws Exception {
        expect(repository.findOAuthTokenInfo(INVALID_USER, APP_URL, NOT_USED, TOKEN_NAME, SERVICE_NAME))
                .andReturn(null);
        replay(repository);

        OAuthTokenInfo oAuthTokenInfo = service.findOAuthTokenInfo(INVALID_USER, APP_URL, NOT_USED,
                TOKEN_NAME, SERVICE_NAME);

        assertNull(oAuthTokenInfo);

    }
View Full Code Here

        expect(tokenInfo.getAccessToken()).andReturn("accessToken");
        expect(tokenInfo.getSessionHandle()).andReturn("sessionHandle");
        expect(tokenInfo.getTokenExpireMillis()).andReturn(3600000L);
        expect(tokenInfo.getTokenSecret()).andReturn("tokenSecret");
        replay(securityToken, tokenInfo);
        return new OAuthTokenInfo(securityToken, SERVICE_NAME, TOKEN_NAME, tokenInfo);
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public void deleteOAuthTokenInfo(String userId, String appUrl, String moduleId, String tokenName,
                                     String serviceName) {
        final OAuthTokenInfo oAuthTokenInfo =
                findOAuthTokenInfo(userId, appUrl, moduleId, tokenName, serviceName);
        if (oAuthTokenInfo != null) {
            repository.delete(oAuthTokenInfo);
        }
    }
View Full Code Here

    @Test
    public void testGetTokenInfo() throws Exception {
        final String testTokenName = "testTokenName";

        OAuthTokenInfo oAuthTokenInfo = new OAuthTokenInfo();
        oAuthTokenInfo.setTokenName(testTokenName);
        oAuthTokenInfo.setTokenSecret(CONSUMER_SECRET);
        OAuthStore.ConsumerInfo consumerInfo = createMock(OAuthStore.ConsumerInfo.class);

        expect(tokenInfoService.findOAuthTokenInfo(token.getViewerId(), token.getAppUrl(),
                OAuthTokenInfo.MODULE_ID, testTokenName,
                SERVICE_NAME)).andReturn(oAuthTokenInfo);
View Full Code Here

    @Autowired
    OAuthTokenInfoService service;

    @Test
    public void testFindOAuthTokenInfo() throws Exception {
        OAuthTokenInfo tokenInfo = repository.findOAuthTokenInfo(VALID_USER,
                APP_URL, OAuthTokenInfo.MODULE_ID, TOKEN_NAME, SERVICE_NAME);
        assertNotNull(tokenInfo);
        assertEquals("accessToken", tokenInfo.getAccessToken());
    }
View Full Code Here

        assertEquals("accessToken", tokenInfo.getAccessToken());
    }

    @Test
    public void testFindOAuthTokenInfo_nullValue() throws Exception {
        OAuthTokenInfo tokenInfo = repository.findOAuthTokenInfo(INVALID_USER,
                APP_URL, OAuthTokenInfo.MODULE_ID, TOKEN_NAME, SERVICE_NAME);
        assertNull(tokenInfo);
    }
View Full Code Here

TOP

Related Classes of org.apache.rave.gadgets.oauth.model.OAuthTokenInfo

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.