Skip to content

Commit 049400f

Browse files
committed
improve web url parameters
improve web url parameters
1 parent 6fccc1a commit 049400f

2 files changed

Lines changed: 35 additions & 8 deletions

File tree

src/main/java/es/prodevelop/testar/api/model/Params.java

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ public class Params {
2424

2525
@JsonProperty("sutConnectorValue")
2626
private String sutConnectorValue = null;
27+
28+
@JsonProperty("webURL")
29+
private String webURL = null;
2730

2831
@JsonProperty("sequences")
2932
private Integer sequences = null;
@@ -134,6 +137,25 @@ public Params sutConnectorValue(String sutConnectorValue) {
134137
this.sutConnectorValue = sutConnectorValue;
135138
return this;
136139
}
140+
141+
/**
142+
* Indicate the URL of a web page to test
143+
* @return webURL
144+
*/
145+
@ApiModelProperty(example = "https://www.google.es/", value = "Indicate the URL of a web page to test")
146+
147+
public String getWebURL() {
148+
return webURL;
149+
}
150+
151+
public void setWebURL(String webURL) {
152+
this.webURL = webURL;
153+
}
154+
155+
public Params webURL(String webURL) {
156+
this.webURL = webURL;
157+
return this;
158+
}
137159

138160
/**
139161
* Number of sequences to generate
@@ -235,7 +257,6 @@ public Params sequenceFileName(String sequenceFileName) {
235257
* @return applicationName
236258
**/
237259
@ApiModelProperty(example = "Notepad", value = "Name of the application run that we are executing")
238-
@NotNull
239260

240261
public String getApplicationName() {
241262
return applicationName;
@@ -255,7 +276,6 @@ public Params applicationName(String applicationName) {
255276
* @return applicationVersion
256277
**/
257278
@ApiModelProperty(example = "1.0.0", value = "Number of the version run that we are executing")
258-
@NotNull
259279

260280
public String getApplicationVersion() {
261281
return applicationVersion;
@@ -275,7 +295,6 @@ public Params applicationVersion(String applicationVersion) {
275295
* @return loginUsername
276296
**/
277297
@ApiModelProperty(example = "username", value = "Username credential to use in the beginSequence method of the protocol")
278-
@NotNull
279298

280299
public String getLoginUsername() {
281300
return loginUsername;
@@ -295,7 +314,6 @@ public Params loginUsername(String loginUsername) {
295314
* @return loginPassword
296315
**/
297316
@ApiModelProperty(example = "password", value = "Password credential to use in the beginSequence method of the protocol")
298-
@NotNull
299317

300318
public String getLoginPassword() {
301319
return loginPassword;
@@ -315,7 +333,6 @@ public Params loginPassword(String loginPassword) {
315333
* @return topWidgetsState
316334
**/
317335
@ApiModelProperty(example = "true", value = "Derive TESTAR Actions with the Top Widgets Of the State")
318-
@NotNull
319336

320337
public boolean getTopWidgetsState() {
321338
return topWidgetsState;
@@ -343,6 +360,7 @@ public boolean equals(java.lang.Object o) {
343360
Objects.equals(this.mode, params.mode) &&
344361
Objects.equals(this.sutConnector, params.sutConnector) &&
345362
Objects.equals(this.sutConnectorValue, params.sutConnectorValue) &&
363+
Objects.equals(this.webURL, params.webURL) &&
346364
Objects.equals(this.sequences, params.sequences) &&
347365
Objects.equals(this.sequenceLength, params.sequenceLength) &&
348366
Objects.equals(this.suspiciousTitles, params.suspiciousTitles) &&
@@ -362,6 +380,7 @@ public int hashCode() {
362380
mode,
363381
sutConnector,
364382
sutConnectorValue,
383+
webURL,
365384
sequences,
366385
sequenceLength,
367386
suspiciousTitles,
@@ -383,6 +402,7 @@ public String toString() {
383402
sb.append(" mode: ").append(toIndentedString(mode)).append("\n");
384403
sb.append(" sutConnector: ").append(toIndentedString(sutConnector)).append("\n");
385404
sb.append(" sutConnectorValue: ").append(toIndentedString(sutConnectorValue)).append("\n");
405+
sb.append(" webURL: ").append(toIndentedString(webURL)).append("\n");
386406
sb.append(" sequences: ").append(toIndentedString(sequences)).append("\n");
387407
sb.append(" sequenceLength: ").append(toIndentedString(sequenceLength)).append("\n");
388408
sb.append(" suspiciousTitles: ").append(toIndentedString(suspiciousTitles)).append("\n");

src/main/java/es/prodevelop/testar/api/service/TestarService.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,16 @@ public ReturnExecution execute(Params params) throws Exception {
5757
if (StringUtils.isNotEmpty(params.getSutConnector())) {
5858
commands.add("SUTConnector="+params.getSutConnector());
5959
}
60-
60+
6161
if (StringUtils.isNotEmpty(params.getSutConnectorValue())) {
6262
String path = params.getSutConnectorValue();
6363
path = path.replace(File.separator, File.separator+File.separator);
64-
commands.add("SUTConnectorValue=\""+path+"\"");
64+
if(params.getWebURL() != null) {
65+
commands.add("SUTConnectorValue=\" \"\""+path+"\"\" \"\""+params.getWebURL()+"\"\" \"");
66+
}
67+
else {
68+
commands.add("SUTConnectorValue=\""+path+"\"");
69+
}
6570
}
6671

6772
if (params.getSequences() != null) {
@@ -104,12 +109,14 @@ public ReturnExecution execute(Params params) throws Exception {
104109
//TODO: sequenceFileName
105110

106111
String[] commadsArray = commands.toArray(new String[0]);
112+
StringBuilder cmdToExecute = new StringBuilder();
107113

108114
for (String string : commadsArray) {
109115
log.info(string);
116+
cmdToExecute.append(string + " ");
110117
}
111118

112-
Process process = Runtime.getRuntime().exec(commadsArray);
119+
Process process = Runtime.getRuntime().exec(cmdToExecute.toString());
113120

114121
/*int exitValue = process.waitFor();
115122
if (exitValue != 0) {

0 commit comments

Comments
 (0)