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

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


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

        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(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(null, mgr.getNewCookieIdSession());
    }
View Full Code Here


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

        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(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(NON_FAILOVER_ID, session.getId());
        assertEquals(NON_FAILOVER_ID, mgr.getNewCookieIdSession());

    }
View Full Code Here

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

        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(FAILOVER_ID);
        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 testFailoverMismatchBadReq() throws Exception {
        log.info("Enter testFailoverMismatchBadReq");

        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(FAILOVER_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 testFailoverMismatchBadReqFromURL() throws Exception {
        log.info("Enter testFailoverMismatchBadReqFromURL");

        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(FAILOVER_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 testFailoverMismatchBadSession() throws Exception {
        log.info("Enter testFailoverMismatchBadSession");

        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(FAILOVER_ID);
        req.setSession(session);
        req.setRequestedSessionId(NON_FAILOVER_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 testFailoverMismatchBadSessionFromURL() throws Exception {
        log.info("Enter testFailoverMismatchBadSessionFromURL");

        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(FAILOVER_ID);
        req.setSession(session);
        req.setRequestedSessionId(NON_FAILOVER_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 testNoSession() throws Exception {
        log.info("Enter testNoSession");

        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);
        req.setRequestedSessionId(NON_FAILOVER_ID);

        Response res = new Response();

        jvmRouteValve.invoke(req, res);

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

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

        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);
        req.setRequestedSessionId(NON_FAILOVER_ID);
        req.setRequestedSessionIdFromURL(true);

        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.getNewCookieIdSession());
    }
View Full Code Here

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

        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);
        req.setRequestedSessionId(FAILOVER_ID);

        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("123.node2"));
        assertEquals(null, 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.