Package org.springframework.social.google.api.plus

Examples of org.springframework.social.google.api.plus.Person


      return false;
    }
  }

  public void setConnectionValues(Google google, ConnectionValues values) {
    Person profile = google.plusOperations().getGoogleProfile();
    values.setProviderUserId(profile.getId());
    values.setDisplayName(profile.getDisplayName());
    values.setProfileUrl(profile.getUrl());
    values.setImageUrl(profile.getImageUrl());
  }
View Full Code Here


    values.setProfileUrl(profile.getUrl());
    values.setImageUrl(profile.getImageUrl());
  }

  public UserProfile fetchUserProfile(Google google) {
    Person profile = google.plusOperations().getGoogleProfile();
    return new UserProfileBuilder().setUsername(profile.getId())
        .setEmail(profile.getAccountEmail())
        .setName(profile.getDisplayName())
        .setFirstName(profile.getGivenName())
        .setLastName(profile.getFamilyName()).build();
  }
View Full Code Here

  public void fetchProfile() {

    PlusOperations plusOperations = Mockito.mock(PlusOperations.class);
    Mockito.when(google.plusOperations()).thenReturn(plusOperations);

    Person person = Mockito.mock(Person.class);
    Mockito.when(person.getDisplayName()).thenReturn("Gabriel Axel");
    Mockito.when(person.getGivenName()).thenReturn("Gabriel");
    Mockito.when(person.getFamilyName()).thenReturn("Axel");
    Mockito.when(person.getAccountEmail()).thenReturn("guznik@gmail.com");
    Mockito.when(person.getId()).thenReturn("114863353858610846998");

    Mockito.when(plusOperations.getGoogleProfile()).thenReturn(person);
    UserProfile profile = apiAdapter.fetchUserProfile(google);
    assertEquals("Gabriel Axel", profile.getName());
    assertEquals("Gabriel", profile.getFirstName());
View Full Code Here

TOP

Related Classes of org.springframework.social.google.api.plus.Person

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.