Package it0025

Examples of it0025.Hello


        resp.setContentType("text/plain");
        final PrintWriter writer = resp.getWriter();
        final String jndiName = req.getParameter(PARAM_JNDI_NAME);
        try {
            final Context ctx = new InitialContext();
            final Hello ejbObject = (Hello) ctx.lookup(jndiName);
            final String msg = ejbObject.sayHello();
            LOGGER.info(msg);
            writer.append(msg);
            ctx.close();
        } catch (NamingException ex) {
            LOGGER.warn("Unable to get EJB.", ex);
View Full Code Here


     */
    @Test
    public void testAuthorizedClient() throws Exception {
        final Properties env = configureEjbClient(CLIENT_AUTHORIZED_NAME);
        InitialContext ctx = new InitialContext(env);
        final Hello helloBean = (Hello) ctx.lookup(HELLOBEAN_LOOKUP_NAME);
        assertEquals(HelloBean.HELLO_WORLD, helloBean.sayHelloWorld());
        ctx.close();
    }
View Full Code Here

     */
    @Test
    public void testNotAuthorizedClient() throws Exception {
        final Properties env = configureEjbClient(CLIENT_NOT_AUTHORIZED_NAME);
        InitialContext ctx = new InitialContext(env);
        final Hello helloBean = (Hello) ctx.lookup(HELLOBEAN_LOOKUP_NAME);
        try {
            helloBean.sayHelloWorld();
            fail("The EJB call should fail for unauthorized client.");
        } catch (EJBAccessException e) {
            //OK
        }
        ctx.close();
View Full Code Here

      Thread.currentThread().setContextClassLoader(Hello.class.getClassLoader());
     
      ProxyContainer<HelloBean> container = new ProxyContainer<HelloBean>("ContextGetMethodTestCase", "InterceptorContainer", HelloBean.class);
     
      Class<?> interfaces[] = { Hello.class };
      Hello proxy = container.constructProxy(interfaces);
     
      String name = new Date().toString();
      String result = proxy.sayHiTo(name);
     
      assertEquals(1, GetMethodInterceptor.invocations);
      assertEquals("Hi " + name, result);
      log.info("======= Done");
   }
View Full Code Here

TOP

Related Classes of it0025.Hello

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.