From 10ef9792bccab12fda849fdfbf29566ca28ead88 Mon Sep 17 00:00:00 2001 From: anhefti Date: Tue, 17 Nov 2020 12:23:39 +0100 Subject: [PATCH] fixed proctoring --- .../seb/sebserver/gui/GuiServiceInfo.java | 22 ++++++++++--------- .../impl/SEBClientConnectionServiceImpl.java | 2 +- .../api/ExamProctoringController.java | 4 +--- .../config/application-dev-ws.properties | 2 +- .../config/application-gui.properties | 6 ++--- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/GuiServiceInfo.java b/src/main/java/ch/ethz/seb/sebserver/gui/GuiServiceInfo.java index a1d927af..0387b748 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/GuiServiceInfo.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/GuiServiceInfo.java @@ -29,24 +29,26 @@ public class GuiServiceInfo { private final UriComponentsBuilder externalServerURIBuilder; public GuiServiceInfo( - @Value("${sebserver.gui.http.external.scheme:https}") final String externalScheme, @Value("${server.address}") final String internalServer, - @Value("${sebserver.webservice.http.external.servername}") final String webserviceServer, - @Value("${sebserver.webservice.http.external.port}") final String webservicePort, - @Value("${sebserver.gui.http.external.servername}") final String externalServer, @Value("${server.port}") final String internalPort, + @Value("${sebserver.gui.http.external.scheme}") final String externalScheme, + @Value("${sebserver.gui.http.external.servername}") final String externalServer, @Value("${sebserver.gui.http.external.port}") final String externalPort, @Value("${sebserver.gui.entrypoint:/gui}") final String entryPoint) { + if (StringUtils.isBlank(externalScheme)) { + throw new RuntimeException("Missing mandatory inital parameter sebserver.gui.http.external.servername"); + } + + if (StringUtils.isBlank(externalServer)) { + throw new RuntimeException("Missing mandatory inital parameter sebserver.gui.http.external.servername"); + } + this.externalScheme = externalScheme; this.internalServer = internalServer; - this.externalServer = StringUtils.isNotBlank(externalServer) - ? externalServer - : StringUtils.isNotBlank(webserviceServer) - ? webserviceServer - : internalServer; + this.externalServer = externalServer; this.internalPort = internalPort; - this.externalPort = StringUtils.isNotBlank(externalPort) ? externalPort : webservicePort; + this.externalPort = externalPort; this.entryPoint = entryPoint; this.internalServerURIBuilder = UriComponentsBuilder .fromHttpUrl("http://" + this.internalServer); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientConnectionServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientConnectionServiceImpl.java index 494361ae..0b23aeaf 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientConnectionServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientConnectionServiceImpl.java @@ -681,7 +681,7 @@ public class SEBClientConnectionServiceImpl implements SEBClientConnectionServic return this.clientConnectionDAO.save(new ClientConnection( clientConnection.id, null, null, status, null, null, null, null, null, null, - null)) + true)) .getOrThrow(); } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamProctoringController.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamProctoringController.java index ed62ff9a..2823c55b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamProctoringController.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamProctoringController.java @@ -33,7 +33,6 @@ import ch.ethz.seb.sebserver.gbl.model.Domain; import ch.ethz.seb.sebserver.gbl.model.exam.ProctoringSettings; import ch.ethz.seb.sebserver.gbl.model.exam.SEBProctoringConnectionData; import ch.ethz.seb.sebserver.gbl.model.session.ClientConnection; -import ch.ethz.seb.sebserver.gbl.model.session.ClientConnection.ConnectionStatus; import ch.ethz.seb.sebserver.gbl.model.session.ClientInstruction; import ch.ethz.seb.sebserver.gbl.model.session.ClientInstruction.InstructionType; import ch.ethz.seb.sebserver.gbl.model.session.RemoteProctoringRoom; @@ -427,8 +426,7 @@ public class ExamProctoringController { // get all active connections for the exam and send the join instruction this.examSessionService.getConnectionData( examId, - cData -> cData.clientConnection.status == ConnectionStatus.ACTIVE - || cData.clientConnection.status == ConnectionStatus.CLOSED) + ExamSessionService.ACTIVE_CONNECTION_DATA_FILTER) .getOrThrow() .stream() .forEach(cc -> { diff --git a/src/main/resources/config/application-dev-ws.properties b/src/main/resources/config/application-dev-ws.properties index 1299fd10..9bbda8ec 100644 --- a/src/main/resources/config/application-dev-ws.properties +++ b/src/main/resources/config/application-dev-ws.properties @@ -26,7 +26,7 @@ sebserver.webservice.clean-db-on-startup=false sebserver.init.adminaccount.gen-on-init=false sebserver.webservice.distributed=false sebserver.webservice.http.external.scheme=http -sebserver.webservice.http.external.servername= +sebserver.webservice.http.external.servername=localhost sebserver.webservice.http.external.port=${server.port} sebserver.webservice.http.redirect.gui=/gui diff --git a/src/main/resources/config/application-gui.properties b/src/main/resources/config/application-gui.properties index fd0863d3..071a9f42 100644 --- a/src/main/resources/config/application-gui.properties +++ b/src/main/resources/config/application-gui.properties @@ -13,9 +13,9 @@ sebserver.gui.supported.languages=en sebserver.gui.date.displayformat=de # GUI API -sebserver.gui.http.external.scheme=https -sebserver.gui.http.external.servername=localhost -sebserver.gui.http.external.port=8080 +sebserver.gui.http.external.scheme=${sebserver.webservice.http.external.scheme} +sebserver.gui.http.external.servername=${sebserver.webservice.http.external.servername} +sebserver.gui.http.external.port=${sebserver.webservice.http.external.port} sebserver.gui.entrypoint=/gui sebserver.gui.webservice.protocol=http sebserver.gui.webservice.address=localhost