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

Examples of org.jboss.test.cluster.ejb2.basic.interfaces.StatelessSessionHome


      StatefulSession statefulSession =
      (StatefulSession)statefulSessionHome.create("Bupple-Dupple");
      assertTrue("statefulSessionHome.create() != null", statefulSession != null);
      getLog().debug("ok");
     
      NodeAnswer node1 = statefulSession.getNodeState ();
      getLog ().debug (node1);
     
      // Now we switch to the other node, simulating a failure on node 1
      //
      System.setProperty ("JBossCluster-DoFail", "once");
      NodeAnswer node2 = statefulSession.getNodeState ();     
      getLog ().debug (node2);
     
      assertTrue ("No failover has occured!", !node1.nodeId.equals (node2.nodeId));
     
      assertTrue ("Value is not identical on replicated node", "Bupple-Dupple".equals (node1.answer) &&
View Full Code Here


      AComplexPK key = new AComplexPK(true, 0, 0, 0, "testCacheInvalidation");
      SessionToEntity bean1 = home1.create(key);
      String msg = bean1.createEntity();
      log.info("create#1, "+msg);
      // Call accessEntity twice to validate data is consistent on both nodes
      NodeAnswer answer1 = bean1.accessEntity();
      log.info("Answer1: "+answer1);
      NodeAnswer answer2 = bean1.accessEntity();
      log.info("Answer2: "+answer2);
      assertTrue("accessCount == 2", bean1.getAccessCount() == 2);
      assertFalse("answer1.nodeId != answer2.nodeId",
                  answer1.nodeId.equals(answer2.nodeId));
View Full Code Here

         long callStart = System.currentTimeMillis();
         long inactive = callStart - accessStamp[id];
         try
         {
            bean.setName(name);
            NodeAnswer node = bean.getNodeState();
            long now = System.currentTimeMillis();           
            long elapsed = now - callStart;
            accessStamp[id] = now;
            assertTrue("NodeAnswer == "+name, node.answer.equals(name));
            min = Math.min(min, elapsed);
            max = Math.max(max, elapsed);
            maxInactive = Math.max(maxInactive, inactive);
            log.debug(n+", elapsed="+elapsed+", inactive="+inactive);
         }
         catch (java.rmi.NoSuchObjectException nso)
         {
            log.debug(n+" Caught NoSuchObjectException on bean " + id + " -- inactive time = " + inactive);
            // Remove the bean as it will never succeed again
            beans[id] = null;
         }
      }
      log.info(N+" calls complete, max="+max+", min="+min+", maxInactive="+maxInactive);

      Thread.sleep(15000);
      start = System.currentTimeMillis();
      for(int n = 0; n < beans.length; n ++)
      {
         beans[n] = (StatefulSession) home.create("testStatefulPassivationExpiration#"+n);
         accessStamp[n] = System.currentTimeMillis();
      }
      end = System.currentTimeMillis();
      log.info("End second round bean creation, elapsed="+(end - start));
      for(int n = 0; n < N; n ++)
      {
         int id = n % beans.length;
         StatefulSession bean = beans[id];
         if (bean == null)
            continue// bean timed out and removed
         String name = "testStatefulPassiviationExpiration#"+id;
         long callStart = System.currentTimeMillis();
         long inactive = callStart - accessStamp[id];
         try
         {
            bean.setName(name);
            NodeAnswer node = bean.getNodeState();
            long now = System.currentTimeMillis();
            long elapsed = now - callStart;
            accessStamp[id] = now;
            assertTrue("NodeAnswer == "+name, node.answer.equals(name));
            min = Math.min(min, elapsed);
View Full Code Here

         getLog().debug("Calling create on StatefulSessionHome" + getJndiSuffix()+"...");
      StatefulSession sfsb = (StatefulSession)sfsbHome.create("Bupple-Dupple");
      assertTrue("statefulSessionHome.create() != null", sfsb != null);
      getLog().debug("ok");
     
      NodeAnswer node1 = sfsb.getNodeState ();
      getLog ().debug (node1);
     
      getLog().debug("Looking up the home nextgen.StatelessSession" + getJndiSuffix()+"...");
      StatelessSessionHome  slsbHome =
      (StatelessSessionHome) ctx.lookup("nextgen_StatelessSession" + getJndiSuffix());
View Full Code Here

      StatefulSession statefulSession =
         (StatefulSession)statefulSessionHome.create("Bupple-Dupple");
      assertTrue("statefulSessionHome.create() != null", statefulSession != null);
      getLog().debug("ok");
     
      NodeAnswer node1 = statefulSession.getNodeState ();
      getLog ().debug (node1);
     
      // Reconfigure the cluster so the existing targets are invalid
      // BES -- don't bother; we test that functionality in testRetryInterceptor
      // just confirm that reestablishing the targets works
View Full Code Here

  
   // Remote Interface implementation ----------------------------------------------
  
   public NodeAnswer getNodeState() throws RemoteException
   {
      NodeAnswer state = new NodeAnswer(this.myId, this.name);
      log.debug("getNodeState, " + state);
      return state;
   }
View Full Code Here

      catch(Exception e)
      {
         log.debug("failed", e);
      }
      log.debug("Exit accessEntity()");
      return new NodeAnswer(nodeID, new Integer(beanCount));
   }
View Full Code Here

      catch(Exception e)
      {
         log.error("Failed to validate EntityPK", e);
         throw new RemoteException("Failed to validate EntityPK");
      }
      return new NodeAnswer(nodeID, new Integer(beanCount));
   }
View Full Code Here

      protected void executeTest() throws Throwable
      {
         // Test that the SFSB still works
        
         System.setProperty ("JBossCluster-DoFail", "once");
         NodeAnswer node2 = sfsb.getNodeState ();     
         log.debug (node2);
        
         assertTrue ("StatefulSession: Failover has occured",
                     !node1.nodeId.equals(node2.nodeId));
        
View Full Code Here

     
      protected void executeTest() throws Throwable
      {
         // Test that the SFSB still works
         System.setProperty ("JBossCluster-DoFail", "once");
         NodeAnswer node2 = sfsb.getNodeState ();     
         log.debug (node2);
        
         assertTrue ("StatefulSession: Failover has occured", node2 != null);
        
         log.debug("StatefulSession: Retry successful");
View Full Code Here

TOP

Related Classes of org.jboss.test.cluster.ejb2.basic.interfaces.StatelessSessionHome

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.