Examples of OAuthTokenInfoImpl


Examples of org.apache.rave.portal.model.impl.OAuthTokenInfoImpl

        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

Examples of org.apache.rave.portal.model.impl.OAuthTokenInfoImpl

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

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

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

Examples of org.apache.rave.portal.model.impl.OAuthTokenInfoImpl

        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 OAuthTokenInfoImpl(securityToken.getAppUrl(), SERVICE_NAME, TOKEN_NAME, tokenInfo.getAccessToken(),
                tokenInfo.getSessionHandle(), tokenInfo.getTokenSecret(),
                securityToken.getViewerId(), tokenInfo.getTokenExpireMillis());
    }
View Full Code Here

Examples of org.apache.rave.portal.model.impl.OAuthTokenInfoImpl

        repo.setTemplate(template);
    }

    @Test
    public void findOAuthTokenInfo(){
        OAuthTokenInfo info = new OAuthTokenInfoImpl();
        String userId = "1234";
        String appUrl = "www.test.com";
        String moduleId = "2222";
        String tokenName = "token";
        String serviceName = "service";
        info.setUserId(userId);
        info.setAppUrl(appUrl);
        info.setModuleId(moduleId);
        info.setTokenName(tokenName);
        info.setServiceName(serviceName);
        expect(template.findOne(query(where("userId").is(userId)
                .andOperator(where("appUrl").is(appUrl))
                .andOperator(where("moduleId").is(moduleId))
                .andOperator(where("tokenName").is(tokenName))
                .andOperator(where("serviceName").is(serviceName))
View Full Code Here

Examples of org.apache.rave.portal.model.impl.OAuthTokenInfoImpl

    }

    @Test
    public void save_null(){
        OAuthTokenInfo info = new OAuthTokenInfoImpl();
        OAuthTokenInfo result;

        template.save(isA(OAuthTokenInfo.class), eq(OAUTH_TOKEN_COLLECTION));
        expectLastCall();
        replay(template);
View Full Code Here

Examples of org.apache.rave.portal.model.impl.OAuthTokenInfoImpl

    }

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

        template.save(isA(OAuthTokenInfo.class), eq(OAUTH_TOKEN_COLLECTION));
        expectLastCall();

        result = repo.save(item);
View Full Code Here

Examples of org.apache.rave.portal.model.impl.OAuthTokenInfoImpl

    }

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

        expect(template.findById("1234L", CLASS2, OAUTH_TOKEN_COLLECTION)).andReturn((OAuthTokenInfoImpl)item);
        replay(template);

        result = repo.get("1234L");
View Full Code Here

Examples of org.apache.rave.portal.model.impl.OAuthTokenInfoImpl

    }

    @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

Examples of org.apache.rave.portal.model.impl.OAuthTokenInfoImpl

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

    @Test
    public void newOAuthTokenInfo() {
        OAuthTokenInfo oAuthTokenInfo = new OAuthTokenInfoImpl();
        oAuthTokenInfo.setId(1L);
        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

Examples of org.apache.rave.portal.model.impl.OAuthTokenInfoImpl

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

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

        expect(tokenInfoService.findOAuthTokenInfo(token.getViewerId(), token.getAppUrl(),
                OAuthTokenInfoImpl.MODULE_ID, testTokenName,
                SERVICE_NAME)).andReturn(oAuthTokenInfo);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.