Search in sources :

Example 1 with Executions

use of com.haulmont.cuba.core.app.execution.Executions in project cuba by cuba-platform.

the class ExecutionsTest method testExceptionOnUserSession.

@Test
public void testExceptionOnUserSession() {
    Executions executions = AppBeans.get(Executions.NAME);
    executions.startExecution("key", "group");
    UserSessionSource userSessionSource = AppBeans.get(UserSessionSource.NAME);
    try {
        ((TestUserSessionSource) userSessionSource).setExceptionOnGetUserSession(true);
    } finally {
        try {
            executions.endExecution();
        } catch (Exception e) {
        // Do nothing
        }
    }
    assertNull(ExecutionContextHolder.getCurrentContext());
    ((TestUserSessionSource) userSessionSource).setExceptionOnGetUserSession(false);
    executions.startExecution("key", "group");
    try {
        executions.endExecution();
    } catch (Exception e) {
    // Do nothing
    }
    assertNull(ExecutionContextHolder.getCurrentContext());
}
Also used : Executions(com.haulmont.cuba.core.app.execution.Executions) TestUserSessionSource(com.haulmont.cuba.testsupport.TestUserSessionSource) UserSessionSource(com.haulmont.cuba.core.global.UserSessionSource) TestUserSessionSource(com.haulmont.cuba.testsupport.TestUserSessionSource) Test(org.junit.Test)

Aggregations

Executions (com.haulmont.cuba.core.app.execution.Executions)1 UserSessionSource (com.haulmont.cuba.core.global.UserSessionSource)1 TestUserSessionSource (com.haulmont.cuba.testsupport.TestUserSessionSource)1 Test (org.junit.Test)1