2222import java .sql .Timestamp ;
2323
2424import java .util .List ;
25+
26+ import lombok .*;
2527import org .apache .logging .log4j .LogManager ;
2628import org .apache .logging .log4j .Logger ;
2729import org .json .JSONArray ;
3234 *
3335 * @author bcivel
3436 */
37+ @ Getter
38+ @ Setter
39+ @ Builder
40+ @ NoArgsConstructor
41+ @ AllArgsConstructor
3542public 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 }
0 commit comments