Source Code Cross Referenced for ContextOperator.java in  » Testing » webtest » com » canoo » webtest » extension » applet » jemmy » 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 » Testing » webtest » com.canoo.webtest.extension.applet.jemmy 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.canoo.webtest.extension.applet.jemmy;
002:
003:        import com.canoo.webtest.boundary.JemmyBoundary;
004:        import com.canoo.webtest.extension.applet.runner.Context;
005:        import org.netbeans.jemmy.JemmyProperties;
006:        import org.netbeans.jemmy.Outputable;
007:        import org.netbeans.jemmy.TestOut;
008:        import org.netbeans.jemmy.Timeoutable;
009:        import org.netbeans.jemmy.Timeouts;
010:        import org.netbeans.jemmy.Waitable;
011:        import org.netbeans.jemmy.Waiter;
012:
013:        import java.net.URL;
014:
015:        /**
016:         * @author Denis N. Antonioli
017:         */
018:
019:        public class ContextOperator implements  Outputable, Timeoutable {
020:            /**
021:             * Should be in org.netbeans.jemmy.operators.AbstractOperator
022:             */
023:            private TestOut fOutput;
024:            /**
025:             * Should be in org.netbeans.jemmy.operators.AbstractOperator
026:             */
027:            private Timeouts fTimeouts;
028:            /**
029:             * Should be in org.netbeans.jemmy.operators.AbstractOperator
030:             */
031:            private JemmyProperties fProperties;
032:
033:            public static final String WAIT_TIMEOUT_NAME = "ContextOperator.WaitStateTimeout";
034:
035:            private final Context fContext;
036:
037:            static {
038:                Timeouts.initDefault(WAIT_TIMEOUT_NAME, 3600000);
039:            }
040:
041:            /**
042:             * Should be in org.netbeans.jemmy.operators.AbstractOperator
043:             */
044:            {
045:                setTimeouts(JemmyProperties.getProperties().getTimeouts());
046:                setOutput(JemmyProperties.getProperties().getOutput());
047:                setProperties(JemmyProperties.getProperties());
048:            }
049:
050:            /**
051:             * Should be in org.netbeans.jemmy.operators.AbstractOperator
052:             *
053:             * @see org.netbeans.jemmy.operators.Operator
054:             */
055:            public void setOutput(TestOut output) {
056:                fOutput = output;
057:            }
058:
059:            /**
060:             * Should be in org.netbeans.jemmy.operators.AbstractOperator
061:             *
062:             * @see org.netbeans.jemmy.operators.Operator
063:             */
064:            public TestOut getOutput() {
065:                return fOutput;
066:            }
067:
068:            /**
069:             * Should be in org.netbeans.jemmy.operators.AbstractOperator
070:             *
071:             * @see org.netbeans.jemmy.operators.Operator
072:             */
073:            public void setTimeouts(Timeouts timeouts) {
074:                fTimeouts = timeouts;
075:            }
076:
077:            /**
078:             * Should be in org.netbeans.jemmy.operators.AbstractOperator
079:             *
080:             * @see org.netbeans.jemmy.operators.Operator
081:             */
082:            public Timeouts getTimeouts() {
083:                return fTimeouts;
084:            }
085:
086:            /**
087:             * Should be in org.netbeans.jemmy.operators.AbstractOperator
088:             *
089:             * @see org.netbeans.jemmy.operators.Operator
090:             */
091:            public JemmyProperties getProperties() {
092:                return fProperties;
093:            }
094:
095:            /**
096:             * Should be in org.netbeans.jemmy.operators.AbstractOperator
097:             *
098:             * @see org.netbeans.jemmy.operators.Operator
099:             */
100:            public JemmyProperties setProperties(JemmyProperties properties) {
101:                JemmyProperties oldProperties = getProperties();
102:                fProperties = properties;
103:                return oldProperties;
104:            }
105:
106:            /**
107:             * Waits a state specified by a Waitable instance. Should be in org.netbeans.jemmy.operators.AbstractOperator
108:             *
109:             * @see org.netbeans.jemmy.operators.Operator
110:             */
111:            public void waitState(final Waitable state) {
112:                Waiter stateWaiter = new Waiter(state);
113:                stateWaiter.setTimeouts(getTimeouts().cloneThis());
114:                stateWaiter.getTimeouts().setTimeout("Waiter.WaitingTime",
115:                        getTimeouts().getTimeout(WAIT_TIMEOUT_NAME));
116:                stateWaiter.setOutput(getOutput().createErrorOutput());
117:                JemmyBoundary.tryWaitAction(stateWaiter, state, fContext);
118:            }
119:
120:            public ContextOperator(Context context) {
121:                fContext = context;
122:            }
123:
124:            public void waitShowDocument() {
125:                waitShowDocument(Context.DEFAULT_TARGET);
126:            }
127:
128:            public void waitShowDocument(String target) {
129:                getOutput().printLine("Wait any url in frame " + target);
130:                getOutput().printGolden("Wait any url in frame " + target);
131:                waitState(new WaitFrame(target));
132:            }
133:
134:            public void waitShowDocument(URL url) {
135:                waitShowDocument(url, Context.DEFAULT_TARGET);
136:            }
137:
138:            public void waitShowDocument(URL url, String target) {
139:                getOutput()
140:                        .printLine("Wait \"" + url + "\" in frame " + target);
141:                getOutput().printGolden(
142:                        "Wait \"" + url + "\" in frame " + target);
143:                waitState(new WaitUrlInFrame(url, target));
144:            }
145:
146:            public Context getContext() {
147:                return fContext;
148:            }
149:
150:            /**
151:             * Checks that the applet asked for any document to be displayed.
152:             */
153:            static class WaitFrame implements  Waitable {
154:                private final String fTarget;
155:
156:                WaitFrame(String target) {
157:                    fTarget = target;
158:                }
159:
160:                public Object actionProduced(final Object obj) {
161:                    return ((Context) obj).getAppletPluginResults().getFrames()
162:                            .get(getTarget());
163:                }
164:
165:                public String getDescription() {
166:                    return "Wait for showDocument(" + getTarget() + ", ...)";
167:                }
168:
169:                public String getTarget() {
170:                    return fTarget;
171:                }
172:            }
173:
174:            /**
175:             * Checks that the applet asked for a specific document to be displayed.
176:             */
177:            static class WaitUrlInFrame extends WaitFrame {
178:                private final URL fUrl;
179:
180:                WaitUrlInFrame(URL url, String target) {
181:                    super (target);
182:                    fUrl = url;
183:                }
184:
185:                public Object actionProduced(Object obj) {
186:                    URL url = (URL) super .actionProduced(obj);
187:                    if (fUrl.equals(url)) {
188:                        return url;
189:                    }
190:                    return null;
191:                }
192:
193:                public String getDescription() {
194:                    return "Wait for showDocument(" + getTarget() + ", "
195:                            + fUrl.toExternalForm() + ")";
196:                }
197:            }
198:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.