@Test public void getUserInfoListTest() { List<UserInfo> userInfo = new ArrayList<>(); userInfo.add(UserInfo.builder() .firstName("test1") .lastName("test1") .userEmail("test1@test.com") .userId("test") .build()); userInfo.add(UserInfo.builder() .firstName("test2") .lastName("test2") .userEmail("test2@test.com") .userId("test") .build()); userInfo.add(UserInfo.builder() .firstName("test3") .lastName("test3") .userEmail("test3@test.com") .userId("test") .build()); when(userInfoAccessor.getUserInfoBy(eq("test"))).thenReturn(userInfoResult); when(userInfoResult.iterator()).thenReturn(userInfo.iterator()); List<UserInfo> result = repository.getUserInfoList( com.intuit.wasabi.authenticationobjects.UserInfo.Username.valueOf("test") ); logger.info(result.toString()); assertThat(result.size(), is(3)); }
List<com.intuit.wasabi.repository.cassandra.pojo.UserInfo> getUserInfoList(UserInfo.Username userID) { List<com.intuit.wasabi.repository.cassandra.pojo.UserInfo> resultList = Collections.EMPTY_LIST; try { Result<com.intuit.wasabi.repository.cassandra.pojo.UserInfo> result = userInfoAccessor.getUserInfoBy(userID.getUsername()); resultList = StreamSupport.stream( Spliterators.spliteratorUnknownSize(result.iterator(), Spliterator.ORDERED), false) .collect(Collectors.toList()); } catch (ReadTimeoutException | UnavailableException | NoHostAvailableException e) { throw new RepositoryException("Could not retrieve info for user \"" + userID + "\"", e); } return resultList; }
CassandraAuthorizationRepository implements AuthorizationRepository { List<com.intuit.wasabi.repository.cassandra.pojo.UserInfo> getUserInfoList(UserInfo.Username userID) { List<com.intuit.wasabi.repository.cassandra.pojo.UserInfo> resultList = Collections.EMPTY_LIST; try { Result<com.intuit.wasabi.repository.cassandra.pojo.UserInfo> result = userInfoAccessor.getUserInfoBy(userID.getUsername()); resultList = StreamSupport.stream( Spliterators.spliteratorUnknownSize(result.iterator(), Spliterator.ORDERED), false) .collect(Collectors.toList()); } catch (ReadTimeoutException | UnavailableException | NoHostAvailableException e) { throw new RepositoryException("Could not retrieve info for user \"" + userID + "\"", e); } return resultList; } }
CassandraAuthorizationRepository implements AuthorizationRepository { List<com.intuit.wasabi.repository.cassandra.pojo.UserInfo> getUserInfoList(UserInfo.Username userID) { List<com.intuit.wasabi.repository.cassandra.pojo.UserInfo> resultList = Collections.EMPTY_LIST; try { Result<com.intuit.wasabi.repository.cassandra.pojo.UserInfo> result = userInfoAccessor.getUserInfoBy(userID.getUsername()); resultList = StreamSupport.stream( Spliterators.spliteratorUnknownSize(result.iterator(), Spliterator.ORDERED), false) .collect(Collectors.toList()); } catch (ReadTimeoutException | UnavailableException | NoHostAvailableException e) { throw new RepositoryException("Could not retrieve info for user \"" + userID + "\"", e); } return resultList; } @Inject  CassandraAuthorizationRepository(ApplicationListAccessor applicationListAccessor,
                                            AppRoleAccessor appRoleAccessor,
                                            UserRoleAccessor userRoleAccessor,
                                            UserInfoAccessor userInfoAccessor,
                                            UserDirectory userDirectory,
                                            MappingManager mappingManager); }
