Examples of OAuthConsumerStore


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

        assertThat(oAuthConsumerStore.getServiceName(), is(SERVICE_NAME_GOOGLE));
    }

    @Test
    public void testFindByUriAndServiceName() throws Exception {
        final OAuthConsumerStore store = repository.findByUriAndServiceName(GADGET_URI, SERVICE_NAME_GOOGLE);
        assertNotNull("OAuthConsumerStore In test db", store);
        assertEquals("gadgetSecret", store.getConsumerSecret());
        assertEquals(JpaOAuthConsumerStore.KeyType.HMAC_SYMMETRIC, store.getKeyType());
    }
View Full Code Here

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

        assertEquals(JpaOAuthConsumerStore.KeyType.HMAC_SYMMETRIC, store.getKeyType());
    }

    @Test
    public void testFindByUriAndServiceName_nullValue() throws Exception {
        final OAuthConsumerStore store = repository.findByUriAndServiceName(GADGET_URI, SERVICE_NAME_FOO);
        assertNull(store);
    }
View Full Code Here

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

    @Test
    @Transactional(readOnly=false)
    @Rollback(true)
    public void delete() {
        OAuthConsumerStore oAuthConsumerStore = repository.get(VALID_ID.toString());
        assertThat(oAuthConsumerStore, is(notNullValue()));
        repository.delete(oAuthConsumerStore);
        oAuthConsumerStore = repository.get(VALID_ID.toString());
        assertThat(oAuthConsumerStore, is(nullValue()));
    }
View Full Code Here

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

        String serviceName = "serviceName";
        OAuthConsumerStoreImpl found = new OAuthConsumerStoreImpl();
        expect(template.findOne(query(where("gadgetUri").is(gadgetUri).andOperator(where("serviceName").is(serviceName))), MongoDbOauthConsumerStoreRepository.CLASS, CollectionNames.OAUTH_CONSUMER_COLLECTION)).andReturn(found);
        replay(template);

        OAuthConsumerStore returned = oauthConsumerStoreRepository.findByUriAndServiceName(gadgetUri, serviceName);

        assertThat((OAuthConsumerStoreImpl) returned, is(sameInstance(found)));
    }
View Full Code Here

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

        assertThat(found, is(sameInstance(oauthConsumerStoreRepository.get(id))));
    }

    @Test
    public void save_Valid(){
        OAuthConsumerStore item = new OAuthConsumerStoreImpl();
        template.save(item, CollectionNames.OAUTH_CONSUMER_COLLECTION);
        expectLastCall();
        replay(template);

        OAuthConsumerStore returned = oauthConsumerStoreRepository.save(item);

        verify(template);
    }
View Full Code Here

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

        verify(template);
    }

    @Test
    public void save_Null_Id(){
        OAuthConsumerStore item = new OAuthConsumerStoreImpl();
        item.setId("1232");
        template.save(item, CollectionNames.OAUTH_CONSUMER_COLLECTION);
        expectLastCall();
        replay(template);

        OAuthConsumerStore returned = oauthConsumerStoreRepository.save(item);

        assertThat(item, is(sameInstance(returned)));
    }
View Full Code Here

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

        assertThat(item, is(sameInstance(returned)));
    }

    @Test
    public void delete_Valid() {
        OAuthConsumerStore item = new OAuthConsumerStoreImpl();
        item.setId("123");

        expect(template.findById(item.getId(), oauthConsumerStoreRepository.CLASS, CollectionNames.OAUTH_CONSUMER_COLLECTION)).andReturn((OAuthConsumerStoreImpl)item);
        template.remove(item);
        expectLastCall();
        replay(template);

        oauthConsumerStoreRepository.delete(item);
View Full Code Here

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

    @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.OAuthConsumerStore

        assertThat(oAuthConsumerStoreConverter.convert(oAuthConsumerStore), is(sameInstance(oAuthConsumerStore)));
    }

    @Test
    public void nullConversion() {
        OAuthConsumerStore oAuthConsumerStore = null;
        assertThat(oAuthConsumerStoreConverter.convert(oAuthConsumerStore), is(nullValue()));
    }
View Full Code Here

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

     */
    @Override
    public ConsumerInfo getConsumerKeyAndSecret(SecurityToken securityToken, String serviceName,
                                                OAuthServiceProvider provider) throws GadgetException {
        String gadgetUri = securityToken.getAppUrl();
        OAuthConsumerStore consumerStore = consumerStoreService.findByUriAndServiceName(gadgetUri, serviceName);
        if (consumerStore == null) {
            return null;
        }
        OAuthConsumer consumer = createOAuthConsumer(provider, consumerStore);
        String callbackUrl = (consumerStore.getCallbackUrl() != null ?
                consumerStore.getCallbackUrl() : defaultCallbackUrl);

        return new ConsumerInfo(consumer, consumerStore.getKeyName(), callbackUrl);
    }
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.