当前位置: 首页>>代码示例>>Java>>正文


Java UserProfileBuilder类代码示例

本文整理汇总了Java中org.springframework.social.connect.UserProfileBuilder的典型用法代码示例。如果您正苦于以下问题:Java UserProfileBuilder类的具体用法?Java UserProfileBuilder怎么用?Java UserProfileBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UserProfileBuilder类属于org.springframework.social.connect包,在下文中一共展示了UserProfileBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testFindUserIdsWithConnectionNewUser

import org.springframework.social.connect.UserProfileBuilder; //导入依赖的package包/类
@Test
public void testFindUserIdsWithConnectionNewUser() throws Exception {
  TestConnection connection = new TestConnection(
      SocialTestUtils.key(SocialTestUtils.FACEBOOK, SocialTestUtils.PROVIDER_USER_ID_ONE));
  connection
      .setDisplayName(SocialTestUtils.DISPLAY_NAME)
      .setImageUrl(SocialTestUtils.IMAGE_URL)
      .setProfileUrl("http://www.facebook.com/sbelov2015")
      .setUserProfile(new UserProfileBuilder()
          .setEmail(SocialTestUtils.USER_EMAIL_ONE)
          .setFirstName("Stan")
          .setLastName("Belov")
          .setName("Stan Belov")
          .setUsername(SocialTestUtils.PROVIDER_USER_ID_ONE)
          .build());
  when(connectionSignUp.execute(connection)).thenReturn(SocialTestUtils.USER_EMAIL_ONE);
  List<String> userIds = usersConnectionRepository.findUserIdsWithConnection(connection);
  assertEquals(ImmutableList.of(SocialTestUtils.USER_EMAIL_ONE), ImmutableList.copyOf(userIds));
  verify(connectionSignUp).execute(connection);
}
 
开发者ID:cs71-caffeine,项目名称:awesome-agile,代码行数:21,代码来源:AwesomeAgileUsersConnectionRepositoryTest.java

示例2: testFindUserIdsWithConnectionExistingUser

import org.springframework.social.connect.UserProfileBuilder; //导入依赖的package包/类
@Test
public void testFindUserIdsWithConnectionExistingUser() throws Exception {
  TestConnection connection = new TestConnection(
      SocialTestUtils.key(SocialTestUtils.FACEBOOK, SocialTestUtils.PROVIDER_USER_ID_ONE));
  connection
      .setDisplayName(SocialTestUtils.DISPLAY_NAME)
      .setImageUrl(SocialTestUtils.IMAGE_URL)
      .setProfileUrl("http://www.facebook.com/sbelov2015")
      .setUserProfile(new UserProfileBuilder()
          .setEmail("[email protected]")
          .setFirstName("Stan")
          .setLastName("Belov")
          .setName("Stan Belov")
          .setUsername(SocialTestUtils.PROVIDER_USER_ID_ONE)
          .build());
  when(userRepository.findOneByAuthProviderUserId(
      SocialTestUtils.FACEBOOK, SocialTestUtils.PROVIDER_USER_ID_ONE))
      .thenReturn(SocialTestUtils.USER_ONE);
  List<String> userIds = usersConnectionRepository.findUserIdsWithConnection(connection);
  verify(userRepository, never()).save(any(User.class));
  assertEquals(ImmutableList.of(SocialTestUtils.USER_EMAIL_ONE), ImmutableList.copyOf(userIds));
}
 
开发者ID:cs71-caffeine,项目名称:awesome-agile,代码行数:23,代码来源:AwesomeAgileUsersConnectionRepositoryTest.java

示例3: fetchUserProfile

import org.springframework.social.connect.UserProfileBuilder; //导入依赖的package包/类
@Override
public UserProfile fetchUserProfile(Discord api) {
    DiscordUser profile = api.userOperations().getUser();
    return new UserProfileBuilder()
        .setId(profile.getId())
        .setName(profile.getUsername() + " " + profile.getDiscriminator())
        .setUsername(api.userOperations().getNickname())
        .setEmail(profile.getEmail())
        .build();
}
 
开发者ID:quanticc,项目名称:sentry,代码行数:11,代码来源:DiscordAdapter.java

示例4: fetchUserProfile

import org.springframework.social.connect.UserProfileBuilder; //导入依赖的package包/类
@Override
public UserProfile fetchUserProfile(GitlabAPI gitlab) {
    try {
        GitlabUser gitlabUser = gitlab.getUser();

        return new UserProfileBuilder()
                .setEmail(gitlabUser.getEmail())
                .setName(gitlabUser.getName())
                .setUsername(gitlabUser.getUsername())
                .build();
    } catch (IOException e) {
        throw new ApiException("gitlab?", "Could not fetch current user.", e);
    }
}
 
开发者ID:burning-duck,项目名称:spring-social-gitlab,代码行数:15,代码来源:GitlabAdapter.java

