Package org.jboss.test.cluster.ejb2.basic.bean

Examples of org.jboss.test.cluster.ejb2.basic.bean.SessionToEntityBean


      // Simple connection count stress test
      PooledInvokerProxy.clearStats();
      PooledInvokerProxy.clearPools();
      for(int n = 0; n < 100; n ++)
      {
         StatelessSession tmp = homeHA.create();
         StatelessSession tmp2 = home.create();
         tmp.getCallCount();
         tmp2.getCallCount();
         tmp.getCallCount();
         tmp2.getCallCount();
         int totalCount = PooledInvokerProxy.getTotalPoolCount();
         // N cluster nodes + 1 for unclustered
         int expectedCount = urls.length + 1;
         assertEquals("TotalPoolCount", expectedCount, totalCount);
         long usedPooled = PooledInvokerProxy.getUsedPooled();
         // iter * Ncalls - expectedCount (for the initial conn creation)
         int expectedUsedPooled = (n+1) * 6 - expectedCount;
         assertEquals("UsedPooled", expectedUsedPooled, usedPooled);
      }
      long inUseCount = PooledInvokerProxy.getInUseCount();
      assertEquals("InUseCount", 0, inUseCount);

      log.debug("Calling create on StatelessSessionHome...");
      StatelessSession statelessSession = homeHA.create();
      assertTrue("homeHA.create() != null", statelessSession != null);
      log.debug("Calling getEJBHome() on StatelessSession...");
      assertTrue("statelessSession.getEJBHome() != null", statelessSession.getEJBHome() != null);

      log.debug("Reseting the number of calls made on beans (making 2 calls)... ");
      for (int i=0; i<6; i++)
      {
         log.debug("Reseting number... ");
         statelessSession.resetNumberOfCalls ();
      }

      log.debug("- "+"Now making 20 calls on this remote... ");
      for (int i=0; i<20; i++)
      {
         log.debug("- "+" Calling remote... ");
         statelessSession.makeCountedCall ();
      }

      log.debug("- "+"Getting the number of calls that have been performed on each bean... ");
      long node1 = statelessSession.getCallCount();
      log.debug("- "+"One node has received: " + node1);

      long node2 = statelessSession.getCallCount();
      log.debug("- "+"The other node has received: " + node2);

      if (node1 == node2 && node1 == 10)
      {
         log.debug("- "+"Test is ok.");
      }
      else if( urls.length > 1 )
      {
         log.debug("- "+"Something wrong has happened! Calls seems not to have been load-balanced.");
         fail ("call count mismatch: "+node1+" != "+node2);
      }

      statelessSession.remove();
      log.debug("ok");
   }
