Package org.impalaframework.web.servlet.wrapper.session

Examples of org.impalaframework.web.servlet.wrapper.session.StateProtectingHttpSession


        ValueHolder valueHolder = new ValueHolder();
        expect(session.getAttribute("myAttribute")).andReturn(valueHolder);
       
        replay(session);

        StateProtectingHttpSession wrappedSession = new StateProtectingHttpSession(session, webAttributeQualifier, applicationId, moduleName, ClassUtils.getDefaultClassLoader());
        assertSame(valueHolder, wrappedSession.getAttribute("myAttribute"));
        verify(session);
    }
View Full Code Here


        session = createMock(HttpSession.class);
        session.invalidate();
       
        replay(session);

        StateProtectingHttpSession wrappedSession = new StateProtectingHttpSession(session, webAttributeQualifier, applicationId, moduleName, ClassUtils.getDefaultClassLoader());

        assertTrue(wrappedSession.isValid());
        wrappedSession.invalidate();
        assertFalse(wrappedSession.isValid());
       
        verify(session);
    }
View Full Code Here

        ValueHolder valueHolder = new ValueHolder();
        expect(session.getAttribute("application_myapp_module_mymodule:myAttribute")).andReturn(valueHolder);
       
        replay(session);

        StateProtectingHttpSession wrappedSession = new StateProtectingHttpSession(session, webAttributeQualifier, applicationId, moduleName, ClassUtils.getDefaultClassLoader());
        assertSame(valueHolder, wrappedSession.getAttribute("myAttribute"));
        verify(session);
    }   
View Full Code Here

        expect(session.getAttribute("myAttribute")).andReturn(clonedObject);
        session.setAttribute(eq("myAttribute"), EasyMock.anyObject());
       
        replay(session);

        StateProtectingHttpSession wrappedSession = new StateProtectingHttpSession(session, webAttributeQualifier, applicationId, moduleName, newModuleClassLoader());
        assertFalse(valueHolder == wrappedSession.getAttribute("myAttribute"));
        verify(session);
    }
View Full Code Here

        expect(session.getAttribute("myAttribute")).andReturn(clonedObject);
        session.removeAttribute("myAttribute");
       
        replay(session);

        StateProtectingHttpSession wrappedSession = cloneFailingSession();
        assertFalse(valueHolder == wrappedSession.getAttribute("myAttribute"));
        verify(session);
    }
View Full Code Here

        //note the call to invalidate
        session.invalidate();
       
        replay(session);

        StateProtectingHttpSession wrappedSession = cloneFailingSession();
        assertFalse(valueHolder == wrappedSession.getAttribute("myAttribute"));
        verify(session);
    }
View Full Code Here

        verify(session);
    }
   
   
    private StateProtectingHttpSession cloneFailingSession() {
        StateProtectingHttpSession wrappedSession = new StateProtectingHttpSession(session, webAttributeQualifier, applicationId, moduleName, newModuleClassLoader()){

            @Override
            Object clone(Object attribute, SerializationHelper helper) {
                throw new RuntimeException();
            }
View Full Code Here

        expect(session.getAttribute("myAttribute")).andReturn(attribute);
        session.removeAttribute("myAttribute");
       
        replay(session);

        StateProtectingHttpSession wrappedSession = new StateProtectingHttpSession(session, webAttributeQualifier, applicationId, moduleName, newModuleClassLoader());
        assertNull(wrappedSession.getAttribute("myAttribute"));
        verify(session);
    }
View Full Code Here

       
        replayMocks();

        HttpSession wrappedSession = wrapperRequest.wrapSession(session);
        assertTrue(wrappedSession instanceof StateProtectingHttpSession);
        StateProtectingHttpSession moduleAwareSession = (StateProtectingHttpSession) wrappedSession;
       
        final ClassLoader classLoader = ReflectionUtils.getFieldValue(moduleAwareSession, "moduleClassLoader", ClassLoader.class);
        assertNotNull(classLoader);
       
        final HttpSession storedSession = ReflectionUtils.getFieldValue(moduleAwareSession, "realSession", HttpSession.class);
View Full Code Here

       
        replayMocks();

        HttpSession wrappedSession = wrapper.wrapSession(session, "mymodule", applicationId);
        assertTrue(wrappedSession instanceof StateProtectingHttpSession);
        StateProtectingHttpSession moduleAwareSession = (StateProtectingHttpSession) wrappedSession;
        assertNotNull(moduleAwareSession.getModuleClassLoader());
        assertSame(session, moduleAwareSession.getRealSession());

        verifyMocks();
    }
View Full Code Here

TOP

Related Classes of org.impalaframework.web.servlet.wrapper.session.StateProtectingHttpSession

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.