Package org.apache.syncope.common.to

Examples of org.apache.syncope.common.to.PasswordPolicyTO


        assertTrue(policyTO.getUsedByRoles().isEmpty());
    }

    @Test
    public void createWithException() {
        PasswordPolicyTO policy = new PasswordPolicyTO(true);
        policy.setSpecification(new PasswordPolicySpec());
        policy.setDescription("global password policy");

        try {
            createPolicy(policy);
            fail();
        } catch (SyncopeClientException e) {
View Full Code Here


    }

    @Test
    public void update() {
        // get global password
        PasswordPolicyTO globalPolicy = policyService.read(2L);

        PasswordPolicyTO policy = new PasswordPolicyTO();
        policy.setDescription("A simple password policy");
        policy.setSpecification(globalPolicy.getSpecification());

        // create a new password policy using global password as a template
        policy = createPolicy(policy);

        // read new password policy
        policy = policyService.read(policy.getId());

        assertNotNull("find to update did not work", policy);

        PasswordPolicySpec policySpec = policy.getSpecification();
        policySpec.setMaxLength(22);
        policy.setSpecification(policySpec);

        // update new password policy
        policyService.update(policy.getId(), policy);
        policy = policyService.read(policy.getId());

        assertNotNull(policy);
        assertEquals(PolicyType.PASSWORD, policy.getType());
        assertEquals(22, policy.getSpecification().getMaxLength());
        assertEquals(8, policy.getSpecification().getMinLength());
    }
View Full Code Here

        assertEquals(1, policyService.getSyncCorrelationRuleClasses().size());
    }

    @Test
    public void issueSYNCOPE466() {
        PasswordPolicyTO policy = policyService.read(4L);
        assertEquals(PolicyType.PASSWORD, policy.getType());

        policy.setType(PolicyType.GLOBAL_PASSWORD);
        try {
            policyService.update(policy.getId(), policy);
            fail();
        } catch (SyncopeClientException e) {
            assertEquals(ClientExceptionType.InvalidPolicy, e.getType());
        }
    }
View Full Code Here

            UserTO userTO = getUniqueSampleTO("issue172@syncope.apache.org");
            createUser(userTO);
        } finally {
            for (PasswordPolicyTO policyTO : policies) {
                Response response = policyService.create(policyTO);
                PasswordPolicyTO cPolicyTO = getObject(
                        response.getLocation(), PolicyService.class, PasswordPolicyTO.class);
                assertNotNull(cPolicyTO);
            }
        }
    }
View Full Code Here

            case ACCOUNT:
                policyTO = new AccountPolicyTO();
                break;

            case GLOBAL_PASSWORD:
                policyTO = new PasswordPolicyTO(true);
                break;

            case PASSWORD:
                policyTO = new PasswordPolicyTO();
                break;

            case GLOBAL_SYNC:
                policyTO = new SyncPolicyTO(true);
                break;
View Full Code Here

        final boolean isGlobal = isGlobalPolicy(policy.getType());

        switch (policy.getType()) {
            case GLOBAL_PASSWORD:
            case PASSWORD:
                policyTO = (T) new PasswordPolicyTO(isGlobal);
                ((PasswordPolicyTO) policyTO).setSpecification(policy.getSpecification(PasswordPolicySpec.class));
                break;

            case GLOBAL_ACCOUNT:
            case ACCOUNT:
View Full Code Here

TOP

Related Classes of org.apache.syncope.common.to.PasswordPolicyTO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.