Skip to content

Commit ea4f35f

Browse files
committed
Merge origin/master
2 parents 5604650 + 154a511 commit ea4f35f

96 files changed

Lines changed: 10363 additions & 11365 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.

source/src/main/java/org/cerberus/core/api/services/QueuedExecutionService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public QueuedExecutionResult addCampaignToExecutionQueue(String campaignId, Queu
197197
LOG.debug("MANUALEXEC {}", manualExecution);
198198
if (CollectionUtils.isEmpty(robots)) {
199199
if (manualExecution.equalsIgnoreCase("Y") || manualExecution.equalsIgnoreCase("A")) {
200-
robotsMap.put("", robotFactory.create(0, "", "", "", "", true, "", "", "", "", "", 0, "", true, "", ""));
200+
robotsMap.put("", robotFactory.create(0, "", "", "", "", true, "", "", "", "", "", 0, "", true, "", "", ""));
201201
} else {
202202
throw new InvalidRequestException("No robots found for this campaign");
203203
}

source/src/main/java/org/cerberus/core/crud/dao/impl/RobotDAO.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,11 +560,12 @@ public Robot loadFromResultSet(ResultSet rs) throws SQLException {
560560
String type = ParameterParserUtil.parseStringParam(rs.getString("type"), "");
561561
Integer acceptNotifications = ParameterParserUtil.parseIntegerParam(rs.getString("AcceptNotifications"), 0);
562562
String extraParam = ParameterParserUtil.parseStringParam(rs.getString("ExtraParam"), "");
563+
String preloadScript = ParameterParserUtil.parseStringParam(rs.getString("preloadScript"), "");
563564
boolean isAcceptInsecureCerts = rs.getBoolean("isAcceptInsecureCerts");
564565

565566
//TODO remove when working in test with mockito and autowired
566567
factoryRobot = new FactoryRobot();
567-
return factoryRobot.create(robotID, robot, platform, browser, version, isActive, lbexemethod, description, userAgent, screenSize, profileFolder, acceptNotifications, extraParam, isAcceptInsecureCerts, robotDecli, type);
568+
return factoryRobot.create(robotID, robot, platform, browser, version, isActive, lbexemethod, description, userAgent, screenSize, profileFolder, acceptNotifications, extraParam, isAcceptInsecureCerts, robotDecli, type, preloadScript);
568569
}
569570

570571
@Override

source/src/main/java/org/cerberus/core/crud/entity/Robot.java

Lines changed: 21 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import java.sql.Timestamp;
2323

2424
import java.util.List;
25+
26+
import lombok.*;
2527
import org.apache.logging.log4j.LogManager;
2628
import org.apache.logging.log4j.Logger;
2729
import org.json.JSONArray;
@@ -32,6 +34,11 @@
3234
*
3335
* @author bcivel
3436
*/
37+
@Getter
38+
@Setter
39+
@Builder
40+
@NoArgsConstructor
41+
@AllArgsConstructor
3542
public class Robot {
3643

3744
private static final Logger LOG = LogManager.getLogger(Robot.class);
@@ -42,20 +49,21 @@ public class Robot {
4249
private String platform;
4350
private String browser;
4451
private String version;
45-
private boolean isActive;
52+
private boolean active;
4653
private String userAgent;
4754
private String screenSize;
4855
private String profileFolder;
4956
private String extraParam;
5057
private Integer acceptNotifications;
51-
private boolean isAcceptInsecureCerts;
58+
private boolean acceptInsecureCerts;
59+
private String preloadScript;
5260
private String robotDecli;
53-
private String lbexemethod; // Contain the method used in order to spread the load against all executors of the robot.
61+
private String lbexemethod; // Contain the method used in order to spread the load against all executors of the robot
5462
private String description;
55-
private String UsrCreated;
56-
private Timestamp DateCreated;
57-
private String UsrModif;
58-
private Timestamp DateModif;
63+
private String usrCreated;
64+
private Timestamp dateCreated;
65+
private String usrModif;
66+
private Timestamp dateModif;
5967

6068
public static final String LOADBALANCINGEXECUTORMETHOD_ROUNDROBIN = "ROUNDROBIN";
6169
public static final String LOADBALANCINGEXECUTORMETHOD_BYRANKING = "BYRANKING";
@@ -67,186 +75,6 @@ public class Robot {
6775
private List<RobotCapability> capabilitiesDecoded;
6876
private List<RobotExecutor> executors;
6977

70-
public String getExtraParam() {
71-
return extraParam;
72-
}
73-
74-
public void setExtraParam(String extraParam) {
75-
this.extraParam = extraParam;
76-
}
77-
78-
public boolean isAcceptInsecureCerts() {
79-
return isAcceptInsecureCerts;
80-
}
81-
82-
public void setIsAcceptInsecureCerts(boolean isAcceptInsecureCerts) {
83-
this.isAcceptInsecureCerts = isAcceptInsecureCerts;
84-
}
85-
86-
public String getProfileFolder() {
87-
return profileFolder;
88-
}
89-
90-
public void setProfileFolder(String profileFolder) {
91-
this.profileFolder = profileFolder;
92-
}
93-
94-
public String getUsrCreated() {
95-
return UsrCreated;
96-
}
97-
98-
public void setUsrCreated(String UsrCreated) {
99-
this.UsrCreated = UsrCreated;
100-
}
101-
102-
public Timestamp getDateCreated() {
103-
return DateCreated;
104-
}
105-
106-
public void setDateCreated(Timestamp DateCreated) {
107-
this.DateCreated = DateCreated;
108-
}
109-
110-
public String getUsrModif() {
111-
return UsrModif;
112-
}
113-
114-
public void setUsrModif(String UsrModif) {
115-
this.UsrModif = UsrModif;
116-
}
117-
118-
public Timestamp getDateModif() {
119-
return DateModif;
120-
}
121-
122-
public void setDateModif(Timestamp DateModif) {
123-
this.DateModif = DateModif;
124-
}
125-
126-
public List<RobotExecutor> getExecutors() {
127-
return executors;
128-
}
129-
130-
public void setExecutors(List<RobotExecutor> executors) {
131-
this.executors = executors;
132-
}
133-
134-
public List<RobotCapability> getCapabilitiesDecoded() {
135-
return capabilitiesDecoded;
136-
}
137-
138-
public void setCapabilitiesDecoded(List<RobotCapability> capabilitiesDecoded) {
139-
this.capabilitiesDecoded = capabilitiesDecoded;
140-
}
141-
142-
public String getLbexemethod() {
143-
return lbexemethod;
144-
}
145-
146-
public void setLbexemethod(String lbexemethod) {
147-
this.lbexemethod = lbexemethod;
148-
}
149-
150-
public String getRobotDecli() {
151-
return robotDecli;
152-
}
153-
154-
public void setRobotDecli(String robotDecli) {
155-
this.robotDecli = robotDecli;
156-
}
157-
158-
public String getScreenSize() {
159-
return screenSize;
160-
}
161-
162-
public void setScreenSize(String screenSize) {
163-
this.screenSize = screenSize;
164-
}
165-
166-
public String getUserAgent() {
167-
return userAgent;
168-
}
169-
170-
public void setUserAgent(String userAgent) {
171-
this.userAgent = userAgent;
172-
}
173-
174-
public Integer getRobotID() {
175-
return robotID;
176-
}
177-
178-
public void setRobotID(Integer robotID) {
179-
this.robotID = robotID;
180-
}
181-
182-
public String getRobot() {
183-
return robot;
184-
}
185-
186-
public void setRobot(String robot) {
187-
this.robot = robot;
188-
}
189-
190-
public boolean isActive() {
191-
return isActive;
192-
}
193-
194-
public void setIsActive(boolean active) {
195-
this.isActive = active;
196-
}
197-
198-
public String getDescription() {
199-
return description;
200-
}
201-
202-
public void setDescription(String description) {
203-
this.description = description;
204-
}
205-
206-
public String getPlatform() {
207-
return platform;
208-
}
209-
210-
public void setPlatform(String platform) {
211-
this.platform = platform;
212-
}
213-
214-
public String getBrowser() {
215-
return browser;
216-
}
217-
218-
public void setBrowser(String browser) {
219-
this.browser = browser;
220-
}
221-
222-
public String getVersion() {
223-
return version;
224-
}
225-
226-
public void setVersion(String version) {
227-
this.version = version;
228-
}
229-
230-
public List<RobotCapability> getCapabilities() {
231-
return capabilities;
232-
}
233-
234-
public void setCapabilities(List<RobotCapability> capabilities) {
235-
this.capabilities = capabilities;
236-
}
237-
238-
public String getType() {
239-
return type;
240-
}
241-
242-
public void setType(String type) {
243-
this.type = type;
244-
}
245-
246-
public Integer getAcceptNotifications(){return acceptNotifications;}
247-
248-
public void setAcceptNotifications(Integer acceptNotifications){this.acceptNotifications = acceptNotifications;}
249-
25078
/**
25179
* Convert the current TestCaseExecution into JSON format
25280
*
@@ -271,33 +99,29 @@ public JSONObject toJson(boolean withChilds, boolean secured) {
27199
result.put("type", this.getType());
272100
result.put("isAcceptInsecureCerts", this.isAcceptInsecureCerts());
273101
result.put("acceptNotifications", this.getAcceptNotifications());
102+
result.put("preloadScript", this.getPreloadScript());
274103
result.put("extraParam", this.getExtraParam());
275104

276105
if (withChilds) {
277-
// Looping on ** Capabilities **
278106
JSONArray arrayCap = new JSONArray();
279107
if (this.getCapabilities() != null) {
280-
for (Object capability : this.getCapabilities()) {
281-
arrayCap.put(((RobotCapability) capability).toJson());
108+
for (RobotCapability capability : this.getCapabilities()) {
109+
arrayCap.put(capability.toJson());
282110
}
283111
}
284112
result.put("capabilities", arrayCap);
285113

286-
// Looping on ** Executors **
287114
JSONArray arrayExecutor = new JSONArray();
288115
if (this.getExecutors() != null) {
289-
for (Object executor : this.getExecutors()) {
290-
arrayExecutor.put(((RobotExecutor) executor).toJson(secured));
116+
for (RobotExecutor executor : this.getExecutors()) {
117+
arrayExecutor.put(executor.toJson(secured));
291118
}
292119
}
293120
result.put("executors", arrayExecutor);
294-
295121
}
296122

297-
} catch (JSONException ex) {
298-
LOG.error(ex.toString(), ex);
299123
} catch (Exception ex) {
300-
LOG.error(ex.toString(), ex);
124+
LOG.error("Error converting Robot to JSON", ex);
301125
}
302126
return result;
303127
}

source/src/main/java/org/cerberus/core/crud/factory/IFactoryRobot.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public interface IFactoryRobot {
5050
* @return
5151
*/
5252
Robot create(Integer robotID, String robot, String platform,
53-
String browser, String version, boolean isActive, String lbexemethod, String description, String userAgent, String screenSize, String profileFolder, Integer acceptNotifications, String extraParam, boolean isAcceptInsecureCerts, String robotDecli, String type);
53+
String browser, String version, boolean isActive, String lbexemethod, String description, String userAgent, String screenSize, String profileFolder, Integer acceptNotifications, String extraParam, boolean isAcceptInsecureCerts, String robotDecli, String type, String preloadScript);
5454

5555
/**
5656
*
@@ -76,6 +76,6 @@ Robot create(Integer robotID, String robot, String platform,
7676
*/
7777
Robot create(Integer robotID, String robot, String platform,
7878
String browser, String version, boolean isActive, String lbexemethod, String description, String userAgent, String screenSize, String profileFolder, Integer acceptNotifications, String extraParam, boolean isAcceptInsecureCerts,
79-
List<RobotCapability> capabilities, List<RobotExecutor> executors, String robotDecli, String type);
79+
List<RobotCapability> capabilities, List<RobotExecutor> executors, String robotDecli, String type, String preloadScript);
8080

8181
}

source/src/main/java/org/cerberus/core/crud/factory/impl/FactoryRobot.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@ public class FactoryRobot implements IFactoryRobot {
3535

3636
@Override
3737
public Robot create(Integer robotID, String robot, String platform,
38-
String browser, String version, boolean isActive, String lbexemethod, String description, String userAgent, String screenSize, String profileFolder, Integer acceptNotifications, String extraParam, boolean isAcceptInsecureCerts, String robotDecli, String type) {
39-
Robot r = create(robotID, robot, platform, browser, version, isActive, lbexemethod, description, userAgent, screenSize, profileFolder,acceptNotifications, extraParam, isAcceptInsecureCerts, new ArrayList<>(), new ArrayList<>(), robotDecli, type);
38+
String browser, String version, boolean isActive, String lbexemethod, String description, String userAgent, String screenSize, String profileFolder, Integer acceptNotifications, String extraParam, boolean isAcceptInsecureCerts, String robotDecli, String type, String preloadScript) {
39+
Robot r = create(robotID, robot, platform, browser, version, isActive, lbexemethod, description, userAgent, screenSize, profileFolder,acceptNotifications, extraParam, isAcceptInsecureCerts, new ArrayList<>(), new ArrayList<>(), robotDecli, type, preloadScript);
4040
return r;
4141
}
4242

4343
@Override
4444
public Robot create(Integer robotID, String robot, String platform, String browser, String version, boolean isActive, String lbexemethod, String description, String userAgent,
45-
String screenSize, String profileFolder, Integer acceptNotifications, String extraParam, boolean isAcceptInsecureCerts, List<RobotCapability> capabilities, List<RobotExecutor> executors, String robotDecli, String type) {
45+
String screenSize, String profileFolder, Integer acceptNotifications, String extraParam, boolean isAcceptInsecureCerts, List<RobotCapability> capabilities, List<RobotExecutor> executors, String robotDecli, String type, String preloadScript) {
4646
Robot newRobot = new Robot();
4747
newRobot.setRobotID(robotID);
4848
newRobot.setRobot(robot);
4949
newRobot.setPlatform(platform);
5050
newRobot.setBrowser(browser);
5151
newRobot.setVersion(version);
52-
newRobot.setIsActive(isActive);
52+
newRobot.setActive(isActive);
5353
newRobot.setLbexemethod(lbexemethod);
5454
newRobot.setDescription(description);
5555
newRobot.setUserAgent(userAgent);
@@ -59,9 +59,10 @@ public Robot create(Integer robotID, String robot, String platform, String brows
5959
newRobot.setProfileFolder(profileFolder);
6060
newRobot.setRobotDecli(robotDecli);
6161
newRobot.setType(type);
62-
newRobot.setIsAcceptInsecureCerts(isAcceptInsecureCerts);
62+
newRobot.setAcceptInsecureCerts(isAcceptInsecureCerts);
6363
newRobot.setAcceptNotifications(acceptNotifications);
6464
newRobot.setExtraParam(extraParam);
65+
newRobot.setPreloadScript(preloadScript);
6566
return newRobot;
6667
}
6768

0 commit comments

Comments
 (0)