throws Exception
{
IOUtils.copy(getClass().getResourceAsStream("/test-conf/etc/security-users-in-both-realms.xml"),
new FileOutputStream(getNexusSecurityConfiguration()));
SecuritySystem securitySystem = this.getSecuritySystem();
securitySystem.start();
List<String> realms = new ArrayList<String>();
realms.add("XmlAuthenticatingRealm");
realms.add(LdapPlugin.REALM_NAME);
securitySystem.setRealms(realms);
// the user developer is in both realms, we need to make sure the order is honored
User user = securitySystem.getUser("brianf");
Assert.assertEquals("default", user.getSource());
realms.clear();
realms.add(LdapPlugin.REALM_NAME);
realms.add("XmlAuthenticatingRealm");
securitySystem.setRealms(realms);
// now the user should belong to the LDAP realm
user = securitySystem.getUser("brianf");
Assert.assertEquals("LDAP", user.getSource());
}