Source Code Cross Referenced for WsdlMessageAssertion.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 javax.swing.ImageIcon;
016:
017:        import org.apache.xmlbeans.XmlObject;
018:
019:        import com.eviware.soapui.config.RequestAssertionConfig;
020:        import com.eviware.soapui.impl.wsdl.submit.WsdlMessageExchange;
021:        import com.eviware.soapui.impl.wsdl.support.assertions.Assertable;
022:        import com.eviware.soapui.impl.wsdl.support.assertions.Assertable.AssertionStatus;
023:        import com.eviware.soapui.impl.wsdl.teststeps.assertions.AssertionError;
024:        import com.eviware.soapui.impl.wsdl.teststeps.assertions.AssertionException;
025:        import com.eviware.soapui.impl.wsdl.teststeps.assertions.WsdlAssertionRegistry;
026:        import com.eviware.soapui.model.iface.SubmitContext;
027:        import com.eviware.soapui.model.settings.Settings;
028:        import com.eviware.soapui.model.support.AbstractModelItem;
029:        import com.eviware.soapui.support.UISupport;
030:
031:        /**
032:         * Base class for WsdlAssertions
033:         * 
034:         * @author Ole.Matzura
035:         */
036:
037:        public abstract class WsdlMessageAssertion extends AbstractModelItem {
038:            private RequestAssertionConfig assertionConfig;
039:            private final Assertable assertable;
040:            private AssertionStatus assertionStatus = AssertionStatus.UNKNOWN;
041:            private com.eviware.soapui.impl.wsdl.teststeps.assertions.AssertionError[] assertionErrors;
042:            private ImageIcon validIcon;
043:            private ImageIcon failedIcon;
044:            private ImageIcon unknownIcon;
045:
046:            public final static String STATUS_PROPERTY = WsdlMessageAssertion.class
047:                    .getName()
048:                    + "@status";
049:            public final static String ERRORS_PROPERTY = WsdlMessageAssertion.class
050:                    .getName()
051:                    + "@errors";
052:            public final static String CONFIGURATION_PROPERTY = WsdlMessageAssertion.class
053:                    .getName()
054:                    + "@configuration";
055:            private final boolean cloneable;
056:            private final boolean configurable;
057:
058:            protected WsdlMessageAssertion(
059:                    RequestAssertionConfig assertionConfig,
060:                    Assertable modelItem, boolean cloneable,
061:                    boolean configurable) {
062:                this .assertionConfig = assertionConfig;
063:                this .assertable = modelItem;
064:                this .cloneable = cloneable;
065:                this .configurable = configurable;
066:
067:                validIcon = UISupport.createImageIcon("/valid_assertion.gif");
068:                failedIcon = UISupport.createImageIcon("/failed_assertion.gif");
069:                unknownIcon = UISupport
070:                        .createImageIcon("/unknown_assertion.gif");
071:            }
072:
073:            public XmlObject getConfiguration() {
074:                if (null == assertionConfig.getConfiguration()) {
075:                    assertionConfig.addNewConfiguration();
076:                }
077:
078:                return assertionConfig.getConfiguration();
079:            }
080:
081:            public void setConfiguration(XmlObject configuration) {
082:                XmlObject oldConfig = assertionConfig.getConfiguration();
083:                assertionConfig.setConfiguration(configuration);
084:                notifyPropertyChanged(
085:                        WsdlMessageAssertion.CONFIGURATION_PROPERTY, oldConfig,
086:                        configuration);
087:            }
088:
089:            public String getName() {
090:                return assertionConfig.isSetName() ? assertionConfig.getName()
091:                        : WsdlAssertionRegistry.getInstance()
092:                                .getAssertionNameForType(
093:                                        assertionConfig.getType());
094:            }
095:
096:            public void setName(String name) {
097:                String old = getName();
098:                assertionConfig.setName(name);
099:                notifyPropertyChanged(NAME_PROPERTY, old, name);
100:            }
101:
102:            public AssertionStatus getStatus() {
103:                return assertionStatus;
104:            }
105:
106:            public AssertionError[] getErrors() {
107:                return assertionErrors;
108:            }
109:
110:            public AssertionStatus assertResponse(
111:                    WsdlMessageExchange messageExchange, SubmitContext context) {
112:                AssertionStatus oldStatus = assertionStatus;
113:                AssertionError[] oldErrors = getErrors();
114:                ImageIcon oldIcon = getIcon();
115:
116:                if (!messageExchange.hasResponse()) {
117:                    if (messageExchange.getOperation().isOneWay()) {
118:                        assertionStatus = AssertionStatus.VALID;
119:                        assertionErrors = null;
120:                    } else {
121:                        assertionStatus = AssertionStatus.FAILED;
122:                        assertionErrors = new com.eviware.soapui.impl.wsdl.teststeps.assertions.AssertionError[] { new com.eviware.soapui.impl.wsdl.teststeps.assertions.AssertionError(
123:                                "null/empty response") };
124:                    }
125:                } else {
126:                    try {
127:                        internalAssertResponse(messageExchange, context);
128:                        assertionStatus = AssertionStatus.VALID;
129:                        assertionErrors = null;
130:                    } catch (AssertionException e) {
131:                        assertionStatus = AssertionStatus.FAILED;
132:                        assertionErrors = e.getErrors();
133:                    } catch (Throwable e) {
134:                        assertionStatus = AssertionStatus.FAILED;
135:                        assertionErrors = new com.eviware.soapui.impl.wsdl.teststeps.assertions.AssertionError[] { new com.eviware.soapui.impl.wsdl.teststeps.assertions.AssertionError(
136:                                e.getMessage()) };
137:                    }
138:                }
139:
140:                notifyPropertyChanged(STATUS_PROPERTY, oldStatus,
141:                        assertionStatus);
142:                notifyPropertyChanged(ERRORS_PROPERTY, oldErrors,
143:                        assertionErrors);
144:                notifyPropertyChanged(ICON_PROPERTY, oldIcon, getIcon());
145:
146:                return assertionStatus;
147:            }
148:
149:            protected abstract String internalAssertResponse(
150:                    WsdlMessageExchange messageExchange, SubmitContext context)
151:                    throws AssertionException;
152:
153:            public AssertionStatus assertRequest(
154:                    WsdlMessageExchange messageExchange, SubmitContext context) {
155:                AssertionStatus oldStatus = assertionStatus;
156:                ImageIcon oldIcon = getIcon();
157:
158:                if (!messageExchange.hasRequest(true)) {
159:                    assertionStatus = AssertionStatus.FAILED;
160:                    assertionErrors = new com.eviware.soapui.impl.wsdl.teststeps.assertions.AssertionError[] { new com.eviware.soapui.impl.wsdl.teststeps.assertions.AssertionError(
161:                            "null/empty response") };
162:                } else {
163:                    try {
164:                        internalAssertRequest(messageExchange, context);
165:                        assertionStatus = AssertionStatus.VALID;
166:                        assertionErrors = null;
167:                    } catch (AssertionException e) {
168:                        assertionStatus = AssertionStatus.FAILED;
169:                        assertionErrors = e.getErrors();
170:                    } catch (Throwable e) {
171:                        assertionStatus = AssertionStatus.FAILED;
172:                        assertionErrors = new com.eviware.soapui.impl.wsdl.teststeps.assertions.AssertionError[] { new com.eviware.soapui.impl.wsdl.teststeps.assertions.AssertionError(
173:                                e.getMessage()) };
174:                    }
175:                }
176:
177:                notifyPropertyChanged(STATUS_PROPERTY, oldStatus,
178:                        assertionStatus);
179:                notifyPropertyChanged(ICON_PROPERTY, oldIcon, getIcon());
180:
181:                return assertionStatus;
182:            }
183:
184:            protected abstract String internalAssertRequest(
185:                    WsdlMessageExchange messageExchange, SubmitContext context)
186:                    throws AssertionException;
187:
188:            public boolean isConfigurable() {
189:                return configurable;
190:            }
191:
192:            public boolean isClonable() {
193:                return cloneable;
194:            }
195:
196:            public boolean configure() {
197:                return true;
198:            }
199:
200:            public String getDescription() {
201:                return getConfig().getDescription();
202:            }
203:
204:            public ImageIcon getIcon() {
205:                switch (getStatus()) {
206:                case FAILED:
207:                    return failedIcon;
208:                case UNKNOWN:
209:                    return unknownIcon;
210:                case VALID:
211:                    return validIcon;
212:                }
213:
214:                return null;
215:            }
216:
217:            public void updateConfig(RequestAssertionConfig config) {
218:                this .assertionConfig = config;
219:            }
220:
221:            public RequestAssertionConfig getConfig() {
222:                return assertionConfig;
223:            }
224:
225:            public Settings getSettings() {
226:                return assertable.getTestStep().getSettings();
227:            }
228:
229:            public void release() {
230:            }
231:
232:            public Assertable getAssertable() {
233:                return assertable;
234:            }
235:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.