Package org.jboss.ejb3.endpoint

Examples of org.jboss.ejb3.endpoint.Endpoint


   @Test
   public void testEqualsSame() throws Exception
   {
      ClassLoader loader = Thread.currentThread().getContextClassLoader();
      Endpoint endpoint = new SimpleEndpoint();
      Serializable session = null;
      Class<SimpleInterface> businessInterface = SimpleInterface.class;
      SimpleInterface proxy = EndpointProxy.newProxyInstance(loader, session, businessInterface, endpoint);
      assertTrue(proxy.equals(proxy));
   }
View Full Code Here


   }

   @Test
   public void testEqualsSameSession() throws Exception
   {
      Endpoint endpoint = new SimpleEndpoint();
      Serializable session1 = UUID.randomUUID();
      Serializable session2 = session1;
      Class<SimpleInterface> businessInterface = null;
      InvocationHandler handler1 = new EndpointInvocationHandler(endpoint, session1, businessInterface);
      InvocationHandler handler2 = new EndpointInvocationHandler(endpoint, session2, businessInterface);
View Full Code Here

   }

   @Test
   public void testEqualsWithAndWithoutSession() throws Exception
   {
      Endpoint endpoint = new SimpleEndpoint();
      Serializable session1 = UUID.randomUUID();
      Serializable session2 = null;
      Class<SimpleInterface> businessInterface = null;
      InvocationHandler handler1 = new EndpointInvocationHandler(endpoint, session1, businessInterface);
      InvocationHandler handler2 = new EndpointInvocationHandler(endpoint, session2, businessInterface);
View Full Code Here

   }

   @Test
   public void testEqualsWithoutAndWithSession() throws Exception
   {
      Endpoint endpoint = new SimpleEndpoint();
      Serializable session1 = null;
      Serializable session2 = UUID.randomUUID();
      Class<SimpleInterface> businessInterface = null;
      InvocationHandler handler1 = new EndpointInvocationHandler(endpoint, session1, businessInterface);
      InvocationHandler handler2 = new EndpointInvocationHandler(endpoint, session2, businessInterface);
View Full Code Here

   }

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

   }

   @Test
   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");
View Full Code Here

      String name = "jboss.j2ee:jar=tests-classes,name=MyStatelessBean,service=EJB3_endpoint";
      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");
View Full Code Here

      String name = "jboss.j2ee:jar=tests-classes,name=MyStatefulBean,service=EJB3_endpoint";
      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();
      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);
View Full Code Here

      // now get hold of the StatefulSessionFactory from the context
      Object target = this.endpointContext.getTarget();
      assert target instanceof Endpoint : "Unexpected object type found " + target + " - expected a " + Endpoint.class;

      Endpoint endpoint = (Endpoint) target;
      if (!endpoint.isSessionAware())
      {
         throw new IllegalStateException("Endpoint " + endpoint
               + " is not session aware. Cannot be used for Stateful no-interface view(s)");
      }

      // create the session
      Serializable session = endpoint.getSessionFactory().createSession(null, null);
      logger.debug("Created session " + session + " for " + this.beanClass);

      // create an invocation handler
      AsyncMethodsMetaData asyncMethods = this.metadata.getAsyncMethods();
      InvocationHandler invocationHandler = new NoInterfaceViewInvocationHandler(this.endpointContext, session,
View Full Code Here

         {
            logger.trace("Cannot handle method: " + method.getName() + " in " + this.getClass().getName());
         }
      }
      // get the endpoint (which will involve pushing it to INSTALLED state)
      Endpoint endpoint = getInstalledEndpoint();
      assert endpoint != null : "No endpoint associated with context " + this.endpointContext
            + " - cannot invoke the method on bean";

      // finally pass-on the control to the endpoint
      return endpoint.invoke(this.session, null, method, args);
   }
View Full Code Here

TOP

Related Classes of org.jboss.ejb3.endpoint.Endpoint

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.