Skip to content

Commit df00e91

Browse files
committed
sync: cherry-pick changes from feature/3.0.x
1 parent 67ea047 commit df00e91

59 files changed

Lines changed: 3031 additions & 50 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/com/smartbear/soapui/template/SoapuiProperties.java

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@
1818
import com.smartbear.soapui.template.property.EnvironmentProperty;
1919
import com.smartbear.soapui.template.setting.SoapuiSettings;
2020

21+
/**
22+
* Provides SoapuiProperties functionality for SOAP UI template processing.
23+
* <p>This component encapsulates reusable behavior used when constructing,
24+
* configuring, or interpreting SOAP UI requests and responses.</p>
25+
*
26+
* @author [@Loong Wan](https://github.com/loong10k)
27+
* @since 3.0.0
28+
* @see SoapuiProperties
29+
*/
2130
public class SoapuiProperties {
2231

2332
public final static String DEFAULT_SETTINGS_FILE = "soapui-settings.xml";
@@ -46,58 +55,128 @@ public class SoapuiProperties {
4655
private EnvironmentProperty env = new EnvironmentProperty();
4756

4857

58+
/**
59+
* Returns whether requests should be automatically created.
60+
*
61+
* @return {@code true} if requests should be created, {@code false} otherwise
62+
*/
4963
public boolean isCreateRequests() {
5064
return createRequests;
5165
}
5266

67+
/**
68+
* Sets whether requests should be automatically created.
69+
*
70+
* @param createRequests {@code true} to enable automatic request creation
71+
*/
5372
public void setCreateRequests(boolean createRequests) {
5473
this.createRequests = createRequests;
5574
}
5675

76+
/**
77+
* Returns the project timeout in milliseconds.
78+
*
79+
* @return the timeout value in milliseconds
80+
*/
5781
public long getTimeout() {
5882
return timeout;
5983
}
6084

85+
/**
86+
* Sets the project timeout in milliseconds.
87+
*
88+
* @param timeout the timeout value in milliseconds
89+
*/
6190
public void setTimeout(long timeout) {
6291
this.timeout = timeout;
6392
}
6493

94+
/**
95+
* Returns the maximum cache size for WSDL interfaces.
96+
*
97+
* @return the maximum number of entries in the cache
98+
*/
6599
public long getMaximumCacheSize() {
66100
return maximumCacheSize;
67101
}
68102

103+
/**
104+
* Sets the maximum cache size for WSDL interfaces.
105+
*
106+
* @param maximumCacheSize the maximum number of entries in the cache
107+
*/
69108
public void setMaximumCacheSize(long maximumCacheSize) {
70109
this.maximumCacheSize = maximumCacheSize;
71110
}
72111

112+
/**
113+
* Returns the cache duration in minutes.
114+
*
115+
* @return the cache duration in minutes
116+
*/
73117
public long getCacheDuration() {
74118
return cacheDuration;
75119
}
76120

121+
/**
122+
* Sets the cache duration in minutes.
123+
*
124+
* @param cacheDuration the cache duration in minutes
125+
*/
77126
public void setCacheDuration(long cacheDuration) {
78127
this.cacheDuration = cacheDuration;
79128
}
80129

130+
/**
131+
* Returns the environment property configuration.
132+
*
133+
* @return the {@link EnvironmentProperty} instance
134+
*/
81135
public EnvironmentProperty getEnv() {
82136
return env;
83137
}
84138

139+
/**
140+
* Sets the environment property configuration.
141+
*
142+
* @param env the {@link EnvironmentProperty} instance
143+
*/
85144
public void setEnv(EnvironmentProperty env) {
86145
this.env = env;
87146
}
88-
147+
148+
/**
149+
* Returns the path to the SoapUI settings file.
150+
*
151+
* @return the settings file path
152+
*/
89153
public String getSettingsFile() {
90154
return settingsFile;
91155
}
92156

157+
/**
158+
* Sets the path to the SoapUI settings file.
159+
*
160+
* @param settingsFile the settings file path
161+
*/
93162
public void setSettingsFile(String settingsFile) {
94163
this.settingsFile = settingsFile;
95164
}
96165

166+
/**
167+
* Returns the SoapUI settings configuration.
168+
*
169+
* @return the {@link SoapuiSettings} instance
170+
*/
97171
public SoapuiSettings getSettings() {
98172
return settings;
99173
}
100174

175+
/**
176+
* Sets the SoapUI settings configuration.
177+
*
178+
* @param settings the {@link SoapuiSettings} instance
179+
*/
101180
public void setSettings(SoapuiSettings settings) {
102181
this.settings = settings;
103182
}

src/main/java/com/smartbear/soapui/template/SoapuiResponse.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,30 @@
1919
import com.eviware.soapui.model.iface.Response;
2020
import com.eviware.soapui.model.iface.Submit.Status;
2121

22+
/**
23+
* Encapsulates the result of a SOAP UI request submission, holding the original
24+
* request, the response content, the submission status, and any error that occurred.
25+
*
26+
* @param <T> the type of the HTTP request, must extend {@link AbstractHttpRequestInterface}
27+
* @author [@Loong Wan](https://github.com/loong10k)
28+
* @since 3.0.0
29+
* @see AbstractHttpRequestInterface
30+
*/
2231
public class SoapuiResponse<T extends AbstractHttpRequestInterface<?>> {
2332

2433
private final T request;
2534
private final Status status;
2635
private final Exception error;
2736
private final Response response;
2837

38+
/**
39+
* Constructs a new SoapuiResponse with the given request, response, status, and error.
40+
*
41+
* @param request the original SOAP UI request
42+
* @param response the response received from the service
43+
* @param status the submission status
44+
* @param error the exception thrown during submission, or {@code null} if successful
45+
*/
2946
public SoapuiResponse(T request, Response response, Status status, Exception error) {
3047
super();
3148
this.request = request;
@@ -34,18 +51,38 @@ public SoapuiResponse(T request, Response response, Status status, Exception err
3451
this.error = error;
3552
}
3653

54+
/**
55+
* Returns the original request that was submitted.
56+
*
57+
* @return the request object
58+
*/
3759
public T getRequest() {
3860
return request;
3961
}
4062

63+
/**
64+
* Returns the submission status.
65+
*
66+
* @return the {@link Status} of the submission
67+
*/
4168
public Status getStatus() {
4269
return status;
4370
}
4471

72+
/**
73+
* Returns the exception that occurred during submission, if any.
74+
*
75+
* @return the exception, or {@code null} if no error occurred
76+
*/
4577
public Exception getError() {
4678
return error;
4779
}
4880

81+
/**
82+
* Returns the response received from the SOAP service.
83+
*
84+
* @return the {@link Response} object
85+
*/
4986
public Response getResponse() {
5087
return response;
5188
}

src/main/java/com/smartbear/soapui/template/SoapuiWsdlRequestTemplate.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@
3333
*
3434
* @author [@Loong Wan](https://github.com/loong10k)
3535
*/
36+
/**
37+
* Provides SoapuiWsdlRequestTemplate functionality for SOAP UI template processing.
38+
* <p>This component encapsulates reusable behavior used when constructing,
39+
* configuring, or interpreting SOAP UI requests and responses.</p>
40+
*
41+
* @author [@Loong Wan](https://github.com/loong10k)
42+
* @since 3.0.0
43+
* @see SoapuiWsdlRequestTemplate
44+
*/
3645
public class SoapuiWsdlRequestTemplate {
3746

3847
private SoapuiWsdlTemplate wsdlTemplate;

src/main/java/com/smartbear/soapui/template/SoapuiWsdlTemplate.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@
4141
* https://www.soapui.org/developers-corner/integrating-with-soapui.html
4242
* @author [@Loong Wan](https://github.com/loong10k)
4343
*/
44+
/**
45+
* Provides SoapuiWsdlTemplate functionality for SOAP UI template processing.
46+
* <p>This component encapsulates reusable behavior used when constructing,
47+
* configuring, or interpreting SOAP UI requests and responses.</p>
48+
*
49+
* @author [@Loong Wan](https://github.com/loong10k)
50+
* @since 3.0.0
51+
* @see SoapuiWsdlTemplate
52+
*/
4453
public class SoapuiWsdlTemplate {
4554

4655
private WsdlProject project;

src/main/java/com/smartbear/soapui/template/handler/AbstractResponseHandler.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,66 @@
33
import org.apache.http.client.ResponseHandler;
44
import org.apache.http.client.protocol.HttpClientContext;
55

6+
/**
7+
* Abstract base class for HTTP response handlers that provides common context
8+
* and charset configuration.
9+
*
10+
* @param <T> the type of the response object produced by this handler
11+
* @author [@Loong Wan](https://github.com/loong10k)
12+
* @since 3.0.0
13+
* @see ResponseHandler
14+
*/
615
public abstract class AbstractResponseHandler<T> implements ResponseHandler<T> {
716

817
protected HttpClientContext context;
918
protected String charsetStr;
1019

20+
/**
21+
* Constructs a new AbstractResponseHandler with the given context and charset.
22+
*
23+
* @param context the HTTP client context
24+
* @param charset the character set name used for response decoding
25+
*/
1126
public AbstractResponseHandler(HttpClientContext context, String charset) {
1227
this.context = context;
1328
this.charsetStr = charset;
1429
}
1530

31+
/**
32+
* Returns the HTTP client context.
33+
*
34+
* @return the {@link HttpClientContext}
35+
*/
1636
public HttpClientContext getContext() {
1737

1838
return context;
1939
}
2040

41+
/**
42+
* Sets the HTTP client context.
43+
*
44+
* @param context the {@link HttpClientContext} to use
45+
*/
2146
public void setContext(HttpClientContext context) {
2247

2348
this.context = context;
2449
}
2550

51+
/**
52+
* Returns the charset used for response decoding.
53+
*
54+
* @return the charset name
55+
*/
2656
public String getCharset() {
2757

2858
return charsetStr;
2959
}
3060

61+
/**
62+
* Sets the charset used for response decoding.
63+
*
64+
* @param charset the charset name
65+
*/
3166
public void setCharset(String charset) {
3267

3368
this.charsetStr = charset;

src/main/java/com/smartbear/soapui/template/handler/SoapRequestHandler.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323
* TODO
2424
* @author [@Loong Wan](https://github.com/loong10k)
2525
*/
26+
/**
27+
* Provides SoapRequestHandler functionality for SOAP UI template processing.
28+
* <p>This component encapsulates reusable behavior used when constructing,
29+
* configuring, or interpreting SOAP UI requests and responses.</p>
30+
*
31+
* @author [@Loong Wan](https://github.com/loong10k)
32+
* @since 3.0.0
33+
* @see SoapRequestHandler
34+
*/
2635
public interface SoapRequestHandler<T> {
2736

2837
String handleRequest(WsdlOperation operationInst, WsdlRequest request,T params) throws SoapUIException;

src/main/java/com/smartbear/soapui/template/handler/SoapResponseHandler.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,21 @@
55
import com.eviware.soapui.support.SoapUIException;
66

77
/**
8-
* Handler that encapsulates the process of generating a response object
9-
* from a {@link Response}.
8+
* Strategy interface for processing SOAP UI responses into application-specific types.
9+
*
10+
* @param <T> the type of the result produced by this handler
11+
* @author [@Loong Wan](https://github.com/loong10k)
12+
* @since 3.0.0
13+
* @see Response
1014
*/
1115
public interface SoapResponseHandler<T> {
1216

1317
/**
14-
* Processes an {@link Response} and returns some value
15-
* corresponding to that response.
16-
*
17-
* @param response The response to process
18-
* @return A value determined by the response
18+
* Processes a {@link Response} and returns a value corresponding to that response.
1919
*
20+
* @param response the response to process
21+
* @param version the SOAP version used in the response
22+
* @return a value determined by the response
2023
* @throws SoapUIException in case of a problem or the connection was aborted
2124
*/
2225
T handleResponse(Response response, SoapVersion version) throws SoapUIException;
Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
1-
package com.smartbear.soapui.template.handler.def;
1+
package com.smartbear.soapui.template.handler.def;
22

33
import com.eviware.soapui.impl.wsdl.support.soap.SoapVersion;
44
import com.eviware.soapui.model.iface.Response;
55
import com.eviware.soapui.support.SoapUIException;
66
import com.smartbear.soapui.template.handler.SoapResponseHandler;
77

88
/**
9-
* 请求响应处理:返回String对象
9+
* Response handler that extracts the SOAP response content as a plain text string.
10+
*
1011
* @author [@Loong Wan](https://github.com/loong10k)
12+
* @since 3.0.0
13+
* @see SoapResponseHandler
1114
*/
1215
public class SoapPlaintextResponseHandler implements SoapResponseHandler<String> {
13-
14-
@Override
16+
17+
/**
18+
* {@inheritDoc}
19+
*
20+
* @return the response content as a plain text string
21+
*/
22+
@Override
1523
public String handleResponse(Response response, SoapVersion version) throws SoapUIException {
1624
return response.getContentAsString();
1725
}
18-
26+
1927
}
2028

2129

0 commit comments

Comments
 (0)