Skip to content

Commit ab4d018

Browse files
committed
Update API execution
Update API execution settings with master development requeriments
1 parent defebfd commit ab4d018

2 files changed

Lines changed: 57 additions & 67 deletions

File tree

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

Lines changed: 33 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ public class Params {
1919
@JsonProperty("mode")
2020
private String mode = null;
2121

22-
@JsonProperty("SUTConnector")
23-
private String SUTConnector = null;
22+
@JsonProperty("sutConnector")
23+
private String sutConnector = null;
2424

25-
@JsonProperty("SUTConnectorValue")
26-
private String SUTConnectorValue = null;
25+
@JsonProperty("sutConnectorValue")
26+
private String sutConnectorValue = null;
2727

2828
@JsonProperty("sequences")
2929
private Integer sequences = null;
@@ -37,20 +37,17 @@ public class Params {
3737
@JsonProperty("clickFilter")
3838
private String clickFilter = null;
3939

40-
@JsonProperty("showVisualSettingsDialogOnStartup")
41-
private String showVisualSettingsDialogOnStartup = null;
42-
4340
@JsonProperty("sequenceFileName")
4441
private String sequenceFileName = null;
4542

46-
@JsonProperty("testCaseName")
47-
private String testCaseName = null;
43+
/*@JsonProperty("testCaseName")
44+
private String testCaseName = null;*/
4845

4946
/**
5047
* Indicates to TESTAR the protocol to be executed
5148
* @return sse
5249
**/
53-
@ApiModelProperty(example = "web_generic", required = true, value = "Indicates to TESTAR the protocol to be executed")
50+
@ApiModelProperty(example = "desktop_generic", required = true, value = "Indicates to TESTAR the protocol to be executed")
5451
@NotNull
5552

5653
public String getSse() {
@@ -70,7 +67,7 @@ public Params sse(String sse) {
7067
* Execution mode in TESTAR (Spy, Generate, GenerateManual, Replay)
7168
* @return mode
7269
**/
73-
@ApiModelProperty(example = "Replay", required = true, value = "Execution mode in TESTAR (Spy, Generate, GenerateManual, Replay)")
70+
@ApiModelProperty(example = "Generate", required = true, value = "Execution mode in TESTAR (Spy, Generate, GenerateManual, Replay)")
7471
@NotNull
7572

7673
public String getMode() {
@@ -88,41 +85,41 @@ public Params mode(String mode) {
8885

8986
/**
9087
* How you want to connect to the SUT (COMMAND_LINE, SUT_WINDOW_TITLE, SUT_PROCESS_NAME, WEB_DRIVER)
91-
* @return SUTConnector
88+
* @return sutConnector
9289
*/
9390
@ApiModelProperty(example = "COMMAND_LINE", required = true, value = "How you want to connect to the SUT (COMMAND_LINE, SUT_WINDOW_TITLE, SUT_PROCESS_NAME, WEB_DRIVER)")
9491
@NotNull
9592

96-
public String getSUTConnector() {
97-
return SUTConnector;
93+
public String getSutConnector() {
94+
return sutConnector;
9895
}
9996

100-
public void setSUTConnector(String SUTConnector) {
101-
this.SUTConnector = SUTConnector;
97+
public void setSutConnector(String sutConnector) {
98+
this.sutConnector = sutConnector;
10299
}
103100

104-
public Params SUTConnector(String SUTConnector) {
105-
this.SUTConnector = SUTConnector;
101+
public Params sutConnector(String sutConnector) {
102+
this.sutConnector = sutConnector;
106103
return this;
107104
}
108105

109106
/**
110107
* Indicate the location of the SUT
111-
* @return SUTConnectorValue
108+
* @return sutConnectorValue
112109
*/
113110
@ApiModelProperty(example = "c:\\windows\\system32\\notepad.exe", required = true, value = "How you want to connect to the SUT (COMMAND_LINE, SUT_WINDOW_TITLE, SUT_PROCESS_NAME, WEB_DRIVER)")
114111
@NotNull
115112

116-
public String getSUTConnectorValue() {
117-
return SUTConnectorValue;
113+
public String getSutConnectorValue() {
114+
return sutConnectorValue;
118115
}
119116

120-
public void setSUTConnectorValue(String SUTConnectorValue) {
121-
this.SUTConnectorValue = SUTConnectorValue;
117+
public void setSutConnectorValue(String sutConnectorValue) {
118+
this.sutConnectorValue = sutConnectorValue;
122119
}
123120

124-
public Params SUTConnectorValue(String SUTConnectorValue) {
125-
this.SUTConnectorValue = SUTConnectorValue;
121+
public Params sutConnectorValue(String sutConnectorValue) {
122+
this.sutConnectorValue = sutConnectorValue;
126123
return this;
127124
}
128125

@@ -201,32 +198,12 @@ public Params clickFilter(String clickFilter) {
201198
this.clickFilter = clickFilter;
202199
return this;
203200
}
204-
205-
/**
206-
* Enable or Disable TESTAR GUI
207-
* @return ShowVisualSettingsDialogOnStartup
208-
*/
209-
@ApiModelProperty(example = "false", required = true, value = "Enable or Disable TESTAR GUI")
210-
@NotNull
211-
212-
public String getShowVisualSettingsDialogOnStartup() {
213-
return showVisualSettingsDialogOnStartup;
214-
}
215-
216-
public void setShowVisualSettingsDialogOnStartup(String showVisualSettingsDialogOnStartup) {
217-
this.showVisualSettingsDialogOnStartup = showVisualSettingsDialogOnStartup;
218-
}
219-
220-
public Params showVisualSettingsDialogOnStartup(String showVisualSettingsDialogOnStartup) {
221-
this.showVisualSettingsDialogOnStartup = showVisualSettingsDialogOnStartup;
222-
return this;
223-
}
224201

225202
/**
226203
* In case of using REPLAY mode filename of the sequence
227204
* @return sequenceFileName
228205
**/
229-
@ApiModelProperty(example = "sequence-testapp", value = "In case of using REPLAY mode filename of the sequence")
206+
@ApiModelProperty(example = "sequence-number", value = "In case of using REPLAY mode filename of the sequence")
230207

231208
public String getSequenceFileName() {
232209
return sequenceFileName;
@@ -245,7 +222,7 @@ public Params sequenceFileName(String sequenceFileName) {
245222
* Name of the testcase to be inserted in internal TESTAR logs for further analysis
246223
* @return testCaseName
247224
**/
248-
@ApiModelProperty(example = "Anp-publicDomain", required = true, value = "Name of the testcase to be inserted in internal TESTAR logs for further analysis")
225+
/*@ApiModelProperty(example = "test-case-name", required = true, value = "Name of the testcase to be inserted in internal TESTAR logs for further analysis")
249226
@NotNull
250227
251228
public String getTestCaseName() {
@@ -259,7 +236,7 @@ public void setTestCaseName(String testCaseName) {
259236
public Params testCaseName(String testCaseName) {
260237
this.testCaseName = testCaseName;
261238
return this;
262-
}
239+
}*/
263240

264241
@Override
265242
public boolean equals(java.lang.Object o) {
@@ -272,20 +249,19 @@ public boolean equals(java.lang.Object o) {
272249
Params params = (Params) o;
273250
return Objects.equals(this.sse, params.sse) &&
274251
Objects.equals(this.mode, params.mode) &&
275-
Objects.equals(this.SUTConnector, params.SUTConnector) &&
276-
Objects.equals(this.SUTConnectorValue, params.SUTConnectorValue) &&
252+
Objects.equals(this.sutConnector, params.sutConnector) &&
253+
Objects.equals(this.sutConnectorValue, params.sutConnectorValue) &&
277254
Objects.equals(this.sequences, params.sequences) &&
278255
Objects.equals(this.sequenceLength, params.sequenceLength) &&
279256
Objects.equals(this.suspiciousTitles, params.suspiciousTitles) &&
280257
Objects.equals(this.clickFilter, params.clickFilter) &&
281-
Objects.equals(this.showVisualSettingsDialogOnStartup, params.showVisualSettingsDialogOnStartup) &&
282-
Objects.equals(this.sequenceFileName, params.sequenceFileName) &&
283-
Objects.equals(this.testCaseName, params.testCaseName);
258+
Objects.equals(this.sequenceFileName, params.sequenceFileName);
259+
//Objects.equals(this.testCaseName, params.testCaseName);
284260
}
285261

286262
@Override
287263
public int hashCode() {
288-
return Objects.hash(sse, mode, SUTConnector, SUTConnectorValue, sequences, sequenceLength, suspiciousTitles, clickFilter, showVisualSettingsDialogOnStartup, sequenceFileName, testCaseName);
264+
return Objects.hash(sse, mode, sutConnector, sutConnectorValue, sequences, sequenceLength, suspiciousTitles, clickFilter, sequenceFileName);
289265
}
290266

291267
@Override
@@ -295,15 +271,14 @@ public String toString() {
295271

296272
sb.append(" sse: ").append(toIndentedString(sse)).append("\n");
297273
sb.append(" mode: ").append(toIndentedString(mode)).append("\n");
298-
sb.append(" SUTConnector: ").append(toIndentedString(SUTConnector)).append("\n");
299-
sb.append(" SUTConnectorValue: ").append(toIndentedString(SUTConnectorValue)).append("\n");
274+
sb.append(" sutConnector: ").append(toIndentedString(sutConnector)).append("\n");
275+
sb.append(" sutConnectorValue: ").append(toIndentedString(sutConnectorValue)).append("\n");
300276
sb.append(" sequences: ").append(toIndentedString(sequences)).append("\n");
301277
sb.append(" sequenceLength: ").append(toIndentedString(sequenceLength)).append("\n");
302278
sb.append(" suspiciousTitles: ").append(toIndentedString(suspiciousTitles)).append("\n");
303279
sb.append(" clickFilter: ").append(toIndentedString(clickFilter)).append("\n");
304-
sb.append(" showVisualSettingsDialogOnStartup: ").append(toIndentedString(showVisualSettingsDialogOnStartup)).append("\n");
305280
sb.append(" sequenceFileName: ").append(toIndentedString(sequenceFileName)).append("\n");
306-
sb.append(" testCaseName: ").append(toIndentedString(testCaseName)).append("\n");
281+
//sb.append(" testCaseName: ").append(toIndentedString(testCaseName)).append("\n");
307282

308283
sb.append("}");
309284
return sb.toString();

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

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.io.BufferedInputStream;
44
import java.io.BufferedReader;
5+
import java.io.File;
56
import java.io.InputStream;
67
import java.io.StringReader;
78
import java.util.ArrayList;
@@ -28,14 +29,14 @@ public ReturnExecution execute(Params params) throws Exception {
2829
/*
2930
* testar sse=web_generic Mode=Generate Sequences=5 SequenceLength=50
3031
* ShowVisualSettingsDialogOnStartup=false
31-
* SuspiciousTitles=".*[eE]rror.*|.*[eE]xcep[ct]i[o?]n.*|.*[bB]ortali.*"
32+
* SuspiciousTitles=".*[eE]rror.*|.*[eE]xcep[ct]i[o?]n.*"
3233
*/
3334
ReturnExecution returnExecution = new ReturnExecution();
3435
returnExecution.setStartDate(OffsetDateTime.now());
3536

3637
log.info("params[{}]", params);
3738

38-
List<String> commands = new ArrayList<String>();
39+
List<String> commands = new ArrayList<>();
3940

4041
/*commands.add("cmd");
4142
commands.add("/K");
@@ -53,6 +54,16 @@ public ReturnExecution execute(Params params) throws Exception {
5354
commands.add("Mode="+params.getMode());
5455
}
5556

57+
if (StringUtils.isNotEmpty(params.getSutConnector())) {
58+
commands.add("SUTConnector="+params.getSutConnector());
59+
}
60+
61+
if (StringUtils.isNotEmpty(params.getSutConnectorValue())) {
62+
String path = params.getSutConnectorValue();
63+
path = path.replace(File.separator, File.separator+File.separator);
64+
commands.add("SUTConnectorValue=\""+path+"\"");
65+
}
66+
5667
if (params.getSequences() != null) {
5768
commands.add("Sequences="+params.getSequences());
5869
}
@@ -61,18 +72,22 @@ public ReturnExecution execute(Params params) throws Exception {
6172
commands.add("SequenceLength="+params.getSequenceLength());
6273
}
6374

64-
if (params.getSuspiciousTitles() != null) {
65-
commands.add("SuspiciousTitles="+params.getSuspiciousTitles());
75+
if (StringUtils.isNotEmpty(params.getSuspiciousTitles())) {
76+
commands.add("SuspiciousTitles=\""+params.getSuspiciousTitles()+"\"");
6677
}
6778

68-
if (params.getTestCaseName() != null) {
69-
commands.add("TestCaseName="+params.getTestCaseName());
79+
if (StringUtils.isNotEmpty(params.getClickFilter())) {
80+
commands.add("ClickFilter=\""+params.getClickFilter()+"\"");
7081
}
71-
72-
//TODO: sequenceFileName
82+
7383
commands.add("ShowVisualSettingsDialogOnStartup=false");
7484

75-
//String command = "cmd /c date";
85+
/*if (params.getTestCaseName() != null) {
86+
commands.add("TestCaseName="+params.getTestCaseName());
87+
}*/
88+
89+
//TODO: sequenceFileName
90+
7691
String[] commadsArray = commands.toArray(new String[0]);
7792

7893
for (String string : commadsArray) {

0 commit comments

Comments
 (0)