Package org.apache.tapestry5.services

Examples of org.apache.tapestry5.services.Session


        train_getSession(hsr, false, hs);

        replay();

        Session session = new SessionImpl(hsr, hs, lock);

        assertFalse(session.isInvalidated());

        verify();

        train_getSession(hsr, false, null);

        replay();

        assertTrue(session.isInvalidated());

        verify();

        train_getSession(hsr, false, mockHttpSession());

        replay();

        assertTrue(session.isInvalidated());

    }
View Full Code Here


        hs.setMaxInactiveInterval(seconds);

        replay();

        Session session = new SessionImpl(null, hs, null);

        session.setMaxInactiveInterval(seconds);

        verify();
    }
View Full Code Here

        expect(hs.getMaxInactiveInterval()).andReturn(seconds);

        replay();

        Session session = new SessionImpl(null, hs, null);

        assertEquals(session.getMaxInactiveInterval(), seconds);

        verify();
    }
View Full Code Here

        train_getAttribute(hs, "dirty", dirty);

        replay();

        Session session = new ClusteredSessionImpl(hsr, hs, lock, analyzer);

        assertSame(session.getAttribute("dirty"), dirty);

        verify();

        expect(analyzer.checkAndResetDirtyState(dirty)).andReturn(true);

        train_getSession(hsr, false, hs);

        lock.acquireWriteLock();

        hs.setAttribute("dirty", dirty);

        replay();

        session.restoreDirtyObjects();

        verify();
    }
View Full Code Here

    Object onActionFromKill()
    {
        if (!productionMode)
        {
            Session session = request.getSession(false);

            if (session == null)
            {
                alertManager.info("No server-side session currently exist.");
            } else
            {
                session.invalidate();
                alertManager.info("Server-side session invalidated.");
            }
        }

        return devmodezone.getBody();
View Full Code Here

    public void force_session_create()
    {
        HttpServletRequest sr = mockHttpServletRequest();
        HttpSession ss = mockHttpSession();
        TapestrySessionFactory sf = newMock(TapestrySessionFactory.class);
        Session session = mockSession();

        expect(sf.getSession(true)).andReturn(session);

        replay();
View Full Code Here

    @Test
    public void isSessionInvalidated_is_false_when_session_exists_and_is_valid()
    {
        HttpServletRequest sr = mockHttpServletRequest();
        Session session = mockSession();

        TapestrySessionFactory sf = newMock(TapestrySessionFactory.class);

        expect(sf.getSession(false)).andReturn(session);
        expect(session.isInvalidated()).andReturn(false);

        replay();

        Request request = new RequestImpl(sr, CHARSET, sf);
View Full Code Here

    @Test
    public void isSessionInvalidated_is_true_when_session_is_invalid()
    {
        HttpServletRequest sr = mockHttpServletRequest();
        Session session = mockSession();

        TapestrySessionFactory sf = newMock(TapestrySessionFactory.class);

        expect(sf.getSession(false)).andReturn(session);
        expect(session.isInvalidated()).andReturn(true);

        replay();

        Request request = new RequestImpl(sr, CHARSET, sf);
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public <T> T get(Class<T> ssoClass, ApplicationStateCreator<T> creator)
    {
        Session session = getSession();

        String key = buildKey(ssoClass);

        T sso = (T) session.getAttribute(key);

        if (sso == null)
        {
            sso = creator.create();
            session.setAttribute(key, sso);
        }

        return sso;
    }
View Full Code Here

    public <T> boolean exists(Class<T> ssoClass)
    {
        String key = buildKey(ssoClass);

        Session session = request.getSession(false);

        return session != null && session.getAttribute(key) != null;
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.services.Session

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.