Package org.jboss.tutorial.jboss_deployment_descriptor.bean

Examples of org.jboss.tutorial.jboss_deployment_descriptor.bean.StatelessTest


   }

   private static void testStateless() throws Exception
   {
      InitialContext jndiContext = new InitialContext();
      StatelessTest stateless = (StatelessTest) jndiContext.lookup("StatelessTest");

      SecurityClient securityClient = SecurityClientFactory.getSecurityClient();
      securityClient.setSimple("bill2", "invalidpassword");
      securityClient.login();
     
      try
      {
         stateless.testSecurity();
         throw new RuntimeException("ERROR - User with incorrect password accessed the bean");
      }
      catch (javax.ejb.EJBAccessException e)
      {
         System.out.println("Caught javax.ejb.EJBAccessException, for SLSB, as expected");
      }

      // logout and login back with correct credentials
      System.out.println("Now passing the correct user/password to access the SLSB");
      securityClient.logout();
      securityClient.setSimple("bill2", "password-default");
      securityClient.login();
     
      // call the bean method
      stateless.testSecurity();

      System.out.println("Successfully accessed SLSB");
   }
View Full Code Here

TOP

Related Classes of org.jboss.tutorial.jboss_deployment_descriptor.bean.StatelessTest

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.