Package org.apache.syncope.client.to

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


        List<NotificationTaskTO> tasks = Arrays.asList(restTemplate.getForObject(BASE_URL + "task/notification/list",
                NotificationTaskTO[].class));
        assertNotNull(tasks);
        assertFalse(tasks.isEmpty());

        NotificationTaskTO taskTO = null;
        for (NotificationTaskTO task : tasks) {
            if (sender.equals(task.getSender())) {
                taskTO = task;
            }
        }
        assertNotNull(taskTO);
        assertTrue(taskTO.getExecutions().isEmpty());

        // 4. execute the generated NotificationTask
        TaskExecTO execution = restTemplate.postForObject(
                BASE_URL + "task/execute/{taskId}", null, TaskExecTO.class, taskTO.getId());
        assertNotNull(execution);

        // 5. verify
        taskTO = restTemplate.getForObject(BASE_URL + "task/read/{taskId}", NotificationTaskTO.class,
                taskTO.getId());
        assertNotNull(taskTO);
        assertEquals(1, taskTO.getExecutions().size());
    }
View Full Code Here


        assertEquals("SUCCESS", taskTO.getExecutions().get(0).getStatus());
    }

    @Test
    public void issueSYNCOPE81() {
        NotificationTaskTO taskTO = restTemplate.getForObject(
                BASE_URL + "task/read/{taskId}", NotificationTaskTO.class, 8L);
        assertNotNull(taskTO);

        int executions = taskTO.getExecutions().size();

        if (executions == 0) {
            // generate an execution in order to verify the deletion of a notification task with one or more executions

            TaskExecTO execution = restTemplate.postForObject(
                    BASE_URL + "task/execute/{taskId}", null, TaskExecTO.class, taskTO.getId());
            assertEquals("NOT_SENT", execution.getStatus());

            int i = 0;
            int maxit = 50;

            // wait for task exec completion (executions incremented)
            do {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                }

                taskTO = restTemplate.getForObject(
                        BASE_URL + "task/read/{taskId}", NotificationTaskTO.class, taskTO.getId());

                assertNotNull(taskTO);
                assertNotNull(taskTO.getExecutions());

                i++;
            } while (executions == taskTO.getExecutions().size() && i < maxit);

            assertFalse(taskTO.getExecutions().isEmpty());
        }

        taskTO = restTemplate.getForObject(BASE_URL + "task/delete/{taskId}", NotificationTaskTO.class, taskTO.getId());
        assertNotNull(taskTO);
    }
View Full Code Here

        List<NotificationTaskTO> tasks = Arrays.asList(restTemplate.getForObject(BASE_URL + "task/notification/list",
                NotificationTaskTO[].class));
        assertNotNull(tasks);
        assertFalse(tasks.isEmpty());

        NotificationTaskTO taskTO = null;
        for (NotificationTaskTO task : tasks) {
            if (sender.equals(task.getSender())) {
                taskTO = task;
            }
        }
        assertNotNull(taskTO);
        assertTrue(taskTO.getExecutions().isEmpty());

        // 4. execute the generated NotificationTask
        TaskExecTO execution = restTemplate.postForObject(
                BASE_URL + "task/execute/{taskId}", null, TaskExecTO.class, taskTO.getId());
        assertNotNull(execution);

        // 5. verify
        taskTO = restTemplate.getForObject(BASE_URL + "task/read/{taskId}", NotificationTaskTO.class,
                taskTO.getId());
        assertNotNull(taskTO);
        assertEquals(1, taskTO.getExecutions().size());
    }
View Full Code Here

        assertEquals("SUCCESS", taskTO.getExecutions().get(0).getStatus());
    }

    @Test
    public void issueSYNCOPE81() {
        NotificationTaskTO taskTO = restTemplate.getForObject(
                BASE_URL + "task/read/{taskId}", NotificationTaskTO.class, 8L);
        assertNotNull(taskTO);

        int executions = taskTO.getExecutions().size();

        if (executions == 0) {
            // generate an execution in order to verify the deletion of a notification task with one or more executions

            TaskExecTO execution = restTemplate.postForObject(
                    BASE_URL + "task/execute/{taskId}", null, TaskExecTO.class, taskTO.getId());
            assertEquals("NOT_SENT", execution.getStatus());

            int i = 0;
            int maxit = 50;

            // wait for task exec completion (executions incremented)
            do {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                }

                taskTO = restTemplate.getForObject(
                        BASE_URL + "task/read/{taskId}", NotificationTaskTO.class, taskTO.getId());

                assertNotNull(taskTO);
                assertNotNull(taskTO.getExecutions());

                i++;
            } while (executions == taskTO.getExecutions().size() && i < maxit);

            assertFalse(taskTO.getExecutions().isEmpty());
        }

        taskTO = restTemplate.getForObject(BASE_URL + "task/delete/{taskId}", NotificationTaskTO.class, taskTO.getId());
        assertNotNull(taskTO);
    }
View Full Code Here

        List<NotificationTaskTO> tasks = Arrays.asList(restTemplate.getForObject(BASE_URL + "task/notification/list",
                NotificationTaskTO[].class));
        assertNotNull(tasks);
        assertFalse(tasks.isEmpty());

        NotificationTaskTO taskTO = null;
        for (NotificationTaskTO task : tasks) {
            if (sender.equals(task.getSender())) {
                taskTO = task;
            }
        }
        assertNotNull(taskTO);
        assertTrue(taskTO.getExecutions().isEmpty());

        // 4. execute the generated NotificationTask
        TaskExecTO execution = restTemplate.postForObject(
                BASE_URL + "task/execute/{taskId}", null, TaskExecTO.class, taskTO.getId());
        assertNotNull(execution);

        // 5. verify
        taskTO = restTemplate.getForObject(BASE_URL + "task/read/{taskId}", NotificationTaskTO.class,
                taskTO.getId());
        assertNotNull(taskTO);
        assertEquals(1, taskTO.getExecutions().size());
    }
View Full Code Here

TOP

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

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.