Skip to content

Commit

Permalink
Not guessing of Cerberus extension is available when robot is on clou…
Browse files Browse the repository at this point in the history
…d provider..
  • Loading branch information
vertigo17 committed Jan 1, 2025
1 parent 1d4dbcf commit 172aac5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,11 @@ public Request authenticate(Route route, Response response) throws IOException {
((LocksDevice) appiumDriver).unlockDevice();
}

// Check if Sikuli is available on node.
if (driver != null) {
// Check if Sikuli is available on node. (only if robot is not provided by cloud services)
if ((driver != null) && (TestCaseExecution.ROBOTPROVIDER_NONE.equals(execution.getRobotProvider()))) {
execution.getSession().setSikuliAvailable(sikuliService.isSikuliServerReachableOnNode(execution.getSession()));
} else {
execution.getSession().setSikuliAvailable(false);
}

execution.getSession().setStarted(true);
Expand All @@ -483,12 +485,12 @@ public Request authenticate(Route route, Response response) throws IOException {
LOG.error(exception.toString(), exception);
throw new CerberusException(exception.getMessageError(), exception);
} catch (MalformedURLException exception) {
LOG.error(exception.toString(), exception);
LOG.warn(exception.toString(), exception);
MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_URL_MALFORMED);
mes.setDescription(mes.getDescription().replace("%URL%", execution.getSession().getHost() + ":" + execution.getSession().getPort()));
throw new CerberusException(mes, exception);
} catch (UnreachableBrowserException exception) {
LOG.warn("Could not connect to : {}:{}", execution.getSeleniumIP(), execution.getSeleniumPort());
LOG.warn("Could not connect to Robot : {}:{}", execution.getSeleniumIP(), execution.getSeleniumPort());
MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_SELENIUM_COULDNOTCONNECT);
mes.setDescription(mes.getDescription().replace("%SSIP%", execution.getSeleniumIP()));
mes.setDescription(mes.getDescription().replace("%SSPORT%", execution.getSeleniumPort()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ public void init() {
MyVersion databaseSchedulerVersion;
try {
databaseSchedulerVersion = MyversionService.findMyVersionByKey("scheduler_version");
LOG.debug("Instance scheduler version : " + instanceSchedulerVersion + " / DB scheduler version : " + databaseSchedulerVersion.getValueString());
LOG.debug("Instance Quartz User scheduler version : " + instanceSchedulerVersion + " / DB scheduler version : " + databaseSchedulerVersion.getValueString());

//Compare version between database and instance
if (databaseSchedulerVersion.getValueString() == null || instanceSchedulerVersion.equalsIgnoreCase(databaseSchedulerVersion.getValueString())) {
LOG.debug("Instance scheduler version is up to date.");
LOG.debug("Instance Quartz User scheduler version is up to date.");
} else {
if (isRunning == false) {
isRunning = true;
LOG.info("Start of Reload Scheduler entries from database.");
LOG.info("Start of Reload Quartz User Scheduler entries from database.");
Set<Trigger> myTriggersSetList = new HashSet<>();

try {
Expand Down Expand Up @@ -162,24 +162,24 @@ public void init() {
instanceSchedulerVersion = databaseSchedulerVersion.getValueString();

} catch (Exception e) {
LOG.error("Failed to load scheduler table. " + myTriggersSetList);
LOG.error("Failed to load Quartz User scheduler table. " + myTriggersSetList);
LOG.error(e);
}
} else {
LOG.debug("Select new result in base not working, catch exception : " + ans.getMessageCodeString());
}

} catch (Exception e) {
LOG.debug("Failed to load schedule entry : " + e);
LOG.debug("Failed to load Quartz User schedule entry : " + e);
} finally {
isRunning = false;
}
} else {
LOG.debug("Scheduler version is already in updating");
LOG.debug("Quartz User Scheduler version is already in updating");
}
}
} catch (Exception e) {
LOG.debug("failed to launch scheduler init :" + e);
LOG.debug("failed to launch Quartz User scheduler init :" + e);
}
} catch (Exception e) {
LOG.debug("Execption : ", e);
Expand All @@ -190,16 +190,16 @@ public void init() {
@PreDestroy
public void closeScheduler() {
try {
LOG.info("Removing all Schedule entries.");
LOG.info("Removing all Quartz User Schedule entries.");
Collection<Scheduler> myCollectionScheduller = schFactory.getAllSchedulers();
Iterator it = myCollectionScheduller.iterator();
for (Scheduler mySched : myCollectionScheduller) {
mySched.clear();
mySched.shutdown(true);
}
LOG.info("end of Removing all Schedule entries.");
LOG.info("end of Removing all Quartz User Schedule entries.");
} catch (Exception e) {
LOG.error("Failed to clear Scheduler entries.");
LOG.error("Failed to clear Quartz User Scheduler entries.");
LOG.error(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public boolean isSikuliServerReachableOnNode(Session session) {
}

if (connection == null || connection.getResponseCode() != 200) {
LOG.warn("Responce code different from 200 when calling '" + urlToConnect + "'");
LOG.info("Responce code different from 200 when calling '" + urlToConnect + "'. Disable Cerberus extension features.");
return false;
}

Expand Down
4 changes: 4 additions & 0 deletions source/src/main/resources/database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6595,3 +6595,7 @@ ALTER TABLE myversion MODIFY COLUMN Value BIGINT NULL;
INSERT INTO myversion (`Key`,Value) VALUES ('scheduler_active_instance_version',0);
INSERT INTO myversion (`Key`,Value) VALUES ('documentation_database_last_refresh',0);

-- 1878
INSERT IGNORE INTO `invariant` (`idname`, `value`, `sort`, `description`)
VALUES ('CAPABILITY', 'unhandledPromptBehavior', 10, 'Defines how the driver should respond when a non-alert action is taken while an alert is present. Possible values : dismiss, accept, ignore, dismiss and notify, accept and notify');

0 comments on commit 172aac5

Please sign in to comment.