User: starksm 
  Date: 02/03/03 23:21:36

  Modified:    src/main/org/jboss/test/security/test
                        EJBSpecUnitTestCase.java
  Log:
  Need to invoke a remote method to ensure ejbCreate is called
  
  Revision  Changes    Path
  1.12      +27 -25    
jbosstest/src/main/org/jboss/test/security/test/EJBSpecUnitTestCase.java
  
  Index: EJBSpecUnitTestCase.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/security/test/EJBSpecUnitTestCase.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- EJBSpecUnitTestCase.java  3 Mar 2002 18:24:17 -0000       1.11
  +++ EJBSpecUnitTestCase.java  4 Mar 2002 07:21:36 -0000       1.12
  @@ -43,7 +43,7 @@
    deployment unit. These test the basic role based access model.
    
    @author [EMAIL PROTECTED]
  - @version $Revision: 1.11 $
  + @version $Revision: 1.12 $
    */
   public class EJBSpecUnitTestCase
      extends JBossTestCase
  @@ -60,6 +60,32 @@
         super(name);
      }
   
  +   /** Test the use of getCallerPrincipal from within the ejbCreate
  +    */
  +   public void testCreateCaller() throws Exception
  +   {
  +      log.debug("+++ testCreateCaller");
  +      login();
  +      InitialContext jndiContext = new InitialContext();
  +      Object obj = jndiContext.lookup("spec.SecureCreateSession");
  +      obj = PortableRemoteObject.narrow(obj, StatelessSessionHome.class);
  +      StatelessSessionHome home = (StatelessSessionHome) obj;
  +      System.out.println("Found StatelessSessionHome");
  +      try
  +      {
  +         StatelessSession bean = home.create();
  +         // Need to invoke a method to ensure an ejbCreate call
  +         bean.noop();
  +         log.debug("Bean.noop(), ok");
  +         fail("Was able to call getCallerPrincipal in ejbCreate");
  +      }
  +      catch(Exception e)
  +      {
  +         log.debug("Create failed as expected", e);
  +      }
  +      logout();
  +   }
  +
      /** Test that:
       1. SecureBean returns a non-null principal when getCallerPrincipal
       is called with a security context and that this is propagated
  @@ -328,30 +354,6 @@
         log.debug("Bean.echo('Hello') -> "+bean.echo("Hello"));
         logout();
      }
  -
  -   /** Test the use of getCallerPrincipal from within the ejbCreate
  -    */
  -   public void testCreateCaller() throws Exception
  -   {
  -      log.debug("+++ testCreateCaller");
  -      login();
  -      InitialContext jndiContext = new InitialContext();
  -      Object obj = jndiContext.lookup("spec.SecureCreateSession");
  -      obj = PortableRemoteObject.narrow(obj, StatelessSessionHome.class);
  -      StatelessSessionHome home = (StatelessSessionHome) obj;
  -      System.out.println("Found StatelessSessionHome");
  -      try
  -      {
  -         StatelessSession bean = home.create();
  -         fail("Was able to call getCallerPrincipal in ejbCreate");
  -      }
  -      catch(Exception e)
  -      {
  -         log.debug("Create failed as expected", e);
  -      }
  -      logout();
  -   }
  -
   
      /** Login as user scott using the conf.name login config or
       'spec-test' if conf.name is not defined.
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to