Source Code Cross Referenced for AddRequestToTestCaseAction.java in  » Web-Services » soapui-1.7.5 » com » eviware » soapui » impl » wsdl » actions » request » 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.actions.request 
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.actions.request;
014:
015:        import com.eviware.soapui.SoapUI;
016:        import com.eviware.soapui.impl.wsdl.WsdlProject;
017:        import com.eviware.soapui.impl.wsdl.WsdlRequest;
018:        import com.eviware.soapui.impl.wsdl.actions.support.AbstractAddToTestCaseAction;
019:        import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase;
020:        import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep;
021:        import com.eviware.soapui.impl.wsdl.teststeps.assertions.NotSoapFaultAssertion;
022:        import com.eviware.soapui.impl.wsdl.teststeps.assertions.SchemaComplianceAssertion;
023:        import com.eviware.soapui.impl.wsdl.teststeps.assertions.SoapResponseAssertion;
024:        import com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestRequestStepFactory;
025:        import com.eviware.soapui.support.UISupport;
026:        import com.eviware.soapui.support.types.StringToStringMap;
027:        import com.eviware.soapui.ui.desktop.SoapUIDesktop;
028:        import com.eviware.x.form.XForm;
029:        import com.eviware.x.form.XFormDialog;
030:        import com.eviware.x.form.XFormDialogBuilder;
031:        import com.eviware.x.form.XFormFactory;
032:        import com.eviware.x.form.XFormField;
033:
034:        /**
035:         * Adds a WsdlRequest to a WsdlTestCase as a WsdlTestRequestStep
036:         * 
037:         * @author Ole.Matzura
038:         */
039:
040:        public class AddRequestToTestCaseAction extends
041:                AbstractAddToTestCaseAction<WsdlRequest> {
042:            public static final String SOAPUI_ACTION_ID = "AddRequestToTestCaseAction";
043:
044:            private static final String STEP_NAME = "Name";
045:            private static final String ADD_SOAP_FAULT_ASSERTION = "Add Not SOAP Fault Assertion";
046:            private static final String ADD_SOAP_RESPONSE_ASSERTION = "Add SOAP Response Assertion";
047:            private static final String ADD_SCHEMA_ASSERTION = "Add Schema Assertion";
048:            private static final String CLOSE_REQUEST = "Close Request Window";
049:            private static final String SHOW_TESTCASE = "Shows TestCase Editor";
050:            private static final String COPY_ATTACHMENTS = "Copy Attachments";
051:            private static final String COPY_HTTPHEADERS = "Copy HTTP Headers";
052:
053:            private XFormDialog dialog;
054:            private StringToStringMap dialogValues = new StringToStringMap();
055:            private XFormField closeRequestCheckBox;
056:
057:            public AddRequestToTestCaseAction() {
058:                super ("Add to TestCase", "Adds this request to a TestCase");
059:            }
060:
061:            public void perform(WsdlRequest request, Object param) {
062:                WsdlProject project = request.getOperation().getInterface()
063:                        .getProject();
064:
065:                WsdlTestCase testCase = getTargetTestCase(project);
066:                if (testCase != null)
067:                    addRequest(testCase, request, -1);
068:            }
069:
070:            public WsdlTestRequestStep addRequest(WsdlTestCase testCase,
071:                    WsdlRequest request, int position) {
072:                if (dialog == null)
073:                    buildDialog();
074:
075:                dialogValues.put(STEP_NAME, request.getOperation().getName()
076:                        + " - " + request.getName());
077:                dialogValues.put(CLOSE_REQUEST, "true");
078:                dialogValues.put(SHOW_TESTCASE, "true");
079:                dialog.getFormField(COPY_ATTACHMENTS).setEnabled(
080:                        request.getAttachmentCount() > 0);
081:                dialog.setBooleanValue(COPY_ATTACHMENTS, true);
082:
083:                dialog.getFormField(COPY_HTTPHEADERS).setEnabled(
084:                        request.getRequestHeaders().size() > 0);
085:                dialog.setBooleanValue(COPY_HTTPHEADERS, true);
086:
087:                SoapUIDesktop desktop = SoapUI.getDesktop();
088:                closeRequestCheckBox.setEnabled(desktop != null
089:                        && desktop.hasDesktopPanel(request));
090:
091:                dialogValues = dialog.show(dialogValues);
092:                if (dialog.getReturnValue() != XFormDialog.OK_OPTION)
093:                    return null;
094:                ;
095:
096:                String name = dialogValues.get(STEP_NAME);
097:
098:                WsdlTestRequestStep test = (WsdlTestRequestStep) testCase
099:                        .insertTestStep(WsdlTestRequestStepFactory
100:                                .createConfig(request, name), position);
101:
102:                if (dialogValues.getBoolean(COPY_ATTACHMENTS))
103:                    request.copyAttachmentsTo(test.getTestRequest());
104:
105:                if (dialogValues.getBoolean(COPY_HTTPHEADERS))
106:                    test.getTestRequest().setRequestHeaders(
107:                            request.getRequestHeaders());
108:
109:                if (dialogValues.getBoolean(ADD_SOAP_RESPONSE_ASSERTION))
110:                    test.getTestRequest()
111:                            .addAssertion(SoapResponseAssertion.ID);
112:
113:                if (dialogValues.getBoolean(ADD_SCHEMA_ASSERTION))
114:                    test.getTestRequest().addAssertion(
115:                            SchemaComplianceAssertion.ID);
116:
117:                if (dialogValues.getBoolean(ADD_SOAP_FAULT_ASSERTION))
118:                    test.getTestRequest().addAssertion(
119:                            NotSoapFaultAssertion.LABEL);
120:
121:                UISupport.selectAndShow(test);
122:
123:                if (dialogValues.getBoolean(CLOSE_REQUEST) && desktop != null) {
124:                    desktop.closeDesktopPanel(request);
125:                }
126:
127:                if (dialogValues.getBoolean(SHOW_TESTCASE)) {
128:                    UISupport.selectAndShow(testCase);
129:                }
130:
131:                return test;
132:            }
133:
134:            private void buildDialog() {
135:                XFormDialogBuilder builder = XFormFactory
136:                        .createDialogBuilder("Add Request to TestCase");
137:                XForm mainForm = builder.createForm("Basic");
138:
139:                mainForm.addTextField(STEP_NAME, "Name of TestStep",
140:                        XForm.FieldType.URL).setWidth(30);
141:
142:                mainForm.addCheckBox(ADD_SOAP_RESPONSE_ASSERTION,
143:                        "(adds validation that response is a SOAP message)");
144:                mainForm
145:                        .addCheckBox(ADD_SCHEMA_ASSERTION,
146:                                "(adds validation that response complies with its schema)");
147:                mainForm.addCheckBox(ADD_SOAP_FAULT_ASSERTION,
148:                        "(adds validation that response is not a SOAP Fault)");
149:                closeRequestCheckBox = mainForm.addCheckBox(CLOSE_REQUEST,
150:                        "(closes the current window for this request)");
151:                mainForm.addCheckBox(SHOW_TESTCASE,
152:                        "(opens the TestCase editor for the target TestCase)");
153:                mainForm.addCheckBox(COPY_ATTACHMENTS,
154:                        "(copies the requests attachments to the TestRequest)");
155:                mainForm
156:                        .addCheckBox(COPY_HTTPHEADERS,
157:                                "(copies the requests HTTP-Headers to the TestRequest)");
158:
159:                dialog = builder.buildDialog(builder.buildOkCancelActions(),
160:                        "Specify options for adding the request to a TestCase",
161:                        UISupport.OPTIONS_ICON);
162:
163:                dialogValues.put(ADD_SOAP_RESPONSE_ASSERTION, Boolean.TRUE
164:                        .toString());
165:            }
166:        }
w__w___w.__j___a__va2__s__.__c___o__m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.