Package org.jboss.test.cluster.web.mocks

Examples of org.jboss.test.cluster.web.mocks.BasicRequestHandler


      validateNewSession(setHandler);
     
      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


     
      // Sleep less than the maxUnreplicated time so next request shouldn't 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

      // Confirm they are still there
      assertNotNull(managers[1].getDistributedCacheManager().getSessionData(id1, false));
      assertNotNull(managers[1].getDistributedCacheManager().getSessionData(id2, false));
     
      // 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

      assertAttributeCount(0);
      assertNullReference(session0B);
      assertNullReference(session1A);
     
      // Reactivate
      BasicRequestHandler getHandler = new BasicRequestHandler(KEYS, false);
      log.info("activate node 1");
      SessionTestUtil.invokeRequest(mgr1, getHandler, sessionId);
     
      WeakReference<Session> session1B = new WeakReference<Session>(mgr1.findSession(sessionId));
      SessionTestUtil.cleanupPipeline(mgr1);
      assertNotNull(session1B.get());
      assertAttributeCount(1);     
     
      // Fail back
      getHandler = new BasicRequestHandler(KEYS, false);
      log.info("fail back request");
      SessionTestUtil.invokeRequest(mgr0, getHandler, sessionId);
     
      WeakReference<Session> session0C = new WeakReference<Session>(mgr0.findSession(sessionId));
      SessionTestUtil.cleanupPipeline(mgr0);
      assertNotNull(session0C.get());
      assertAttributeCount(2);  
     
      // Invalidate session
      InvalidateSessionRequestHandler invalidateHandler = new InvalidateSessionRequestHandler(KEYS, false);
      log.info("invalidate request");
      SessionTestUtil.invokeRequest(mgr0, invalidateHandler, sessionId);
      SessionTestUtil.cleanupPipeline(mgr0);
     
      cleanHeap();
      assertNotNull(session1B.get());
      assertNullReference(session0C);
      assertAttributeCount(1);
     
      // Make mgr1 aware of the invalidation
      getHandler = new BasicRequestHandler(KEYS, false);
      SessionTestUtil.invokeRequest(mgr1, getHandler, sessionId);
     
      cleanHeap();
      assertNullReference(session1B);
      assertAttributeCount(0);
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

      validateNewSession(setHandler);
     
      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(mgr0, 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(mgr1, getHandler, setHandler.getSessionId());
     
      validateExpectedAttributes(allAttributes, getHandler);
   }
View Full Code Here

     
      // Sleep less than the maxUnreplicated time so next request shouldn't 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(mgr0, 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(mgr1, getHandler, setHandler.getSessionId());
     
      validateNewSession(getHandler);
   }
View Full Code Here

     
      // 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

     
      public void run()
      {
         try
         {
            BasicRequestHandler getHandler = new BasicRequestHandler(attributeKeys, false);
            concurrentHandler.registerHandler(getHandler);
            Request request = SessionTestUtil.setupRequest(manager, sessionId);
            startingGun.countDown();
            startingGun.await();
            System.out.println("started");
           
            SessionTestUtil.invokeRequest(pipelineHead, request);
            this.checkedAttributes = getHandler.getCheckedAttributes();
            if (this.checkedAttributes != null)
            {
               System.out.println(this.checkedAttributes.keySet());
            }
         }
View Full Code Here

      validateNewSession(setHandler);
     
      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

TOP

Related Classes of org.jboss.test.cluster.web.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.