Package org.apache.rave.portal.model

Examples of org.apache.rave.portal.model.OAuthTokenInfo


    }

    @Test
    public void delete(){
        OAuthTokenInfo item = new OAuthTokenInfoImpl("appUrl", "serviceName",
                "tokenName", "accessToken", "sessionHandle",
                "tokenSecret", "userId", 1111L);
        item.setId("1234L");

        template.remove(item);
        expectLastCall();
        expect(template.findById("1234L", CLASS2, OAUTH_TOKEN_COLLECTION)).andReturn((OAuthTokenInfoImpl)item);
        replay(template);
View Full Code Here


     * {@inheritDoc}
     */
    @Override
    public TokenInfo getTokenInfo(SecurityToken securityToken, ConsumerInfo consumerInfo, String serviceName,
                                  String tokenName) throws GadgetException {
        OAuthTokenInfo oAuthTokenInfo = tokenInfoService.findOAuthTokenInfo(
                securityToken.getViewerId(), securityToken.getAppUrl(),
                OAuthTokenInfo.MODULE_ID, tokenName, serviceName);
        if (oAuthTokenInfo == null) {
            return null;
        }

        return new TokenInfo(oAuthTokenInfo.getAccessToken(), oAuthTokenInfo.getTokenSecret(),
                oAuthTokenInfo.getSessionHandle(), oAuthTokenInfo.getTokenExpireMillis());
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public void setTokenInfo(SecurityToken securityToken, ConsumerInfo consumerInfo, String serviceName,
                             String tokenName, TokenInfo tokenInfo) throws GadgetException {
        OAuthTokenInfo oAuthTokenInfo = new OAuthTokenInfoImpl(securityToken.getAppUrl(),
                serviceName, tokenName, tokenInfo.getAccessToken(), tokenInfo.getSessionHandle(),
                tokenInfo.getTokenSecret(), securityToken.getViewerId(), tokenInfo.getTokenExpireMillis());
        tokenInfoService.saveOAuthTokenInfo(oAuthTokenInfo);
    }
View Full Code Here

    @Autowired
    private JpaOAuthTokenInfoConverter oAuthTokenInfoConverter;

    @Test
    public void noConversion() {
        OAuthTokenInfo oAuthTokenInfo = new JpaOAuthTokenInfo();
        assertThat(oAuthTokenInfoConverter.convert(oAuthTokenInfo), is(sameInstance(oAuthTokenInfo)));
    }
View Full Code Here

        assertThat(oAuthTokenInfoConverter.convert(oAuthTokenInfo), is(sameInstance(oAuthTokenInfo)));
    }

    @Test
    public void nullConversion() {
        OAuthTokenInfo oAuthTokenInfo = null;
        assertThat(oAuthTokenInfoConverter.convert(oAuthTokenInfo), is(nullValue()));
    }
View Full Code Here

        assertThat(oAuthTokenInfoConverter.convert(oAuthTokenInfo), is(nullValue()));
    }

    @Test
    public void newOAuthTokenInfo() {
        OAuthTokenInfo oAuthTokenInfo = new OAuthTokenInfoImpl();
        oAuthTokenInfo.setId("1");
        oAuthTokenInfo.setAccessToken("accesstoken");
        oAuthTokenInfo.setAppUrl("appurl");
        oAuthTokenInfo.setModuleId("moduleid");
        oAuthTokenInfo.setServiceName("servicename");
        oAuthTokenInfo.setSessionHandle("sessionhandle");
        oAuthTokenInfo.setTokenExpireMillis(99L);
        oAuthTokenInfo.setTokenName("tokenname");
        oAuthTokenInfo.setTokenSecret("tokensecret");
        oAuthTokenInfo.setUserId("userid");

        JpaOAuthTokenInfo converted = oAuthTokenInfoConverter.convert(oAuthTokenInfo);
        assertThat(converted, is(not(sameInstance(oAuthTokenInfo))));
        assertThat(converted, is(instanceOf(JpaOAuthTokenInfo.class)));
        assertThat(converted.getId(), is(equalTo(oAuthTokenInfo.getId())));
        assertThat(converted.getAccessToken(), is(equalTo(oAuthTokenInfo.getAccessToken())));
        assertThat(converted.getAppUrl(), is(equalTo(oAuthTokenInfo.getAppUrl())));
        assertThat(converted.getModuleId(), is(equalTo(oAuthTokenInfo.getModuleId())));
        assertThat(converted.getServiceName(), is(equalTo(oAuthTokenInfo.getServiceName())));
        assertThat(converted.getSessionHandle(), is(equalTo(oAuthTokenInfo.getSessionHandle())));
        assertThat(converted.getTokenExpireMillis(), is(equalTo(oAuthTokenInfo.getTokenExpireMillis())));
        assertThat(converted.getTokenName(), is(equalTo(oAuthTokenInfo.getTokenName())));
        assertThat(converted.getTokenSecret(), is(equalTo(oAuthTokenInfo.getTokenSecret())));
        assertThat(converted.getUserId(), is(equalTo(oAuthTokenInfo.getUserId())));
    }
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.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.