@Test public void retrieveOrDefaultUserTest() { com.intuit.wasabi.authenticationobjects.UserInfo mocked = mock(com.intuit.wasabi.authenticationobjects.UserInfo.class); com.intuit.wasabi.authenticationobjects.UserInfo.Username username = com.intuit.wasabi.authenticationobjects.UserInfo.Username.valueOf("test"); doReturn(mocked).when(spyRepository).lookupUser(eq(username)); doNothing().when(spyRepository).setUserInfo(anyObject()); spyRepository.retrieveOrDefaultUser(username); verify(spyRepository, times(1)).lookupUser(username); verify(spyRepository, times(1)).setUserInfo(anyObject()); }
UserInfo retrieveOrDefaultUser(UserInfo.Username userID) { UserInfo userInfo = lookupUser(userID); setUserInfo(userInfo); return userInfo; }
CassandraAuthorizationRepository implements AuthorizationRepository { UserInfo retrieveOrDefaultUser(UserInfo.Username userID) { UserInfo userInfo = lookupUser(userID); setUserInfo(userInfo); return userInfo; } }
CassandraAuthorizationRepository implements AuthorizationRepository { UserInfo retrieveOrDefaultUser(UserInfo.Username userID) { UserInfo userInfo = lookupUser(userID); setUserInfo(userInfo); return userInfo; } @Inject  CassandraAuthorizationRepository(ApplicationListAccessor applicationListAccessor,
                                            AppRoleAccessor appRoleAccessor,
                                            UserRoleAccessor userRoleAccessor,
                                            UserInfoAccessor userInfoAccessor,
                                            UserDirectory userDirectory,
                                            MappingManager mappingManager); }
CassandraAuthorizationRepository implements AuthorizationRepository { UserInfo retrieveOrDefaultUser(UserInfo.Username userID) { UserInfo userInfo = lookupUser(userID); setUserInfo(userInfo); return userInfo; } @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 { UserInfo retrieveOrDefaultUser(UserInfo.Username userID) { UserInfo userInfo = lookupUser(userID); setUserInfo(userInfo); return userInfo; } @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; }