Package org.apache.rave.portal.model

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


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

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

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

    @Test
    public void newOAuthConsumerStore() {
        OAuthConsumerStore oAuthConsumerStore = new OAuthConsumerStoreImpl();
        oAuthConsumerStore.setId(1L);
        oAuthConsumerStore.setServiceName("servicename");
        oAuthConsumerStore.setCallbackUrl("callbackurl");
        oAuthConsumerStore.setConsumerKey("key");
        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(), 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

        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);
        assertThat(oAuthConsumerStore, is(notNullValue()));
        repository.delete(oAuthConsumerStore);
        oAuthConsumerStore = repository.get(VALID_ID);
        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

        OAuthConsumerStore consumerStore = service.findByUriAndServiceName(GADGET_URI, SERVICE_NAME_FOO);
        assertNull(consumerStore);
    }

    OAuthConsumerStore getOAuthConsumerStore() {
        OAuthConsumerStore consumerStore = new OAuthConsumerStoreImpl();
        consumerStore.setCallbackUrl("http://oauth.gmodules.com/gadgets/oauthcallback");
        consumerStore.setConsumerKey("gadgetConsumer");
        consumerStore.setConsumerSecret("gadgetSecret");
        consumerStore.setGadgetUri(GADGET_URI);
        consumerStore.setServiceName(SERVICE_NAME_GOOGLE);
        consumerStore.setKeyName("keyName");
        consumerStore.setKeyType(OAuthConsumerStore.KeyType.HMAC_SYMMETRIC);
        return consumerStore;
    }
View Full Code Here

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

    @Test
    public void newOAuthConsumerStore() {
        OAuthConsumerStore oAuthConsumerStore = new OAuthConsumerStoreImpl();
        oAuthConsumerStore.setId("1");
        oAuthConsumerStore.setServiceName("servicename");
        oAuthConsumerStore.setCallbackUrl("callbackurl");
        oAuthConsumerStore.setConsumerKey("key");
        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

TOP

Related Classes of org.apache.rave.portal.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.