001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.test.jacc.test;
023:
024: import javax.security.auth.login.Configuration;
025:
026: import junit.framework.Test;
027: import junit.framework.TestSuite;
028: import junit.extensions.TestSetup;
029: import org.jboss.test.JBossTestSetup;
030: import org.jboss.security.auth.login.XMLLoginConfigImpl;
031:
032: /** Test of EJB spec conformace using the security-spec.jar
033: * deployment unit when running under a JACC authorization manager.
034: *
035: * @author Scott.Stark@jboss.org
036: * @version $Revision: 60043 $
037: */
038: public class EJBSpecUnitTestCase extends
039: org.jboss.test.security.test.EJBSpecUnitTestCase {
040:
041: public EJBSpecUnitTestCase(String name) {
042: super (name);
043: }
044:
045: /**
046: * Setup the test suite.
047: */
048: public static Test suite() throws Exception {
049: // JBAS-3602, the execution order of tests in this test case is important
050: // so it must be defined explicitly when running under some JVMs
051: TestSuite suite = new TestSuite();
052:
053: // @todo this fails under JACC because there is no automatic granting
054: // of the correct create permissions needed for the handle activation. This
055: // is due to the implementation detail of the handle calling back into
056: // the container on activation.
057: //suite.addTest(new EJBSpecUnitTestCase("testStatefulHandle"));
058:
059: // Needs to be excluded because for JACC, the role "Role2"
060: // is not defined as a security-role-ref
061: //suite.addTest(new EJBSpecUnitTestCase("testDomainInteraction"));
062:
063: // All are baseclass tests
064: suite.addTest(new EJBSpecUnitTestCase("testSecurityDomain"));
065: suite.addTest(new EJBSpecUnitTestCase(
066: "testStatefulCreateCaller"));
067: suite
068: .addTest(new EJBSpecUnitTestCase(
069: "testGetCallerPrincipal"));
070: suite.addTest(new EJBSpecUnitTestCase(
071: "testPrincipalPropagation"));
072: suite.addTest(new EJBSpecUnitTestCase("testMethodAccess"));
073: suite
074: .addTest(new EJBSpecUnitTestCase(
075: "testDomainMethodAccess"));
076: suite.addTest(new EJBSpecUnitTestCase("testMethodAccess2"));
077: suite.addTest(new EJBSpecUnitTestCase("testLocalMethodAccess"));
078: suite.addTest(new EJBSpecUnitTestCase("testUncheckedRemote"));
079: suite.addTest(new EJBSpecUnitTestCase("testRemoteUnchecked"));
080: suite.addTest(new EJBSpecUnitTestCase("testUnchecked"));
081: suite
082: .addTest(new EJBSpecUnitTestCase(
083: "testUncheckedWithLogin"));
084: suite.addTest(new EJBSpecUnitTestCase("testExcluded"));
085: suite.addTest(new EJBSpecUnitTestCase("testRunAs"));
086: suite.addTest(new EJBSpecUnitTestCase("testDeepRunAs"));
087: suite.addTest(new EJBSpecUnitTestCase("testRunAsSFSB"));
088: suite.addTest(new EJBSpecUnitTestCase("testJBAS1852"));
089: suite.addTest(new EJBSpecUnitTestCase("testMDBRunAs"));
090: suite.addTest(new EJBSpecUnitTestCase("testMDBDeepRunAs"));
091: suite.addTest(new EJBSpecUnitTestCase("testRunAsWithRoles"));
092: suite.addTest(new EJBSpecUnitTestCase("testHandle"));
093: suite.addTest(new EJBSpecUnitTestCase("testStress"));
094: suite.addTest(new EJBSpecUnitTestCase("testStressNoJaasCache"));
095:
096: // Create an initializer for the test suite
097: TestSetup wrapper = new JBossTestSetup(suite) {
098: protected void setUp() throws Exception {
099: super .setUp();
100: /* Validate the java.security.auth.login.config setting, and if not
101: found, set it to the security/auth.conf classpath resource value.
102: */
103: super .initDefaultLoginConfig();
104: Configuration
105: .setConfiguration(new XMLLoginConfigImpl());
106: redeploy("security-spec.jar");
107: flushAuthCache();
108: }
109:
110: protected void tearDown() throws Exception {
111: undeploy("security-spec.jar");
112: super.tearDown();
113:
114: }
115: };
116: return wrapper;
117: }
118:
119: }
|