Source Code Cross Referenced for TestSFAnnotationSecurityRoles.java in  » J2EE » ow2-easybeans » org » ow2 » easybeans » tests » security » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » ow2 easybeans » org.ow2.easybeans.tests.security 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * EasyBeans
003:         * Copyright (C) 2006 Bull S.A.S.
004:         * Contact: easybeans@ow2.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: TestSFAnnotationSecurityRoles.java 1970 2007-10-16 11:49:25Z benoitf $
023:         * --------------------------------------------------------------------------
024:         */package org.ow2.easybeans.tests.security;
025:
026:        import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.security.ItfSecurityRolesTester;
027:        import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.security.SFSBSecurityRolesTester00;
028:        import org.ow2.easybeans.tests.common.helper.EJBHelper;
029:        import org.testng.annotations.BeforeMethod;
030:        import org.testng.annotations.Test;
031:
032:        /**
033:         * Verifies if the container manages the security roles defined by annotation,
034:         * as well as verifies the methods in the session context related with security.
035:         * The bean used during the tests is stateless. The chapter verified is the 17.
036:         * @reference JSR 220- FINAL RELEASE
037:         * @requirement Application Server must be running; the bean
038:         *              SLSBSecurityRolesTester and SLSBSecurityRoles must be deployed.
039:         * @setup gets the reference of SLSBSecurityRolesTester.
040:         * @author Gisele Pinheiro Souza
041:         * @author Eduardo Studzinski Estima de Castro
042:         */
043:        public class TestSFAnnotationSecurityRoles {
044:
045:            /**
046:             * Bean used during the tests.
047:             */
048:            private ItfSecurityRolesTester tester;
049:
050:            /**
051:             * Creates the stateful bean used during the tests.
052:             * @throws Exception if an error occurs during the lookup.
053:             */
054:            @BeforeMethod
055:            public void setup() throws Exception {
056:                tester = EJBHelper.getBeanRemoteInstance(
057:                        SFSBSecurityRolesTester00.class,
058:                        ItfSecurityRolesTester.class);
059:            }
060:
061:            /**
062:             * Test if the permit all role works. The bean call a method with the
063:             * annotation permitAll.
064:             * @input -
065:             * @output the correct method execution.
066:             */
067:            @Test
068:            public void testPermitAll() {
069:                tester.testPermitAll();
070:            }
071:
072:            /**
073:             * Test if the deny all role works. The bean call a method with the
074:             * annotation denyAll.
075:             * @input -
076:             * @output the correct method execution. The EJBAccessException is verified
077:             *         in the server site.
078:             */
079:            @Test
080:            public void testDenyAll() {
081:                tester.testDenyAll();
082:            }
083:
084:            /**
085:             * Verifies if the role defined in the roles allowed can access the method. The annotation has only the role defined.
086:             * @input -
087:             * @output the correct method execution.
088:             */
089:            @Test
090:            public void testAllowedRolesWithOneRole() {
091:                tester.testAllowedRolesWithOneRole();
092:            }
093:
094:            /**
095:             * Verifies if the role defined in the roles allowed at bean level can access the method.
096:             * The annotation has only the role defined.
097:             * @input -
098:             * @output the correct method execution.
099:             */
100:            @Test
101:            public void testAllowedRolesDeclaredAtBeanLevel() {
102:                tester.testAllowedRolesDeclaredAtBeanLevel();
103:            }
104:
105:            /**
106:             * Verifies if the role defined in the roles allowed can access the method. The annotation has two roles defined.
107:             * @input -
108:             * @output the correct method execution.
109:             */
110:            @Test
111:            public void testAllowedRolesWithTwoRoles() {
112:                tester.testAllowedRolesWithTwoRoles();
113:            }
114:
115:            /**
116:             * Verifies if the correct exception(Runtime or subclass) is thrown when the deprecated method getCallerIdentity is called.
117:             * @input -
118:             * @output the correct method execution, the exception is verified in the server side.
119:             *
120:             */
121:            @Test
122:            public void testGetCallerIdentity() {
123:                tester.testGetCallerIdentity();
124:            }
125:
126:            /**
127:             * Verifies if the annotation RunAs does not change the current caller for a
128:             * class the has the RunAs(bean1). The bean1 call a method in other bean
129:             * that returns the caller principal, this caller must be different of the
130:             * current bean1 caller.
131:             * @input -
132:             * @output the correct method execution.
133:             */
134:            @Test
135:            public void testGetCallerPrincipalDifferentCaller() {
136:                tester.testGetCallerPrincipalDifferentCaller();
137:            }
138:
139:            /**
140:             * Verifies if the caller is propagated among the beans. The bean1(that has
141:             * not the annotation RunAs) call the bean2, the both caller principal must
142:             * be the same.
143:             * @input -
144:             * @output the correct method execution.
145:             */
146:            @Test
147:            public void testGetCallerPrincipalSameCaller() {
148:                tester.testGetCallerPrincipalSameCaller();
149:            }
150:
151:            /**
152:             * Verifies if the isCallerInRole returns true when the correct role name is
153:             * used. The bean1 has the annotation RunAs(role1) and call the bean2 that
154:             * verifies if the isCallerInRoleMethod(role1) returns true.
155:             * @input -
156:             * @output the correct method execution.
157:             */
158:            @Test
159:            public void testIsCallerInRoleCorrect() {
160:                tester.testIsCallerInRoleCorrect();
161:            }
162:
163:            /**
164:             * Verifies if the correct exception(Runtime or subclass) is thrown when the
165:             * deprecated method getCallerInRole(Identity identity) is called.
166:             * @input -
167:             * @output the correct method execution, the exception is verified in the
168:             *         server side.
169:             */
170:            @Test
171:            public void testIsCallerInRoleDeprecated() {
172:                tester.testIsCallerInRoleDeprecated();
173:            }
174:
175:            /**
176:             * Verifies if the isCallerInRole returns false when the incorrect role name is
177:             * used. The bean1 has the annotation RunAs(role1) and call the bean2 that
178:             * verifies if the isCallerInRoleMethod(roleX) returns false.
179:             * @input -
180:             * @output the correct method execution.
181:             */
182:            @Test
183:            public void testIsCallerInRoleIncorrect() {
184:                tester.testIsCallerInRoleIncorrect();
185:            }
186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.