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 = newSession();
        Request request = newRequest();
        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 = newSession();
        Request request = newRequest();

        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

        expect(hs.getAttributeNames()).andReturn(e);

        replay();

        Session session = new SessionImpl(hs);

        assertEquals(session.getAttributeNames(), Arrays.asList("barney", "fred"));

        verify();
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void get_aso_already_exists()
    {
        SessionHolder holder = newMock(SessionHolder.class);
        Session session = newSession();
        Class asoClass = ReadOnlyBean.class;
        Object aso = new ReadOnlyBean();
        String key = "aso:" + asoClass.getName();
        ApplicationStateCreator creator = newApplicationStateCreator();
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void get_aso_needs_to_be_created()
    {
        SessionHolder holder = newMock(SessionHolder.class);
        Session session = newSession();
        Class asoClass = ReadOnlyBean.class;
        Object aso = new ReadOnlyBean();
        String key = "aso:" + asoClass.getName();
        ApplicationStateCreator creator = newApplicationStateCreator();

        train_getSession(holder, true, session);
        train_getAttribute(session, key, null);

        train_create(creator, aso);

        session.setAttribute(key, aso);

        replay();

        ApplicationStatePersistenceStrategy strategy = new SessionApplicationStatePersistenceStrategy(
                holder);
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void set_aso()
    {
        SessionHolder holder = newMock(SessionHolder.class);
        Session session = newSession();
        Class asoClass = ReadOnlyBean.class;
        Object aso = new ReadOnlyBean();
        String key = "aso:" + asoClass.getName();

        train_getSession(holder, true, session);
        session.setAttribute(key, aso);

        replay();

        ApplicationStatePersistenceStrategy strategy = new SessionApplicationStatePersistenceStrategy(
                holder);
View Full Code Here

        expect(hs.getAttributeNames()).andReturn(e);

        replay();

        Session session = new SessionImpl(hs);

        assertEquals(session.getAttributeNames("f"), Arrays.asList("fanny", "fred"));

        verify();
    }
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

        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

        _request = request;
    }

    public final Collection<PersistentFieldChange> gatherFieldChanges(String pageName)
    {
        Session session = _request.getSession(false);

        if (session == null) return Collections.emptyList();

        List<PersistentFieldChange> result = newList();

        String fullPrefix = _prefix + pageName + ":";

        for (String name : session.getAttributeNames(fullPrefix))
        {
            PersistentFieldChange change = buildChange(name, session.getAttribute(name));

            result.add(change);

            didReadChange(session, name);
        }
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.