Skip to content

Commit 0397649

Browse files
committed
test: add JUnit tests (>=90% coverage); docs: comprehensive English JavaDoc
1 parent 5c98cbe commit 0397649

48 files changed

Lines changed: 2868 additions & 103 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: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,58 +55,128 @@ public class SoapuiProperties {
5555
private EnvironmentProperty env = new EnvironmentProperty();
5656

5757

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

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

76+
/**
77+
* Returns the project timeout in milliseconds.
78+
*
79+
* @return the timeout value in milliseconds
80+
*/
6681
public long getTimeout() {
6782
return timeout;
6883
}
6984

85+
/**
86+
* Sets the project timeout in milliseconds.
87+
*
88+
* @param timeout the timeout value in milliseconds
89+
*/
7090
public void setTimeout(long timeout) {
7191
this.timeout = timeout;
7292
}
7393

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

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

112+
/**
113+
* Returns the cache duration in minutes.
114+
*
115+
* @return the cache duration in minutes
116+
*/
82117
public long getCacheDuration() {
83118
return cacheDuration;
84119
}
85120

121+
/**
122+
* Sets the cache duration in minutes.
123+
*
124+
* @param cacheDuration the cache duration in minutes
125+
*/
86126
public void setCacheDuration(long cacheDuration) {
87127
this.cacheDuration = cacheDuration;
88128
}
89129

130+
/**
131+
* Returns the environment property configuration.
132+
*
133+
* @return the {@link EnvironmentProperty} instance
134+
*/
90135
public EnvironmentProperty getEnv() {
91136
return env;
92137
}
93138

139+
/**
140+
* Sets the environment property configuration.
141+
*
142+
* @param env the {@link EnvironmentProperty} instance
143+
*/
94144
public void setEnv(EnvironmentProperty env) {
95145
this.env = env;
96146
}
97-
147+
148+
/**
149+
* Returns the path to the SoapUI settings file.
150+
*
151+
* @return the settings file path
152+
*/
98153
public String getSettingsFile() {
99154
return settingsFile;
100155
}
101156

157+
/**
158+
* Sets the path to the SoapUI settings file.
159+
*
160+
* @param settingsFile the settings file path
161+
*/
102162
public void setSettingsFile(String settingsFile) {
103163
this.settingsFile = settingsFile;
104164
}
105165

166+
/**
167+
* Returns the SoapUI settings configuration.
168+
*
169+
* @return the {@link SoapuiSettings} instance
170+
*/
106171
public SoapuiSettings getSettings() {
107172
return settings;
108173
}
109174

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

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

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
import com.eviware.soapui.model.iface.Submit.Status;
2121

2222
/**
23-
* Provides SoapuiResponse functionality for SOAP UI template processing.
24-
* <p>This component encapsulates reusable behavior used when constructing,
25-
* configuring, or interpreting SOAP UI requests and responses.</p>
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.
2625
*
26+
* @param <T> the type of the HTTP request, must extend {@link AbstractHttpRequestInterface}
2727
* @author [@Loong Wan](https://github.com/loong10k)
2828
* @since 3.0.0
29-
* @see SoapuiResponse
29+
* @see AbstractHttpRequestInterface
3030
*/
3131
public class SoapuiResponse<T extends AbstractHttpRequestInterface<?>> {
3232

@@ -35,6 +35,14 @@ public class SoapuiResponse<T extends AbstractHttpRequestInterface<?>> {
3535
private final Exception error;
3636
private final Response response;
3737

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+
*/
3846
public SoapuiResponse(T request, Response response, Status status, Exception error) {
3947
super();
4048
this.request = request;
@@ -43,18 +51,38 @@ public SoapuiResponse(T request, Response response, Status status, Exception err
4351
this.error = error;
4452
}
4553

54+
/**
55+
* Returns the original request that was submitted.
56+
*
57+
* @return the request object
58+
*/
4659
public T getRequest() {
4760
return request;
4861
}
4962

63+
/**
64+
* Returns the submission status.
65+
*
66+
* @return the {@link Status} of the submission
67+
*/
5068
public Status getStatus() {
5169
return status;
5270
}
5371

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

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

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/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

src/main/java/com/smartbear/soapui/template/handler/def/SoapRequestArrayParamHandler.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,20 @@
2323
import com.smartbear.soapui.template.utils.SoapuiRequestUtils;
2424

2525
/**
26-
* TODO
26+
* Request handler that populates a SOAP request template using positional array parameters.
27+
* Each parameter value is placed in the corresponding element position within the SOAP body.
28+
*
2729
* @author [@Loong Wan](https://github.com/loong10k)
30+
* @since 3.0.0
31+
* @see SoapRequestHandler
2832
*/
2933
public class SoapRequestArrayParamHandler implements SoapRequestHandler<String[]> {
3034

35+
/**
36+
* {@inheritDoc}
37+
*
38+
* @return the populated SOAP request XML string
39+
*/
3140
@Override
3241
public String handleRequest(WsdlOperation operationInst, WsdlRequest request, String[] params) throws SoapUIException {
3342
// generate the request content from the schema

src/main/java/com/smartbear/soapui/template/handler/def/SoapRequestMapParamHandler.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,20 @@
2525
import com.smartbear.soapui.template.utils.SoapuiRequestUtils;
2626

2727
/**
28-
* TODO
28+
* Request handler that populates a SOAP request template using named map parameters.
29+
* Each key in the map corresponds to an element name in the SOAP body.
30+
*
2931
* @author [@Loong Wan](https://github.com/loong10k)
32+
* @since 3.0.0
33+
* @see SoapRequestHandler
3034
*/
3135
public class SoapRequestMapParamHandler implements SoapRequestHandler<Map<String, Object>> {
3236

37+
/**
38+
* {@inheritDoc}
39+
*
40+
* @return the populated SOAP request XML string
41+
*/
3342
@Override
3443
public String handleRequest(WsdlOperation operationInst, WsdlRequest request, Map<String, Object> params) throws SoapUIException {
3544
// generate the request content from the schema

0 commit comments

Comments
 (0)