Skip to content

Commit

Permalink
Edit Robot on execution page
Browse files Browse the repository at this point in the history
MANUAL Proxy configuration for Robot Executors
  • Loading branch information
vertigo17 committed Jan 14, 2024
1 parent 07d8add commit d5a4ab1
Show file tree
Hide file tree
Showing 17 changed files with 154 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,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`, `active`, `rank`, `host`, `port`, `host_user`, `host_password`, `deviceudid`, `devicename`, `deviceport`, `devicelockunlock`, `executorextensionhost`, `executorextensionport`, `executorproxyhost`, `executorproxyport`, `executorproxyactive`, `description`, `usrcreated`) ");
query.append("INSERT INTO robotexecutor (`robot`, `executor`, `active`, `rank`, `host`, `port`, `host_user`, `host_password`, `deviceudid`, `devicename`, `deviceport`, `devicelockunlock`, `executorextensionhost`, `executorextensionport`, `executorproxyhost`, `executorproxyport`, `executorproxytype`, `description`, `usrcreated`) ");
query.append("VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");

// Debug message on SQL.
Expand Down Expand Up @@ -310,7 +310,7 @@ public Answer create(RobotExecutor object) {
} else {
preStat.setNull(i++, Types.INTEGER);
}
preStat.setString(i++, object.getExecutorProxyActive());
preStat.setString(i++, object.getExecutorProxyType());
preStat.setString(i++, object.getDescription());
preStat.setString(i++, object.getUsrCreated());
preStat.executeUpdate();
Expand Down Expand Up @@ -368,7 +368,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 = ?, active = ?, `rank` = ?, `host` = ?, `port` = ?, `host_user` = ?, `host_password` = ?, `deviceudid` = ?, `devicename` = ?, `deviceport` = ?, `devicelockunlock` = ?, `executorextensionhost` = ?, `executorextensionport` = ?, `executorproxyhost` = ?, `executorproxyport` = ?, `executorproxyactive` = ?, "
final String query = "UPDATE robotexecutor SET `robot` = ?, `executor` = ?, description = ?, active = ?, `rank` = ?, `host` = ?, `port` = ?, `host_user` = ?, `host_password` = ?, `deviceudid` = ?, `devicename` = ?, `deviceport` = ?, `devicelockunlock` = ?, `executorextensionhost` = ?, `executorextensionport` = ?, `executorproxyhost` = ?, `executorproxyport` = ?, `executorproxytype` = ?, "
+ "dateModif = NOW(), usrModif= ? WHERE `robot` = ? and `executor` = ?";

// Debug message on SQL.
Expand Down Expand Up @@ -410,7 +410,7 @@ public Answer update(String robot, String executor, RobotExecutor object) {
} else {
preStat.setNull(i++, Types.INTEGER);
}
preStat.setString(i++, object.getExecutorProxyActive());
preStat.setString(i++, object.getExecutorProxyType());
preStat.setString(i++, object.getUsrModif());
preStat.setString(i++, robot);
preStat.setString(i++, executor);
Expand Down Expand Up @@ -477,7 +477,7 @@ public RobotExecutor loadFromResultSet(ResultSet rs) throws SQLException {
Integer executorExtensionPort = rs.getInt("rbe.executorextensionport");
String executorProxyHost = rs.getString("rbe.executorproxyhost");
Integer executorProxyPort = rs.getInt("rbe.executorproxyport");
String executorProxyActive = rs.getString("rbe.executorproxyactive");
String executorProxyType = rs.getString("rbe.executorproxytype");
if(deviceport == 0) {
deviceport=null;
}
Expand All @@ -490,7 +490,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, active, rank, host, port, host_user, host_password, nodeProxyPort, deviceudid, devicename, deviceport, devicelockunlock, executorExtensionHost, executorExtensionPort, executorProxyHost, executorProxyPort, executorProxyActive, description, usrCreated, dateCreated, usrModif, dateModif);
return factoryRobotExecutor.create(id, robot, executor, active, rank, host, port, host_user, host_password, nodeProxyPort, deviceudid, devicename, deviceport, devicelockunlock, executorExtensionHost, executorExtensionPort, executorProxyHost, executorProxyPort, executorProxyType, description, usrCreated, dateCreated, usrModif, dateModif);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class RobotExecutor {
private String deviceLockUnlock;
private String description;
private long dateLastExeSubmitted;
private String executorProxyActive;
private String executorProxyType;
private String executorExtensionHost;
private Integer executorExtensionPort;
private String executorProxyHost;
Expand All @@ -60,6 +60,13 @@ public class RobotExecutor {
private String UsrModif;
private Timestamp DateModif;

/**
* Static PROXY TYPE String.
*/
public static final String PROXY_TYPE_NONE = "NONE"; // No Proxy. Browser will connect directly on Internet
public static final String PROXY_TYPE_MANUAL = "MANUAL"; // A Manual proxy is configured on executorProxyHost and executorProxyPort
public static final String PROXY_TYPE_NETWORKTRAFFIC = "NETWORKTRAFFIC"; // Proxy will be configured to Cerberus robot proxy component --> Network traffic features will be activated.

public Integer getNodeProxyPort() {
return nodeProxyPort;
}
Expand Down Expand Up @@ -240,12 +247,12 @@ public void setExecutorProxyPort(Integer executorProxyPort) {
this.executorProxyPort = executorProxyPort;
}

public String getExecutorProxyActive() {
return executorProxyActive;
public String getExecutorProxyType() {
return executorProxyType;
}

public void setExecutorProxyActive(String executorProxyActive) {
this.executorProxyActive = executorProxyActive;
public void setExecutorProxyType(String executorProxyType) {
this.executorProxyType = executorProxyType;
}

/**
Expand Down Expand Up @@ -357,7 +364,7 @@ public boolean equals(Object obj) {
if ((this.deviceLockUnlock == null) ? (other.deviceLockUnlock != null) : !this.deviceLockUnlock.equals(other.deviceLockUnlock)) {
return false;
}
if ((this.executorProxyActive == null) ? (other.executorProxyActive != null) : !this.executorProxyActive.equals(other.executorProxyActive)) {
if ((this.executorProxyType == null) ? (other.executorProxyType != null) : !this.executorProxyType.equals(other.executorProxyType)) {
return false;
}
if ((this.executorExtensionHost == null) ? (other.executorExtensionHost != null) : !this.executorExtensionHost.equals(other.executorExtensionHost)) {
Expand Down Expand Up @@ -398,7 +405,7 @@ public JSONObject toJson(boolean secured) {
result.put("executorExtensionPort", this.getExecutorExtensionPort());
result.put("executorProxyHost", this.getExecutorProxyHost());
result.put("executorProxyPort", this.getExecutorProxyPort());
result.put("executorProxyActive", "Y".equals(this.getExecutorProxyActive()));
result.put("executorProxyType", this.getExecutorProxyType());
result.put("executor", this.getExecutor());
result.put("host", this.getHost());
if (secured) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ public interface IFactoryRobotExecutor {
* @param executorProxyPort
* @param deviceUdid
* @param UsrCreated
* @param executorProxyActive
* @param executorProxyType
* @param DateCreated
* @param UsrModif
* @param DateModif
* @return
*/
RobotExecutor create(Integer ID, String robot, String executor, String active,
Integer rank, String host, String port, String hostUser, String hostPassword, Integer nodeProxyPort, String deviceUdid,
String deviceName, Integer devicePort, String deviceLockUnlock, String executorExtensionHost, Integer executorExtensionPort, String executorProxyHost, Integer executorProxyPort, String executorProxyActive,
String deviceName, Integer devicePort, String deviceLockUnlock, String executorExtensionHost, Integer executorExtensionPort, 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 @@ -31,7 +31,7 @@
public class FactoryRobotExecutor implements IFactoryRobotExecutor {

@Override
public RobotExecutor create(Integer ID, String robot, String executor, String active, Integer rank, String host, String port, String hostUser, String hostPassword, Integer nodeProxyPort, String deviceUdid, String deviceName, Integer devicePort, String deviceLockUnlock,String executorExtensionHost, Integer executorExtensionPort, String executorProxyHost, Integer executorProxyPort, String executorProxyActive, String description,
public RobotExecutor create(Integer ID, String robot, String executor, String active, Integer rank, String host, String port, String hostUser, String hostPassword, Integer nodeProxyPort, String deviceUdid, String deviceName, Integer devicePort, String deviceLockUnlock,String executorExtensionHost, Integer executorExtensionPort, 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 @@ -50,7 +50,7 @@ public RobotExecutor create(Integer ID, String robot, String executor, String ac
newRobot.setExecutorExtensionHost(executorExtensionHost);
newRobot.setExecutorExtensionPort(executorExtensionPort);
newRobot.setExecutorProxyHost(executorProxyHost);
newRobot.setExecutorProxyActive(executorProxyActive);
newRobot.setExecutorProxyType(executorProxyType);
newRobot.setExecutorProxyPort(executorProxyPort);
newRobot.setDescription(description);
newRobot.setUsrCreated(UsrCreated);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ public String exeSQL(String sqlString) {
}
}
LOG.info("Starting Execution of '{}'", sqlStringLog);
try (Connection connection = this.databaseSpring.connect();
Statement preStat = connection.createStatement()) {
try (Connection connection = this.databaseSpring.connect(); Statement preStat = connection.createStatement()) {
preStat.execute(sqlString);
LOG.info("'{}' Executed successfully.", sqlStringLog);
} catch (Exception exception1) {
Expand Down Expand Up @@ -781,9 +780,9 @@ public ArrayList<String> getSqlDocumentation() {
b.append(",('robotexecutor','executorProxyHost','','fa','میزبان پروکسی مرورگر', 'میزبانی که برای اتصال به سرویس پروکسی به مرورگر داده می شود. اگر خالی باشد، میزبان سرویس ربات پروکسی استفاده خواهد شد.',NULL)");
b.append(",('robotexecutor','executorProxyPort','','en','Browser Proxy Port','Port that will be used by the browser in order to connect to the proxy service. If 0, port will be determined randomly.',NULL)");
b.append(",('robotexecutor','executorProxyPort','','fa','درگاه پروکسی مرورگر','درگاهی که مرورگر برای اتصال به سرویس پروکسی از آن استفاده می کند. اگر 0 باشد، پورت به صورت تصادفی تعیین می شود.',NULL)");
b.append(",('robotexecutor','executorProxyActive','','fr','Activer Proxy', 'Activer / Désactiver l\\'utilisation du proxy. L\\'utilisation du proxy permet de collecter des statistique et de controler le trafic réseau engendré par le navigateur.',NULL)");
b.append(",('robotexecutor','executorProxyActive','','en','Activate Proxy', 'Activate / Unactivate the usage of proxy service. Proxy service will allow to collect statistics and control the network traffic generated by the browser.',NULL)");
b.append(",('robotexecutor','executorProxyActive','','fa','فعالسازی پروکسی', 'فعالسازی / غیرفعالسازی استفاده از پروکسی. سرویس پروکسی امکان جمع آوری آمار و کنترل ترافیک شبکه تولید شده توسط مرورگر را فراهم می کند.',NULL)");
b.append(",('robotexecutor','executorProxyType','','fr','Type de Proxy', 'Activer / Désactiver l\\'utilisation du proxy. L\\'utilisation du proxy permet de collecter des statistique et de controler le trafic réseau engendré par le navigateur.',NULL)");
b.append(",('robotexecutor','executorProxyType','','en','Proxy Type', 'Activate / Unactivate the usage of proxy service. Proxy service will allow to collect statistics and control the network traffic generated by the browser.',NULL)");
b.append(",('robotexecutor','executorProxyType','','fa','فعالسازی پروکسی', 'فعالسازی / غیرفعالسازی استفاده از پروکسی. سرویس پروکسی امکان جمع آوری آمار و کنترل ترافیک شبکه تولید شده توسط مرورگر را فراهم می کند.',NULL)");
b.append(",('scheduleentry','cronDefinition','','fr','Expression Cron Quartz','Expression Cron parametree pour ordonnancer la campagne',NULL)");
b.append(",('scheduleentry','cronDefinition','','en','Quartz Cron Expression','Cron expression use to schedule campaign',NULL)");
b.append(",('scheduleentry','cronDefinition','','fa','عبارت کرون کوارتز','پارامتر عبارت کرون برای زمانبندی کمپین',NULL)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import java.util.Date;
import org.cerberus.core.crud.entity.BuildRevisionInvariant;
import org.cerberus.core.crud.entity.CountryEnvParam;
import org.cerberus.core.crud.entity.RobotExecutor;
import org.cerberus.core.crud.entity.Test;
import org.cerberus.core.crud.entity.TestCase;
import org.cerberus.core.crud.entity.TestCaseExecution;
Expand Down Expand Up @@ -366,7 +367,7 @@ private boolean checkMaintenanceTime(TestCaseExecution tCExecution) {
private boolean checkExecutorProxy(TestCaseExecution tce) {

//if executor proxy active, check cerberus-executor is available
if (tce.getRobotExecutorObj() != null && "Y".equals(tce.getRobotExecutorObj().getExecutorProxyActive())) {
if (tce.getRobotExecutorObj() != null && RobotExecutor.PROXY_TYPE_NETWORKTRAFFIC.equals(tce.getRobotExecutorObj().getExecutorProxyType())) {

//If ExecutorExtensionHost is null or empty, use the Robot Host
if (tce.getRobotExecutorObj().getExecutorExtensionHost() == null || tce.getRobotExecutorObj().getExecutorExtensionHost().isEmpty()) {
Expand Down
Loading

0 comments on commit d5a4ab1

Please sign in to comment.