Package org.jboss.ejb3.endpoint.reflect

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


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

            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

      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

      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

      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

         if(service instanceof StatelessContainer)
         {
            ((StatelessContainer) service).setBusinessObjectFactory(new EJB31StatelessBusinessObjectFactory());
         }
         if(service instanceof StatefulContainer)
            ((StatefulContainer) service).setBusinessObjectFactory(new EJB31StatefulBusinessObjectFactory(kernel));
      }

      if(unit != null)
      {
         // Just add the mc bean metadata to the unit
View Full Code Here

         builder.addPropertyMetaData("beanInstantiator", new AbstractInjectionValueMetaData(beanInstantiatorMcName));

         // ahem
         if(service instanceof StatelessContainer)
         {
            ((StatelessContainer) service).setBusinessObjectFactory(new EJB31StatelessBusinessObjectFactory());
         }
         if(service instanceof StatefulContainer)
            ((StatefulContainer) service).setBusinessObjectFactory(new EJB31StatefulBusinessObjectFactory(kernel));
      }
View Full Code Here

      try
      {
         if(injectors == null)
            return;
         Advisor advisor = getAdvisor();
         InjectionInvocation invocation = new InjectionInvocation(beanContext, injectors, injectionCallbackStack);
         invocation.setAdvisor(advisor);
         invocation.setTargetObject(beanContext.getInstance());
         invocation.invokeNext();
      }
      catch(Throwable t)
      {
         if(t instanceof Error)
            throw (Error) t;
View Full Code Here

      this.addInput(JBossMetaData.class);
      this.addOutput(BeanInstantiator.class);
      jsr299BeanInstantiatorDeployer = new Jsr299BeanInstantiatorDeployer();
      jsr299BeanInstantiatorDeployer.setKernel(kernel);
      jsr299BeanInstantiatorDeployer.setJavaEEComponentInformer(javaEEComponentInformer);
      singletonBeanInstantiatorDeployer = new SingletonBeanInstantiatorDeployer(defaultBeanInstantiator);
      singletonBeanInstantiatorDeployer.setKernel(kernel);
      singletonBeanInstantiatorDeployer.setJavaEEComponentInformer(javaEEComponentInformer);
   }
View Full Code Here

TOP

Related Classes of org.jboss.ejb3.endpoint.reflect.EndpointInvocationHandler

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.