Examples of SyncTaskTO


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

                    private static final long serialVersionUID = -7834632442532690940L;

                    @Override
                    public Page createPage() {
                        return new SyncTaskModalPage(window, new SyncTaskTO(), pageRef);
                    }
                });

                window.show(target);
            }
View Full Code Here

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

            private static final long serialVersionUID = 2054811145491901166L;

            @Override
            public ActionLinksPanel getActions(final String componentId, final IModel<TaskTO> model) {

                final SyncTaskTO taskTO = (SyncTaskTO) model.getObject();

                final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, pageRef);

                panel.add(new ActionLink() {

                    private static final long serialVersionUID = -3722207913631435501L;

                    @Override
                    public void onClick(final AjaxRequestTarget target) {

                        window.setPageCreator(new ModalWindow.PageCreator() {

                            private static final long serialVersionUID = -7834632442532690940L;

                            @Override
                            public Page createPage() {
                                return new SyncTaskModalPage(window, taskTO, pageRef);
                            }
                        });

                        window.show(target);
                    }
                }, ActionLink.ActionType.EDIT, TASKS);

                panel.add(new ActionLink() {

                    private static final long serialVersionUID = -3722207913631435501L;

                    @Override
                    public void onClick(final AjaxRequestTarget target) {

                        window.setPageCreator(new ModalWindow.PageCreator() {

                            private static final long serialVersionUID = -7834632442532690940L;

                            @Override
                            public Page createPage() {
                                return new UserTemplateModalPage(pageRef, window, taskTO);
                            }
                        });

                        window.show(target);
                    }
                }, ActionLink.ActionType.USER_TEMPLATE, TASKS);

                panel.add(new ActionLink() {

                    private static final long serialVersionUID = -3722207913631435501L;

                    @Override
                    public void onClick(final AjaxRequestTarget target) {

                        window.setPageCreator(new ModalWindow.PageCreator() {

                            private static final long serialVersionUID = -7834632442532690940L;

                            @Override
                            public Page createPage() {
                                return new RoleTemplateModalPage(pageRef, window, taskTO);
                            }
                        });

                        window.show(target);
                    }
                }, ActionLink.ActionType.ROLE_TEMPLATE, TASKS);

                panel.add(new ActionLink() {

                    private static final long serialVersionUID = -3722207913631435501L;

                    @Override
                    public void onClick(final AjaxRequestTarget target) {
                        try {
                            restClient.startExecution(taskTO.getId(), false);
                            getSession().info(getString(Constants.OPERATION_SUCCEEDED));
                        } catch (SyncopeClientCompositeErrorException scce) {
                            error(scce.getMessage());
                        }

                        target.add(container);
                        target.add(getPage().get(Constants.FEEDBACK));
                    }
                }, ActionLink.ActionType.EXECUTE, TASKS);

                panel.add(new ActionLink() {

                    private static final long serialVersionUID = -3722207913631435501L;

                    @Override
                    public void onClick(final AjaxRequestTarget target) {
                        try {
                            restClient.startExecution(taskTO.getId(), true);
                            getSession().info(getString(Constants.OPERATION_SUCCEEDED));
                        } catch (SyncopeClientCompositeErrorException scce) {
                            error(scce.getMessage());
                        }

                        target.add(container);
                        target.add(getPage().get(Constants.FEEDBACK));
                    }
                }, ActionLink.ActionType.DRYRUN, TASKS);

                panel.add(new ActionLink() {

                    private static final long serialVersionUID = -3722207913631435501L;

                    @Override
                    public void onClick(final AjaxRequestTarget target) {
                        try {
                            restClient.delete(taskTO.getId(), SyncTaskTO.class);
                            info(getString(Constants.OPERATION_SUCCEEDED));
                        } catch (SyncopeClientCompositeErrorException scce) {
                            error(scce.getMessage());
                        }
                        target.add(container);
View Full Code Here

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

        if (taskUtil == TaskUtil.SYNC) {
            if (!(taskTO instanceof SyncTaskTO)) {
                throw new ClassCastException("taskUtil is type SyncTask but taskTO is not SyncTaskTO: " + taskTO.
                        getClass().getName());
            }
            SyncTaskTO syncTaskTO = (SyncTaskTO) taskTO;

            ExternalResource resource = resourceDAO.find(syncTaskTO.getResource());
            if (resource == null) {
                throw new NotFoundException("Resource " + syncTaskTO.getResource());
            }
            ((SyncTask) task).setResource(resource);

            fill((SyncTask) task, syncTaskTO);
        }
View Full Code Here

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

        assertFalse(actions.isEmpty());
    }

    @Test
    public void create() {
        SyncTaskTO task = new SyncTaskTO();
        task.setName("Test create Sync");
        task.setResource(RESOURCE_NAME_WS2);

        UserTO userTemplate = new UserTO();
        userTemplate.addResource(RESOURCE_NAME_WS2);
        MembershipTO membershipTO = new MembershipTO();
        membershipTO.setRoleId(8L);
        userTemplate.addMembership(membershipTO);
        task.setUserTemplate(userTemplate);

        RoleTO roleTemplate = new RoleTO();
        roleTemplate.addResource(RESOURCE_NAME_LDAP);
        task.setRoleTemplate(roleTemplate);

        Response response = taskService.create(task);
        SyncTaskTO actual = getObject(response, SyncTaskTO.class, taskService);
        assertNotNull(actual);

        task = taskService.read(TaskType.SYNCHRONIZATION, actual.getId());
        assertNotNull(task);
        assertEquals(actual.getId(), task.getId());
        assertEquals(actual.getJobClassName(), task.getJobClassName());
        assertEquals(userTemplate, task.getUserTemplate());
        assertEquals(roleTemplate, task.getRoleTemplate());
    }
View Full Code Here

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

        try {
            int usersPre = userService.count();
            assertNotNull(usersPre);

            // Update sync task
            SyncTaskTO task = taskService.read(TaskType.SYNCHRONIZATION, SYNC_TASK_ID);
            assertNotNull(task);

            // add custom SyncJob actions
            task.setActionsClassName(TestSyncActions.class.getName());

            // add user template
            UserTO template = new UserTO();
            template.addAttribute(attributeTO("type", "email == 'test8@syncope.apache.org'? 'TYPE_8': 'TYPE_OTHER'"));
            template.addDerivedAttribute(attributeTO("cn", null));
            template.addResource(RESOURCE_NAME_TESTDB);

            MembershipTO membershipTO = new MembershipTO();
            membershipTO.setRoleId(8L);
            membershipTO.addAttribute(attributeTO("subscriptionDate", "'2009-08-18T16:33:12.203+0200'"));
            template.addMembership(membershipTO);

            task.setUserTemplate(template);

            taskService.update(task.getId(), task);
            SyncTaskTO actual = taskService.read(TaskType.SYNCHRONIZATION, task.getId());
            assertNotNull(actual);
            assertEquals(task.getId(), actual.getId());
            assertEquals(TestSyncActions.class.getName(), actual.getActionsClassName());

            execSyncTask(SYNC_TASK_ID, 50, false);

            // after execution of the sync task the user data should be synced from
            // csv datasource and processed by user template
View Full Code Here

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

    }

    @Test
    public void reconcileFromDB() {
        // update sync task
        SyncTaskTO task = taskService.read(TaskType.SYNCHRONIZATION, 7L);
        assertNotNull(task);

        // add user template
        UserTO template = new UserTO();
        template.addAttribute(attributeTO("type", "'type a'"));
        template.addAttribute(attributeTO("userId", "'reconciled@syncope.apache.org'"));
        template.addAttribute(attributeTO("fullname", "'reconciled fullname'"));
        template.addAttribute(attributeTO("surname", "'surname'"));

        task.setUserTemplate(template);

        taskService.update(task.getId(), task);
        SyncTaskTO actual = taskService.read(TaskType.SYNCHRONIZATION, task.getId());
        assertNotNull(actual);
        assertEquals(task.getId(), actual.getId());
        assertEquals(template, actual.getUserTemplate());
        assertEquals(new RoleTO(), actual.getRoleTemplate());

        TaskExecTO execution = execSyncTask(actual.getId(), 20, false);
        assertNotNull(execution.getStatus());
        assertTrue(PropagationTaskExecStatus.valueOf(execution.getStatus()).isSuccessful());

        UserTO userTO = userService.read("testuser1");
        assertNotNull(userTO);
        assertEquals("reconciled@syncope.apache.org", userTO.getAttributeMap().get("userId").getValues().get(0));
        assertEquals("suspended", userTO.getStatus());

        // enable user on external resource
        JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
        jdbcTemplate.execute("UPDATE TEST SET STATUS=TRUE");

        // re-execute the same SyncTask: now user must be active
        execution = execSyncTask(actual.getId(), 20, false);
        assertNotNull(execution.getStatus());
        assertTrue(PropagationTaskExecStatus.valueOf(execution.getStatus()).isSuccessful());

        userTO = userService.read("testuser1");
        assertNotNull(userTO);
View Full Code Here

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

    @Test
    public void reconcileFromLDAP()
            throws InvalidSearchConditionException {
        // Update sync task
        SyncTaskTO task = taskService.read(TaskType.SYNCHRONIZATION, 11L);
        assertNotNull(task);

        //  add user template
        final UserTO userTemplate = task.getUserTemplate();
        userTemplate.setResources(Collections.singleton(RESOURCE_NAME_LDAP));
        userTemplate.addVirtualAttribute(attributeTO("virtualReadOnly", ""));

        task.setUserTemplate(userTemplate);

        //  add role template
        final RoleTO roleTemplate = new RoleTO();
        roleTemplate.setParent(8L);
        roleTemplate.addAttribute(attributeTO("show", "'true'"));

        task.setRoleTemplate(roleTemplate);

        taskService.update(task.getId(), task);
        SyncTaskTO actual = taskService.read(TaskType.SYNCHRONIZATION, task.getId());
        assertNotNull(actual);
        assertEquals(task.getId(), actual.getId());
        assertEquals(roleTemplate, actual.getRoleTemplate());
        assertEquals(userTemplate, actual.getUserTemplate());

        TaskExecTO execution = execSyncTask(actual.getId(), 20, false);

        // 1. verify execution status
        final String status = execution.getStatus();
        assertNotNull(status);
        assertTrue(PropagationTaskExecStatus.valueOf(status).isSuccessful());
View Full Code Here

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

            template.addResource(RESOURCE_NAME_NOPROPAGATION4);
            //-----------------------------

            // Update sync task
            SyncTaskTO task = taskService.read(TaskType.SYNCHRONIZATION, 9L);
            assertNotNull(task);

            task.setUserTemplate(template);

            taskService.update(task.getId(), task);
            SyncTaskTO actual = taskService.read(TaskType.SYNCHRONIZATION, task.getId());
            assertNotNull(actual);
            assertEquals(task.getId(), actual.getId());
            assertFalse(actual.getUserTemplate().getResources().isEmpty());
            assertFalse(actual.getUserTemplate().getMemberships().isEmpty());

            TaskExecTO execution = execSyncTask(actual.getId(), 50, false);
            final String status = execution.getStatus();
            assertNotNull(status);
            assertTrue(PropagationTaskExecStatus.valueOf(status).isSuccessful());

            userTO = userService.read("testuser2");
View Full Code Here

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

            assertNotNull(userTO);
            assertEquals(1, userTO.getPropagationStatusTOs().size());
            assertTrue(userTO.getPropagationStatusTOs().get(0).getStatus().isSuccessful());

            // update sync task
            SyncTaskTO task = taskService.read(TaskType.SYNCHRONIZATION, SYNC_TASK_ID);
            assertNotNull(task);

            // add user template

            AttributeTO newAttrTO = new AttributeTO();
            newAttrTO.setSchema("firstname");
            newAttrTO.setValues(Collections.singletonList(""));

            UserTO template = new UserTO();
            template.addAttribute(newAttrTO);
            template.addAttribute(attributeTO("userId", "'test'"));
            template.addAttribute(attributeTO("fullname", "'test'"));
            template.addAttribute(attributeTO("surname", "'test'"));
            template.addResource(RESOURCE_NAME_TESTDB);

            task.setUserTemplate(template);

            taskService.update(task.getId(), task);
            SyncTaskTO actual = taskService.read(TaskType.SYNCHRONIZATION, task.getId());
            assertNotNull(actual);
            assertEquals(task.getId(), actual.getId());

            TaskExecTO taskExecTO = execSyncTask(SYNC_TASK_ID, 50, false);
            assertNotNull(actual);
            assertEquals(task.getId(), actual.getId());

            assertNotNull(taskExecTO.getStatus());
            assertTrue(PropagationTaskExecStatus.valueOf(taskExecTO.getStatus()).isSuccessful());

            userTO = userService.read(userTO.getUsername());
View Full Code Here

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

        policyTO.getSpecification().setUserJavaRule(TestSyncRule.class.getName());

        policyService.update(PolicyType.SYNC, policyTO.getId(), policyTO);
        // -----------------------------

        SyncTaskTO task = new SyncTaskTO();
        task.setName("Test Sync Rule");
        task.setResource(RESOURCE_NAME_WS2);
        task.setFullReconciliation(true);
        task.setPerformCreate(true);
        task.setPerformDelete(true);
        task.setPerformUpdate(true);

        Response response = taskService.create(task);
        SyncTaskTO actual = getObject(response, SyncTaskTO.class, taskService);
        assertNotNull(actual);

        UserTO userTO = UserTestITCase.getUniqueSampleTO("s258_1@apache.org");
        userTO.getResources().clear();
        userTO.addResource(RESOURCE_NAME_WS2);

        userTO = createUser(userTO);

        userTO = UserTestITCase.getUniqueSampleTO("s258_2@apache.org");
        userTO.getResources().clear();
        userTO.addResource(RESOURCE_NAME_WS2);

        userTO = createUser(userTO);

        // change email in order to unmatch the second user
        UserMod userMod = new UserMod();
        userMod.setId(userTO.getId());
        userMod.addAttributeToBeRemoved("email");
        userMod.addAttributeToBeUpdated(attributeMod("email", "s258@apache.org"));

        userTO = userService.update(userMod.getId(), userMod);

        execSyncTask(actual.getId(), 50, false);

        SyncTaskTO executed = taskService.read(TaskType.SYNCHRONIZATION, actual.getId());
        assertEquals(1, executed.getExecutions().size());

        // asser for just one match
        assertTrue(executed.getExecutions().get(0).getMessage().substring(0, 55) + "...",
                executed.getExecutions().get(0).getMessage().contains("[updated/failures]: 1/0"));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.