Package org.jboss.test.cluster.ejb3.stateful.nested.base.xpc

Examples of org.jboss.test.cluster.ejb3.stateful.nested.base.xpc.ShoppingCart


      StatefulRemote stateful = (StatefulRemote) ctx.lookup("testStateful/remote");

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

      assertEquals("Counter: ", 1, stateful.increment());
      assertEquals("Counter: ", 2, stateful.increment());
     
      sleep_(10100);

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

      assertNotSame ("No failover has occured!", node1.nodeId, node2.nodeId);
View Full Code Here


      StatefulRemote stateful = (StatefulRemote) ctx.lookup(jndiBinding);

      stateful.setName("The Code");
      _sleep(300);

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

      assertEquals("Counter: ", 1, stateful.increment());
      assertEquals("Counter: ", 2, stateful.increment());
View Full Code Here

      getLog().debug("=========================================================");
      getLog().debug(++test +"- Looking up " + jndiBinding + "...");
      StatefulRemote stateful = (StatefulRemote) ctx.lookup(jndiBinding);

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

      assertEquals("Counter: ", 1, stateful.increment());
      assertEquals("Counter: ", 2, stateful.increment());
      _sleep(300);

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

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

      StatefulRemote stateful = (StatefulRemote) ctx.lookup(jndiBinding);

      stateful.setName("Bupple-Dupple");
      _sleep(300);

      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");
      NodeAnswer node2 = stateful.getNodeState ();
      assertNotNull("State node: ", node2);
      getLog ().debug ("Node 2 ID : " +node2);

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

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

      InitialContext ctx = getInitialContext(0);

      getLog().debug("==================================");
      getLog().debug(++PassivationUnitTestCase.test +"- "
              +"Looking up testStateful...");
      StatefulRemote remote = (StatefulRemote) ctx.lookup("testStateful/remote");

      int invCount = 0;
     
      remote.reset();
      invCount++;
      remote.setState("hello");
      invCount++;
     
      sleep_(11100);
     
      assertEquals("hello", remote.getState());
      invCount++;
     
      assertEquals(invCount, remote.getPrePassivate());
      invCount++;
     
      assertEquals(invCount, remote.getPostActivate());

      remote.remove();

   }
View Full Code Here

      InitialContext ctx = getInitialContext(0);

      getLog().debug("==================================");
      getLog().debug(++PassivationUnitTestCase.test +"- "
              +"Looking up testIgnoreReplicationStateful...");
      StatefulRemote remote = (StatefulRemote) ctx.lookup("testIgnoreReplicationStateful/remote");

      remote.reset();
      remote.setState("hello");
     
      sleep_(11100);
     
      assertEquals("hello", remote.getState());     
      assertEquals("@PrePassivate count correct", 1, remote.getPrePassivate());
      assertEquals("@PostActivate count correct", 1, remote.getPostActivate());

      remote.remove();
   }
View Full Code Here

      InitialContext ctx = getInitialContext(0);

      getLog().debug("==================================");
      getLog().debug(++PassivationUnitTestCase.test +"- "
              +"Looking up testOptimizedStateful...");
      StatefulRemote remote = (StatefulRemote) ctx.lookup("testOptimizedStateful/remote");

      int invCount = 0;
      remote.reset();
      invCount++;
      remote.setState("hello");
      invCount++;
     
      sleep_(10100);
     
      assertEquals("hello", remote.getState());
      invCount++;
     
      // Don't include the regular passivation in the count
      // since there won't be an event following replication
      assertEquals(invCount, remote.getPrePassivate());
      // don't increment count
      assertEquals(invCount, remote.getPostActivate());
      // don't increment count
      // Check that getPostActivate() didn't cause replication
      assertEquals(invCount, remote.getPrePassivate());
     
      remote.remove();
   }
View Full Code Here

      InitialContext ctx = getInitialContext(0);

      getLog().debug("==================================");
      getLog().debug(++PassivationUnitTestCase.test +"- "
              +"Looking up testStateful...");
      StatefulRemote stateful = (StatefulRemote) ctx.lookup("testStateful/remote");

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

      assertEquals("Counter: ", 1, stateful.increment());
      assertEquals("Counter: ", 2, stateful.increment());
     
      sleep_(10100);

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

      assertNotSame ("No failover has occured!", node1.nodeId, node2.nodeId);

      assertEquals ("Node 1: ", "The Code", node1.answer);
      assertEquals ("Node 2: ", "The Code", node2.answer);

      stateful.resetActivationCounter(); // This will activate the bean.
      int invCount = 1;
     
      sleep_(10100); // let it get passivated again.
     
      assertEquals("Counter: ", 3, stateful.increment());
      invCount++;
      assertEquals("Counter: ", 4, stateful.increment());
      invCount++;

      assertEquals(invCount, stateful.getPrePassivate());
      invCount++;
      assertEquals(invCount, stateful.getPostActivate());

      stateful.remove();
   }
View Full Code Here

     
      Properties env1 = new Properties();
      env1.setProperty(Context.PROVIDER_URL, jndiURLs[0]);
      env1.setProperty("jnp.disableDiscovery", "true");
      InitialContext ctx1 = new InitialContext(env1);
      VMTester tester1 = (VMTester) ctx1.lookup(TESTER_JNDI_NAME);
     
      VMID create1 = tester1.getCreatorVMID();
      // confirm that the bean didn't have to migrate
      assertEquals("bean targeted where created", create1, tester1.getVMID());
     
      // Get another bean from the same server; should target
      // a different server from the first
      VMTester tester2 = (VMTester) ctx1.lookup(TESTER_JNDI_NAME);
     
      VMID create2 = tester2.getCreatorVMID();
      assertEquals("2nd bean targeted where created", create2, tester2.getVMID());     
      assertFalse("creation of 2 beans load balanced", create1.equals(create2));
     
      // A third bean should come from the same as the first
      VMTester tester3 = (VMTester) ctx1.lookup(TESTER_JNDI_NAME);
     
      VMID create3 = tester3.getCreatorVMID();
      assertEquals("3rd bean targeted where created", create3, tester3.getVMID());
      assertEquals("creation of 3 beans load balanced", create1, create3);
     
      // Get the next proxy from the other server, but the overall
      // bean creation should still be round robin
     
      Properties env2 = new Properties();
      env2.setProperty(Context.PROVIDER_URL, jndiURLs[1]);
      env2.setProperty("jnp.disableDiscovery", "true");
      InitialContext ctx2 = new InitialContext(env2);
      VMTester tester4 = (VMTester) ctx2.lookup(TESTER_JNDI_NAME);
     
      VMID create4 = tester4.getCreatorVMID();
      assertEquals("4th bean targeted where created", create4, tester4.getVMID());
      assertEquals("creation of 4 beans load balanced", create2, create4);
     
      // One last time
      VMTester tester5 = (VMTester) ctx2.lookup(TESTER_JNDI_NAME);
     
      VMID create5 = tester5.getCreatorVMID();
      assertEquals("5th bean targeted where created", create5, tester5.getVMID());
      assertEquals("creation of 5 beans load balanced", create1, create5);
   }
View Full Code Here

TOP

Related Classes of org.jboss.test.cluster.ejb3.stateful.nested.base.xpc.ShoppingCart

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.