Package org.jboss.test.cluster.ejb3.stateful

Examples of org.jboss.test.cluster.ejb3.stateful.Stateless


         throws ServletException, IOException
   {
      try
      {
         log.info("EJBServlet.processRequest invoked");
         ServiceRemote test = (ServiceRemote) getInitialContext().lookup("ServiceBean/remote");
         log.info("looked up remote bean ServiceBean/remote, about to invoke remoteMethod() on bean");
         test.remoteMethod();
         log.info("invoked remoteMethod() on bean");
  /*       MBeanServer server = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
         ObjectName testerName = new ObjectName("default:service=service");
         Object[] params = {};
         String[] sig = {};
View Full Code Here


      getLog().debug("Test Stateless Bean loadbalancing");
      getLog().debug("==================================");
      getLog().debug(++StatelessUnitTestCase.test +"- "
              +"Looking up clusteredStateless/remote...");
      ClusteredStatelessRemote stateless = (ClusteredStatelessRemote) ctx.lookup("clusteredStateless/remote");
     
      confirmTargetCount(2, true);
     
      NodeAnswer node1 = stateless.getNodeState();
      getLog ().debug ("Node 1 ID: " +node1);

      confirmTargetCount(2, false);
     
      Map<VMID, Integer> callCount = new HashMap<VMID, Integer>();
     
      int allowedErr = 0;
      allowedErr = validateBalancing(stateless, callCount, 4, 2, 0);
     
      ctx = getInitialContext(1);
      stateless = (ClusteredStatelessRemote) ctx.lookup("clusteredStateless/remote");
      confirmTargetCount(2, true);
      NodeAnswer node2 = stateless.getNodeState();
      getLog ().debug ("Node 2 ID : " +node2);
      confirmTargetCount(2, true);
     
//      assertFalse("Second call went to different node " + node2.nodeId + " vs " + node1.nodeId,
//            node1.nodeId.equals(node2.nodeId));
View Full Code Here

  
      getLog().debug("Test Stateless Bean loadbalancing after topology change");
      getLog().debug("==================================");
      getLog().debug(++StatelessUnitTestCase.test +"- "
              +"Looking up clusteredStateless/remote...");
      ClusteredStatelessRemote stateless = (ClusteredStatelessRemote) ctx.lookup("clusteredStateless/remote");
      confirmTargetCount(2, true);
      NodeAnswer node1 = stateless.getNodeState();
      getLog ().debug ("Node 1 ID: " +node1);
      confirmTargetCount(2, true);
      NodeAnswer node2 = stateless.getNodeState();
      getLog ().debug ("Node 2 ID : " +node2);
        
      assertFalse(node1.nodeId.equals(node2.nodeId));
      confirmTargetCount(2, false);
     
      MBeanServerConnection[] adaptors = getAdaptors();
     
      deployed0 = false;
      undeploy(adaptors[0], DEPLOYMENT);
     
      NodeAnswer call3 = stateless.getNodeState();
      getLog ().debug ("Call 3 ID : " +call3);
      confirmTargetCount(1, true);
     
      assertTrue("Call 3 hit existing node", node1.nodeId.equals(call3.nodeId) || node2.nodeId.equals(call3.nodeId));
     
      NodeAnswer call4 = stateless.getNodeState();
      getLog ().debug ("Call 4 ID : " +call4);
     
      assertEquals("Call 3 and Call 4 hit the same node", call3.nodeId, call4.nodeId);
     
      deploy(adaptors[0], DEPLOYMENT);
      deployed0 = true;
     
      // Call once to get the new topology. The next call after this
      // might go to the same node if the topology change means the node
      // that handled this call moves in the target list to the next position
      NodeAnswer call5 = stateless.getNodeState();
      getLog ().debug ("Call 5 ID : " +call5);
     
      Map<VMID, Integer> callCount = new HashMap<VMID, Integer>();
      validateBalancing(stateless, callCount, 4, 2, 0);
     
      deployed1 = false;
      undeploy(adaptors[1], DEPLOYMENT);
     
      NodeAnswer call6 = stateless.getNodeState();
      getLog ().debug ("Call 6 ID : " +call6);
      confirmTargetCount(1, true);
     
      assertTrue("Call 6 hit existing node", callCount.containsKey(call6.nodeId));
     
      NodeAnswer call7 = stateless.getNodeState();
      getLog ().debug ("Call 7 ID : " +call7);
     
      assertEquals("Call 6 and Call 7 hit the same node", call6.nodeId, call7.nodeId);
     
      deploy(adaptors[1], DEPLOYMENT);
      deployed1 = true;
     
      // Call once to get the new topology. The next call after this
      // might go to the same node if the topology change means the node
      // that handled this call moves in the target list to the next position
      NodeAnswer call8 = stateless.getNodeState();
      getLog ().debug ("Call 8 ID : " +call8);
     
      callCount = new HashMap<VMID, Integer>();
      validateBalancing(stateless, callCount, 4, 2, 0);
   }
View Full Code Here

  
      getLog().debug("testBeanProxyTargets");
      getLog().debug("================================================");
     
      getLog().debug("Checking ClusteredStatelessRemote on node 0");
      ClusteredStatelessRemote csr = (ClusteredStatelessRemote) getInitialContext(0).lookup("clusteredStateless/remote");
      confirmTargetCount(getFamilyName(SLSB), 2);
     
      getLog().debug("Checking ClusteredStatelessRemote on node 1");
      csr = (ClusteredStatelessRemote) getInitialContext(1).lookup("clusteredStateless/remote");
      confirmTargetCount(getFamilyName(SLSB), 2);
View Full Code Here

      catch (NameNotFoundException nnfe)
      {
         fail(nnfe.getMessage());
      }

      NodeAnswer node1 = stateful.getNodeState ();
      getLog ().debug ("Node 1 ID: " +node1);

      // Now we switch to the other node, simulating a failure on node 1
      //
      stateful.setUpFailover("once");
View Full Code Here

      catch (NameNotFoundException nnfe)
      {
         fail(nnfe.getMessage());
      }
     
      NodeAnswer node1 = stateless.getNodeState();
      assertNotNull(node1);
      getLog ().debug ("Node 1 ID: " +node1);
     
      for (int i = 0; i < 20; i++)
      {
View Full Code Here

              +"Looking up clusteredStateless/remote...");
      ClusteredStatelessRemote stateless = (ClusteredStatelessRemote) ctx.lookup("clusteredStateless/remote");
     
      confirmTargetCount(2, true);
     
      NodeAnswer node1 = stateless.getNodeState();
      getLog ().debug ("Node 1 ID: " +node1);

      confirmTargetCount(2, false);
     
      Map<VMID, Integer> callCount = new HashMap<VMID, Integer>();
     
      int allowedErr = 0;
      allowedErr = validateBalancing(stateless, callCount, 4, 2, 0);
     
      ctx = getInitialContext(1);
      stateless = (ClusteredStatelessRemote) ctx.lookup("clusteredStateless/remote");
      confirmTargetCount(2, true);
      NodeAnswer node2 = stateless.getNodeState();
      getLog ().debug ("Node 2 ID : " +node2);
      confirmTargetCount(2, true);
     
//      assertFalse("Second call went to different node " + node2.nodeId + " vs " + node1.nodeId,
//            node1.nodeId.equals(node2.nodeId));
View Full Code Here

      getLog().debug("==================================");
      getLog().debug(++StatelessUnitTestCase.test +"- "
              +"Looking up clusteredStateless/remote...");
      ClusteredStatelessRemote stateless = (ClusteredStatelessRemote) ctx.lookup("clusteredStateless/remote");
      confirmTargetCount(2, true);
      NodeAnswer node1 = stateless.getNodeState();
      getLog ().debug ("Node 1 ID: " +node1);
      confirmTargetCount(2, true);
      NodeAnswer node2 = stateless.getNodeState();
      getLog ().debug ("Node 2 ID : " +node2);
        
      assertFalse(node1.nodeId.equals(node2.nodeId));
      confirmTargetCount(2, false);
     
      MBeanServerConnection[] adaptors = getAdaptors();
     
      deployed0 = false;
      undeploy(adaptors[0], DEPLOYMENT);
     
      NodeAnswer call3 = stateless.getNodeState();
      getLog ().debug ("Call 3 ID : " +call3);
      confirmTargetCount(1, true);
     
      assertTrue("Call 3 hit existing node", node1.nodeId.equals(call3.nodeId) || node2.nodeId.equals(call3.nodeId));
     
      NodeAnswer call4 = stateless.getNodeState();
      getLog ().debug ("Call 4 ID : " +call4);
     
      assertEquals("Call 3 and Call 4 hit the same node", call3.nodeId, call4.nodeId);
     
      deploy(adaptors[0], DEPLOYMENT);
      deployed0 = true;
     
      // Call once to get the new topology. The next call after this
      // might go to the same node if the topology change means the node
      // that handled this call moves in the target list to the next position
      NodeAnswer call5 = stateless.getNodeState();
      getLog ().debug ("Call 5 ID : " +call5);
     
      Map<VMID, Integer> callCount = new HashMap<VMID, Integer>();
      validateBalancing(stateless, callCount, 4, 2, 0);
     
      deployed1 = false;
      undeploy(adaptors[1], DEPLOYMENT);
     
      NodeAnswer call6 = stateless.getNodeState();
      getLog ().debug ("Call 6 ID : " +call6);
      confirmTargetCount(1, true);
     
      assertTrue("Call 6 hit existing node", callCount.containsKey(call6.nodeId));
     
      NodeAnswer call7 = stateless.getNodeState();
      getLog ().debug ("Call 7 ID : " +call7);
     
      assertEquals("Call 6 and Call 7 hit the same node", call6.nodeId, call7.nodeId);
     
      deploy(adaptors[1], DEPLOYMENT);
      deployed1 = true;
     
      // Call once to get the new topology. The next call after this
      // might go to the same node if the topology change means the node
      // that handled this call moves in the target list to the next position
      NodeAnswer call8 = stateless.getNodeState();
      getLog ().debug ("Call 8 ID : " +call8);
     
      callCount = new HashMap<VMID, Integer>();
      validateBalancing(stateless, callCount, 4, 2, 0);
   }
View Full Code Here

  
   private int validateBalancing(ClusteredStatelessRemote stateless, Map<VMID, Integer> callCount, int numCalls, int expectedServers, int allowedError)
   {
      for (int i = 0; i < numCalls; i++)
      {
         NodeAnswer answer = stateless.getNodeState();
         Integer count = callCount.get(answer.nodeId);
         if (count == null)
         {
            callCount.put(answer.nodeId, new Integer(1));
         }
View Full Code Here

      // we can keep creating SFSBs until we get one we want
      getLog().debug("Looking up VMTrackerBean...");
      VMTracker tracker = (VMTracker) getInitialContext(0).lookup("VMTrackerBean/remote");
      VMID monitorVM = tracker.getVMID();
     
      NodeAnswer node0 = null;
      boolean vmMatch = false;
      for (int i = 0; i < 10 && !vmMatch; i++)
      {
         getLog().debug("Looking up testStateful/remote... Attempt " + i +1);
         stateful = (StatefulRemote) ctx.lookup("testStateful/remote");
        
         node0 = stateful.getNodeState();
         vmMatch = monitorVM.equals(node0.getNodeId());
         if (!vmMatch)
         {
            stateful.remove();
         }
      }
     
      Assert.assertTrue("Tracker and SFSB in same VM", vmMatch);

      stateful.setName("Bupple-Dupple");

      node0 = stateful.getNodeState();
      getLog().debug ("Node 0 ID: " +node0);
     
      sleep(500);

      // Redeploy on node 1
      redeploy();
     
      // Now we switch to the other node, simulating a failure on node 0
      stateful.setUpFailover("once");
      NodeAnswer node1 = stateful.getNodeState ();
      assertNotNull("State node: ", node1);
      getLog ().debug ("Node 1 ID : " +node1);

      assertFalse("Failover has occured", node0.nodeId.equals(node1.nodeId));
View Full Code Here

TOP

Related Classes of org.jboss.test.cluster.ejb3.stateful.Stateless

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.