Package org.apache.syncope.client.to

Examples of org.apache.syncope.client.to.SyncPolicyTO


                    try {
                        policy = (T) SyncopeSession.get().getRestTemplate().getForObject(
                                baseURL + "policy/sync/global/read", SyncPolicyTO.class);
                    } catch (Exception e) {
                        LOG.debug("No password policy found", e);
                        policy = (T) new SyncPolicyTO();
                    }
                    break;
                default:
                    throw new Exception("Invalid policy type");
            }
View Full Code Here


        assertFalse(policyTOs.isEmpty());
    }

    @Test
    public void read() {
        SyncPolicyTO policyTO = restTemplate.getForObject(BASE_URL + "policy/read/{id}", SyncPolicyTO.class, 1L);

        assertNotNull(policyTO);
    }
View Full Code Here

        assertNotNull(t);
    }

    @Test
    public void createMissingDescription() {
        SyncPolicyTO policy = new SyncPolicyTO();
        policy.setSpecification(new SyncPolicySpec());

        Throwable t = null;
        try {
            restTemplate.postForObject(BASE_URL + "policy/sync/create", policy, PasswordPolicyTO.class);
            fail();
View Full Code Here

        assertNotNull(t);
    }

    @Test
    public void create() {
        SyncPolicyTO policy = new SyncPolicyTO();
        policy.setSpecification(new SyncPolicySpec());
        policy.setDescription("Sync policy");

        SyncPolicyTO policyTO = restTemplate.postForObject(BASE_URL + "policy/sync/create", policy, SyncPolicyTO.class);

        assertNotNull(policyTO);
        assertEquals(PolicyType.SYNC, policyTO.getType());
    }
View Full Code Here

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

            case GLOBAL_SYNC:
                policyTO = new SyncPolicyTO(true);
                break;

            case SYNC:
            default:
                policyTO = new SyncPolicyTO();
        }

        return policyTO;
    }
View Full Code Here

                    try {
                        policy = (T) SyncopeSession.get().getRestTemplate().getForObject(
                                baseURL + "policy/sync/global/read", SyncPolicyTO.class);
                    } catch (Exception e) {
                        LOG.debug("No password policy found", e);
                        policy = (T) new SyncPolicyTO();
                    }
                    break;
                default:
                    throw new Exception("Invalid policy type");
            }
View Full Code Here

            case SYNC:
            default:
                if (!(policy.getSpecification() instanceof SyncPolicySpec)) {
                    throw new ClassCastException("policy is expected to be typed SyncPolicySpec: " + policy.getSpecification().getClass().getName());
                }
                policyTO = new SyncPolicyTO(isGlobal);
                ((SyncPolicyTO) policyTO).setSpecification((SyncPolicySpec) policy.getSpecification());
        }

        policyTO.setId(policy.getId());
        policyTO.setDescription(policy.getDescription());
View Full Code Here

        assertFalse(policyTOs.isEmpty());
    }

    @Test
    public void read() {
        SyncPolicyTO policyTO = restTemplate.getForObject(BASE_URL + "policy/read/{id}", SyncPolicyTO.class, 1L);

        assertNotNull(policyTO);
    }
View Full Code Here

        assertNotNull(t);
    }

    @Test
    public void createMissingDescription() {
        SyncPolicyTO policy = new SyncPolicyTO();
        policy.setSpecification(new SyncPolicySpec());

        Throwable t = null;
        try {
            restTemplate.postForObject(BASE_URL + "policy/sync/create", policy, PasswordPolicyTO.class);
            fail();
View Full Code Here

        assertNotNull(t);
    }

    @Test
    public void create() {
        SyncPolicyTO policy = new SyncPolicyTO();
        policy.setSpecification(new SyncPolicySpec());
        policy.setDescription("Sync policy");

        SyncPolicyTO policyTO = restTemplate.postForObject(BASE_URL + "policy/sync/create", policy, SyncPolicyTO.class);

        assertNotNull(policyTO);
        assertEquals(PolicyType.SYNC, policyTO.getType());
    }
View Full Code Here

TOP

Related Classes of org.apache.syncope.client.to.SyncPolicyTO

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.