[jboss-cvs] JBossAS SVN: r82358 - in projects/ejb3/trunk/testsuite/src/test: resources and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Dec 18 05:28:03 EST 2008
Author: wolfc
Date: 2008-12-18 05:28:03 -0500 (Thu, 18 Dec 2008)
New Revision: 82358
Modified:
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security/unit/EJBSpecUnitTestCase.java
projects/ejb3/trunk/testsuite/src/test/resources/known-issues.xml
Log:
EJBTHREE-1644: Make security domain interaction fail and a known issue. Removed testing the security manager itself (not our job).
Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security/unit/EJBSpecUnitTestCase.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security/unit/EJBSpecUnitTestCase.java 2008-12-18 10:23:40 UTC (rev 82357)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security/unit/EJBSpecUnitTestCase.java 2008-12-18 10:28:03 UTC (rev 82358)
@@ -23,6 +23,7 @@
import java.util.HashSet;
+import javax.ejb.EJBException;
import javax.jms.Message;
import javax.jms.Queue;
import javax.jms.QueueConnection;
@@ -76,63 +77,6 @@
logout();
}
-/** Validate that the users have the expected logins and roles.
- *
- * @throws Exception
- */
-public void testSecurityDomain() throws Exception
-{
- log.info("+++ testSecurityDomain, domain=spec-test");
- fail("THINK ABOUT THE AS DEPENDENCIES");
- /**
- MBeanServerConnection conn = (MBeanServerConnection) getServer();
- ObjectName secMgrName = new ObjectName("jboss.security:service=JaasSecurityManager");
- JaasSecurityManagerServiceMBean secMgr = (JaasSecurityManagerServiceMBean)
- MBeanServerInvocationHandler.newProxyInstance(conn, secMgrName,
- JaasSecurityManagerServiceMBean.class, false);
-
- // Test the spec-test security domain
- String domain = "spec-test";
- SimplePrincipal user = new SimplePrincipal("scott");
- boolean isValid = secMgr.isValid(domain, user, password);
- assertTrue("scott password is echoman", isValid);
- HashSet testRole = new HashSet();
- testRole.add(new SimplePrincipal("Echo"));
- boolean hasRole = secMgr.doesUserHaveRole(domain, user, password, testRole);
- assertTrue("scott has Echo role", hasRole);
- testRole.clear();
- testRole.add(new SimplePrincipal("EchoLocal"));
- hasRole = secMgr.doesUserHaveRole(domain, user, password, testRole);
- assertTrue("scott has EchoLocal role", hasRole);
- testRole.clear();
- testRole.add(new SimplePrincipal("ProjectUser"));
- hasRole = secMgr.doesUserHaveRole(domain, user, password, testRole);
- assertTrue("scott has ProjectUser role", hasRole);
-
- isValid = secMgr.isValid(domain, user, "badpass".toCharArray());
- assertTrue("badpass is an invalid password for scott", isValid == false);
-
- // Test the spec-test-domain security domain
- log.info("+++ testSecurityDomain, domain=spec-test-domain");
- domain = "spec-test-domain";
- isValid = secMgr.isValid(domain, user, password);
- assertTrue("scott password is echoman", isValid);
- hasRole = secMgr.doesUserHaveRole(domain, user, password, testRole);
- assertTrue("scott has Echo role", hasRole);
- testRole.clear();
- testRole.add(new SimplePrincipal("EchoLocal"));
- hasRole = secMgr.doesUserHaveRole(domain, user, password, testRole);
- assertTrue("scott has EchoLocal role", hasRole);
- testRole.clear();
- testRole.add(new SimplePrincipal("ProjectUser"));
- hasRole = secMgr.doesUserHaveRole(domain, user, password, testRole);
- assertTrue("scott has ProjectUser role", hasRole);
-
- isValid = secMgr.isValid(domain, user, "badpass".toCharArray());
- assertTrue("badpass is an invalid password for scott", isValid == false);
- */
-}
-
/** Test that:
1. SecureBean returns a non-null principal when getCallerPrincipal
is called with a security context and that this is propagated
@@ -201,7 +145,20 @@
HashSet roles = new HashSet();
roles.add("Role1");
roles.add("Role2");
- bean.testDomainInteraction(roles);
+ try
+ {
+ bean.testDomainInteraction(roles);
+ }
+ catch(EJBException e)
+ {
+ Throwable cause = e.getCause();
+ if(cause != null && cause instanceof SecurityException)
+ {
+ cause.printStackTrace();
+ fail(cause.getMessage());
+ }
+ throw e;
+ }
}
/** Test that the calling principal is propagated across bean calls.
Modified: projects/ejb3/trunk/testsuite/src/test/resources/known-issues.xml
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/resources/known-issues.xml 2008-12-18 10:23:40 UTC (rev 82357)
+++ projects/ejb3/trunk/testsuite/src/test/resources/known-issues.xml 2008-12-18 10:28:03 UTC (rev 82358)
@@ -29,6 +29,8 @@
<entry key="org.jboss.ejb3.test.ejbthree1222.unit.RegularRemoveMethodUnitTestCase.testLocalNormalMethodNamedRemove">show</entry>
<!-- EJBTHREE-1637 -->
<entry key="org.jboss.ejb3.test.jacc.unit.JaccTestCase.testSomeEntityDelete">show</entry>
+ <!-- EJBTHREE-1644 -->
+ <entry key="org.jboss.ejb3.test.security.unit.EJBSpecUnitTestCase.testDomainInteraction">show</entry>
<!-- JBAS-6332 -->
<entry key="org.jboss.ejb3.test.servlet.unit.ServletUnitTestCase.testEJBServlet">show</entry>
<!-- EJBTHREE-1640 -->
More information about the jboss-cvs-commits
mailing list