Package org.jboss.ejb3.test.tx.common

Examples of org.jboss.ejb3.test.tx.common.Greeter.sayHi()


      tm.begin();
      try
      {
         TxSync bean = lookup("TxSyncBean/local", TxSync.class);
         bean.setThrowInAfterCompletion(true);
         bean.sayHi("me");
      }
      finally
      {
         tm.commit();
      }
View Full Code Here


      tm.begin();
      try
      {
         TxSync bean = lookup("TxSyncBean/local", TxSync.class);
         bean.setThrowInBeforeCompletion(true);
         bean.sayHi("me");
      }
      finally
      {
         tm.commit();
      }
View Full Code Here

      tm.begin();
      try
      {
         try
         {
            bean.sayHi("me");
            fail("Should have throw NoSuchEJBException");
         }
         catch(NoSuchEJBException e)
         {
            // good
View Full Code Here

      tm.begin();
      try
      {
         try
         {
            bean.sayHi("me");
            fail("Should have throw NoSuchEJBException");
         }
         catch(NoSuchEJBException e)
         {
            // good
View Full Code Here

      {
         TxSyncBean.setThrowInAfterBegin(true);
         TxSync bean = lookup("TxSyncBean/local", TxSync.class);
         try
         {
            bean.sayHi("me");
            fail("Should have thrown EJBTransactionRolledbackException");
         }
         catch(EJBTransactionRolledbackException e)
         {
            assertEquals("afterBegin", e.getCause().getMessage());
View Full Code Here

      {
         TxSyncBean.setThrowInAfterBegin(true);
         TxSync bean = lookup("TxSyncBean/local", TxSync.class);
         try
         {
            bean.sayHi("me");
            fail("Should have thrown EJBTransactionRolledbackException");
         }
         catch(EJBTransactionRolledbackException e)
         {
            assertEquals("afterBegin", e.getCause().getMessage());
View Full Code Here

      Endpoint endpoint = (Endpoint) context.getTarget();
      EndpointInvocationHandler handler = new EndpointInvocationHandler(endpoint, null, Greeter.class);
      ClassLoader loader = Thread.currentThread().getContextClassLoader();
      Class<?> interfaces[] = { Greeter.class };
      Greeter bean = (Greeter) Proxy.newProxyInstance(loader, interfaces, handler);
      String result = bean.sayHi("Thingy");
      assertEquals("Hi Thingy from MyStatelessBean", result);
   }

   @Test
   public void testStateful() throws Throwable
View Full Code Here

      EndpointInvocationHandler handler = new EndpointInvocationHandler(endpoint, session, businessInterface);
      ClassLoader loader = Thread.currentThread().getContextClassLoader();
      Class<?> interfaces[] = { businessInterface };
      StatefulGreeter bean = (StatefulGreeter) Proxy.newProxyInstance(loader, interfaces, handler);
      bean.setName("testStateful");
      String result = bean.sayHi();
      assertEquals("Hi testStateful from MyStatefulBean", result);
   }
}
View Full Code Here

     
      assertEquals("BasicInterceptor postConstruct must have been called once", 1, BasicInterceptor.postConstructs);
     
      System.out.println(bean.getClass() + " " + bean.getClass().getClassLoader());
      System.out.println("  " + Arrays.toString(bean.getClass().getInterfaces()));
      String result = bean.sayHi("Test");
      System.out.println(result);
     
      assertEquals("sayHi didn't invoke BasicInterceptor.aroundInvoke once", 1, BasicInterceptor.aroundInvokes);
      assertEquals("sayHi didn't invoke BasicBean.aroundInvoke once", 1, BasicBean.aroundInvokes);
     
View Full Code Here

      ProxyContainer<ProxiedBean> container = new ProxyContainer<ProxiedBean>("ProxyTestCase", "InterceptorContainer", ProxiedBean.class);
     
      Class<?> interfaces[] = { MyInterface.class };
      MyInterface proxy = container.constructProxy(interfaces);
     
      String result = proxy.sayHi("Me");
      assertEquals("Hi Me", result);

      assertEquals(1, InvocationCounterInterceptor.counter);
   }
}
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.