Package org.apache.rave.model

Examples of org.apache.rave.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


        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

        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

    @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

     */
    @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

        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

        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

    @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

        service = new DefaultOAuthConsumerStoreService(repository);
    }

    @Test
    public void testFindByUriAndServiceName() throws Exception {
        OAuthConsumerStore dbConsumerStore = getOAuthConsumerStore();
        expect(repository.findByUriAndServiceName(GADGET_URI, SERVICE_NAME_GOOGLE)).andReturn(dbConsumerStore);
        replay(repository);

        OAuthConsumerStore consumerStore = service.findByUriAndServiceName(GADGET_URI, SERVICE_NAME_GOOGLE);
        assertNotNull("Found consumerStore in repo", consumerStore);
        assertEquals("gadgetConsumer", consumerStore.getConsumerKey());
        assertEquals(OAuthConsumerStore.KeyType.HMAC_SYMMETRIC, consumerStore.getKeyType());
    }
View Full Code Here

    }

    @Test
    public void testFindByUriAndServiceName_nullValue() throws Exception {
        expect(repository.findByUriAndServiceName(GADGET_URI, SERVICE_NAME_FOO)).andReturn(null);
        OAuthConsumerStore consumerStore = service.findByUriAndServiceName(GADGET_URI, SERVICE_NAME_FOO);
        assertNull(consumerStore);
    }
View Full Code Here

TOP

Related Classes of org.apache.rave.model.OAuthConsumerStore

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.