SEBSERV-270
This commit is contained in:
parent
c66a59223e
commit
aea16bfc99
3 changed files with 21 additions and 10 deletions
|
@ -150,11 +150,17 @@ public class JitsiProctoringService implements ExamProctoringService {
|
|||
final ResponseEntity<String> result =
|
||||
restTemplate.getForEntity(proctoringSettings.serverURL, String.class);
|
||||
if (result.getStatusCode() != HttpStatus.OK) {
|
||||
throw new APIMessageException(APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR);
|
||||
throw new APIMessageException(Arrays.asList(
|
||||
APIMessage.fieldValidationError(ProctoringServiceSettings.ATTR_SERVER_URL,
|
||||
"proctoringSettings:serverURL:url.invalid"),
|
||||
APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR.of()));
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
log.error("Failed to access proctoring service: {}", e.getMessage());
|
||||
throw new APIMessageException(APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR, e.getMessage());
|
||||
throw new APIMessageException(Arrays.asList(
|
||||
APIMessage.fieldValidationError(ProctoringServiceSettings.ATTR_SERVER_URL,
|
||||
"proctoringSettings:serverURL:url.invalid"),
|
||||
APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR.of(e)));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -186,14 +186,17 @@ public class ZoomProctoringService implements ExamProctoringService {
|
|||
credentials);
|
||||
|
||||
if (result.getStatusCode() != HttpStatus.OK) {
|
||||
throw new APIMessageException(
|
||||
APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR,
|
||||
String.valueOf(result.getStatusCode()));
|
||||
throw new APIMessageException(Arrays.asList(
|
||||
APIMessage.fieldValidationError(ProctoringServiceSettings.ATTR_SERVER_URL,
|
||||
"proctoringSettings:serverURL:url.invalid"),
|
||||
APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR.of()));
|
||||
}
|
||||
|
||||
} catch (final Exception e) {
|
||||
log.error("Failed to access Zoom service at: {}", proctoringSettings.serverURL, e);
|
||||
throw new APIMessageException(APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR, e.getMessage());
|
||||
throw new APIMessageException(Arrays.asList(
|
||||
APIMessage.fieldValidationError(ProctoringServiceSettings.ATTR_SERVER_URL,
|
||||
"proctoringSettings:serverURL:url.invalid"),
|
||||
APIMessage.ErrorMessage.EXTERNAL_SERVICE_BINDING_ERROR.of()));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -379,9 +379,11 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
|
|||
return this.entityDAO.byPK(examId)
|
||||
.flatMap(this.authorization::checkModify)
|
||||
.map(exam -> {
|
||||
this.examAdminService.getExamProctoringService(proctoringServiceSettings.serverType)
|
||||
.flatMap(service -> service.testExamProctoring(proctoringServiceSettings))
|
||||
.getOrThrow();
|
||||
if (proctoringServiceSettings.enableProctoring) {
|
||||
this.examAdminService.getExamProctoringService(proctoringServiceSettings.serverType)
|
||||
.flatMap(service -> service.testExamProctoring(proctoringServiceSettings))
|
||||
.getOrThrow();
|
||||
}
|
||||
this.examAdminService.saveProctoringServiceSettings(examId, proctoringServiceSettings);
|
||||
return exam;
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue