Search in sources :

Example 1 with TaskManagerException

use of com.evolveum.midpoint.task.api.TaskManagerException in project midpoint by Evolveum.

the class TestSanityLegacy method test999Shutdown.

@Test
public void test999Shutdown() throws Exception {
    taskManager.shutdown();
    waitFor("waiting for task manager shutdown", new Checker() {

        @Override
        public boolean check() throws CommonException {
            try {
                return taskManager.getLocallyRunningTasks(new OperationResult("dummy")).isEmpty();
            } catch (TaskManagerException e) {
                throw new SystemException(e);
            }
        }

        @Override
        public void timeout() {
        // No reaction, the test will fail right after return from this
        }
    }, 10000);
    AssertJUnit.assertEquals("Some tasks left running after shutdown", new HashSet<Task>(), taskManager.getLocallyRunningTasks(new OperationResult("dummy")));
}
Also used : Checker(com.evolveum.midpoint.test.Checker) ObjectChecker(com.evolveum.midpoint.test.ObjectChecker) Task(com.evolveum.midpoint.task.api.Task) TaskManagerException(com.evolveum.midpoint.task.api.TaskManagerException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test) AbstractModelIntegrationTest(com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)

Example 2 with TaskManagerException

use of com.evolveum.midpoint.task.api.TaskManagerException in project midpoint by Evolveum.

the class ConsistencyTest method test999Shutdown.

@Test
public void test999Shutdown() throws Exception {
    taskManager.shutdown();
    waitFor("waiting for task manager shutdown", new Checker() {

        @Override
        public boolean check() throws CommonException {
            try {
                return taskManager.getLocallyRunningTasks(new OperationResult("dummy")).isEmpty();
            } catch (TaskManagerException e) {
                throw new SystemException(e);
            }
        }

        @Override
        public void timeout() {
        // No reaction, the test will fail right after return from this
        }
    }, 10000);
    AssertJUnit.assertEquals("Some tasks left running after shutdown", new HashSet<Task>(), taskManager.getLocallyRunningTasks(new OperationResult("dummy")));
}
Also used : Checker(com.evolveum.midpoint.test.Checker) Task(com.evolveum.midpoint.task.api.Task) SystemException(com.evolveum.midpoint.util.exception.SystemException) TaskManagerException(com.evolveum.midpoint.task.api.TaskManagerException) CommonException(com.evolveum.midpoint.util.exception.CommonException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test) AbstractModelIntegrationTest(com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)

Example 3 with TaskManagerException

use of com.evolveum.midpoint.task.api.TaskManagerException in project midpoint by Evolveum.

the class TestSanity method test999Shutdown.

@Test
public void test999Shutdown() throws Exception {
    taskManager.shutdown();
    waitFor("waiting for task manager shutdown", new Checker() {

        @Override
        public boolean check() throws CommonException {
            try {
                return taskManager.getLocallyRunningTasks(new OperationResult("dummy")).isEmpty();
            } catch (TaskManagerException e) {
                throw new SystemException(e);
            }
        }

        @Override
        public void timeout() {
        // No reaction, the test will fail right after return from this
        }
    }, 10000);
    AssertJUnit.assertEquals("Some tasks left running after shutdown", new HashSet<Task>(), taskManager.getLocallyRunningTasks(new OperationResult("dummy")));
}
Also used : Checker(com.evolveum.midpoint.test.Checker) ObjectChecker(com.evolveum.midpoint.test.ObjectChecker) Task(com.evolveum.midpoint.task.api.Task) TaskManagerException(com.evolveum.midpoint.task.api.TaskManagerException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test) AbstractModelIntegrationTest(com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)

Aggregations

AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)3 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)3 Task (com.evolveum.midpoint.task.api.Task)3 TaskManagerException (com.evolveum.midpoint.task.api.TaskManagerException)3 Checker (com.evolveum.midpoint.test.Checker)3 Test (org.testng.annotations.Test)3 ObjectChecker (com.evolveum.midpoint.test.ObjectChecker)2 CommonException (com.evolveum.midpoint.util.exception.CommonException)1 SystemException (com.evolveum.midpoint.util.exception.SystemException)1