Examples of VMTester


Examples of org.jboss.test.cluster.ejb3.clusteredsession.islocal.VMTester

     
      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

Examples of org.jboss.test.cluster.ejb3.clusteredsession.islocal.VMTester

     
      Properties env = new Properties();
      env.setProperty(Context.PROVIDER_URL, jndiURLs[0]);
      env.setProperty("jnp.disableDiscovery", "true");
      InitialContext ctx = new InitialContext(env);
      VMTester tester = (VMTester) ctx.lookup(TESTER_JNDI_NAME);
     
      VMID local = tester.getVMID();
      assertNotNull("Got the local VMID", local);
     
      Properties env1 = new Properties();
      env1.setProperty(Context.PROVIDER_URL, jndiURLs[1]);
      env1.setProperty("jnp.disableDiscovery", "true");
      ctx = new InitialContext(env1);
      VMTester remote = (VMTester) ctx.lookup(jndiName);
     
      // This call instantiates the SFSB if needed
      VMID remoteID = remote.getVMID();
      assertNotNull("Got the remote VMID", remoteID);
     
      // Pass the proxy back to the server and invoke getVMID() on it
      VMID passThroughID = tester.getVMIDFromRemote(remote);
      assertNotNull("Got the remote VMID", passThroughID);
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.