示例5: testExecute

import org.springframework.social.connect.UserProfileBuilder; //导入依赖的package包/类
@Test
public void testExecute() throws Exception {
  TestConnection connection = new TestConnection(
      SocialTestUtils.key(SocialTestUtils.FACEBOOK, SocialTestUtils.PROVIDER_USER_ID_ONE));
  connection
      .setDisplayName(SocialTestUtils.DISPLAY_NAME)
      .setImageUrl(SocialTestUtils.IMAGE_URL)
      .setProfileUrl("http://www.facebook.com/sbelov2015")
      .setUserProfile(new UserProfileBuilder()
          .setEmail(SocialTestUtils.USER_EMAIL_ONE)
          .setFirstName("Stan")
          .setLastName("Belov")
          .setName("Stan Belov")
          .setUsername(SocialTestUtils.PROVIDER_USER_ID_ONE)
          .build());
  connectionSignUp.execute(connection);
  ArgumentCaptor<User> userCaptor = ArgumentCaptor.forClass(User.class);
  verify(userRepository).save(userCaptor.capture());
  User captured = userCaptor.getValue();
  assertEquals(FACEBOOK, captured.getAuthProviderId());
  assertEquals(PROVIDER_USER_ID_ONE, captured.getAuthProviderUserId());
  assertEquals(USER_EMAIL_ONE, captured.getPrimaryEmail());
  assertEquals(DISPLAY_NAME, captured.getDisplayName());
  assertEquals(UserStatus.ACTIVE, captured.getStatus());
  assertEquals(IMAGE_URL, captured.getAvatar());
  assertTrue(captured.isVisible());
}
 
开发者ID:cs71-caffeine,项目名称:awesome-agile,代码行数:28,代码来源:AwesomeAgileConnectionSignupTest.java

示例6: fetchUserProfile

import org.springframework.social.connect.UserProfileBuilder; //导入依赖的package包/类
@Override
public UserProfile fetchUserProfile(Kakao kakao) {
    UserProfileBuilder profileBuilder = new UserProfileBuilder();

    KakaoProfile profile = fetchPrimaryProfile(kakao);
    if (profile != null) {
        profileBuilder.setUsername(profile.getUsername());
    }

    return profileBuilder.build();

}
 
开发者ID:Hongchae,项目名称:spring-social-kakao,代码行数:13,代码来源:KakaoAdaptor.java

示例7: fetchUserProfile

import org.springframework.social.connect.UserProfileBuilder; //导入依赖的package包/类
public UserProfile fetchUserProfile(final Naver naver) {
	return new UserProfileBuilder()
			.setEmail(naver.userOperation().getEmail())
			.setName(naver.userOperation().getName())
			.setUsername(naver.userOperation().getNickname())
			.build();
}
 
开发者ID:mornya,项目名称:spring-social-naver,代码行数:8,代码来源:NaverAdapter.java

示例8: fetchUserProfile

import org.springframework.social.connect.UserProfileBuilder; //导入依赖的package包/类
@Override
public UserProfile fetchUserProfile(Weibo api) {
	try {
		String uid = api.accountOperations().getUid().getString("uid");
		User user = api.usersOperations().showUserById(uid);
		return new UserProfileBuilder().setName(user.getName()).setUsername(uid).build();
	} catch (Exception e) {
		LOG.error("error fetchUserProfile", e);
	}
	return null;

}
 
开发者ID:xfcjscn,项目名称:spring-social-weibo,代码行数:13,代码来源:WeiboAdapter.java

示例9: fetchUserProfile

import org.springframework.social.connect.UserProfileBuilder; //导入依赖的package包/类
@Override
public UserProfile fetchUserProfile(Reddit reddit) {
    RedditProfile profile = reddit.userOperations().getUserProfile();
    return new UserProfileBuilder()
            .setUsername(profile.getUsername())
            .setName(profile.getUsername())
            .build();
                                        
}
 
开发者ID:alyahmed,项目名称:spring-social-reddit,代码行数:10,代码来源:RedditAdapter.java

示例10: fetchUserProfile

import org.springframework.social.connect.UserProfileBuilder; //导入依赖的package包/类
@Override
public UserProfile fetchUserProfile(Meetup meetup) {
	
	Member self = meetup.memberOperations().getDetails();
	
	return new UserProfileBuilder().setName(self.getName())
							.setEmail(self.getEmail())
							.setUsername(self.getId()).build();
}
 
开发者ID:yarli4u,项目名称:spring-social-meetup,代码行数:10,代码来源:MeetupAdapter.java

示例11: fetchUserProfile

import org.springframework.social.connect.UserProfileBuilder; //导入依赖的package包/类
@Override
public UserProfile fetchUserProfile(Gaelic gaelic) {
    GaelicProfile profile = gaelic.getProfile();
    final UserProfileBuilder BUILDER = new UserProfileBuilder();
    return BUILDER
            .setUsername(profile.getId())
            .setEmail(profile.getEmail())
            .build();
}
 
