Package org.apache.rave.portal.model

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


    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

        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

        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

        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

    @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

    @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

TOP

Related Classes of org.apache.rave.portal.model.JpaOAuthConsumerStore

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.