Source Code Cross Referenced for SessionTimeoutTest.java in  » Portal » Pluto » org » apache » pluto » testsuite » test » 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 » Portal » Pluto » org.apache.pluto.testsuite.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.pluto.testsuite.test;
018:
019:        import javax.portlet.PortletRequest;
020:        import javax.portlet.PortletSession;
021:
022:        import org.apache.commons.logging.Log;
023:        import org.apache.commons.logging.LogFactory;
024:        import org.apache.pluto.testsuite.TestResult;
025:
026:        public class SessionTimeoutTest extends AbstractReflectivePortletTest {
027:
028:            /** Logger. */
029:            private static final Log LOG = LogFactory
030:                    .getLog(SessionTimeoutTest.class);
031:
032:            /**
033:             * Render parameter name indicating if the max inactive interval is set to
034:             * the portlet session or not.
035:             */
036:            private static final String MAX_INACTIVE_INTERVAL_SET = "maxInactiveIntervalSet";
037:
038:            // Test Methods ------------------------------------------------------------
039:
040:            protected TestResult checkSessionInvalidated(PortletRequest request) {
041:                TestResult result = new TestResult();
042:                result
043:                        .setDescription("Ensure portlet session is invalidated after "
044:                                + "the max inactive interval.");
045:                result.setSpecPLT("15.6");
046:
047:                // Check if max inactive interval is set to the portlet session.
048:                String maxInactiveIntervalSet = request
049:                        .getParameter(MAX_INACTIVE_INTERVAL_SET);
050:                if (LOG.isDebugEnabled()) {
051:                    LOG.debug("Retrieved render parameter: "
052:                            + MAX_INACTIVE_INTERVAL_SET + " = "
053:                            + maxInactiveIntervalSet);
054:                }
055:
056:                // If the max inactive interval is set to portlet session, the portlet
057:                //   session should have been invalidated by the container.
058:                if (Boolean.TRUE.toString().equals(maxInactiveIntervalSet)) {
059:                    if (LOG.isDebugEnabled()) {
060:                        LOG
061:                                .debug("Max inactive interval is set to portlet session: "
062:                                        + "portlet session should have expired "
063:                                        + "(current time millis: "
064:                                        + System.currentTimeMillis() + ")...");
065:                    }
066:                    PortletSession session = request.getPortletSession(false);
067:                    if (session == null) {
068:                        result.setReturnCode(TestResult.PASSED);
069:                    } else {
070:                        result.setReturnCode(TestResult.FAILED);
071:                        result
072:                                .setResultMessage("PortletSession should have expired "
073:                                        + "and have been invalidated, but is still available. "
074:                                        + "Make sure that other portlets did not create a new "
075:                                        + "portlet session.");
076:                    }
077:                }
078:
079:                // If the max inactive interval is not set to portlet session, set its
080:                //   value to 5 (seconds). In this way, next time the test portlet is
081:                //   rendered, the portlet session should have been invalidated.
082:                else {
083:                    if (LOG.isDebugEnabled()) {
084:                        LOG
085:                                .debug("Max inactive interval is not set to portlet session: "
086:                                        + "setting to 5 seconds (current time millis: "
087:                                        + System.currentTimeMillis() + ")...");
088:                    }
089:                    PortletSession session = request.getPortletSession(true);
090:                    session.setMaxInactiveInterval(5);
091:                    result.setReturnCode(TestResult.WARNING);
092:                    result
093:                            .setResultMessage("Click the provided link to validate test.");
094:                }
095:
096:                // Return the test result:
097:                //   PASSED - the test is passed.
098:                //   FAILED - the test is failed.
099:                //   WARNING - the test requires manual intervention.
100:                return result;
101:            }
102:
103:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.