Package org.jboss.test.metadata.annotation.jbmeta99

Examples of org.jboss.test.metadata.annotation.jbmeta99.MyStateful


   public void test1() throws Throwable
   {
      Serializable id = container.getSessionFactory().createSession(new Class[] { }, new Object[] { });
     
      Method method = MyStateful.class.getMethod("getBusinessObject");
      MyStateful bean = (MyStateful) container.invoke(id, MyStateful.class, method, null);
     
      MyStatefulBean.barrier.await(5000, TimeUnit.MILLISECONDS);
     
      assertEquals(0, MyStatefulBean.activations);
      assertEquals(1, MyStatefulBean.passivations);
     
      MyStateful bean2 = bean.getBusinessObject();
     
      assertEquals(1, MyStatefulBean.activations);
     
      assertEquals(bean, bean2);
   }
View Full Code Here


   public void test1() throws Throwable
   {
      Serializable id = container.getSessionFactory().createSession(null, null);
     
      Method method = MyStateful.class.getMethod("getBusinessObject");
      MyStateful bean = (MyStateful) container.invoke(id, MyStateful.class, method, null);
     
      MyStatefulBean.barrier.await(5000, TimeUnit.MILLISECONDS);
     
      assertEquals(0, MyStatefulBean.activations);
      assertEquals(1, MyStatefulBean.passivations);
     
      MyStateful bean2 = bean.getBusinessObject();
     
      assertEquals(1, MyStatefulBean.activations);
     
      assertEquals(bean, bean2);
   }
View Full Code Here

      containers.add(deploySessionEjb(MyStateful21Bean.class));
   }
  
   private MyStateful runMyStatefulTest() throws NamingException
   {
      MyStateful session = (MyStateful) getInitialContext().lookup("MyStatefulBean/remote");
      session.setName("Test");
      String actual = session.sayHello();
      assertEquals("Hi Test", actual);
      try
      {
         session.remove();
      }
      catch(RuntimeException e)
      {
         if(e.getCause().getMessage().equals("pre destroy called multiple times"))
            fail("pre destroy called multiple times");
View Full Code Here

   }
  
   @Test
   public void test1() throws Exception
   {
      MyStateful session = runMyStatefulTest();
      try
      {
         session.remove();
         fail("Should have thrown NoSuchEJBException");
      }
      catch(NoSuchEJBException e)
      {
         // okay
View Full Code Here

   }
  
   @Test
   public void testWithInTransaction() throws Exception
   {
      MyStateful session;
      TransactionManager tm = lookup("java:/TransactionManager", TransactionManager.class);
      tm.begin();
      try
      {
         session = runMyStatefulTest();
      }
      finally
      {
         tm.rollback();
      }
      try
      {
         session.remove();
         fail("Should have thrown NoSuchEJBException");
      }
      catch(NoSuchEJBException e)
      {
         // okay
View Full Code Here

     
      InitialContext ctx = new InitialContext();
      System.out.println("ctx = " + ctx);
      //System.out.println("  " + container.getInitialContext().list("MyStatelessBean").next());
      MyStateful bean = (MyStateful) ctx.lookup("MyStatefulBean/remote");
     
      bean.setName("Me");
      String actual = bean.sayHi();
      assertEquals("Hi Me", actual);
     
      getBootstrap().getKernel().getController().uninstall(containerName);
      Ejb3Registry.unregister(container);
   }
View Full Code Here

     
      InitialContext ctx = new InitialContext();
      System.out.println("ctx = " + ctx);
      //System.out.println("  " + container.getInitialContext().list("MyStatelessBean").next());
      MyStateful bean = (MyStateful) ctx.lookup("MyStatefulBean/remote");
     
      bean.setName("Me");
      String actual = bean.sayHi();
      assertEquals("Hi Me", actual);
     
      getBootstrap().getKernel().getController().uninstall(containerName);
      Ejb3Registry.unregister(container);
   }
View Full Code Here

      return new InitialContext(env1);
   }
  
   public void test1() throws Exception
   {
      MyStateful stateful = (MyStateful) getInitialContext(0).lookup("MyStatefulBean/remote");
      Person p = new Person("Brian");
      stateful.save(p);
      String expected = "Changing SFSB state";
      stateful.setDescription(expected);
      stateful.setUpFailover("once");
      try
      {
         String actual = stateful.getDescription();
         assertEquals(expected, actual);
      }
      catch(Exception e)
      {
         Throwable cause = e;
         while(cause.getCause() != null) cause = cause.getCause();
         throw (Exception) cause;
      }
      stateful.remove(p);
      stateful.done();
   }
View Full Code Here

TOP

Related Classes of org.jboss.test.metadata.annotation.jbmeta99.MyStateful

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.