@Test public void blankIdentifierAndForceReturnsInvalidUser() throws Exception { User u = this.userManager.getUser("\n \t", true); Assert.assertEquals("", u.getId()); Assert.assertTrue(u instanceof InvalidUser); }
@Override public User getUser(String identifier, boolean force) { if (StringUtils.isBlank(identifier)) { return new InvalidUser(null, this.serializer); } User result = null; try { Map<String, UserManager> managers = this.componentManager.getInstanceMap(UserManager.class); managers.remove("default"); for (UserManager manager : managers.values()) { result = manager.getUser(identifier); if (result != null) { return result; } } } catch (ComponentLookupException ex) { } if (force) { try { UserManager defaultManager = this.componentManager.getInstance(UserManager.class, this.configuration.getProperty("users.defaultUserManager", "wiki")); return defaultManager.getUser(identifier, true); } catch (ComponentLookupException ex) { } } return new InvalidUser(getDefaultReference(identifier), this.serializer); }
MetaUserManager extends AbstractUserManager { @Override public User getUser(String identifier, boolean force) { if (StringUtils.isBlank(identifier)) { return new InvalidUser(null, this.serializer); } User result = null; try { Map<String, UserManager> managers = this.componentManager.getInstanceMap(UserManager.class); managers.remove("default"); for (UserManager manager : managers.values()) { result = manager.getUser(identifier); if (result != null) { return result; } } } catch (ComponentLookupException ex) { } if (force) { try { UserManager defaultManager = this.componentManager.getInstance(UserManager.class, this.configuration.getProperty("users.defaultUserManager", "wiki")); return defaultManager.getUser(identifier, true); } catch (ComponentLookupException ex) { } } return new InvalidUser(getDefaultReference(identifier), this.serializer); } }
MetaUserManager extends AbstractUserManager { @Override public User getUser(String identifier, boolean force) { if (StringUtils.isBlank(identifier)) { return new InvalidUser(null, this.serializer); } User result = null; try { Map<String, UserManager> managers = this.componentManager.getInstanceMap(UserManager.class); managers.remove("default"); for (UserManager manager : managers.values()) { result = manager.getUser(identifier); if (result != null) { return result; } } } catch (ComponentLookupException ex) { } if (force) { try { UserManager defaultManager = this.componentManager.getInstance(UserManager.class, this.configuration.getProperty("users.defaultUserManager", "wiki")); return defaultManager.getUser(identifier, true); } catch (ComponentLookupException ex) { } } return new InvalidUser(getDefaultReference(identifier), this.serializer); }  }
MetaUserManager extends AbstractUserManager { @Override public User getUser(String identifier, boolean force) { if (StringUtils.isBlank(identifier)) { return new InvalidUser(null, this.serializer); } User result = null; try { Map<String, UserManager> managers = this.componentManager.getInstanceMap(UserManager.class); managers.remove("default"); for (UserManager manager : managers.values()) { result = manager.getUser(identifier); if (result != null) { return result; } } } catch (ComponentLookupException ex) { } if (force) { try { UserManager defaultManager = this.componentManager.getInstance(UserManager.class, this.configuration.getProperty("users.defaultUserManager", "wiki")); return defaultManager.getUser(identifier, true); } catch (ComponentLookupException ex) { } } return new InvalidUser(getDefaultReference(identifier), this.serializer); }  @Override User getUser(String identifier, boolean force); @Override User getCurrentUser(); }
MetaUserManager extends AbstractUserManager { @Override public User getUser(String identifier, boolean force) { if (StringUtils.isBlank(identifier)) { return new InvalidUser(null, this.serializer); } User result = null; try { Map<String, UserManager> managers = this.componentManager.getInstanceMap(UserManager.class); managers.remove("default"); for (UserManager manager : managers.values()) { result = manager.getUser(identifier); if (result != null) { return result; } } } catch (ComponentLookupException ex) { } if (force) { try { UserManager defaultManager = this.componentManager.getInstance(UserManager.class, this.configuration.getProperty("users.defaultUserManager", "wiki")); return defaultManager.getUser(identifier, true); } catch (ComponentLookupException ex) { } } return new InvalidUser(getDefaultReference(identifier), this.serializer); }  @Override User getUser(String identifier, boolean force); @Override User getCurrentUser();  }