[jboss-cvs] JBossAS SVN: r65706 - trunk/ejb3/src/test/org/jboss/ejb3/test/stateless/unit.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 1 06:12:54 EDT 2007
Author: wolfc
Date: 2007-10-01 06:12:54 -0400 (Mon, 01 Oct 2007)
New Revision: 65706
Modified:
trunk/ejb3/src/test/org/jboss/ejb3/test/stateless/unit/StatelessTestCase.java
Log:
EJBTHREE-1051: fixed unit test
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/stateless/unit/StatelessTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/stateless/unit/StatelessTestCase.java 2007-10-01 09:55:49 UTC (rev 65705)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/stateless/unit/StatelessTestCase.java 2007-10-01 10:12:54 UTC (rev 65706)
@@ -132,27 +132,44 @@
}
}
- public void testUnsecureToSecure() throws Exception
+ /**
+ * EJBTHREE-1051: A bean without a security domain should still
+ * propagate the caller.
+ *
+ * @throws Exception
+ */
+ public void testUnsecureToSecureWithCredentials() throws Exception
{
UnsecuredStateless stateless = (UnsecuredStateless)getInitialContext().lookup("UnsecuredStatelessBean/remote");
- SecurityAssociation.clear();
+ SecurityAssociation.setPrincipal(new SimplePrincipal("somebody"));
+ SecurityAssociation.setCredential("password".toCharArray());
try
{
- stateless.method(1);
- fail();
+ assertEquals(1, stateless.method(1));
}
- catch (Exception e)
+ catch(EJBAccessException e)
{
-
+ fail("EJBTHREE-1051: caller wasn't propagated");
}
+ }
+
+ public void testUnsecureToSecureWithoutCredentials() throws Exception
+ {
+ UnsecuredStateless stateless = (UnsecuredStateless)getInitialContext().lookup("UnsecuredStatelessBean/remote");
- SecurityAssociation.setPrincipal(new SimplePrincipal("somebody"));
- SecurityAssociation.setCredential("password".toCharArray());
+ SecurityAssociation.clear();
- assertEquals(1, stateless.method(1));
-
+ try
+ {
+ stateless.method(2);
+ fail("Should not have been allowed");
+ }
+ catch (EJBAccessException e)
+ {
+ // okay
+ }
}
public static Test suite() throws Exception
More information about the jboss-cvs-commits
mailing list