Examples of SetAttributesRequestHandler


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

      ctx = (Context) managers[1].getContainer();
      ctx.setApplicationSessionLifecycleListeners(new Object[]{ hsl1 })
      ctx.setApplicationEventListeners(new Object[]{ hsal1 });
     
      // Initial request
      SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(attributes, false);
      SessionTestUtil.invokeRequest(managers[0], setHandler, null);
     
      validateNewSession(setHandler);
     
      String sessionId = setHandler.getSessionId();
     
      if (!notify)
      {
         validateNoNotifications(hsl0, hsal0, hsl1, hsal1);
      }
      else
      {
         assertEquals(1, hsl0.invocations.size());
         assertEquals(MockHttpSessionListener.Type.CREATED, hsl0.invocations.get(0));
         assertEquals(1, hsal0.invocations.size());
         assertEquals(MockHttpSessionAttributeListener.Type.ADDED, hsal0.invocations.get(0));
         assertEquals(2, SessionSpecListenerAttribute.invocations.size());
         assertEquals(SessionSpecListenerAttribute.Type.BOUND, SessionSpecListenerAttribute.invocations.get(0));
         assertEquals(SessionSpecListenerAttribute.Type.PASSIVATED, SessionSpecListenerAttribute.invocations.get(1));
        
         validateNoNotifications(null, null, hsl1, hsal1, null);
         clearNotifications(hsl0, hsal0, null, null, SessionSpecListenerAttribute.invocations);        
      }
     
      // Failover request
      setHandler = new SetAttributesRequestHandler(newAttributes, false);
      SessionTestUtil.invokeRequest(managers[1], setHandler, sessionId);
     
      if (!notify)
      {
         validateNoNotifications(hsl0, hsal0, hsl1, hsal1);
View Full Code Here

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

      ctx = (Context) managers[1].getContainer();
      ctx.setApplicationSessionLifecycleListeners(new Object[]{ hsl1 })
      ctx.setApplicationEventListeners(new Object[]{ hsal1 });
     
      // Initial request
      SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(attributes, false);
      SessionTestUtil.invokeRequest(managers[0], setHandler, null);
     
      validateNewSession(setHandler);
     
      if (!notify)
View Full Code Here

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

      DataSourcePersistentManager mgr0 = mgrs[0];
      DataSourcePersistentManager mgr1 = mgrs[1];
     
     
      // Initial request
      SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(getAttributeMap(), false);
      log.info("initial request");
      SessionTestUtil.invokeRequest(mgr0, setHandler, null);     
     
      String sessionId = setHandler.getSessionId();
      WeakReference<Session> session0A = new WeakReference<Session>(mgr0.findSession(sessionId));     
      SessionTestUtil.cleanupPipeline(mgr0);
      assertNotNull(session0A.get());
     
      // Modify attribute request
      setHandler = new SetAttributesRequestHandler(getAttributeMap(), false);
      log.info("Modify attribute request");
      SessionTestUtil.invokeRequest(mgr0, setHandler, sessionId);     
      SessionTestUtil.cleanupPipeline(mgr0);
     
      cleanHeap();
      assertAttributeCount(1);
     
      // Passivate
      Thread.sleep(1100);
     
      log.info("passivate node 0");
      mgr0.backgroundProcess();
      log.info("passivate node 1");
      mgr1.backgroundProcess();
     
      cleanHeap();
      assertAttributeCount(0);
      assertNullReference(session0A);
     
      // Remove attribute request
      RemoveAttributesRequestHandler removeHandler = new RemoveAttributesRequestHandler(KEYS, false);
      log.info("remove request");
      SessionTestUtil.invokeRequest(mgr0, removeHandler, sessionId);
     
      WeakReference<Session> session0B = new WeakReference<Session>(mgr0.findSession(sessionId));
      SessionTestUtil.cleanupPipeline(mgr0);
      cleanHeap();
      assertAttributeCount(0);
      assertNotNull(session0B.get());
     
      // Failover request
      setHandler = new SetAttributesRequestHandler(getAttributeMap(), false);
      log.info("failover request");
      SessionTestUtil.invokeRequest(mgr1, setHandler, sessionId);
     
      WeakReference<Session> session1A = new WeakReference<Session>(mgr1.findSession(sessionId));
      SessionTestUtil.cleanupPipeline(mgr1);
View Full Code Here

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

      DataSourcePersistentManager[] mgrs = getCacheManagers(warname, 2, 10);
      DataSourcePersistentManager mgr0 = mgrs[0];
      DataSourcePersistentManager mgr1 = mgrs[1];
     
      // Initial request
      SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(getAttributeMap(), false);
      log.info("initial request");
      SessionTestUtil.invokeRequest(mgr0, setHandler, null);
      assertAttributeCount(1);       
     
      String sessionId = setHandler.getSessionId();
      WeakReference<Session> session0A = new WeakReference<Session>(mgr0.findSession(sessionId));
      SessionTestUtil.cleanupPipeline(mgr0);
      assertNotNull(session0A.get());
      assertAttributeCount(1);       
     
      // Failover request
      setHandler = new SetAttributesRequestHandler(getAttributeMap(), false);
      log.info("fail over request");
      SessionTestUtil.invokeRequest(mgr1, setHandler, sessionId);
      assertNotNull(setHandler.getCheckedAttributes().get(KEY));
      assertEquals(Attribute.COUNT -1, ((Attribute) setHandler.getCheckedAttributes().get(KEY)).getCount());
     
      WeakReference<Session> session1A = new WeakReference<Session>(mgr1.findSession(sessionId));
      SessionTestUtil.cleanupPipeline(mgr1);
     
      cleanHeap();
View Full Code Here

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

      DataSourcePersistentManager[] mgrs = getCacheManagers(warname, 1800, -1);
      DataSourcePersistentManager mgr0 = mgrs[0];
      DataSourcePersistentManager mgr1 = mgrs[1];
     
      // Initial request
      SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(getAttributeMap(), false);
      SessionTestUtil.invokeRequest(mgr0, setHandler, null);
      assertAttributeCount(1)
     
      String sessionId = setHandler.getSessionId();
      WeakReference<Session> session0A = new WeakReference<Session>(mgr0.findSession(sessionId));
      SessionTestUtil.cleanupPipeline(mgr0);
      assertNotNull(session0A.get());
     
      mgr0.stop();        
View Full Code Here

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

     
      // A war with a maxInactive of 30 mins maxUnreplicated of 0
      this.startManagers(warname, 1800, 1);
     
      // Initial request
      SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(getAttributeMap(), false);
      log.info("initial request");
      SessionTestUtil.invokeRequest(managers[0], setHandler, null);     
     
      String sessionId = setHandler.getSessionId();
      WeakReference<Session> session0A = new WeakReference<Session>(managers[0].findSession(sessionId));
      SessionTestUtil.cleanupPipeline(managers[0]);
      assertNotNull(session0A.get());
     
      // Modify attribute request
      setHandler = new SetAttributesRequestHandler(getAttributeMap(), false);
      log.info("Modify attribute request");
      SessionTestUtil.invokeRequest(managers[0], setHandler, sessionId);     
      SessionTestUtil.cleanupPipeline(managers[0]);
     
      System.gc();
      System.runFinalization();
      assertEquals(1, Attribute.attributeCount());
     
      // Passivate
      Thread.sleep(1100);
     
      log.info("passivate node 0");
      managers[0].backgroundProcess();
      log.info("passivate node 1");
      managers[1].backgroundProcess();
     
      System.gc();
      System.runFinalization();
      assertEquals(0, Attribute.attributeCount());
      assertNull(session0A.get());
     
      // Remove attribute request
      RemoveAttributesRequestHandler removeHandler = new RemoveAttributesRequestHandler(KEYS, false);
      log.info("remove request");
      SessionTestUtil.invokeRequest(managers[0], removeHandler, sessionId);
     
      WeakReference<Session> session0B = new WeakReference<Session>(managers[0].findSession(sessionId));
      SessionTestUtil.cleanupPipeline(managers[0]);
      System.gc();
      System.runFinalization();
      assertEquals(0, Attribute.attributeCount());
      assertNotNull(session0B.get());
     
      // Failover request
      setHandler = new SetAttributesRequestHandler(getAttributeMap(), false);
      log.info("failover request");
      SessionTestUtil.invokeRequest(managers[1], setHandler, sessionId);
     
      WeakReference<Session> session1A = new WeakReference<Session>(managers[1].findSession(sessionId));
      SessionTestUtil.cleanupPipeline(managers[1]);
View Full Code Here

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

     
      // A war with a maxInactive of 2 secs and a maxIdle of 10 (don't passivate)
      this.startManagers(warname, 2, 10);
     
      // Initial request
      SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(getAttributeMap(), false);
      log.info("initial request");
      SessionTestUtil.invokeRequest(managers[0], setHandler, null);
      assertEquals(1, Attribute.attributeCount());
     
      String sessionId = setHandler.getSessionId();
      WeakReference<Session> session0A = new WeakReference<Session>(managers[0].findSession(sessionId));
      SessionTestUtil.cleanupPipeline(managers[0]);
      assertNotNull(session0A.get());
      assertEquals(1, Attribute.attributeCount());
     
      // Failover request
      setHandler = new SetAttributesRequestHandler(getAttributeMap(), false);
      log.info("fail over request");
      SessionTestUtil.invokeRequest(managers[1], setHandler, sessionId);
      assertNotNull(setHandler.getCheckedAttributes().get(KEY));
      assertEquals(Attribute.COUNT -1, ((Attribute) setHandler.getCheckedAttributes().get(KEY)).getCount());
     
      WeakReference<Session> session1A = new WeakReference<Session>(managers[1].findSession(sessionId));
      SessionTestUtil.cleanupPipeline(managers[1]);
     
      System.gc();
View Full Code Here

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

     
      // A war with a maxInactive of 30 mins and no maxIdle
      this.startManagers(warname, 1800, -1);
     
      // Initial request
      SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(getAttributeMap(), false);
      SessionTestUtil.invokeRequest(managers[0], setHandler, null);
      assertEquals(1, Attribute.attributeCount());
     
      String sessionId = setHandler.getSessionId();
      WeakReference<Session> session0A = new WeakReference<Session>(managers[0].findSession(sessionId));
      SessionTestUtil.cleanupPipeline(managers[0]);
      assertNotNull(session0A.get());
     
      managers[0].stop();
View Full Code Here

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

      DataSourcePersistentManager[] mgrs = getCacheManagers(warname, 3, maxUnrep);
      DataSourcePersistentManager mgr0 = mgrs[0];
      DataSourcePersistentManager mgr1 = mgrs[1];
     
      // Establish session.
      SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(allAttributes, false);
      SessionTestUtil.invokeRequest(mgr0, setHandler, null);
     
      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

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

      // A war with a maxInactive of 3 secs and a maxUnreplicated of 1
      DataSourcePersistentManager[] mgrs = getCacheManagers(warname, 3, 1);
      DataSourcePersistentManager mgr0 = mgrs[0];
      DataSourcePersistentManager mgr1 = mgrs[1];
     
      SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(allAttributes, false);
      SessionTestUtil.invokeRequest(mgr0, setHandler, null);
     
      // 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
TOP
Copyright © 2018 www.massapi.com. 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.