Package org.apache.syncope.common.services

Examples of org.apache.syncope.common.services.EntitlementService


        userTO = createUser(userTO);
        assertNotNull(userTO);
        assertEquals("createApproval", userTO.getStatus());

        // 2. try to authenticate: fail
        EntitlementService myEntitlementService =
                setupCredentials(entitlementService, EntitlementService.class, userTO.getUsername(), "password123");
        try {
            myEntitlementService.getMyEntitlements();
            fail();
        } catch (AccessControlException e) {
            assertNotNull(e);
        }

        // 3. approve user
        super.resetRestTemplate();

        WorkflowFormTO form = userWorkflowService.getFormForUser(userTO.getId());
        form = userWorkflowService.claimForm(form.getTaskId());
        Map<String, WorkflowFormPropertyTO> props = form.getPropertyMap();
        props.get("approve").setValue(Boolean.TRUE.toString());
        form.setProperties(props.values());
        userTO = userWorkflowService.submitForm(form);
        assertNotNull(userTO);
        assertEquals("active", userTO.getStatus());

        // 4. try to authenticate again: success
        myEntitlementService =
                setupCredentials(entitlementService, EntitlementService.class, userTO.getUsername(), "password123");
        assertNotNull(myEntitlementService.getMyEntitlements());

        super.resetRestTemplate();
    }
View Full Code Here


        userTO = createUser(userTO);
        assertNotNull(userTO);
        assertEquals("createApproval", userTO.getStatus());

        // 2. try to authenticate: fail
        EntitlementService myEntitlementService = clientFactory.create(userTO.getUsername(), "password123").
                getService(EntitlementService.class);
        try {
            myEntitlementService.getOwnEntitlements();
            fail();
        } catch (AccessControlException e) {
            assertNotNull(e);
        }

        // 3. approve user
        WorkflowFormTO form = userWorkflowService.getFormForUser(userTO.getId());
        form = userWorkflowService.claimForm(form.getTaskId());
        Map<String, WorkflowFormPropertyTO> props = form.getPropertyMap();
        props.get("approve").setValue(Boolean.TRUE.toString());
        form.setProperties(props.values());
        userTO = userWorkflowService.submitForm(form);
        assertNotNull(userTO);
        assertEquals("active", userTO.getStatus());

        // 4. try to authenticate again: success
        assertNotNull(myEntitlementService.getOwnEntitlements());
    }
View Full Code Here

TOP

Related Classes of org.apache.syncope.common.services.EntitlementService

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.