Examples of JpaOAuthConsumerStore


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

    @Autowired
    private JpaOAuthConsumerStoreConverter oAuthConsumerStoreConverter;

    @Test
    public void noConversion() {
        OAuthConsumerStore oAuthConsumerStore = new JpaOAuthConsumerStore();
        assertThat(oAuthConsumerStoreConverter.convert(oAuthConsumerStore), is(sameInstance(oAuthConsumerStore)));
    }
View Full Code Here

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

        oAuthConsumerStore.setConsumerSecret("secret");
        oAuthConsumerStore.setGadgetUri("gadgeturi");
        oAuthConsumerStore.setKeyName("key");
        oAuthConsumerStore.setKeyType(OAuthConsumerStore.KeyType.HMAC_SYMMETRIC);

        JpaOAuthConsumerStore converted = oAuthConsumerStoreConverter.convert(oAuthConsumerStore);
        assertThat(converted, is(not(sameInstance(oAuthConsumerStore))));
        assertThat(converted, is(instanceOf(JpaOAuthConsumerStore.class)));
        assertThat(converted.getId(), is(equalTo(oAuthConsumerStore.getId())));
        assertThat(converted.getServiceName(), is(equalTo(oAuthConsumerStore.getServiceName())));
        assertThat(converted.getCallbackUrl(), is(equalTo(oAuthConsumerStore.getCallbackUrl())));
        assertThat(converted.getConsumerKey(), is(equalTo(oAuthConsumerStore.getConsumerKey())));
        assertThat(converted.getConsumerSecret(), is(equalTo(oAuthConsumerStore.getConsumerSecret())));
        assertThat(converted.getEntityId().toString(), is(equalTo(oAuthConsumerStore.getId())));
        assertThat(converted.getGadgetUri(), is(equalTo(oAuthConsumerStore.getGadgetUri())));
        assertThat(converted.getKeyName(), is(equalTo(oAuthConsumerStore.getKeyName())));
        assertThat(converted.getKeyType(), is(equalTo(oAuthConsumerStore.getKeyType())));
    }
View Full Code Here

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

    public JpaOAuthConsumerStore convert(OAuthConsumerStore source) {
        return source instanceof JpaOAuthConsumerStore ? (JpaOAuthConsumerStore) source : createEntity(source);
    }

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

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

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

    @Test
    public void get() {
        JpaOAuthConsumerStore oAuthConsumerStore = (JpaOAuthConsumerStore) repository.get(VALID_ID.toString());
        assertThat(oAuthConsumerStore.getEntityId(), is(VALID_ID));
        assertThat(oAuthConsumerStore.getGadgetUri(), is(GADGET_URI));
        assertThat(oAuthConsumerStore.getServiceName(), is(SERVICE_NAME_GOOGLE));
    }
View Full Code Here

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

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

        assertThat(oAuthConsumerStore.getEntityId(), is(nullValue()));
        repository.save(oAuthConsumerStore);
        Long newId = oAuthConsumerStore.getEntityId();
        assertThat(newId > 0, is(true));
        JpaOAuthConsumerStore newOAuthConsumerStore = (JpaOAuthConsumerStore) repository.get(newId.toString());
        assertThat(newOAuthConsumerStore.getServiceName(), is(NEW_SERVICE_NAME));
        assertThat(newOAuthConsumerStore.getCallbackUrl(), is(NEW_URL));
    }
View Full Code Here

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

    @Test
    @Transactional(readOnly=false)
    @Rollback(true)
    public void save_existing() {
        final String UPDATED_SERVICE_NAME = "updated service name";
        JpaOAuthConsumerStore oAuthConsumerStore = (JpaOAuthConsumerStore) repository.get(VALID_ID.toString());
        assertThat(oAuthConsumerStore.getServiceName(), is(not(UPDATED_SERVICE_NAME)));
        oAuthConsumerStore.setServiceName(UPDATED_SERVICE_NAME);
        repository.save(oAuthConsumerStore);
        assertThat(repository.get(VALID_ID.toString()).getServiceName(), is(UPDATED_SERVICE_NAME));
    }
View Full Code Here

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

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

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

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

    public JpaOAuthConsumerStore convert(OAuthConsumerStore source) {
        return source instanceof JpaOAuthConsumerStore ? (JpaOAuthConsumerStore) source : createEntity(source);
    }

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

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

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

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

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

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

    @Override
    public OAuthConsumerStore save(OAuthConsumerStore item) {
        JpaOAuthConsumerStore jpaItem = converter.convert(item);
        return saveOrUpdate(jpaItem.getEntityId(), manager, jpaItem);
    }
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.