tester.assertRenderedPage(basePage.getClass());
assertEquals(3, countItmes());
assertNotNull(getSecurityNamedServiceConfig("default"));
assertNotNull(getSecurityNamedServiceConfig("master"));
PasswordPolicyConfig pwConfig=
(PasswordPolicyConfig)
getSecurityNamedServiceConfig("default2");
assertNotNull(pwConfig);
assertEquals("default2",pwConfig.getName());
assertEquals(PasswordValidatorImpl.class.getName(),pwConfig.getClassName());
assertTrue(pwConfig.isDigitRequired());
assertTrue(pwConfig.isLowercaseRequired());
assertTrue(pwConfig.isUppercaseRequired());
assertEquals(2, pwConfig.getMinLength());
assertEquals(4, pwConfig.getMaxLength());
// reload from manager
pwConfig= (PasswordPolicyConfig)
getSecurityManager().loadPasswordPolicyConfig("default2");
assertNotNull(pwConfig);
assertEquals("default2",pwConfig.getName());
assertEquals(PasswordValidatorImpl.class.getName(),pwConfig.getClassName());
assertTrue(pwConfig.isDigitRequired());
assertTrue(pwConfig.isLowercaseRequired());
assertTrue(pwConfig.isUppercaseRequired());
assertEquals(2, pwConfig.getMinLength());
assertEquals(4, pwConfig.getMaxLength());
// test add with name clash
clickAddNew();
newFormTester();
setSecurityConfigClassName(PasswordPolicyPanelInfo.class);
newFormTester();
setSecurityConfigName("default2");
clickSave(); // should not work
tester.assertRenderedPage(SecurityNamedServiceNewPage.class);
testErrorMessagesWithRegExp(".*default2.*");
clickCancel();
tester.assertRenderedPage(basePage.getClass());
// end test add with name clash
// start test modify
clickNamedServiceConfig("default2");
tester.assertRenderedPage(SecurityNamedServiceEditPage.class);
newFormTester("panel:panel:form");
formTester.setValue("panel:maxLength:maxLength", "27");
clickCancel();
tester.assertRenderedPage(basePage.getClass());
pwConfig=
(PasswordPolicyConfig)
getSecurityNamedServiceConfig("default2");
assertEquals(4,pwConfig.getMaxLength());
clickNamedServiceConfig("default2");
newFormTester("panel:panel:form");
//setUnlimted(true);
formTester.setValue("panel:unlimitedMaxLength", true);
tester.executeAjaxEvent("panel:panel:form:panel:unlimitedMaxLength","onclick");
tester.assertInvisible("panel:panel:form:panel:maxLength:maxLength");
newFormTester("panel:panel:form");
//setDigitRequired(false);
formTester.setValue("panel:digitRequired", false);
//setUpperCaseRequired(false);
formTester.setValue("panel:uppercaseRequired", false);
//setLowerCaseRequired(false);
formTester.setValue("panel:lowercaseRequired", false);
formTester.setValue("panel:minLength", "3");
//setMinLength(3);
clickSave();
tester.assertRenderedPage(basePage.getClass());
pwConfig=
(PasswordPolicyConfig )
getSecurityNamedServiceConfig("default2");
assertFalse(pwConfig.isDigitRequired());
assertFalse(pwConfig.isLowercaseRequired());
assertFalse(pwConfig.isUppercaseRequired());
assertEquals(3, pwConfig.getMinLength());
assertEquals(-1, pwConfig.getMaxLength());
pwConfig=getSecurityManager().loadPasswordPolicyConfig("default2");
assertFalse(pwConfig.isDigitRequired());
assertFalse(pwConfig.isLowercaseRequired());
assertFalse(pwConfig.isUppercaseRequired());
assertEquals(3, pwConfig.getMinLength());
assertEquals(-1, pwConfig.getMaxLength());
//doRemove("tabbedPanel:panel:removeSelected");
}