01: /*
02: * soapUI, copyright (C) 2004-2007 eviware.com
03: *
04: * soapUI is free software; you can redistribute it and/or modify it under the
05: * terms of version 2.1 of the GNU Lesser General Public License as published by
06: * the Free Software Foundation.
07: *
08: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
09: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: * See the GNU Lesser General Public License for more details at gnu.org.
11: */
12:
13: package com.eviware.soapui.impl.wsdl.teststeps.actions;
14:
15: import java.awt.event.ActionEvent;
16:
17: import javax.swing.AbstractAction;
18: import javax.swing.Action;
19:
20: import com.eviware.soapui.impl.wsdl.WsdlOperation;
21: import com.eviware.soapui.impl.wsdl.WsdlRequest;
22: import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep;
23: import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStepResult;
24: import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestStepResult;
25: import com.eviware.soapui.support.UISupport;
26:
27: /**
28: * Creates a request from the specified TestStepResult
29: *
30: * @author Ole.Matzura
31: */
32:
33: public class CreateRequestAction extends AbstractAction {
34: private final WsdlTestRequestStepResult result;
35:
36: public CreateRequestAction(WsdlTestStepResult result) {
37: this .result = (WsdlTestRequestStepResult) result;
38:
39: putValue(Action.SMALL_ICON, UISupport
40: .createImageIcon("/create_request_from_result.gif"));
41: putValue(Action.SHORT_DESCRIPTION,
42: "Creates a new request from this result");
43: }
44:
45: public void actionPerformed(ActionEvent e) {
46: WsdlTestRequestStep step = (WsdlTestRequestStep) result
47: .getTestStep();
48: String name = UISupport.prompt("Specify name of request",
49: "Create Request", "Result from " + step.getName());
50:
51: if (name != null) {
52: WsdlOperation operation = (WsdlOperation) step
53: .getTestRequest().getOperation();
54: WsdlRequest request = operation.addNewRequest(name);
55: request.setRequestContent(result.getRequestContent());
56: request.setDomain(result.getDomain());
57: request.setEncoding(result.getEncoding());
58: request.setEndpoint(result.getEndpoint());
59: request.setPassword(result.getPassword());
60: request.setUsername(result.getUsername());
61:
62: UISupport.showDesktopPanel(request);
63: }
64: }
65: }
|