Search in sources :

Example 31 with ISession

use of org.eclipse.scout.rt.shared.ISession in project scout.rt by eclipse.

the class ClientTestRunnerSameSessionTest method afterClass.

@AfterClass
public static void afterClass() {
    ISession clientSession = IClientSession.CURRENT.get();
    assertTrue(clientSession instanceof JUnitClientSession);
    assertEquals("anna", getCurrentUser());
    m_clientSessions.add(clientSession);
    assertEquals(1, m_clientSessions.size());
}
Also used : ISession(org.eclipse.scout.rt.shared.ISession) JUnitClientSession(org.eclipse.scout.rt.testing.client.runner.ClientTestRunnerSameSessionTest.JUnitClientSession) AfterClass(org.junit.AfterClass)

Example 32 with ISession

use of org.eclipse.scout.rt.shared.ISession in project scout.rt by eclipse.

the class SessionFutureFilter method accept.

@Override
public boolean accept(final IFuture<?> future) {
    final RunContext runContext = future.getJobInput().getRunContext();
    if (runContext == null) {
        return false;
    }
    final ISession session = runContext.getAdapter(ISession.class);
    if (session == null) {
        return false;
    }
    return m_session == session;
}
Also used : ISession(org.eclipse.scout.rt.shared.ISession) RunContext(org.eclipse.scout.rt.platform.context.RunContext)

Example 33 with ISession

use of org.eclipse.scout.rt.shared.ISession in project scout.rt by eclipse.

the class AbstractMultiSessionCookieStore method getDelegate.

protected CS getDelegate() {
    ISession currentSession = ISession.CURRENT.get();
    if (currentSession == null) {
        return m_defaultCookieStore;
    }
    // Check cache with read lock first.
    m_cookieStoresLock.readLock().lock();
    try {
        CS cookieStore = m_cookieStores.get(currentSession);
        if (cookieStore != null) {
            return cookieStore;
        }
    } finally {
        m_cookieStoresLock.readLock().unlock();
    }
    // No entry found - get write lock to create it
    m_cookieStoresLock.writeLock().lock();
    try {
        // In the meantime, the cookie store might have been created already by another thread - check again.
        CS cookieStore = m_cookieStores.get(currentSession);
        if (cookieStore != null) {
            return cookieStore;
        } else {
            cookieStore = createNewCookieStore();
            m_cookieStores.put(currentSession, cookieStore);
            currentSession.addListener(new P_SessionStoppedListenr());
            return cookieStore;
        }
    } finally {
        m_cookieStoresLock.writeLock().unlock();
    }
}
Also used : ISession(org.eclipse.scout.rt.shared.ISession)

Aggregations

ISession (org.eclipse.scout.rt.shared.ISession)33 Test (org.junit.Test)14 ITransaction (org.eclipse.scout.rt.platform.transaction.ITransaction)13 AfterClass (org.junit.AfterClass)6 BeforeClass (org.junit.BeforeClass)6 JUnitClientSession1 (org.eclipse.scout.rt.testing.client.runner.ClientTestRunnerDifferentSessionTest.JUnitClientSession1)4 JUnitClientSession (org.eclipse.scout.rt.testing.client.runner.ClientTestRunnerDifferentSubjectTest.JUnitClientSession)4 JUnitClientSession (org.eclipse.scout.rt.testing.client.runner.ClientTestRunnerSameSessionTest.JUnitClientSession)4 JUnitServerSession1 (org.eclipse.scout.rt.testing.server.runner.ServerTestRunnerDifferentSessionTest.JUnitServerSession1)4 JUnitServerSession (org.eclipse.scout.rt.testing.server.runner.ServerTestRunnerDifferentSubjectTest.JUnitServerSession)4 JUnitServerSession (org.eclipse.scout.rt.testing.server.runner.ServerTestRunnerSameSessionTest.JUnitServerSession)4 RunWithSubject (org.eclipse.scout.rt.testing.platform.runner.RunWithSubject)2 IClientSession (org.eclipse.scout.rt.client.IClientSession)1 ClientNotificationDispatcher (org.eclipse.scout.rt.client.clientnotification.ClientNotificationDispatcher)1 RunContext (org.eclipse.scout.rt.platform.context.RunContext)1 IRunnable (org.eclipse.scout.rt.platform.util.concurrent.IRunnable)1 IServerSession (org.eclipse.scout.rt.server.IServerSession)1 ClientNotificationCollector (org.eclipse.scout.rt.server.clientnotification.ClientNotificationCollector)1 ServerRunContext (org.eclipse.scout.rt.server.context.ServerRunContext)1 ClusterNotificationProperties (org.eclipse.scout.rt.server.services.common.clustersync.internal.ClusterNotificationProperties)1