开发者ID:goldengekko,项目名称:spring-social-gaelic,代码行数:10,代码来源:GaelicAdapter.java

示例12: fetchUserProfile

import org.springframework.social.connect.UserProfileBuilder; //导入依赖的package包/类
public UserProfile fetchUserProfile(Plus api) {
    Person person = api.getPeopleOperations().get("me");
    UserProfileBuilder builder = new UserProfileBuilder().setFirstName(person.getName().getGivenName()).setLastName(person.getName().getFamilyName());
    builder.setEmail(person.getGoogleAccountEmail());
    builder.setName(person.getName().getFormatted());
    return builder.build();
}
 
开发者ID:Glamdring,项目名称:google-plus-java-api,代码行数:8,代码来源:GooglePlusAdapter.java

示例13: fetchUserProfile

import org.springframework.social.connect.UserProfileBuilder; //导入依赖的package包/类
@Override
public UserProfile fetchUserProfile(Evernote evernote) {
	final User user = evernote.userStoreOperations().getUser();
	return new UserProfileBuilder()
			.setName(user.getName())
			.setEmail(user.getEmail())
			.setUsername(user.getUsername())
			.build();
}
 
开发者ID:ttddyy,项目名称:spring-social-evernote,代码行数:10,代码来源:EvernoteAdapter.java

示例14: testSignup

import org.springframework.social.connect.UserProfileBuilder; //导入依赖的package包/类
@Test
public void testSignup() throws Exception {

    final ConnectionData connectionData = new ConnectionData("provider id",
                                                             "provider user id",
                                                             "display name",
                                                             "profile url",
                                                             "image url",
                                                             "access token",
                                                             "secret",
                                                             "refresh token",
                                                             1234L);

    final UserProfile userProfile = new UserProfileBuilder().setFirstName("first name")
                                                            .setLastName("last name")
                                                            .setEmail("[email protected]")
                                                            .build();

    final Connection<?> connection = new ConnectionStub<>(connectionData, userProfile);

    final ConnectionFactory<?> connectionFactory = new ConnectionFactoryStub<>("provider id", connection);

    final ConnectionFactoryLocatorStub connectionFactoryLocator = new ConnectionFactoryLocatorStub(connectionFactory);

    final ProviderSignInAttempt providerSignInAttempt = new ProviderSignInAttempt(connection, connectionFactoryLocator, null);

    subject.perform(get("/signup")
                            .sessionAttr(ProviderSignInAttempt.class.getName(), providerSignInAttempt))
           .andExpect(view().name(".signup"))
           .andExpect(model().attribute("userForm", allOf(hasProperty("email", equalTo("[email protected]")),
                                                          hasProperty("firstName", equalTo("first name")),
                                                          hasProperty("lastName", equalTo("last name")))));
}
 
开发者ID:martinlau,项目名称:unidle-old,代码行数:34,代码来源:SignupControllerTest.java

示例15: testSubmit

import org.springframework.social.connect.UserProfileBuilder; //导入依赖的package包/类
@Test
public void testSubmit() throws Exception {

    final ConnectionData connectionData = new ConnectionData("provider id",
                                                             "provider user id",
                                                             "display name",
                                                             "profile url",
                                                             "image url",
                                                             "access token",
                                                             "secret",
                                                             "refresh token",
                                                             1234L);

    final UserProfile userProfile = new UserProfileBuilder().setFirstName("first name")
                                                            .setLastName("last name")
                                                            .setEmail("[email protected]")
                                                            .build();

    final Connection<?> connection = new ConnectionStub<>(connectionData, userProfile);

    final ConnectionFactory<?> connectionFactory = new ConnectionFactoryStub<>("provider id", connection);

    final ConnectionFactoryLocatorStub connectionFactoryLocator = new ConnectionFactoryLocatorStub(connectionFactory);

    final UsersConnectionRepository usersConnectionRepository = new UsersConnectionRepositoryStub();

    final ProviderSignInAttempt providerSignInAttempt = new ProviderSignInAttempt(connection, connectionFactoryLocator, usersConnectionRepository);

    subject.perform(post("/signup")
                            .param("email", "[email protected]")
                            .param("firstName", "first name")
                            .param("lastName", "last name")
                            .sessionAttr(ProviderSignInAttempt.class.getName(), providerSignInAttempt))
           .andExpect(view().name("redirect:/account"))
           .andExpect(request().sessionAttribute(ProviderSignInAttempt.class.getName(), nullValue()));

    assertThat(userRepository.count()).isEqualTo(1L);
}
 
开发者ID:martinlau,项目名称:unidle-old,代码行数:39,代码来源:SignupControllerTest.java


注:本文中的org.springframework.social.connect.UserProfileBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。