Source Code Cross Referenced for WsdlTestStepResult.java in  » Web-Services » soapui-1.7.5 » com » eviware » soapui » impl » wsdl » teststeps » 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 » Web Services » soapui 1.7.5 » com.eviware.soapui.impl.wsdl.teststeps 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  soapUI, copyright (C) 2004-2007 eviware.com 
003:         *
004:         *  soapUI is free software; you can redistribute it and/or modify it under the 
005:         *  terms of version 2.1 of the GNU Lesser General Public License as published by 
006:         *  the Free Software Foundation.
007:         *
008:         *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
009:         *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
010:         *  See the GNU Lesser General Public License for more details at gnu.org.
011:         */
012:
013:        package com.eviware.soapui.impl.wsdl.teststeps;
014:
015:        import java.awt.event.ActionEvent;
016:        import java.io.PrintWriter;
017:        import java.util.ArrayList;
018:        import java.util.Date;
019:        import java.util.List;
020:
021:        import javax.swing.AbstractAction;
022:        import javax.swing.Action;
023:
024:        import com.eviware.soapui.model.testsuite.TestStep;
025:        import com.eviware.soapui.model.testsuite.TestStepResult;
026:        import com.eviware.soapui.support.UISupport;
027:        import com.eviware.soapui.support.action.swing.ActionList;
028:        import com.eviware.soapui.support.action.swing.DefaultActionList;
029:
030:        /**
031:         * Default implementation of TestStepResult interface 
032:         * 
033:         * @author Ole.Matzura
034:         */
035:
036:        public class WsdlTestStepResult implements  TestStepResult {
037:            private static final String[] EMPTY_MESSAGES = new String[0];
038:            private final WsdlTestStep testStep;
039:            private List<String> messages = new ArrayList<String>();
040:            private Throwable error;
041:            private TestStepStatus status = TestStepStatus.UNKNOWN;
042:            private long timeTaken;
043:            private long timeStamp;
044:            private long size;
045:            private DefaultActionList actionList;
046:            private long startTime;
047:            private boolean discarded;
048:
049:            private static DefaultActionList discardedActionList = new DefaultActionList(
050:                    null);
051:
052:            static {
053:                discardedActionList.setDefaultAction(new AbstractAction() {
054:                    public void actionPerformed(ActionEvent arg0) {
055:                        UISupport.showErrorMessage("Result has been discarded");
056:                    }
057:                });
058:            }
059:
060:            public WsdlTestStepResult(WsdlTestStep testStep) {
061:                this .testStep = testStep;
062:                timeStamp = System.currentTimeMillis();
063:            }
064:
065:            public TestStepStatus getStatus() {
066:                return status;
067:            }
068:
069:            public void setStatus(TestStepStatus status) {
070:                this .status = status;
071:            }
072:
073:            public TestStep getTestStep() {
074:                return testStep;
075:            }
076:
077:            public ActionList getActions() {
078:                if (isDiscarded())
079:                    return discardedActionList;
080:
081:                if (actionList == null) {
082:                    actionList = new DefaultActionList(testStep.getName());
083:                    actionList.setDefaultAction(new AbstractAction() {
084:
085:                        public void actionPerformed(ActionEvent e) {
086:                            if (getMessages().length > 0) {
087:                                StringBuffer buf = new StringBuffer();
088:                                if (getError() != null)
089:                                    buf.append(getError().toString()).append(
090:                                            "\r\n");
091:
092:                                for (String s : getMessages())
093:                                    buf.append(s).append("\r\n");
094:
095:                                UISupport.showExtendedInfo("TestStep Result",
096:                                        "Step [" + testStep.getName()
097:                                                + "] ran with status ["
098:                                                + getStatus() + "]", buf
099:                                                .toString(), null);
100:                            } else if (getError() != null) {
101:                                UISupport.showExtendedInfo("TestStep Result",
102:                                        "Step [" + testStep.getName()
103:                                                + "] ran with status ["
104:                                                + getStatus() + "]", getError()
105:                                                .toString(), null);
106:                            } else {
107:                                UISupport.showInfoMessage("Step ["
108:                                        + testStep.getName()
109:                                        + "] ran with status [" + getStatus()
110:                                        + "]", "TestStep Result");
111:                            }
112:                        }
113:                    });
114:                }
115:
116:                return actionList;
117:            }
118:
119:            public void addAction(Action action, boolean isDefault) {
120:                if (isDiscarded())
121:                    return;
122:
123:                if (actionList == null) {
124:                    actionList = new DefaultActionList(testStep.getName());
125:                }
126:
127:                actionList.addAction(action);
128:                if (isDefault)
129:                    actionList.setDefaultAction(action);
130:            }
131:
132:            public Throwable getError() {
133:                return error;
134:            }
135:
136:            public void setError(Throwable error) {
137:                this .error = error;
138:            }
139:
140:            public String[] getMessages() {
141:                return messages == null ? EMPTY_MESSAGES : messages
142:                        .toArray(new String[messages.size()]);
143:            }
144:
145:            public void addMessage(String message) {
146:                if (messages != null)
147:                    messages.add(message);
148:            }
149:
150:            public long getTimeTaken() {
151:                return timeTaken;
152:            }
153:
154:            public void setTimeTaken(long timeTaken) {
155:                this .timeTaken = timeTaken;
156:            }
157:
158:            public long getTimeStamp() {
159:                return timeStamp;
160:            }
161:
162:            public void setTimeStamp(long timeStamp) {
163:                this .timeStamp = timeStamp;
164:            }
165:
166:            public void setSize(long size) {
167:                this .size = size;
168:            }
169:
170:            public long getSize() {
171:                return size;
172:            }
173:
174:            public void writeTo(PrintWriter writer) {
175:                writer.println("Status: " + getStatus());
176:                writer.println("Time Taken: " + getTimeTaken());
177:                writer.println("Size: " + getSize());
178:                writer.println("Timestamp: "
179:                        + new Date(getTimeStamp()).toString());
180:                writer.println("TestStep: " + getTestStep().getName());
181:                if (error != null)
182:                    writer.println("Error:" + error.toString());
183:
184:                if (messages != null)
185:                    for (String message : messages)
186:                        if (message != null)
187:                            writer.println(message);
188:
189:                if (isDiscarded())
190:                    writer.println("Result has been Discarded!");
191:            }
192:
193:            public void startTimer() {
194:                startTime = System.nanoTime();
195:            }
196:
197:            public void stopTimer() {
198:                timeTaken = ((System.nanoTime() - startTime) / 1000000);
199:            }
200:
201:            public void discard() {
202:                discarded = true;
203:
204:                messages = null;
205:                error = null;
206:                actionList = null;
207:            }
208:
209:            public boolean isDiscarded() {
210:                return discarded;
211:            }
212:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.