Package org.apache.tapestry.services

Examples of org.apache.tapestry.services.Session


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

        // First for exists()
        train_getSession(request, false, session);
        train_getAttribute(session, key, null);

        // Second for get()
        train_getSession(request, true, session);
        train_getAttribute(session, key, null);

        train_create(creator, aso);

        session.setAttribute(key, aso);

        // Then for exists() after
        train_getSession(request, false, session);
        train_getAttribute(session, key, aso);
View Full Code Here


    @SuppressWarnings("unchecked")
    @Test
    public void set_aso()
    {
        Request request = mockRequest();
        Session session = mockSession();
        Class asoClass = ReadOnlyBean.class;
        Object aso = new ReadOnlyBean();
        String key = "aso:" + asoClass.getName();

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

        replay();

        ApplicationStatePersistenceStrategy strategy = new SessionApplicationStatePersistenceStrategy(request);
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

     * TAPESTRY-1475
     */
    @Test
    public void discard_changes()
    {
        Session session = mockSession();
        Request request = mockRequest();

        train_getSession(request, false, session);

        train_getAttributeNames(session, "state:foo.Bar:", "state:foo.Bar:baz:field");

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

        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

        _sessionHolder = sessionHolder;
    }

    public final Collection<PersistentFieldChange> gatherFieldChanges(String pageName)
    {
        Session session = _sessionHolder.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

            builder.append(componentId);

        builder.append(':');
        builder.append(fieldName);

        Session session = _sessionHolder.getSession(true);

        session.setAttribute(builder.toString(), newValue);
    }
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

        if (componentId != null) builder.append(componentId);

        builder.append(':');
        builder.append(fieldName);

        Session session = _request.getSession(true);

        session.setAttribute(builder.toString(), newValue);
    }
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.