Package org.jboss.as.web.session.mocks

Examples of org.jboss.as.web.session.mocks.MockClusteredSessionManager


    @Test
    public void testNoSessionNoRequestedSession() throws Exception {
        log.info("Enter testNoSessionNoRequestedSession");

        MockClusteredSessionManager mgr = new MockClusteredSessionManager();
        mgr.setJvmRoute(JVM_ROUTE);

        JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);

        MockValve mockValve = new MockValve();

        jvmRouteValve.setNext(mockValve);

        MockRequest req = new MockRequest(mgr);

        Response res = new Response();

        jvmRouteValve.invoke(req, res);

        assertSame(req, mockValve.getInvokedRequest());
        assertSame(res, mockValve.getInvokedResponse());
        assertEquals(null, mgr.findSession(NON_FAILOVER_ID));
        assertEquals(null, mgr.findSession(FAILOVER_ID));
        assertEquals(null, mgr.getNewCookieIdSession());
    }
View Full Code Here


    @Test
    public void testSessionNoRequestedSession() throws Exception {
        log.info("Enter testSessionNoRequestedSession");

        MockClusteredSessionManager mgr = new MockClusteredSessionManager();
        mgr.setJvmRoute(JVM_ROUTE);

        JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);

        MockValve mockValve = new MockValve();

        jvmRouteValve.setNext(mockValve);

        Session session = mgr.createSession(NON_FAILOVER_ID);
        MockRequest req = new MockRequest(mgr);
        req.setSession(session);

        Response res = new Response();

        jvmRouteValve.invoke(req, res);

        assertSame(req, mockValve.getInvokedRequest());
        assertSame(res, mockValve.getInvokedResponse());
        assertEquals(NON_FAILOVER_ID, session.getId());
        assertEquals(NON_FAILOVER_ID, mgr.getNewCookieIdSession());
    }
View Full Code Here

    @Test
    public void testSessionNoRequestedSessionFromURL() throws Exception {
        log.info("Enter testSessionNoRequestedSessionFromURL");

        MockClusteredSessionManager mgr = new MockClusteredSessionManager();
        mgr.setJvmRoute(JVM_ROUTE);

        JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);

        MockValve mockValve = new MockValve();

        jvmRouteValve.setNext(mockValve);

        Session session = mgr.createSession(NON_FAILOVER_ID);
        MockRequest req = new MockRequest(mgr);
        req.setSession(session);
        req.setRequestedSessionIdFromURL(true);

        Response res = new Response();

        jvmRouteValve.invoke(req, res);

        assertSame(req, mockValve.getInvokedRequest());
        assertSame(res, mockValve.getInvokedResponse());
        assertEquals(NON_FAILOVER_ID, session.getId());
        assertEquals(null, mgr.getNewCookieIdSession());
    }
View Full Code Here

    @Test
    public void testFailoverSessionNoRequestedSession() throws Exception {
        log.info("Enter testFailoverSessionNoRequestedSession");

        MockClusteredSessionManager mgr = new MockClusteredSessionManager();
        mgr.setJvmRoute(JVM_ROUTE);

        JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);

        MockValve mockValve = new MockValve();

        jvmRouteValve.setNext(mockValve);

        Session session = mgr.createSession(FAILOVER_ID);
        MockRequest req = new MockRequest(mgr);
        req.setSession(session);

        Response res = new Response();

        jvmRouteValve.invoke(req, res);

        assertSame(req, mockValve.getInvokedRequest());
        assertSame(res, mockValve.getInvokedResponse());
        assertEquals(NON_FAILOVER_ID, session.getId());
        assertEquals(NON_FAILOVER_ID, mgr.getNewCookieIdSession());
    }
View Full Code Here

    @Test
    public void testFailoverSessionNoRequestedSessionFromURL() throws Exception {
        log.info("Enter testFailoverSessionNoRequestedSessionFromURL");

        MockClusteredSessionManager mgr = new MockClusteredSessionManager();
        mgr.setJvmRoute(JVM_ROUTE);

        JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);

        MockValve mockValve = new MockValve();

        jvmRouteValve.setNext(mockValve);

        Session session = mgr.createSession(FAILOVER_ID);
        MockRequest req = new MockRequest(mgr);
        req.setSession(session);
        req.setRequestedSessionIdFromURL(true);

        Response res = new Response();

        jvmRouteValve.invoke(req, res);

        assertSame(req, mockValve.getInvokedRequest());
        assertSame(res, mockValve.getInvokedResponse());
        assertEquals(NON_FAILOVER_ID, session.getId());
        assertEquals(null, mgr.getNewCookieIdSession());
    }
