Package org.apache.tapestry5.services

Examples of org.apache.tapestry5.services.Session


    }

    @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

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

        replay();

        Session session = new SessionImpl(hs);

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

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

        hs.invalidate();

        replay();

        Session session = new SessionImpl(hs);

        session.invalidate();

        verify();
    }
View Full Code Here

        hs.setMaxInactiveInterval(seconds);

        replay();

        Session session = new SessionImpl(hs);

        session.setMaxInactiveInterval(seconds);

        verify();
    }
View Full Code Here

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

        replay();

        Session session = new SessionImpl(hs);

        assertEquals(session.getMaxInactiveInterval(), seconds);

        verify();
    }
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();
        Map<String, Object> asoMap = CollectionFactory.newMap();
View Full Code Here

    @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();
        Map<String, Object> asoMap = CollectionFactory.newMap();

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

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

        train_getAttribute(request, ASO_MAP_ATTRIBUTE, asoMap);
        // Not in map
        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

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.