@Test public void canGetUserByUserNameForExistingUsers() throws Exception{ final User result = userManager.getUser(USER_ID); assertThat(result.getUsername(), is(USER_ID)); assertThat(result.getEmail(), is("test-email@example.com")); assertThat(result.getName(), is("Test User Name")); }
public User getUser(String username) throws UserNotFoundException { if (username == null) { throw new UserNotFoundException("Username cannot be null"); } username = username.trim().toLowerCase(); User user = userCache.get(username); if (user == null) { synchronized (userBaseMutex.intern(username)) { user = userCache.get(username); if (user == null) { user = provider.loadUser(username); userCache.put(username, user); } } } return user; }
UserManager { public User getUser(String username) throws UserNotFoundException { if (username == null) { throw new UserNotFoundException("Username cannot be null"); } username = username.trim().toLowerCase(); User user = userCache.get(username); if (user == null) { synchronized (userBaseMutex.intern(username)) { user = userCache.get(username); if (user == null) { user = provider.loadUser(username); userCache.put(username, user); } } } return user; } }
UserManager { public User getUser(String username) throws UserNotFoundException { if (username == null) { throw new UserNotFoundException("Username cannot be null"); } username = username.trim().toLowerCase(); User user = userCache.get(username); if (user == null) { synchronized (userBaseMutex.intern(username)) { user = userCache.get(username); if (user == null) { user = provider.loadUser(username); userCache.put(username, user); } } } return user; } private  UserManager();   UserManager(final XMPPServer xmppServer); }
UserManager { public User getUser(String username) throws UserNotFoundException { if (username == null) { throw new UserNotFoundException("Username cannot be null"); } username = username.trim().toLowerCase(); User user = userCache.get(username); if (user == null) { synchronized (userBaseMutex.intern(username)) { user = userCache.get(username); if (user == null) { user = provider.loadUser(username); userCache.put(username, user); } } } return user; } private  UserManager();   UserManager(final XMPPServer xmppServer); @SuppressWarnings("AccessStaticViaInstance") static UserProvider getUserProvider(); @SuppressWarnings("AccessStaticViaInstance") static UserPropertyProvider getUserPropertyProvider(); static UserManager getInstance(); User createUser(String username, final String password, final String name, final String email); void deleteUser(final User user); User getUser(String username); int getUserCount(); Collection<User> getUsers(); Collection<String> getUsernames(); Collection<User> getUsers(final int startIndex, final int numResults); Set<String> getSearchFields(); Collection<User> findUsers(final Set<String> fields, final String query); Collection<User> findUsers(final Set<String> fields, final String query, final int startIndex,
                                      final int numResults); boolean isRegisteredUser(final String username); boolean isRegisteredUser(final JID user); static void setProvider(UserProvider provider); void clearCaches(); }
UserManager { public User getUser(String username) throws UserNotFoundException { if (username == null) { throw new UserNotFoundException("Username cannot be null"); } username = username.trim().toLowerCase(); User user = userCache.get(username); if (user == null) { synchronized (userBaseMutex.intern(username)) { user = userCache.get(username); if (user == null) { user = provider.loadUser(username); userCache.put(username, user); } } } return user; } private  UserManager();   UserManager(final XMPPServer xmppServer); @SuppressWarnings("AccessStaticViaInstance") static UserProvider getUserProvider(); @SuppressWarnings("AccessStaticViaInstance") static UserPropertyProvider getUserPropertyProvider(); static UserManager getInstance(); User createUser(String username, final String password, final String name, final String email); void deleteUser(final User user); User getUser(String username); int getUserCount(); Collection<User> getUsers(); Collection<String> getUsernames(); Collection<User> getUsers(final int startIndex, final int numResults); Set<String> getSearchFields(); Collection<User> findUsers(final Set<String> fields, final String query); Collection<User> findUsers(final Set<String> fields, final String query, final int startIndex,
                                      final int numResults); boolean isRegisteredUser(final String username); boolean isRegisteredUser(final JID user); static void setProvider(UserProvider provider); void clearCaches(); static final SystemProperty<Class> USER_PROVIDER; static final SystemProperty<Class> USER_PROPERTY_PROVIDER; }