Examples of EndpointInvocationHandler


Examples of org.jboss.ejb3.endpoint.reflect.EndpointInvocationHandler

   public void testHashCode() throws Exception
   {
      Endpoint endpoint = new SimpleEndpoint();
      Serializable session = null;
      Class<SimpleInterface> businessInterface = null;
      InvocationHandler handler = new EndpointInvocationHandler(endpoint, session, businessInterface);
      int result = handler.hashCode();
      assertEquals(createHashCode(endpoint, session, businessInterface), result);
   }
View Full Code Here

Examples of org.jboss.ejb3.endpoint.reflect.EndpointInvocationHandler

   public void testHashCodeOnInvoke() throws Throwable
   {
      Endpoint endpoint = new SimpleEndpoint();
      Serializable session = null;
      Class<SimpleInterface> businessInterface = null;
      InvocationHandler handler = new EndpointInvocationHandler(endpoint, session, businessInterface);
      Object proxy = null;
      Method method = Object.class.getDeclaredMethod("hashCode");
      Object args[] = null;
      int result = (Integer) handler.invoke(proxy, method, args);
      assertEquals(createHashCode(endpoint, session, businessInterface), result);
   }
View Full Code Here

Examples of org.jboss.ejb3.endpoint.reflect.EndpointInvocationHandler

   public void testHashCodeWithBusinessInterface() throws Exception
   {
      Endpoint endpoint = new SimpleEndpoint();
      Serializable session = null;
      Class<SimpleInterface> businessInterface = SimpleInterface.class;
      InvocationHandler handler = new EndpointInvocationHandler(endpoint, session, businessInterface);
      int result = handler.hashCode();
      assertEquals(createHashCode(endpoint, session, businessInterface), result);
      assertFalse(createHashCode(endpoint, session, null) == result);
   }
View Full Code Here

Examples of org.jboss.ejb3.endpoint.reflect.EndpointInvocationHandler

   public void testHashCodeWithSession() throws Exception
   {
      Endpoint endpoint = new SimpleEndpoint();
      Serializable session = UUID.randomUUID();
      Class<SimpleInterface> businessInterface = null;
      InvocationHandler handler = new EndpointInvocationHandler(endpoint, session, businessInterface);
      int result = handler.hashCode();
      assertEquals(createHashCode(endpoint, session, businessInterface), result);
      assertFalse(createHashCode(endpoint, null, businessInterface) == result);
   }
View Full Code Here

Examples of org.jboss.ejb3.endpoint.reflect.EndpointInvocationHandler

   public void testHashCodeWithSessionAndBusinessInterface() throws Exception
   {
      Endpoint endpoint = new SimpleEndpoint();
      Serializable session = UUID.randomUUID();
      Class<SimpleInterface> businessInterface = SimpleInterface.class;
      InvocationHandler handler = new EndpointInvocationHandler(endpoint, session, businessInterface);
      int result = handler.hashCode();
      assertEquals(createHashCode(endpoint, session, businessInterface), result);
      assertFalse(createHashCode(endpoint, null, businessInterface) == result);
      assertFalse(createHashCode(endpoint, session, null) == result);
      assertFalse(createHashCode(endpoint, null, null) == result);
   }
View Full Code Here

Examples of org.jboss.ejb3.endpoint.reflect.EndpointInvocationHandler

         }
      };
      assertTrue(endpoint.isSessionAware());
      Serializable session = endpoint.getSessionFactory().createSession(null, null);
      Class<?> invokedBusinessInterface = null;
      InvocationHandler handler = new EndpointInvocationHandler(endpoint, session, invokedBusinessInterface);
      Object proxy = null;
      // just make sure method is not null
      Method method = SessionTestCase.class.getDeclaredMethod("testSession");
      Date now = new Date();
      Object args[] = { now };
      Object result = handler.invoke(proxy, method, args);
      assertEquals("Hi " + now, result);
   }
View Full Code Here

Examples of org.jboss.ejb3.endpoint.reflect.EndpointInvocationHandler

            return "Hi " + args[0];
         }
      };
      Serializable session = null;
      Class<?> invokedBusinessInterface = null;
      InvocationHandler handler = new EndpointInvocationHandler(endpoint, session, invokedBusinessInterface);
      Object proxy = null;
      // just make sure method is not null
      Method method = InvocationTestCase.class.getDeclaredMethod("testInvocation");
      Date now = new Date();
      Object args[] = { now };
      Object result = handler.invoke(proxy, method, args);
      assertEquals("Hi " + now, result);
   }
View Full Code Here

Examples of org.jboss.ejb3.endpoint.reflect.EndpointInvocationHandler

      Endpoint endpoint = null;
      Serializable session = null;
      Class<?> invokedBusinessInterface = null;
      try
      {
         new EndpointInvocationHandler(endpoint, session, invokedBusinessInterface);
         fail("Should have thrown AssertionError (or run with -ea)");
      }
      catch(AssertionError e)
      {
         assertEquals("endpoint is null", e.getMessage());
View Full Code Here

Examples of org.jboss.ejb3.endpoint.reflect.EndpointInvocationHandler

      ControllerState state = null;
      ControllerContext context = server.getKernel().getController().getContext(name, state);
      if(context.getState() != ControllerState.INSTALLED)
         context.getController().change(context, ControllerState.INSTALLED);
      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);
View Full Code Here

Examples of org.jboss.ejb3.endpoint.reflect.EndpointInvocationHandler

      if(context.getState() != ControllerState.INSTALLED)
         context.getController().change(context, ControllerState.INSTALLED);
      Endpoint endpoint = (Endpoint) context.getTarget();
      Serializable session = endpoint.getSessionFactory().createSession(null, null);
      Class<?> businessInterface = StatefulGreeter.class;
      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();
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.