Package org.springframework.social.connect

Examples of org.springframework.social.connect.ConnectionKey


   */
  protected void initKey(String providerId, String providerUserId) {
    if (providerUserId == null) {
      providerUserId = setValues().providerUserId;
    }
    key = new ConnectionKey(providerId, providerUserId);   
  }
View Full Code Here


    try {
      RemoteUser existingConnection = get(userId, providerId,
          providerUserId);
      if (existingConnection != null)
        throw new DuplicateConnectionException(new ConnectionKey(
            providerId, providerUserId));
    } catch (EmptyResultDataAccessException e) {
    }

    save(remoteUser);
View Full Code Here

  @Test
  @SuppressWarnings("unchecked")
  public void findConnectionByKey() {
    insertFacebookConnection();
    assertFacebookConnection((Connection<TestFacebookApi>) connectionRepository.getConnection(new ConnectionKey("facebook", "12345")));
  }
View Full Code Here

    assertFacebookConnection((Connection<TestFacebookApi>) connectionRepository.getConnection(new ConnectionKey("facebook", "12345")));
  }
 
  @Test(expected=NoSuchConnectionException.class)
  public void findConnectionByKeyNoSuchConnection() {
    connectionRepository.getConnection(new ConnectionKey("facebook", "bogus"));
  }
View Full Code Here

  @Test
  public void removeConnection() {
    insertFacebookConnection();
    insertFacebookConnection2();
    assertEquals(2, connectionRepository.findConnections("facebook").size());
    connectionRepository.removeConnection(new ConnectionKey("facebook", "12345"));
    assertEquals(1, connectionRepository.findConnections("facebook").size());
  }
View Full Code Here

    assertEquals(1, connectionRepository.findConnections("facebook").size());
  }

  @Test
  public void removeConnectionNoOp() {
    connectionRepository.removeConnection(new ConnectionKey("facebook", "1"));
  }
View Full Code Here

    return twitterConnectionFactory;
  }

 
  private void assertTwitterConnection(Connection<TestTwitterApi> twitter) {
    assertEquals(new ConnectionKey("twitter", "habuma"), twitter.getKey());
    assertEquals("@habuma", twitter.getDisplayName());
    assertEquals("http://twitter.com/habuma", twitter.getProfileUrl());
    assertEquals("http://twitter.com/habuma/picture", twitter.getImageUrl());
    TestTwitterApi twitterApi = twitter.getApi();
    assertEquals("ACCESS_TOKEN", twitterApi.getAccessToken());   
View Full Code Here

    twitter.sync();
    assertEquals("http://twitter.com/habuma/a_new_picture", twitter.getImageUrl());
  }
 
  private void assertFacebookConnection(Connection<TestFacebookApi> facebook) {
    assertEquals(new ConnectionKey("facebook", "12345"), facebook.getKey());
    assertEquals("Craig Walls", facebook.getDisplayName());
    assertEquals("http://facebook.com/habuma", facebook.getProfileUrl());
    assertEquals("http://facebook.com/habuma/picture", facebook.getImageUrl());
    TestFacebookApi facebookApi = facebook.getApi();
    assertEquals("ACCESS_TOKEN", facebookApi.getAccessToken());
View Full Code Here

 
  @Test
  @SuppressWarnings("unchecked")
  public void findConnectionByKey() {
    insertFacebookConnection();
    assertFacebookConnection((Connection<TestFacebookApi>) connectionRepository.getConnection(new ConnectionKey("facebook", "9")));
  }
View Full Code Here

    assertFacebookConnection((Connection<TestFacebookApi>) connectionRepository.getConnection(new ConnectionKey("facebook", "9")));
  }
 
  @Test(expected=NoSuchConnectionException.class)
  public void findConnectionByKeyNoSuchConnection() {
    connectionRepository.getConnection(new ConnectionKey("facebook", "bogus"));
  }
View Full Code Here

TOP

Related Classes of org.springframework.social.connect.ConnectionKey

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.