KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > jacc > test > EJBSpecUnitTestCase


1 /*
2  * JBoss, Home of Professional Open Source
3  * Copyright 2005, JBoss Inc., and individual contributors as indicated
4  * by the @authors tag. See the copyright.txt in the distribution for a
5  * full listing of individual contributors.
6  *
7  * This is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation; either version 2.1 of
10  * the License, or (at your option) any later version.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this software; if not, write to the Free
19  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21  */

22 package org.jboss.test.jacc.test;
23
24 import javax.security.auth.login.Configuration JavaDoc;
25
26 import junit.framework.Test;
27 import junit.framework.TestSuite;
28 import junit.extensions.TestSetup;
29 import org.jboss.test.JBossTestSetup;
30 import org.jboss.security.auth.login.XMLLoginConfigImpl;
31
32 /** Test of EJB spec conformace using the security-spec.jar
33  * deployment unit when running under a JACC authorization manager.
34  *
35  * @author Scott.Stark@jboss.org
36  * @version $Revision: 56755 $
37  */

38 public class EJBSpecUnitTestCase
39    extends org.jboss.test.security.test.EJBSpecUnitTestCase
40 {
41
42    public EJBSpecUnitTestCase(String JavaDoc name)
43    {
44       super(name);
45    }
46
47    /**
48     * Setup the test suite.
49     */

50    public static Test suite() throws Exception JavaDoc
51    {
52       // JBAS-3602, the execution order of tests in this test case is important
53
// so it must be defined explicitly when running under some JVMs
54
TestSuite suite = new TestSuite();
55       
56       // @todo this fails under JACC because there is no automatic granting
57
// of the correct create permissions needed for the handle activation. This
58
// is due to the implementation detail of the handle calling back into
59
// the container on activation.
60
//suite.addTest(new EJBSpecUnitTestCase("testStatefulHandle"));
61

62       // Needs to be excluded because for JACC, the role "Role2"
63
// is not defined as a security-role-ref
64
//suite.addTest(new EJBSpecUnitTestCase("testDomainInteraction"));
65

66       // All are baseclass tests
67
suite.addTest(new EJBSpecUnitTestCase("testSecurityDomain"));
68       suite.addTest(new EJBSpecUnitTestCase("testStatefulCreateCaller"));
69       suite.addTest(new EJBSpecUnitTestCase("testGetCallerPrincipal"));
70       suite.addTest(new EJBSpecUnitTestCase("testPrincipalPropagation"));
71       suite.addTest(new EJBSpecUnitTestCase("testMethodAccess"));
72       suite.addTest(new EJBSpecUnitTestCase("testDomainMethodAccess"));
73       suite.addTest(new EJBSpecUnitTestCase("testMethodAccess2"));
74       suite.addTest(new EJBSpecUnitTestCase("testLocalMethodAccess"));
75       suite.addTest(new EJBSpecUnitTestCase("testUncheckedRemote"));
76       suite.addTest(new EJBSpecUnitTestCase("testRemoteUnchecked"));
77       suite.addTest(new EJBSpecUnitTestCase("testUnchecked"));
78       suite.addTest(new EJBSpecUnitTestCase("testUncheckedWithLogin"));
79       suite.addTest(new EJBSpecUnitTestCase("testExcluded"));
80       suite.addTest(new EJBSpecUnitTestCase("testRunAs"));
81       suite.addTest(new EJBSpecUnitTestCase("testDeepRunAs"));
82       suite.addTest(new EJBSpecUnitTestCase("testRunAsSFSB"));
83       suite.addTest(new EJBSpecUnitTestCase("testJBAS1852"));
84       suite.addTest(new EJBSpecUnitTestCase("testMDBRunAs"));
85       suite.addTest(new EJBSpecUnitTestCase("testMDBDeepRunAs"));
86       suite.addTest(new EJBSpecUnitTestCase("testRunAsWithRoles"));
87       suite.addTest(new EJBSpecUnitTestCase("testHandle"));
88       suite.addTest(new EJBSpecUnitTestCase("testStress"));
89       suite.addTest(new EJBSpecUnitTestCase("testStressNoJaasCache"));
90       
91       // Create an initializer for the test suite
92
TestSetup wrapper = new JBossTestSetup(suite)
93       {
94          protected void setUp() throws Exception JavaDoc
95          {
96             super.setUp();
97             Configuration.setConfiguration(new XMLLoginConfigImpl());
98             redeploy("security-spec.jar");
99             flushAuthCache();
100          }
101          protected void tearDown() throws Exception JavaDoc
102          {
103             undeploy("security-spec.jar");
104             super.tearDown();
105          
106          }
107       };
108       return wrapper;
109    }
110
111 }
112
Popular Tags