String oldp = System.getProperty(LOGIN_CONFIG);
try {
System.setProperty(LOGIN_CONFIG,
new File(otherConfFile).getCanonicalPath());
DefaultConfiguration dc = new DefaultConfiguration();
assertNotNull(dc);
ents = dc.getAppConfigurationEntry("Login2");
assertNotNull(ents);
ents = dc.getAppConfigurationEntry("other");
assertNotNull(ents);
ents = dc.getAppConfigurationEntry("Login1");
assertNotNull(ents);
Map<String, String> m = new HashMap<String, String>();
for (AppConfigurationEntry element : ents) {
assertEquals("com.intel.security.auth.module.LoginModule1",
element.getLoginModuleName());
m.clear();
m.put("debug1", "true");
m.put("test1", "false");
assertEquals(m, element.getOptions());
assertEquals("LoginModuleControlFlag: required", element
.getControlFlag().toString());
}
ents = dc.getAppConfigurationEntry("Login7");
assertNotNull(ents);
assertEquals("com.intel.security.auth.module.LoginModule1", ents[0].getLoginModuleName());
assertEquals("com.intel.security.auth.module.LoginModule2", ents[1].getLoginModuleName());