Package org.apache.tapestry.services

Examples of org.apache.tapestry.services.Session


public class FlashPersistentFieldStrategyTest extends InternalBaseTestCase
{
    @Test
    public void post_change_to_root_component()
    {
        Session session = mockSession();
        Request request = mockRequest();
        Object value = new Object();

        train_getSession(request, true, session);

        session.setAttribute("flash:foo.Bar::field", value);

        replay();

        PersistentFieldStrategy strategy = new FlashPersistentFieldStrategy(request);
View Full Code Here


    }

    @Test
    public void gather_changes_with_active_session()
    {
        Session session = mockSession();
        Request request = mockRequest();

        train_getSession(request, false, session);
        train_getAttributeNames(
                session,
                "flash:foo.Bar:",
                "flash:foo.Bar::root",
                "flash:foo.Bar:nested:down");

        train_getAttribute(session, "flash:foo.Bar::root", "ROOT");
        session.setAttribute("flash:foo.Bar::root", null);

        train_getAttribute(session, "flash:foo.Bar:nested:down", "DOWN");
        session.setAttribute("flash:foo.Bar:nested:down", null);

        replay();

        PersistentFieldStrategy strategy = new FlashPersistentFieldStrategy(request);
View Full Code Here

        train_getAttribute(ss, "foo", "bar");

        replay();

        Request request = new RequestImpl(sr);
        Session session = request.getSession(true);

        assertEquals(session.getAttribute("foo"), "bar");

        verify();
    }
View Full Code Here

public class SessionPersistentFieldStrategyTest extends InternalBaseTestCase
{
    @Test
    public void post_change_to_root_component()
    {
        Session session = mockSession();
        Request request = mockRequest();
        Object value = new Object();

        train_getSession(request, true, session);

        session.setAttribute("state:foo.Bar::field", value);

        replay();

        SessionPersistentFieldStrategy strategy = new SessionPersistentFieldStrategy(request);
View Full Code Here

    }

    @Test
    public void post_change_to_nested_component()
    {
        Session session = mockSession();
        Request request = mockRequest();
        Object value = new Object();

        train_getSession(request, true, session);

        session.setAttribute("state:foo.Bar:fee.fum:field", value);

        replay();

        SessionPersistentFieldStrategy strategy = new SessionPersistentFieldStrategy(request);
View Full Code Here

    }

    @Test
    public void gather_changes_with_active_session()
    {
        Session session = mockSession();
        Request request = mockRequest();

        train_getSession(request, false, session);
        train_getAttributeNames(
                session,
View Full Code Here

        train_getAttribute(ss, "foo", "bar");

        replay();

        Request request = new RequestImpl(sr);
        Session session = request.getSession(true);

        assertEquals(session.getAttribute("foo"), "bar");

        verify();
    }
View Full Code Here

    }

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

        String key = buildKey(asoClass);

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

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

        return aso;
    }
View Full Code Here

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

        Session session = _sessionHolder.getSession(false);

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

    @SuppressWarnings("unchecked")
    @Test
    public void get_aso_already_exists()
    {
        Request request = mockRequest();
        Session session = mockSession();
        Class asoClass = ReadOnlyBean.class;
        Object aso = new ReadOnlyBean();
        String key = "aso:" + asoClass.getName();
        ApplicationStateCreator creator = mockApplicationStateCreator();
View Full Code Here

TOP

Related Classes of org.apache.tapestry.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.