Package org.jboss.test.cts.interfaces

Examples of org.jboss.test.cts.interfaces.StatefulSessionLocal


      }
   }

   public void testPassivationByTimeLocal()
   {
      StatefulSessionLocal sessionBean1 = null;
      Handle handle = null;
      try
      {
         Context ctx = new InitialContext();
         log.debug("+++ testPassivationByTime");
         StatefulSessionLocalHome sessionHome = ( StatefulSessionLocalHome ) ctx.lookup("ejbcts/StatefulSessionLocalBean");
         sessionBean1 = sessionHome.create("testPassivationByTimeLocal");   
         sessionBean1.ping();

       handle = sessionBean1.getHandle();

         log.debug("Waiting 41 seconds for passivation...");
         Thread.sleep(41*1000);

         // Validate that sessionBean1 was passivated and activated
         boolean passivated = sessionBean1.getWasPassivated();
         if (passivated == false) throw new EJBException("sessionBean1 WasPassivated");
         boolean activated = sessionBean1.getWasActivated();
         if (activated == false) throw new EJBException("sessionBean1 WasActivated");

         log.debug("Waiting 90 seconds for removal due to age...");
         Thread.sleep(90*1000);
      }
      catch (CreateException e)
      {
         throw new EJBException(e.toString());
      }
      catch (NamingException e)
      {
         throw new EJBException(e.toString());
      }
      catch (InterruptedException e)
      {
         throw new EJBException(e.toString());
      }

      try
      {
         sessionBean1.ping();
         throw new EJBException("Was able to ping for a removed session");
      }
      catch (NoSuchObjectLocalException expected)
      {
         log.debug("Session access failed as expected", expected);
View Full Code Here

TOP

Related Classes of org.jboss.test.cts.interfaces.StatefulSessionLocal

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.