more integration tests
This commit is contained in:
parent
2919cfaacd
commit
2eefbfae30
2 changed files with 52 additions and 4 deletions
|
@ -248,6 +248,9 @@ public final class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String formatDate(final DateTime dateTime) {
|
public static String formatDate(final DateTime dateTime) {
|
||||||
|
if (dateTime == null) {
|
||||||
|
return Constants.EMPTY_NOTE;
|
||||||
|
}
|
||||||
return dateTime.toString(Constants.STANDARD_DATE_TIME_MILLIS_FORMATTER);
|
return dateTime.toString(Constants.STANDARD_DATE_TIME_MILLIS_FORMATTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ import org.junit.runners.MethodSorters;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.test.context.jdbc.Sql;
|
import org.springframework.test.context.jdbc.Sql;
|
||||||
import org.springframework.util.LinkedMultiValueMap;
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.util.MultiValueMap;
|
||||||
|
@ -99,6 +100,7 @@ import ch.ethz.seb.sebserver.gbl.model.sebconfig.View;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.session.ClientConnection;
|
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.ClientConnection.ConnectionStatus;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.session.ClientConnectionData;
|
import ch.ethz.seb.sebserver.gbl.model.session.ClientConnectionData;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.model.session.ClientEvent.ExportType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.session.ClientInstruction;
|
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.ClientInstruction.InstructionType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.session.ClientNotification;
|
import ch.ethz.seb.sebserver.gbl.model.session.ClientNotification;
|
||||||
|
@ -168,7 +170,9 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.lmssetup.GetLmsSe
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.lmssetup.NewLmsSetup;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.lmssetup.NewLmsSetup;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.lmssetup.SaveLmsSetup;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.lmssetup.SaveLmsSetup;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.lmssetup.TestLmsSetup;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.lmssetup.TestLmsSetup;
|
||||||
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.logs.DeleteAllClientEvents;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.logs.DeleteAllUserLogs;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.logs.DeleteAllUserLogs;
|
||||||
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.logs.ExportSEBClientLogs;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.logs.GetExtendedClientEventPage;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.logs.GetExtendedClientEventPage;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.logs.GetUserLogNames;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.logs.GetUserLogNames;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.logs.GetUserLogPage;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.logs.GetUserLogPage;
|
||||||
|
@ -2121,6 +2125,8 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest {
|
||||||
new GetClientConnection(),
|
new GetClientConnection(),
|
||||||
new GetMonitoringFullPageData(),
|
new GetMonitoringFullPageData(),
|
||||||
new GetExtendedClientEventPage(),
|
new GetExtendedClientEventPage(),
|
||||||
|
new ExportSEBClientLogs(),
|
||||||
|
new DeleteAllClientEvents(),
|
||||||
new DisableClientConnection(),
|
new DisableClientConnection(),
|
||||||
new PropagateInstruction(),
|
new PropagateInstruction(),
|
||||||
new GetClientConnectionPage(),
|
new GetClientConnectionPage(),
|
||||||
|
@ -2137,7 +2143,8 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest {
|
||||||
new ActivateClientConfig(),
|
new ActivateClientConfig(),
|
||||||
new GetClientConfigPage(),
|
new GetClientConfigPage(),
|
||||||
new GetIndicatorPage(),
|
new GetIndicatorPage(),
|
||||||
new GetIndicators());
|
new GetIndicators(),
|
||||||
|
new DeleteAllClientEvents());
|
||||||
|
|
||||||
// get running exams
|
// get running exams
|
||||||
final Result<Page<Exam>> runningExamsCall = restService.getBuilder(GetRunningExamPage.class)
|
final Result<Page<Exam>> runningExamsCall = restService.getBuilder(GetRunningExamPage.class)
|
||||||
|
@ -2332,7 +2339,8 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest {
|
||||||
assertEquals("DISABLED", conData.clientConnection.status.name());
|
assertEquals("DISABLED", conData.clientConnection.status.name());
|
||||||
|
|
||||||
// get client logs
|
// get client logs
|
||||||
final Result<Page<ExtendedClientEvent>> clientLogPage = restService.getBuilder(GetExtendedClientEventPage.class)
|
final Result<Page<ExtendedClientEvent>> clientLogPage = restService
|
||||||
|
.getBuilder(GetExtendedClientEventPage.class)
|
||||||
.call();
|
.call();
|
||||||
|
|
||||||
assertNotNull(clientLogPage);
|
assertNotNull(clientLogPage);
|
||||||
|
@ -2342,6 +2350,32 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest {
|
||||||
final ExtendedClientEvent extendedClientEvent = clientLogs.content.get(0);
|
final ExtendedClientEvent extendedClientEvent = clientLogs.content.get(0);
|
||||||
assertNotNull(extendedClientEvent);
|
assertNotNull(extendedClientEvent);
|
||||||
|
|
||||||
|
// export client logs
|
||||||
|
restService
|
||||||
|
.getBuilder(ExportSEBClientLogs.class)
|
||||||
|
.withQueryParam(API.SEB_CLIENT_EVENT_EXPORT_TYPE, ExportType.CSV.name())
|
||||||
|
.withQueryParam(API.SEB_CLIENT_EVENT_EXPORT_INCLUDE_EXAMS, "true")
|
||||||
|
.withResponseExtractor(response -> {
|
||||||
|
final HttpStatus statusCode = response.getStatusCode();
|
||||||
|
assertEquals("200 OK", statusCode.toString());
|
||||||
|
final String csvExport = IOUtils.toString(response.getBody());
|
||||||
|
assertTrue(StringUtils.isNotBlank(csvExport));
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.call();
|
||||||
|
|
||||||
|
// delete client logs
|
||||||
|
final Result<EntityProcessingReport> report = adminRestService
|
||||||
|
.getBuilder(DeleteAllClientEvents.class)
|
||||||
|
.withFormParam(
|
||||||
|
API.PARAM_MODEL_ID_LIST,
|
||||||
|
StringUtils.join(
|
||||||
|
clientLogs.content.stream().map(e -> e.getModelId()).collect(Collectors.toList()), ","))
|
||||||
|
.call();
|
||||||
|
|
||||||
|
assertNotNull(report);
|
||||||
|
assertFalse(report.hasError());
|
||||||
|
|
||||||
// get client connection page
|
// get client connection page
|
||||||
Result<Page<ClientConnection>> connectionPageRes = restService
|
Result<Page<ClientConnection>> connectionPageRes = restService
|
||||||
.getBuilder(GetClientConnectionPage.class)
|
.getBuilder(GetClientConnectionPage.class)
|
||||||
|
@ -2362,19 +2396,30 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest {
|
||||||
assertNotNull(connectionPage);
|
assertNotNull(connectionPage);
|
||||||
assertTrue(connectionPage.isEmpty());
|
assertTrue(connectionPage.isEmpty());
|
||||||
|
|
||||||
final Result<Page<ClientConnectionData>> connectionDatacall = restService
|
Result<Page<ClientConnectionData>> connectionDatacall = restService
|
||||||
.getBuilder(GetFinishedExamClientConnectionPage.class)
|
.getBuilder(GetFinishedExamClientConnectionPage.class)
|
||||||
.withURIVariable(API.PARAM_PARENT_MODEL_ID, exam.getModelId())
|
.withURIVariable(API.PARAM_PARENT_MODEL_ID, exam.getModelId())
|
||||||
.call();
|
.call();
|
||||||
assertNotNull(connectionDatacall);
|
assertNotNull(connectionDatacall);
|
||||||
assertFalse(connectionDatacall.hasError());
|
assertFalse(connectionDatacall.hasError());
|
||||||
final Page<ClientConnectionData> ccDataPage = connectionDatacall.get();
|
Page<ClientConnectionData> ccDataPage = connectionDatacall.get();
|
||||||
assertNotNull(ccDataPage);
|
assertNotNull(ccDataPage);
|
||||||
assertFalse(ccDataPage.content.isEmpty());
|
assertFalse(ccDataPage.content.isEmpty());
|
||||||
final ClientConnectionData clientConnectionData = ccDataPage.content.get(0);
|
final ClientConnectionData clientConnectionData = ccDataPage.content.get(0);
|
||||||
assertNotNull(clientConnectionData);
|
assertNotNull(clientConnectionData);
|
||||||
assertEquals("DISABLED", clientConnectionData.clientConnection.status.toString());
|
assertEquals("DISABLED", clientConnectionData.clientConnection.status.toString());
|
||||||
|
|
||||||
|
connectionDatacall = restService
|
||||||
|
.getBuilder(GetFinishedExamClientConnectionPage.class)
|
||||||
|
.withURIVariable(API.PARAM_PARENT_MODEL_ID, exam.getModelId())
|
||||||
|
.withQueryParam(ClientConnection.FILTER_ATTR_INFO, "test")
|
||||||
|
.call();
|
||||||
|
assertNotNull(connectionDatacall);
|
||||||
|
assertFalse(connectionDatacall.hasError());
|
||||||
|
ccDataPage = connectionDatacall.get();
|
||||||
|
assertNotNull(ccDataPage);
|
||||||
|
assertTrue(ccDataPage.content.isEmpty());
|
||||||
|
|
||||||
final Result<ClientConnectionData> ccDataCall = restService
|
final Result<ClientConnectionData> ccDataCall = restService
|
||||||
.getBuilder(GetFinishedExamClientConnection.class)
|
.getBuilder(GetFinishedExamClientConnection.class)
|
||||||
.withURIVariable(API.PARAM_MODEL_ID, clientConnectionData.getModelId())
|
.withURIVariable(API.PARAM_MODEL_ID, clientConnectionData.getModelId())
|
||||||
|
|
Loading…
Reference in a new issue