@Test
 public void removeConnection() {
   SocialUserConnection facebookConnection = insertFacebookConnection();
   assertThat(socialUserConnectionRepository.findOne(facebookConnection.getId())).isNotNull();
   connectionRepository.removeConnection(new ConnectionKey("facebook", "9"));
   assertThat(socialUserConnectionRepository.findOne(facebookConnection.getId())).isNull();
 }
 private SocialUserConnection createExistingSocialUserConnection(
     String userId,
     String providerId,
     String providerUserId,
     Long rank,
     String displayName,
     String profileURL,
     String imageURL,
     String accessToken,
     String secret,
     String refreshToken,
     Long expireTime) {
   SocialUserConnection socialUserConnectionToSabe =
       new SocialUserConnection(
           userId,
           providerId,
           providerUserId,
           rank,
           displayName,
           profileURL,
           imageURL,
           accessToken,
           secret,
           refreshToken,
           expireTime);
   return socialUserConnectionRepository.save(socialUserConnectionToSabe);
 }
コード例 #3
0
 @Override
 public Set<String> findUserIdsConnectedTo(String providerId, Set<String> providerUserIds) {
   List<SocialUserConnection> socialUserConnections =
       socialUserConnectionRepository.findAllByProviderIdAndProviderUserIdIn(
           providerId, providerUserIds);
   return socialUserConnections
       .stream()
       .map(SocialUserConnection::getUserId)
       .collect(Collectors.toSet());
 };
コード例 #4
0
 @Override
 public List<String> findUserIdsWithConnection(Connection<?> connection) {
   ConnectionKey key = connection.getKey();
   List<SocialUserConnection> socialUserConnections =
       socialUserConnectionRepository.findAllByProviderIdAndProviderUserId(
           key.getProviderId(), key.getProviderUserId());
   return socialUserConnections
       .stream()
       .map(SocialUserConnection::getUserId)
       .collect(Collectors.toList());
 };
  @Before
  public void setUp() {
    socialUserConnectionRepository.deleteAll();

    connectionFactoryRegistry = new ConnectionFactoryRegistry();
    connectionFactory = new TestFacebookConnectionFactory();
    connectionFactoryRegistry.addConnectionFactory(connectionFactory);
    usersConnectionRepository =
        new CustomSocialUsersConnectionRepository(
            socialUserConnectionRepository, connectionFactoryRegistry);
    connectionRepository = usersConnectionRepository.createConnectionRepository("1");
  }