View Full Code Here


      for(int n = 0; n < 100; n ++)
      {
         StatefulSession tmp = (StatefulSession) homeHA.create();
         tmp.remove();
         tmp = (StatefulSession) homeHA.create();
         StatelessSession tmp2 = home.create();
         tmp.getNodeState();
         tmp2.getCallCount();
         tmp.getNodeState();
         tmp2.getCallCount();
         tmp.remove();
         int totalCount = PooledInvokerProxy.getTotalPoolCount();
         // N cluster nodes + 1 for unclustered
         int expectedCount = urls.length + 1;
         assertEquals("TotalPoolCount", expectedCount, totalCount);
View Full Code Here

      InitialContext ctx = new InitialContext(env1);
     
      getLog().debug("Test Stateless Bean load-balancing");
      getLog().debug("==================================");
      getLog().debug(++test+"- "+"Looking up the home nextgen.StatelessSession...");
      StatelessSessionHome  statelessSessionHome =
      (StatelessSessionHome) ctx.lookup("nextgen_StatelessSession");
      if (statelessSessionHome!= null ) getLog().debug("ok");
         getLog().debug(++test+"- "+"Calling create on StatelessSessionHome...");
      StatelessSession statelessSession =
      (StatelessSession)statelessSessionHome.create();
      assertTrue("statelessSessionHome.create() != null", statelessSession != null);
      getLog().debug("ok");
     
      getLog().debug(++test+"- "+"Calling getEJBHome() on StatelessSession...");
      assertTrue("statelessSession.getEJBHome() != null", statelessSession.getEJBHome() != null);
View Full Code Here

      InitialContext ctx = new InitialContext(env1);
     
      // Do 4 home lookups in case different lookups lead to different patterns
      for (int i = 0; i < 4; i++)
      {
         StatelessSessionHome  home =
            (StatelessSessionHome) ctx.lookup("nextgen_StatelessSession");
         assertTrue("home != null", home != null);
         getLog().debug("lookup " + i + " ok");
        
         String last = null;
         for (int j = 0; j < 10; j++)
         {
            StatelessSession slsb = home.create();
            assertTrue("slsb != null", slsb != null);
            getLog().debug("create " + j + " ok");
           
            for (int k = 0; k < 3; k++)
            {
View Full Code Here

      InitialContext ctx = new InitialContext(env1);
     
      getLog().debug("Test Stateless Bean colocation");
      getLog().debug("==================================");
      getLog().debug(++test+"- "+"Looking up the home nextgen.StatelessSession...");
      StatelessSessionHome  statelessSessionHome =
      (StatelessSessionHome) ctx.lookup("nextgen_StatelessSession");
      if (statelessSessionHome!= null ) getLog().debug("ok");
         getLog().debug(++test+"- "+"Calling create on StatelessSessionHome...");
      StatelessSession statelessSession = (StatelessSession)statelessSessionHome.create();
      assertTrue("statelessSessionHome.create() != null", statelessSession != null);
      getLog().debug("ok");

      getLog().debug(++test+"- "+"reset number of calls");
      statelessSession.resetNumberOfCalls();
View Full Code Here

      {
         System.out.println("begin testColocation");
         InitialContext ctx = new InitialContext();
         if( jndiURL == null )
            jndiURL = "jnp://" + System.getProperty("jboss.bind.address", "localhost") + ":1100/nextgen_StatelessSession";
         StatelessSessionHome home = (StatelessSessionHome) ctx.lookup(jndiURL);
         StatelessSession session = home.create();
         session.callBusinessMethodA();
         System.out.println("end testColocation");
      }
      catch (Exception ex)
      {
View Full Code Here

     
      NodeAnswer node1 = sfsb.getNodeState ();
      getLog ().debug (node1);
     
      getLog().debug("Looking up the home nextgen.StatelessSession" + getJndiSuffix()+"...");
      StatelessSessionHome  slsbHome =
      (StatelessSessionHome) ctx.lookup("nextgen_StatelessSession" + getJndiSuffix());
      if (slsbHome!= null ) getLog().debug("ok");
      getLog().debug("Calling create on StatelessSessionHome" + getJndiSuffix()+"...");
      StatelessSession slsb = slsbHome.create();

      getLog().debug("StatelessSession: Now making 1 call on server0 ");
      assertEquals("StatelessSession: Server0 has no calls", 0, slsb.getCallCount());
     
      getLog().debug("Looking up home for nextgen_EntityPK" + getJndiSuffix()+"...");
View Full Code Here

      Properties env = getNamingProperties("org.jboss.naming.NamingContextFactory",
                                           false);
      InitialContext ctx = new InitialContext(env);
     
      getLog().debug("Looking up the home nextgen.StatelessSession" + getJndiSuffix()+"...");
      StatelessSessionHome  home =
            (StatelessSessionHome) ctx.lookup("nextgen_StatelessSession" + getJndiSuffix());
      if (home!= null ) getLog().debug("ok");
      getLog().debug("Calling create on StatelessSessionHome" + getJndiSuffix()+"...");
      StatelessSession slsb = home.create();

      getLog().debug("StatelessSession: Now making 1 call on server0 ");
      assertEquals("StatelessSession: Server0 has no calls", 0, slsb.getCallCount());
     
      // Undeploy the ear
View Full Code Here

         "org.jnp.interfaces.NamingContextFactory");
      env1.setProperty(Context.PROVIDER_URL, urls[0]);
      InitialContext ctx = new InitialContext(env1);

      log.debug("Looking up the home pooledha_StatelessSession..."+urls[0]);
      StatelessSessionHome homeHA =
         (StatelessSessionHome) ctx.lookup("pooledha_StatelessSession");
      log.debug("Looking up the home pooled_StatelessSession..."+urls[0]);
      StatelessSessionHome home =
         (StatelessSessionHome) ctx.lookup("pooled_StatelessSession");

      // Simple connection count stress test
      PooledInvokerProxy.clearStats();
      PooledInvokerProxy.clearPools();
      for(int n = 0; n < 100; n ++)
      {
         StatelessSession tmp = homeHA.create();
         StatelessSession tmp2 = home.create();
         tmp.getCallCount();
         tmp2.getCallCount();
         tmp.getCallCount();
         tmp2.getCallCount();
         int totalCount = PooledInvokerProxy.getTotalPoolCount();
View Full Code Here

      log.debug("Looking up the home pooledha_StatefulSession..."+urls[0]);
      StatefulSessionHome homeHA =
         (StatefulSessionHome) ctx.lookup("pooledha_StatefulSession");
      log.debug("Looking up the home pooled_StatelessSession..."+urls[0]);
      StatelessSessionHome home =
         (StatelessSessionHome) ctx.lookup("pooled_StatelessSession");

      // Simple connection count stress test
      PooledInvokerProxy.clearStats();
      PooledInvokerProxy.clearPools();
      for(int n = 0; n < 100; n ++)
      {
         StatefulSession tmp = (StatefulSession) homeHA.create();
         tmp.remove();
         tmp = (StatefulSession) homeHA.create();
         StatelessSession tmp2 = home.create();
         tmp.getNodeState();
         tmp2.getCallCount();
         tmp.getNodeState();
         tmp2.getCallCount();
         tmp.remove();
View Full Code Here

TOP

Related Classes of org.jboss.test.cluster.ejb2.basic.bean.SessionToEntityBean

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.