use of org.apache.syncope.common.lib.policy.DefaultPasswordRuleConf in project syncope by apache.
the class PolicyTest method update.
@Test
public void update() {
PasswordPolicy policy = policyDAO.find("ce93fcda-dc3a-4369-a7b0-a6108c261c85");
assertNotNull(policy);
assertEquals(1, policy.getRules().size());
DefaultPasswordRuleConf ruleConf = new DefaultPasswordRuleConf();
ruleConf.setMaxLength(8);
ruleConf.setMinLength(6);
Implementation rule = entityFactory.newEntity(Implementation.class);
rule.setKey("PasswordRule" + UUID.randomUUID().toString());
rule.setEngine(ImplementationEngine.JAVA);
rule.setType(ImplementationType.PASSWORD_RULE);
rule.setBody(POJOHelper.serialize(ruleConf));
rule = implementationDAO.save(rule);
policy.add(rule);
policy = policyDAO.save(policy);
assertNotNull(policy);
rule = policy.getRules().get(1);
DefaultPasswordRuleConf actual = POJOHelper.deserialize(rule.getBody(), DefaultPasswordRuleConf.class);
assertEquals(actual.getMaxLength(), 8);
assertEquals(actual.getMinLength(), 6);
}
Aggregations