Package org.jboss.ejb3.endpoint

Examples of org.jboss.ejb3.endpoint.Endpoint


      // Create the EJB Container
      final Map<String, String> ejbContainerProps = new HashMap<String, String>();
      ejbContainerProps.put(EJBContainer.MODULES, ""); // Deploy no modules and do no scanning by default
      final JBossEJBContainerProvider ejbContainer = (JBossEJBContainerProvider) EJBContainer
            .createEJBContainer(ejbContainerProps);
      final ShrinkWrapEJBContainer shrinkwrapEjbContainer = new ShrinkWrapEJBContainerImpl(ejbContainer);

      // Define the EJB JAR
      final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "outputSlsb.jar").addClasses(OutputBean.class,
            OutputLocalBusiness.class);

      // Deploy the JAR
      shrinkwrapEjbContainer.deploy(archive);

      // Look up the EJB
      final Context context = ejbContainer.getContext();
      final OutputLocalBusiness bean;
      try
      {
         bean = (OutputLocalBusiness) context.lookup(OutputLocalBusiness.JNDI_NAME);
      }
      catch (final NamingException e)
      {
         throw new RuntimeException("Could not find bean proxy at " + OutputLocalBusiness.JNDI_NAME, e);
      }

      // Invoke
      final String value = bean.getOutput();

      // Undeploy
      shrinkwrapEjbContainer.undeploy(archive);

      // Shut down EJBContainer
      ejbContainer.close();

      // Write out
View Full Code Here


      response.setContentType(CONTENT_TYPE_TEXT_PLAIN);

      // Create the EJB Container
      final Map<String, String> ejbContainerProps = new HashMap<String, String>();
      ejbContainerProps.put(EJBContainer.MODULES, ""); // Deploy no modules and do no scanning by default
      final JBossEJBContainerProvider ejbContainer = (JBossEJBContainerProvider) EJBContainer
            .createEJBContainer(ejbContainerProps);
      final ShrinkWrapEJBContainer shrinkwrapEjbContainer = new ShrinkWrapEJBContainerImpl(ejbContainer);

      // Define the EJB JAR
      final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "outputSlsb.jar").addClasses(OutputBean.class,
            OutputLocalBusiness.class);

      // Deploy the JAR
      shrinkwrapEjbContainer.deploy(archive);

      // Look up the EJB
      final Context context = ejbContainer.getContext();
      final OutputLocalBusiness bean;
      try
      {
         bean = (OutputLocalBusiness) context.lookup(OutputLocalBusiness.JNDI_NAME);
      }
      catch (final NamingException e)
      {
         throw new RuntimeException("Could not find bean proxy at " + OutputLocalBusiness.JNDI_NAME, e);
      }

      // Invoke
      final String value = bean.getOutput();

      // Undeploy
      shrinkwrapEjbContainer.undeploy(archive);

      // Shut down EJBContainer
      ejbContainer.close();

      // Write out
      log.info("Got value from EJB: " + value);
      response.getWriter().write(value);
   }
View Full Code Here

         boolean isEar = unit != unit.getTopLevel();
         this.deploymentScope = new JBoss5DeploymentScope(unit.getParent(), isEar);
      }

      ejbResolver = new ClientEjbResolver(deploymentScope, unit.getSimpleName());
      messageDestinationResolver = new MessageDestinationResolver(deploymentScope, xml.getMessageDestinations());

      String on = Ejb3Module.BASE_EJB3_JMX_NAME + createScopeKernelName(unit, deploymentScope) + ",name=" + applicationClientName;
      try
      {
         this.objectName = new ObjectName(on);
View Full Code Here

   }

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

   }

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

   }

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

   @Test
   public void testToString() 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);
      String result = proxy.toString();
      assertTrue(result.startsWith("Proxy on " + EndpointInvocationHandler.class.getName()));
View Full Code Here

public class SessionTestCase
{
   @Test
   public void testNoSessionFactory() throws Throwable
   {
      Endpoint endpoint = new AbstractEndpoint() {
         public Object invoke(Serializable session, Class<?> invokedBusinessInterface, Method method, Object[] args)
            throws Throwable
         {
            return "Hi " + args[0];
         }
      };
      assertFalse(endpoint.isSessionAware());
      try
      {
         endpoint.getSessionFactory();
         fail("Should have thrown IllegalStateException");
      }
      catch(IllegalStateException e)
      {
         // good
View Full Code Here

         public void destroySession(Serializable session)
         {
            assert session instanceof UUID;
         }
      };
      Endpoint endpoint = new AbstractEndpoint(factory) {
         public Object invoke(Serializable session, Class<?> invokedBusinessInterface, Method method, Object[] args)
            throws Throwable
         {
            return "Hi " + args[0];
         }
      };
      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");
View Full Code Here

public class InvocationTestCase
{
   @Test
   public void testInvocation() throws Throwable
   {
      Endpoint endpoint = new AbstractEndpoint() {
         public Object invoke(Serializable session, Class<?> invokedBusinessInterface, Method method, Object[] args)
            throws Throwable
         {
            return "Hi " + args[0];
         }
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.