Package org.jboss.test.cts.interfaces

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


   public void testSerialization ()
      throws Exception
   {
      getLog().debug("+++ testSerialize");
      Context ctx  = new InitialContext();
      StatefulSessionHome home = ( StatefulSessionHome ) ctx.lookup("ejbcts/StatefulSessionBean");
      StatefulSession bean = home.create("testSerialization");   
      getLog().debug("Increment bean, count = 3");

      // put on some state...
      bean.setCounter(1);
      bean.incCounter();
View Full Code Here


      getLog().debug("+++ testSessionHandleNoDefaultJNDI()");

      Properties env = new Properties();
      env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.NamingContextFactory");
      InitialContext ctx = new InitialContext(env);
      StatefulSessionHome home = ( StatefulSessionHome ) ctx.lookup("ejbcts/StatefulSessionBean");
      StatefulSession bean = home.create("testSessionHandleNoDefaultJNDI");

      Handle beanHandle = bean.getHandle();
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(out);
      oos.writeObject(beanHandle);
View Full Code Here

      getLog().debug("+++ testBMTSessionHandleNoDefaultJNDI()");

      Properties env = new Properties();
      env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.NamingContextFactory");
      InitialContext ctx = new InitialContext(env);
      StatefulSessionHome home = ( StatefulSessionHome ) ctx.lookup("ejbcts/BMTStatefulSessionBean");
      StatefulSession bean = home.create("testBMTSessionHandleNoDefaultJNDI");

      Handle beanHandle = bean.getHandle();
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(out);
      oos.writeObject(beanHandle);
View Full Code Here

      env.setProperty("java.naming.provider.url", super.getJndiURL());
      try
      {
         InitialContext ctx = new InitialContext(env);
         Object ref = ctx.lookup("ejbcts/StatefulSessionBean");
         StatefulSessionHome home = (StatefulSessionHome)
               PortableRemoteObject.narrow(ref, StatefulSessionHome.class);
         StatefulSession bean1 = home.create("testHomeFromRemoteNoDefaultJNDI");
         StatefulSessionHome home2 = (StatefulSessionHome) bean1.getEJBHome();
         StatefulSession bean2 = home2.create("testHomeFromRemoteNoDefaultJNDI");
         bean2.remove();
      }
      finally
      {
         System.setProperties(sysProps);
View Full Code Here

   public void testProbeBeanContext ()
      throws Exception
   {
      getLog().debug("+++ testProbeBeanContext");
      Context ctx  = new InitialContext();
      StatefulSessionHome home = ( StatefulSessionHome ) ctx.lookup("ejbcts/StatefulSessionBean");
      StatefulSession bean = home.create("testProbeBeanContext");   

      getLog().debug("Invoking bean...");

      BeanContextInfo beanCtxInfo = bean.getBeanContextInfo();
View Full Code Here

   {
      getLog().debug("+++ testLoopback");

      // Create a new session object
      Context ctx  = new InitialContext();
      StatefulSessionHome home = ( StatefulSessionHome ) ctx.lookup("ejbcts/StatefulSessionBean");
      StatefulSession bean = home.create("testLoopback");   
      getLog().debug("Calling loopbackTest( )....");
      try
      {
         bean.loopbackTest();
         fail("Was able to call loopbackTest()");
View Full Code Here

      getLog().debug("Obtain home interface");
      // Create a new session object
      Context ctx  = new InitialContext();
      Object ref = ctx.lookup("ejbcts/StatefulSessionBean");
      StatefulSessionHome home = ( StatefulSessionHome ) PortableRemoteObject.narrow(ref,
         StatefulSessionHome.class);
      StatefulSession bean = home.create("testUserTx");   

      bean.setCounter(100);
      getLog().debug("Try to instantiate a UserTransaction");
      UserTransaction userTx = (UserTransaction)ctx.lookup("UserTransaction");
      userTx.begin();
View Full Code Here

      getLog().debug("Obtain home interface");
      // Create a new session object
      Context ctx  = new InitialContext();
      Object ref = ctx.lookup("ejbcts/BMTStatefulSessionBean");
      StatefulSessionHome home = (StatefulSessionHome) PortableRemoteObject.narrow(ref,
         StatefulSessionHome.class);
      StatefulSession bean = home.create("testBadUserTx");    

      clearJndiTxTracking();
      try
      {
         bean.testBadUserTx();
View Full Code Here

     */
  public void testLongWait() throws Exception
  {
      Context ctx = getInitialContext();
      getLog().debug("+++ testLongWait");
      StatefulSessionHome sessionHome = ( StatefulSessionHome ) ctx.lookup("ejbcts/LongWaitStatefulSessionBean");
      StatefulSession sessionBean = sessionHome.create("testLongWait");   

      getLog().debug("Sleeping...");
      sessionBean.sleep(5000);
      sessionBean.ping();
      getLog().debug("+++ testLongWait passed");
View Full Code Here

     */
  public void testLocalInterfacePassivation() throws Exception
  {
      Context ctx = new InitialContext();
      getLog().debug("+++ testLocalInterfacePassivation");
      StatefulSessionHome sessionHome = ( StatefulSessionHome ) ctx.lookup("ejbcts/StatefulSessionBean");
      StatefulSession sessionBean = sessionHome.create("testLocalInterfacePassivation");   

    getLog().debug("Creating local home");
      AccountPK pk = new AccountPK("123456789");
      sessionBean.createLocalEntity(pk, "jduke");

      getLog().debug("Creating a second session bean, forcing the first one to be passivated?");
      // The pool size has been set to 1 in the container
      // config, so creating another ASession here should
      // cause the first one to be passivated.
      StatefulSession anotherSession = sessionHome.create("testLocalInterfacePassivation2");
      getLog().debug("OK, anotherSession="+anotherSession);

      getLog().debug("Checking for complete passivation/activation");
      Thread.sleep(1000);
      assertTrue(sessionBean.getWasPassivated() == true);
View Full Code Here

TOP

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

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.