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

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


        assertFalse(id1.equals(id2));

        // Ensure replication of session 2 has occurred
        boolean found = false;
        for (int i = 0; i < 10; i++) {
            BasicRequestHandler getHandler = new BasicRequestHandler(attrs.keySet(), false);
            SessionTestUtil.invokeRequest(managers[1], getHandler, id2);
            if (getHandler.getCheckedAttributes() != null && value.equals(getHandler.getCheckedAttributes().get("count"))) {
                found = true;
                break;
            }
            Thread.sleep(50);
        }
View Full Code Here


        }

        @Override
        public void run() {
            try {
                BasicRequestHandler getHandler = new BasicRequestHandler(attributeKeys, false);
                concurrentHandler.registerHandler(getHandler);
                Request request = SessionTestUtil.setupRequest(manager, sessionId);
                startingGun.countDown();
                startingGun.await();

                SessionTestUtil.invokeRequest(pipelineHead, request);
                this.checkedAttributes = getHandler.getCheckedAttributes();
            } catch (Exception e) {
                e.printStackTrace(System.err);
            } finally {
                finishedSignal.countDown();
                concurrentHandler.unregisterHandler();
View Full Code Here

        assertEquals(0, Attribute.attributeCount());
        assertNull(session0B.get());
        assertNull(session1A.get());

        // Reactivate
        BasicRequestHandler getHandler = new BasicRequestHandler(KEYS, false);
        log.info("activate node 1");
        SessionTestUtil.invokeRequest(managers[1], getHandler, sessionId);

        WeakReference<Session> session1B = new WeakReference<Session>(managers[1].findSession(sessionId));
        SessionTestUtil.cleanupPipeline(managers[1]);
        assertNotNull(session1B.get());
        assertEquals(1, Attribute.attributeCount());

        // Fail back
        getHandler = new BasicRequestHandler(KEYS, false);
        log.info("fail back request");
        SessionTestUtil.invokeRequest(managers[0], getHandler, sessionId);

        WeakReference<Session> session0C = new WeakReference<Session>(managers[0].findSession(sessionId));
        SessionTestUtil.cleanupPipeline(managers[0]);
View Full Code Here

        Thread.sleep(250);

        // Now make a request that will not trigger replication but keeps the
        // jbcm0 session alive
        BasicRequestHandler getHandler = new BasicRequestHandler(immutables.keySet(), false);
        SessionTestUtil.invokeRequest(managers[0], getHandler, setHandler.getSessionId());

        validateExpectedAttributes(immutables, getHandler);

        // Sleep long enough that the session will be expired on other server
        // if it doesn't have a maxUnreplicatedInterval grace period
        Thread.sleep(2800);

        // jbcm1 considers the session unmodified for > 3 sec
        // maxInactiveInterval.
        // Try to drive the session out of the jbcm1 cache
        managers[1].backgroundProcess();

        // Replicate just one attribute; see if the other is still in jbcm1
        SetAttributesRequestHandler modifyHandler = new SetAttributesRequestHandler(mutables, false);
        SessionTestUtil.invokeRequest(managers[0], modifyHandler, setHandler.getSessionId());

        // Fail over and confirm all is well. If the session was removed,
        // the last replication of just one attribute won't restore all
        // attributes and we'll have a failure
        getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
        SessionTestUtil.invokeRequest(managers[1], getHandler, setHandler.getSessionId());

        validateExpectedAttributes(allAttributes, getHandler);
    }
View Full Code Here

        SessionTestUtil.invokeRequest(managers[0], modifyHandler, setHandler.getSessionId());

        Thread.sleep(1760);

        // Fail over and confirm all is well
        BasicRequestHandler getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
        SessionTestUtil.invokeRequest(managers[1], getHandler, setHandler.getSessionId());

        validateExpectedAttributes(allAttributes, getHandler);
    }
View Full Code Here

        setHandler = new SetAttributesRequestHandler(allAttributes, false);
        SessionTestUtil.invokeRequest(managersB[0], setHandler, null);
        validateNewSession(setHandler);
        String idB = setHandler.getSessionId();

        BasicRequestHandler getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
        SessionTestUtil.invokeRequest(managersA[1], getHandler, idA);

        validateExpectedAttributes(allAttributes, getHandler);

        getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
        SessionTestUtil.invokeRequest(managersB[1], getHandler, idB);

        validateExpectedAttributes(allAttributes, getHandler);

        // Undeploy one webapp on node 1
        managersB[1].stop();
        log.info("jbcmB1 stopped");

        // Deploy again
        managersB[1] = this.startManager(warnameB, cacheContainers[1]);

        log.info("jbcmB1 started");

        getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
        SessionTestUtil.invokeRequest(managersA[1], getHandler, idA);

        validateExpectedAttributes(allAttributes, getHandler);

        getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
        SessionTestUtil.invokeRequest(managersB[1], getHandler, idB);

        validateExpectedAttributes(allAttributes, getHandler);
    }
View Full Code Here

        Thread.sleep(1050);

        // Now make a request that will not trigger replication unless the
        // interval is exceeded
        BasicRequestHandler getHandler = new BasicRequestHandler(immutables.keySet(), false);
        SessionTestUtil.invokeRequest(managers[0], getHandler, setHandler.getSessionId());

        validateExpectedAttributes(immutables, getHandler);

        // Sleep long enough that the session will be expired on other server
        // if previous request didn't keep it alive
        Thread.sleep(2000);

        // Fail over and confirm all is well
        getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
        SessionTestUtil.invokeRequest(managers[1], getHandler, setHandler.getSessionId());

        validateExpectedAttributes(allAttributes, getHandler);
    }
View Full Code Here

        // trigger timestamp repl
        Thread.sleep(500);

        // Now make a request that will not trigger replication unless the
        // interval is exceeded
        BasicRequestHandler getHandler = new BasicRequestHandler(immutables.keySet(), false);
        SessionTestUtil.invokeRequest(managers[0], getHandler, setHandler.getSessionId());

        validateExpectedAttributes(immutables, getHandler);

        // Sleep long enough that the session will be expired on other server
        // if previous request didn't keep it alive
        Thread.sleep(2600);

        // Fail over and confirm the session was expired
        getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
        SessionTestUtil.invokeRequest(managers[1], getHandler, setHandler.getSessionId());

        validateNewSession(getHandler);
    }
View Full Code Here

        assertNotNull(data1);
        assertNotNull(data2);

        // Access one to prove it gets expired once the manager can see its real
        // timestamp
        BasicRequestHandler getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
        SessionTestUtil.invokeRequest(managers[1], getHandler, setHandler1.getSessionId());
        validateNewSession(getHandler);

        // Sleep past the grace period
        Thread.sleep(2010);
View Full Code Here

TOP

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

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.