Examples of MyStateful


Examples of org.jboss.ejb3.core.test.ejbthree1846.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

Examples of org.jboss.ejb3.core.test.ejbthree1846.MyStateful

   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

Examples of org.jboss.ejb3.core.test.ejbthree670.MyStateful

      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

Examples of org.jboss.ejb3.core.test.ejbthree670.MyStateful

   }
  
   @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

Examples of org.jboss.ejb3.core.test.ejbthree670.MyStateful

   }
  
   @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

Examples of org.jboss.ejb3.core.test.regression.ejbthree1253.MyStateful

     
      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

Examples of org.jboss.ejb3.core.test.regression.ejbthree1253.MyStateful

     
      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

Examples of org.jboss.ejb3.test.iiop.MyStateful

   {
      InitialContext ctx = getInitialContext();
      Object obj = ctx.lookup("MyStatefulBean/home");
      MyStatefulHome home = (MyStatefulHome) PortableRemoteObject.narrow(obj, MyStatefulHome.class);
      //MyStateful bean1 = (MyStateful) PortableRemoteObject.narrow(obj, MyStateful.class);
      MyStateful bean1 = home.create();
      bean1.setName("bean1");
      String response = bean1.sayHello();
      assertEquals("Hello bean1", response);
      bean1.remove();
   }
View Full Code Here

Examples of org.jboss.ejb3.test.iiop.MyStateful

   public void testGetPrimaryKeyAndRemove() throws Exception
   {
      InitialContext ctx = getInitialContext();
      Object obj = ctx.lookup("MyStatefulBean/home");
      MyStatefulHome home = (MyStatefulHome) PortableRemoteObject.narrow(obj, MyStatefulHome.class);
      MyStateful session = home.create();
      Object primaryKey = session.getPrimaryKey();
      assertNotNull(primaryKey);
     
      home.remove(primaryKey);
      try
      {
         session.sayHello();
         fail("should throw an exception");
      }
      catch(Exception e)
      {
         // TODO: check exception (NoSuchEJBException)
View Full Code Here

Examples of org.jboss.ejb3.test.iiop.MyStateful

   public void testIsIdentical() throws Exception
   {
      InitialContext ctx = getInitialContext();
      Object obj = ctx.lookup("MyStatefulBean/home");
      MyStatefulHome home = (MyStatefulHome) PortableRemoteObject.narrow(obj, MyStatefulHome.class);
      MyStateful session = home.create();
      Handle h = session.getHandle();
      MarshalledObject mo = new MarshalledObject(h);
      Handle h2 = (Handle) mo.get();
      Object o = h2.getEJBObject();
      MyStateful session2 = (MyStateful) PortableRemoteObject.narrow(o, MyStateful.class);
      assertTrue(session.isIdentical(session2));
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.