CassandraAuthorizationRepository implements AuthorizationRepository { List<com.intuit.wasabi.repository.cassandra.pojo.UserInfo> getUserInfoList(UserInfo.Username userID) { List<com.intuit.wasabi.repository.cassandra.pojo.UserInfo> resultList = Collections.EMPTY_LIST; try { Result<com.intuit.wasabi.repository.cassandra.pojo.UserInfo> result = userInfoAccessor.getUserInfoBy(userID.getUsername()); resultList = StreamSupport.stream( Spliterators.spliteratorUnknownSize(result.iterator(), Spliterator.ORDERED), false) .collect(Collectors.toList()); } catch (ReadTimeoutException | UnavailableException | NoHostAvailableException e) { throw new RepositoryException("Could not retrieve info for user \"" + userID + "\"", e); } return resultList; } @Inject  CassandraAuthorizationRepository(ApplicationListAccessor applicationListAccessor,
                                            AppRoleAccessor appRoleAccessor,
                                            UserRoleAccessor userRoleAccessor,
                                            UserInfoAccessor userInfoAccessor,
                                            UserDirectory userDirectory,
                                            MappingManager mappingManager); @Override UserPermissionsList getUserPermissionsList(UserInfo.Username userID); @Override UserRoleList getApplicationUsers(Application.Name applicationName); @Override UserPermissions getUserPermissions(@Nonnull UserInfo.Username username,
                                              @Nonnull Application.Name applicationName); @Override void deleteUserRole(UserInfo.Username userID, Application.Name applicationName); @Override void setUserRole(UserRole userRole); @Override UserRoleList getUserRoleList(UserInfo.Username userID); @Override UserInfo getUserInfo(UserInfo.Username userID); @Override void setUserInfo(UserInfo userInfo); @Override UserPermissions checkSuperAdminPermissions(UserInfo.Username userID, Application.Name applicationName); @Override void assignUserToSuperAdminRole(UserInfo candidateUser); @Override void removeUserFromSuperAdminRole(UserInfo candidateUser); @Override List<UserRole> getSuperAdminRoleList(); }
CassandraAuthorizationRepository implements AuthorizationRepository { List<com.intuit.wasabi.repository.cassandra.pojo.UserInfo> getUserInfoList(UserInfo.Username userID) { List<com.intuit.wasabi.repository.cassandra.pojo.UserInfo> resultList = Collections.EMPTY_LIST; try { Result<com.intuit.wasabi.repository.cassandra.pojo.UserInfo> result = userInfoAccessor.getUserInfoBy(userID.getUsername()); resultList = StreamSupport.stream( Spliterators.spliteratorUnknownSize(result.iterator(), Spliterator.ORDERED), false) .collect(Collectors.toList()); } catch (ReadTimeoutException | UnavailableException | NoHostAvailableException e) { throw new RepositoryException("Could not retrieve info for user \"" + userID + "\"", e); } return resultList; } @Inject  CassandraAuthorizationRepository(ApplicationListAccessor applicationListAccessor,
                                            AppRoleAccessor appRoleAccessor,
                                            UserRoleAccessor userRoleAccessor,
                                            UserInfoAccessor userInfoAccessor,
                                            UserDirectory userDirectory,
                                            MappingManager mappingManager); @Override UserPermissionsList getUserPermissionsList(UserInfo.Username userID); @Override UserRoleList getApplicationUsers(Application.Name applicationName); @Override UserPermissions getUserPermissions(@Nonnull UserInfo.Username username,
                                              @Nonnull Application.Name applicationName); @Override void deleteUserRole(UserInfo.Username userID, Application.Name applicationName); @Override void setUserRole(UserRole userRole); @Override UserRoleList getUserRoleList(UserInfo.Username userID); @Override UserInfo getUserInfo(UserInfo.Username userID); @Override void setUserInfo(UserInfo userInfo); @Override UserPermissions checkSuperAdminPermissions(UserInfo.Username userID, Application.Name applicationName); @Override void assignUserToSuperAdminRole(UserInfo candidateUser); @Override void removeUserFromSuperAdminRole(UserInfo candidateUser); @Override List<UserRole> getSuperAdminRoleList(); static final String ALL_APPLICATIONS; }