Examples of JpaOAuthTokenInfo


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

    @Autowired
    private JpaOAuthTokenInfoConverter oAuthTokenInfoConverter;

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

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

        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.JpaOAuthTokenInfo

    public JpaOAuthTokenInfo convert(OAuthTokenInfo source) {
        return source instanceof JpaOAuthTokenInfo ? (JpaOAuthTokenInfo) source : createEntity(source);
    }

    private JpaOAuthTokenInfo createEntity(OAuthTokenInfo source) {
        JpaOAuthTokenInfo converted = null;
        if (source != null) {
            converted = source.getId() == null ? new JpaOAuthTokenInfo() : manager.find(JpaOAuthTokenInfo.class, Long.parseLong(source.getId()))if(converted == null) {
                converted = new JpaOAuthTokenInfo();
            }
            updateProperties(source, converted);
        }
        return converted;
    }
View Full Code Here

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

        assertEquals(repository.getType(), JpaOAuthTokenInfo.class);
    }

    @Test
    public void get() {
        JpaOAuthTokenInfo oAuthTokenInfo = (JpaOAuthTokenInfo) repository.get(VALID_ID.toString());
        assertThat(oAuthTokenInfo.getEntityId(), is(VALID_ID));
        assertThat(oAuthTokenInfo.getAppUrl(), is(APP_URL));
        assertThat(oAuthTokenInfo.getTokenName(), is(TOKEN_NAME));
        assertThat(oAuthTokenInfo.getServiceName(), is(SERVICE_NAME));
    }
View Full Code Here

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

    @Transactional(readOnly=false)
    @Rollback(true)
    public void save_new() {
        final String NEW_URL = "testurl";
        final String NEW_SERVICE_NAME = "testservice";
        JpaOAuthTokenInfo oAuthTokenInfo = new JpaOAuthTokenInfo();
        oAuthTokenInfo.setAppUrl(NEW_URL);
        oAuthTokenInfo.setServiceName(NEW_SERVICE_NAME);

        assertThat(oAuthTokenInfo.getEntityId(), is(nullValue()));
        repository.save(oAuthTokenInfo);
        Long newId = oAuthTokenInfo.getEntityId();
        assertThat(newId > 0, is(true));
        JpaOAuthTokenInfo newOAuthTokenInfo = (JpaOAuthTokenInfo) repository.get(newId.toString());
        assertThat(newOAuthTokenInfo.getServiceName(), is(NEW_SERVICE_NAME));
        assertThat(newOAuthTokenInfo.getAppUrl(), is(NEW_URL));
    }
View Full Code Here

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

        return manager.find(JpaOAuthTokenInfo.class, Long.parseLong(id));
    }

    @Override
    public OAuthTokenInfo save(OAuthTokenInfo item) {
        JpaOAuthTokenInfo jpaItem = converter.convert(item);
        return saveOrUpdate(jpaItem.getEntityId(), manager, jpaItem);
    }
View Full Code Here

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

    public JpaOAuthTokenInfo convert(OAuthTokenInfo source) {
        return source instanceof JpaOAuthTokenInfo ? (JpaOAuthTokenInfo) source : createEntity(source);
    }

    private JpaOAuthTokenInfo createEntity(OAuthTokenInfo source) {
        JpaOAuthTokenInfo converted = null;
        if (source != null) {
            converted = manager.find(JpaOAuthTokenInfo.class, source.getId() == null ? null : Long.parseLong(source.getId()));
            if (converted == null) {
                converted = new JpaOAuthTokenInfo();
            }
            updateProperties(source, converted);
        }
        return converted;
    }
View Full Code Here

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

        return manager.find(JpaOAuthTokenInfo.class, id);
    }

    @Override
    public OAuthTokenInfo save(OAuthTokenInfo item) {
        JpaOAuthTokenInfo jpaItem = converter.convert(item);
        return saveOrUpdate(jpaItem.getEntityId(), manager, jpaItem);
    }
View Full Code Here

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

        return manager.find(JpaOAuthTokenInfo.class, id);
    }

    @Override
    public OAuthTokenInfo save(OAuthTokenInfo item) {
        JpaOAuthTokenInfo jpaItem = converter.convert(item);
        return saveOrUpdate(jpaItem.getEntityId(), manager, jpaItem);
    }
View Full Code Here

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

        assertEquals(repository.getType(), JpaOAuthTokenInfo.class);
    }

    @Test
    public void get() {
        JpaOAuthTokenInfo oAuthTokenInfo = (JpaOAuthTokenInfo) repository.get(VALID_ID);
        assertThat(oAuthTokenInfo.getEntityId(), is(VALID_ID));
        assertThat(oAuthTokenInfo.getAppUrl(), is(APP_URL));
        assertThat(oAuthTokenInfo.getTokenName(), is(TOKEN_NAME));
        assertThat(oAuthTokenInfo.getServiceName(), is(SERVICE_NAME));
    }
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.