Skip to content

Commit

Permalink
refactor(robot-proxy): renaming executorExtensionPort to executorProx…
Browse files Browse the repository at this point in the history
…yServicePort
  • Loading branch information
lucashimpens committed Feb 13, 2025
1 parent 153caa0 commit c3ed04a
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public AnswerList<RobotExecutor> readByVariousByCriteria(List<String> robot, Str
public Answer create(RobotExecutor object) {
MessageEvent msg = null;
StringBuilder query = new StringBuilder();
query.append("INSERT INTO robotexecutor (`robot`, `executor`, `isactive`, `rank`, `host`, `port`, `host_user`, `host_password`, `deviceudid`, `devicename`, `deviceport`, `isdevicelockunlock`, `ExecutorProxyServiceHost`, `executorextensionport`, `executorproxyhost`, `executorproxyport`, `executorproxytype`, `description`, `usrcreated`) ");
query.append("INSERT INTO robotexecutor (`robot`, `executor`, `isactive`, `rank`, `host`, `port`, `host_user`, `host_password`, `deviceudid`, `devicename`, `deviceport`, `isdevicelockunlock`, `ExecutorProxyServiceHost`, `ExecutorProxyServicePort`, `executorproxyhost`, `executorproxyport`, `executorproxytype`, `description`, `usrcreated`) ");
query.append("VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");

// Debug message on SQL.
Expand Down Expand Up @@ -298,8 +298,8 @@ public Answer create(RobotExecutor object) {
}
preStat.setBoolean(i++, object.isDeviceLockUnlock());
preStat.setString(i++, object.getExecutorProxyServiceHost());
if (object.getExecutorExtensionPort() != null) {
preStat.setInt(i++, object.getExecutorExtensionPort());
if (object.getExecutorProxyServicePort() != null) {
preStat.setInt(i++, object.getExecutorProxyServicePort());
} else {
preStat.setNull(i++, Types.INTEGER);
}
Expand Down Expand Up @@ -367,7 +367,7 @@ public Answer delete(RobotExecutor object) {
@Override
public Answer update(String robot, String executor, RobotExecutor object) {
MessageEvent msg = null;
final String query = "UPDATE robotexecutor SET `robot` = ?, `executor` = ?, description = ?, isactive = ?, `rank` = ?, `host` = ?, `port` = ?, `host_user` = ?, `host_password` = ?, `deviceudid` = ?, `devicename` = ?, `deviceport` = ?, `isdevicelockunlock` = ?, `ExecutorProxyServiceHost` = ?, `executorextensionport` = ?, `executorproxyhost` = ?, `executorproxyport` = ?, `executorproxytype` = ?, "
final String query = "UPDATE robotexecutor SET `robot` = ?, `executor` = ?, description = ?, isactive = ?, `rank` = ?, `host` = ?, `port` = ?, `host_user` = ?, `host_password` = ?, `deviceudid` = ?, `devicename` = ?, `deviceport` = ?, `isdevicelockunlock` = ?, `ExecutorProxyServiceHost` = ?, `ExecutorProxyServicePort` = ?, `executorproxyhost` = ?, `executorproxyport` = ?, `executorproxytype` = ?, "
+ "dateModif = NOW(), usrModif= ? WHERE `robot` = ? and `executor` = ?";

// Debug message on SQL.
Expand Down Expand Up @@ -398,8 +398,8 @@ public Answer update(String robot, String executor, RobotExecutor object) {
}
preStat.setBoolean(i++, object.isDeviceLockUnlock());
preStat.setString(i++, object.getExecutorProxyServiceHost());
if (object.getExecutorExtensionPort() != null) {
preStat.setInt(i++, object.getExecutorExtensionPort());
if (object.getExecutorProxyServicePort() != null) {
preStat.setInt(i++, object.getExecutorProxyServicePort());
} else {
preStat.setNull(i++, Types.INTEGER);
}
Expand Down Expand Up @@ -473,7 +473,7 @@ public RobotExecutor loadFromResultSet(ResultSet rs) throws SQLException {
Integer deviceport = rs.getInt("rbe.deviceport");
boolean isDevicelockunlock = rs.getBoolean("rbe.isdevicelockunlock");
String executorProxyServiceHost = rs.getString("rbe.ExecutorProxyServiceHost");
Integer executorExtensionPort = rs.getInt("rbe.executorextensionport");
Integer executorProxyServicePort = rs.getInt("rbe.ExecutorProxyServicePort");
String executorProxyHost = rs.getString("rbe.executorproxyhost");
Integer executorProxyPort = rs.getInt("rbe.executorproxyport");
String executorProxyType = rs.getString("rbe.executorproxytype");
Expand All @@ -489,7 +489,7 @@ public RobotExecutor loadFromResultSet(ResultSet rs) throws SQLException {

//TODO remove when working in test with mockito and autowired
factoryRobotExecutor = new FactoryRobotExecutor();
return factoryRobotExecutor.create(id, robot, executor, isActive, rank, host, port, host_user, host_password, nodeProxyPort, deviceudid, devicename, deviceport, isDevicelockunlock, executorProxyServiceHost, executorExtensionPort, executorProxyHost, executorProxyPort, executorProxyType, description, usrCreated, dateCreated, usrModif, dateModif);
return factoryRobotExecutor.create(id, robot, executor, isActive, rank, host, port, host_user, host_password, nodeProxyPort, deviceudid, devicename, deviceport, isDevicelockunlock, executorProxyServiceHost, executorProxyServicePort, executorProxyHost, executorProxyPort, executorProxyType, description, usrCreated, dateCreated, usrModif, dateModif);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class RobotExecutor {
private long dateLastExeSubmitted;
private String executorProxyType;
private String executorProxyServiceHost;
private Integer executorExtensionPort;
private Integer executorProxyServicePort;
private String executorProxyHost;
private Integer executorProxyPort;
private String UsrCreated;
Expand Down Expand Up @@ -223,12 +223,12 @@ public void setExecutorProxyServiceHost(String executorProxyServiceHost) {
this.executorProxyServiceHost = executorProxyServiceHost;
}

public Integer getExecutorExtensionPort() {
return executorExtensionPort;
public Integer getExecutorProxyServicePort() {
return executorProxyServicePort;
}

public void setExecutorExtensionPort(Integer executorExtensionPort) {
this.executorExtensionPort = executorExtensionPort;
public void setExecutorProxyServicePort(Integer executorProxyServicePort) {
this.executorProxyServicePort = executorProxyServicePort;
}

public String getExecutorProxyHost() {
Expand Down Expand Up @@ -368,7 +368,7 @@ public boolean equals(Object obj) {
if ((this.executorProxyServiceHost == null) ? (other.executorProxyServiceHost != null) : !this.executorProxyServiceHost.equals(other.executorProxyServiceHost)) {
return false;
}
if ((this.executorExtensionPort == null) ? (other.executorExtensionPort != null) : !this.executorExtensionPort.equals(other.executorExtensionPort)) {
if ((this.executorProxyServicePort == null) ? (other.executorProxyServicePort != null) : !this.executorProxyServicePort.equals(other.executorProxyServicePort)) {
return false;
}
if ((this.executorProxyHost == null) ? (other.executorProxyHost != null) : !this.executorProxyHost.equals(other.executorProxyHost)) {
Expand Down Expand Up @@ -400,7 +400,7 @@ public JSONObject toJson(boolean secured) {
result.put("devicePort", this.getDevicePort());
result.put("isDeviceLockUnlock", this.isDeviceLockUnlock());
result.put("executorProxyServiceHost", this.getExecutorProxyServiceHost());
result.put("executorExtensionPort", this.getExecutorExtensionPort());
result.put("executorProxyServicePort", this.getExecutorProxyServicePort());
result.put("executorProxyHost", this.getExecutorProxyHost());
result.put("executorProxyPort", this.getExecutorProxyPort());
result.put("executorProxyType", this.getExecutorProxyType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public interface IFactoryRobotExecutor {
* @param devicePort
* @param isDeviceLockUnlock
* @param executorProxyServiceHost
* @param executorExtensionPort
* @param executorProxyServicePort
* @param executorProxyHost
* @param executorProxyPort
* @param deviceUdid
Expand All @@ -57,6 +57,6 @@ public interface IFactoryRobotExecutor {
*/
RobotExecutor create(Integer ID, String robot, String executor, boolean isActive,
Integer rank, String host, String port, String hostUser, String hostPassword, Integer nodeProxyPort, String deviceUdid,
String deviceName, Integer devicePort, boolean isDeviceLockUnlock, String executorProxyServiceHost, Integer executorExtensionPort, String executorProxyHost, Integer executorProxyPort, String executorProxyType,
String deviceName, Integer devicePort, boolean isDeviceLockUnlock, String executorProxyServiceHost, Integer executorProxyServicePort, String executorProxyHost, Integer executorProxyPort, String executorProxyType,
String description, String UsrCreated, Timestamp DateCreated, String UsrModif, Timestamp DateModif);
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class FactoryRobotExecutor implements IFactoryRobotExecutor {

@Override
public RobotExecutor create(Integer ID, String robot, String executor, boolean isActive, Integer rank, String host, String port, String hostUser, String hostPassword,
Integer nodeProxyPort, String deviceUdid, String deviceName, Integer devicePort, boolean isDeviceLockUnlock, String executorProxyServiceHost, Integer executorExtensionPort, String executorProxyHost, Integer executorProxyPort, String executorProxyType, String description,
Integer nodeProxyPort, String deviceUdid, String deviceName, Integer devicePort, boolean isDeviceLockUnlock, String executorProxyServiceHost, Integer executorProxyServicePort, String executorProxyHost, Integer executorProxyPort, String executorProxyType, String description,
String UsrCreated, Timestamp DateCreated, String UsrModif, Timestamp DateModif) {
RobotExecutor newRobot = new RobotExecutor();
newRobot.setID(ID);
Expand All @@ -49,7 +49,7 @@ public RobotExecutor create(Integer ID, String robot, String executor, boolean i
newRobot.setDeviceName(deviceName);
newRobot.setIsDeviceLockUnlock(isDeviceLockUnlock);
newRobot.setExecutorProxyServiceHost(executorProxyServiceHost);
newRobot.setExecutorExtensionPort(executorExtensionPort);
newRobot.setExecutorProxyServicePort(executorProxyServicePort);
newRobot.setExecutorProxyHost(executorProxyHost);
newRobot.setExecutorProxyType(executorProxyType);
newRobot.setExecutorProxyPort(executorProxyPort);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -795,11 +795,11 @@ public ArrayList<String> getSqlDocumentation() {
b.append(",('robotexecutor','dateLastExeSubmitted','','fa','مهر زمانی آخرین اجرای ارسال شده','',NULL)");
b.append(",('robotexecutor','executorProxyServiceHost','','fr','Nom d\\'hote du service de proxy','Nom de la machine qui heberge le service Cerberus robot-proxy. Si vide, le host est le même que celui de l\\'executor.',NULL)");
b.append(",('robotexecutor','executorProxyServiceHost','','en','Proxy service host', 'Host of the Cerberus robot-proxy service. If empty, the executor Host will be used.',NULL)");
b.append(",('robotexecutor','executorExtensionPort','','fr','Port du service de proxy','Port d\\'écoute du service Cerberus robot-proxy.',NULL)");
b.append(",('robotexecutor','executorProxyServicePort','','fr','Port du service de proxy','Port d\\'écoute du service Cerberus robot-proxy.',NULL)");
b.append(",('robotexecutor','executorProxyServiceHost','','fa','میزبان سرویس پراکسی', 'میزبان سرویس پروکسی ربات Cerberus. اگر خالی باشد، میزبان مجری استفاده خواهد شد.',NULL)");
b.append(",('robotexecutor','executorExtensionPort','','en','Proxy service port', 'Port of the robot-proxy service.',NULL)");
b.append(",('robotexecutor','executorProxyServicePort','','en','Proxy service port', 'Port of the robot-proxy service.',NULL)");
b.append(",('robotexecutor','executorProxyHost','','fr','Nom d\\'hote du proxy pour le navigateur', 'Nom d\\'hote qui sera donné au navigateur pour acceder au service de proxy. Si vide, le nom d\\'hote du service robot-proxy sera utilisé.',NULL)");
b.append(",('robotexecutor','executorExtensionPort','','fa','درگاه سرویس پروکسی', 'درگاه سرویس ربات پروکسی.',NULL)");
b.append(",('robotexecutor','executorProxyServicePort','','fa','درگاه سرویس پروکسی', 'درگاه سرویس ربات پروکسی.',NULL)");
b.append(",('robotexecutor','executorProxyHost','','en','Browser Proxy Host', 'Host that will be given to the browser in order to connect to the proxy service. If empty, the host of robot-proxy service will be used.',NULL)");
b.append(",('robotexecutor','executorProxyPort','','fr','Port du proxy pour le navigateur','Port qui sera utilisé par le navigateur pour acceder au proxy. Si 0, il sera determiné aléatoirement.',NULL)");
b.append(",('robotexecutor','executorProxyHost','','fa','میزبان پروکسی مرورگر', 'میزبانی که برای اتصال به سرویس پروکسی به مرورگر داده می شود. اگر خالی باشد، میزبان سرویس ربات پروکسی استفاده خواهد شد.',NULL)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ private boolean checkExecutorProxy(TestCaseExecution tce) {
tce.getRobotExecutorObj().setExecutorProxyServiceHost(tce.getRobotExecutorObj().getHost());
}

String urlString = "http://" + tce.getRobotExecutorObj().getExecutorProxyServiceHost() + ":" + tce.getRobotExecutorObj().getExecutorExtensionPort() + "/check";
String urlString = "http://" + tce.getRobotExecutorObj().getExecutorProxyServiceHost() + ":" + tce.getRobotExecutorObj().getExecutorProxyServicePort() + "/check";
LOG.debug("Url to check Proxy Executor : {}", urlString);

URL url;
Expand All @@ -399,16 +399,16 @@ private boolean checkExecutorProxy(TestCaseExecution tce) {
return true;
}
} catch (Exception ex) {
LOG.warn("Exception Reaching Cerberus Extension {}:{} Exception: {}", tce.getRobotExecutorObj().getExecutorProxyServiceHost(), tce.getRobotExecutorObj().getExecutorExtensionPort(), ex.toString());
LOG.warn("Exception Reaching Cerberus Extension {}:{} Exception: {}", tce.getRobotExecutorObj().getExecutorProxyServiceHost(), tce.getRobotExecutorObj().getExecutorProxyServicePort(), ex.toString());
}

} catch (IOException ex) {
LOG.warn("Exception Reaching Cerberus Extension {}:{} Exception: {}", tce.getRobotExecutorObj().getExecutorProxyServiceHost(), tce.getRobotExecutorObj().getExecutorExtensionPort(), ex.toString());
LOG.warn("Exception Reaching Cerberus Extension {}:{} Exception: {}", tce.getRobotExecutorObj().getExecutorProxyServiceHost(), tce.getRobotExecutorObj().getExecutorProxyServicePort(), ex.toString());
}

message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_CERBERUSEXECUTORNOTAVAILABLE);
message.resolveDescription("HOST", tce.getRobotExecutorObj().getExecutorProxyServiceHost())
.resolveDescription("PORT", String.valueOf(tce.getRobotExecutorObj().getExecutorExtensionPort()))
.resolveDescription("PORT", String.valueOf(tce.getRobotExecutorObj().getExecutorProxyServicePort()))
.resolveDescription("ROBOT", String.valueOf(tce.getRobotExecutorObj().getRobot()))
.resolveDescription("ROBOTEXE", String.valueOf(tce.getRobotExecutorObj().getExecutor()));
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1155,10 +1155,10 @@ public boolean stopServer(TestCaseExecution tce) {
&& tce.getVerbose() >= 1 && (parameterService.getParameterBooleanByKey("cerberus_networkstatsave_active", tce.getSystem(), false))) {

// Before collecting the stats, we wait the network idles for few minutes
executorService.waitForIdleNetwork(tce.getRobotExecutorObj().getExecutorProxyServiceHost(), tce.getRobotExecutorObj().getExecutorExtensionPort(), tce.getRemoteProxyUUID(), tce.getSystem());
executorService.waitForIdleNetwork(tce.getRobotExecutorObj().getExecutorProxyServiceHost(), tce.getRobotExecutorObj().getExecutorProxyServicePort(), tce.getRemoteProxyUUID(), tce.getSystem());

// We now get the har data.
JSONObject har = executorService.getHar(null, false, tce.getRobotExecutorObj().getExecutorProxyServiceHost(), tce.getRobotExecutorObj().getExecutorExtensionPort(), tce.getRemoteProxyUUID(), tce.getSystem(), 0);
JSONObject har = executorService.getHar(null, false, tce.getRobotExecutorObj().getExecutorProxyServiceHost(), tce.getRobotExecutorObj().getExecutorProxyServicePort(), tce.getRemoteProxyUUID(), tce.getSystem(), 0);

// and enrich it with stat entry.
har = harService.enrichWithStats(har, tce.getCountryEnvApplicationParam().getDomain(), tce.getSystem(), tce.getNetworkTrafficIndexList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1644,7 +1644,7 @@ private MessageEvent doActionWaitVanish(TestCaseExecution tCExecution, String va
private MessageEvent doActionWaitNetworkTrafficIdle(TestCaseExecution tCExecution) {
try {

return executorService.waitForIdleNetwork(tCExecution.getRobotExecutorObj().getExecutorProxyServiceHost(), tCExecution.getRobotExecutorObj().getExecutorExtensionPort(),
return executorService.waitForIdleNetwork(tCExecution.getRobotExecutorObj().getExecutorProxyServiceHost(), tCExecution.getRobotExecutorObj().getExecutorProxyServicePort(),
tCExecution.getRemoteProxyUUID(), tCExecution.getSystem());

} catch (CerberusEventException ex) {
Expand Down Expand Up @@ -1965,7 +1965,7 @@ private MessageEvent doActionSetNetworkTrafficContent(TestCaseExecution exe, Tes

// We now get the har data.
boolean doWithResponse = ParameterParserUtil.parseBooleanParam(withResponseContent, false);
JSONObject har = executorService.getHar(urlToFilter, doWithResponse, exe.getRobotExecutorObj().getExecutorProxyServiceHost(), exe.getRobotExecutorObj().getExecutorExtensionPort(), exe.getRemoteProxyUUID(), exe.getSystem(), indexFrom);
JSONObject har = executorService.getHar(urlToFilter, doWithResponse, exe.getRobotExecutorObj().getExecutorProxyServiceHost(), exe.getRobotExecutorObj().getExecutorProxyServicePort(), exe.getRemoteProxyUUID(), exe.getSystem(), indexFrom);

har = harService.enrichWithStats(har, exe.getCountryEnvApplicationParam().getDomain(), exe.getSystem(), exe.getNetworkTrafficIndexList());

Expand Down Expand Up @@ -2013,7 +2013,7 @@ private MessageEvent doActionIndexNetworkTraffic(TestCaseExecution exe, TestCase
/**
* Building the url to get the Latest index from cerberus-executor
*/
Integer nbHits = executorService.getHitsNb(exe.getRobotExecutorObj().getExecutorProxyServiceHost(), exe.getRobotExecutorObj().getExecutorExtensionPort(), exe.getRemoteProxyUUID());
Integer nbHits = executorService.getHitsNb(exe.getRobotExecutorObj().getExecutorProxyServiceHost(), exe.getRobotExecutorObj().getExecutorProxyServicePort(), exe.getRemoteProxyUUID());

NetworkTrafficIndex nti = new NetworkTrafficIndex();
if (StringUtil.isEmptyOrNull(value1)) {
Expand Down
Loading

0 comments on commit c3ed04a

Please sign in to comment.