View Full Code Here

    @Test
    public void testNoJvmRouteSession() throws Exception {
        log.info("Enter testNoJvmRouteSession");

        MockClusteredSessionManager mgr = new MockClusteredSessionManager();
        mgr.setJvmRoute(JVM_ROUTE);

        JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);

        MockValve mockValve = new MockValve();

        jvmRouteValve.setNext(mockValve);

        Session session = mgr.createSession(NO_JVMROUTE_ID);
        MockRequest req = new MockRequest(mgr);
        req.setSession(session);
        req.setRequestedSessionId(session.getId());

        Response res = new Response();

        jvmRouteValve.invoke(req, res);

        assertSame(req, mockValve.getInvokedRequest());
        assertSame(res, mockValve.getInvokedResponse());
        assertEquals(NON_FAILOVER_ID, session.getId());
        assertEquals(NON_FAILOVER_ID, mgr.getNewCookieIdSession());
    }
View Full Code Here

    @Test
    public void testNoJvmRouteSessionFromURL() throws Exception {
        log.info("Enter testNoJvmRouteSessionFromURL");

        MockClusteredSessionManager mgr = new MockClusteredSessionManager();
        mgr.setJvmRoute(JVM_ROUTE);

        JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);

        MockValve mockValve = new MockValve();

        jvmRouteValve.setNext(mockValve);

        Session session = mgr.createSession(NO_JVMROUTE_ID);
        MockRequest req = new MockRequest(mgr);
        req.setSession(session);
        req.setRequestedSessionId(session.getId());
        req.setRequestedSessionIdFromURL(true);

        Response res = new Response();

        jvmRouteValve.invoke(req, res);

        assertSame(req, mockValve.getInvokedRequest());
        assertSame(res, mockValve.getInvokedResponse());
        assertEquals(NON_FAILOVER_ID, session.getId());
        assertEquals(null, mgr.getNewCookieIdSession());
    }
View Full Code Here

    @Test
    public void testNoJvmRouteRequest() throws Exception {
        log.info("Enter testNoJvmRouteRequest");

        MockClusteredSessionManager mgr = new MockClusteredSessionManager();
        mgr.setJvmRoute(JVM_ROUTE);

        JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);

        MockValve mockValve = new MockValve();

        jvmRouteValve.setNext(mockValve);

        Session session = mgr.createSession(NON_FAILOVER_ID);
        MockRequest req = new MockRequest(mgr);
        req.setSession(session);
        req.setRequestedSessionId(NO_JVMROUTE_ID);

        Response res = new Response();

        jvmRouteValve.invoke(req, res);

        assertSame(req, mockValve.getInvokedRequest());
        assertSame(res, mockValve.getInvokedResponse());
        assertEquals(NON_FAILOVER_ID, session.getId());
        assertEquals(NON_FAILOVER_ID, mgr.getNewCookieIdSession());
    }
View Full Code Here

    @Test
    public void testNoJvmRouteRequestFromURL() throws Exception {
        log.info("Enter testNoJvmRouteRequest");

        MockClusteredSessionManager mgr = new MockClusteredSessionManager();
        mgr.setJvmRoute(JVM_ROUTE);

        JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);

        MockValve mockValve = new MockValve();

        jvmRouteValve.setNext(mockValve);

        MockRequest req = new MockRequest(mgr);
        Session session = mgr.createSession(NON_FAILOVER_ID);
        req.setSession(session);
        req.setRequestedSessionId(NO_JVMROUTE_ID);
        req.setRequestedSessionIdFromURL(true);

        Response res = new Response();

        jvmRouteValve.invoke(req, res);

        assertSame(req, mockValve.getInvokedRequest());
        assertSame(res, mockValve.getInvokedResponse());
        assertEquals(NON_FAILOVER_ID, session.getId());
        assertEquals(null, mgr.getNewCookieIdSession());
    }
View Full Code Here

    @Test
    public void testJvmRouteIncludesDomain() throws Exception {
        log.info("Enter testJvmRouteIncludesDomain");

        MockClusteredSessionManager mgr = new MockClusteredSessionManager();
        mgr.setJvmRoute(DOMAIN_JVM_ROUTE);

        JvmRouteValve jvmRouteValve = new JvmRouteValve(mgr);

        MockValve mockValve = new MockValve();

        jvmRouteValve.setNext(mockValve);

        MockRequest req = new MockRequest(mgr);
        Session session = mgr.createSession(DOMAIN_FAILOVER_ID);
        req.setSession(session);
        req.setRequestedSessionId(session.getId());

        Response res = new Response();

        jvmRouteValve.invoke(req, res);

        assertSame(req, mockValve.getInvokedRequest());
        assertSame(res, mockValve.getInvokedResponse());
        assertEquals(DOMAIN_NON_FAILOVER_ID, session.getId());
        assertEquals(DOMAIN_NON_FAILOVER_ID, mgr.getNewCookieIdSession());

    }
View Full Code Here

TOP

Related Classes of org.jboss.as.web.session.mocks.MockClusteredSessionManager

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.