more tests
This commit is contained in:
parent
8d770d3926
commit
e9bd233635
3 changed files with 107 additions and 40 deletions
|
@ -13,11 +13,8 @@ import java.io.InputStream;
|
|||
import java.io.OutputStream;
|
||||
import java.io.PipedInputStream;
|
||||
import java.io.PipedOutputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
@ -57,36 +54,6 @@ public class ExamConfigServiceImpl implements ExamConfigService {
|
|||
|
||||
private static final Logger log = LoggerFactory.getLogger(ExamConfigServiceImpl.class);
|
||||
|
||||
// comma separated list of SEB exam config keys that can be ignored on imports
|
||||
// See: https://jira.let.ethz.ch/browse/SEBSERV-100
|
||||
private static final Set<String> SEB_EXAM_CONFIG_KEYS_TO_IGNORE = new HashSet<>(Arrays.asList(
|
||||
|
||||
// These keys don't exist anymore:
|
||||
"examConfigKeyContainedKeys",
|
||||
"allowWLAN",
|
||||
"insideSebEnableEnableNetworkConnectionSelector",
|
||||
"ignoreQuitPassword",
|
||||
"oskBehavior",
|
||||
"outsideSebEnableChangeAPassword",
|
||||
"outsideSebEnableEaseOfAccess",
|
||||
"outsideSebEnableLockThisComputer",
|
||||
"outsideSebEnableLogOff",
|
||||
"outsideSebEnableShutDownurlFilterRegex",
|
||||
"outsideSebEnableStartTaskManager",
|
||||
"outsideSebEnableSwitchUser",
|
||||
"outsideSebEnableVmWareClientShade",
|
||||
"enableURLContentFilter",
|
||||
"enableURLFilter",
|
||||
"prohibitedProcesses.windowHandlingProcess",
|
||||
"backgroundOpenSEBConfig",
|
||||
|
||||
// These keys are only used internally
|
||||
"urlFilterRegex",
|
||||
"urlFilterTrustedContent",
|
||||
"blacklistURLFilter",
|
||||
"whitelistURLFilter",
|
||||
"URLFilterIgnoreList"));
|
||||
|
||||
private final ExamConfigIO examConfigIO;
|
||||
private final ConfigurationAttributeDAO configurationAttributeDAO;
|
||||
private final ExamConfigurationMapDAO examConfigurationMapDAO;
|
||||
|
|
|
@ -34,6 +34,46 @@ public class ExamConfigXMLParser extends DefaultHandler {
|
|||
|
||||
private static final Logger log = LoggerFactory.getLogger(ExamConfigXMLParser.class);
|
||||
|
||||
// comma separated list of SEB exam config keys that can be ignored on imports
|
||||
// See: https://jira.let.ethz.ch/browse/SEBSERV-100
|
||||
private static final Set<String> SEB_EXAM_CONFIG_KEYS_TO_IGNORE = new HashSet<>(Arrays.asList(
|
||||
// SEB Server specific
|
||||
"sebMode",
|
||||
"sebServerFallback",
|
||||
"sebServerURL",
|
||||
|
||||
// Obsolete on SEB Server
|
||||
"startURL",
|
||||
"startURLAllowDeepLink",
|
||||
"startURLAppendQueryParameter",
|
||||
|
||||
// These keys don't exist anymore:
|
||||
"examConfigKeyContainedKeys",
|
||||
"allowWLAN",
|
||||
"insideSebEnableEnableNetworkConnectionSelector",
|
||||
"ignoreQuitPassword",
|
||||
"oskBehavior",
|
||||
"outsideSebEnableChangeAPassword",
|
||||
"outsideSebEnableEaseOfAccess",
|
||||
"outsideSebEnableLockThisComputer",
|
||||
"outsideSebEnableLogOff",
|
||||
"outsideSebEnableShutDownurlFilterRegex",
|
||||
"outsideSebEnableStartTaskManager",
|
||||
"outsideSebEnableSwitchUser",
|
||||
"outsideSebEnableVmWareClientShade",
|
||||
"enableURLContentFilter",
|
||||
"enableURLFilter",
|
||||
"prohibitedProcesses.windowHandlingProcess",
|
||||
"permittedProcesses.windowHandlingProcess",
|
||||
"backgroundOpenSEBConfig",
|
||||
|
||||
// These keys are only used internally
|
||||
"urlFilterRegex",
|
||||
"urlFilterTrustedContent",
|
||||
"blacklistURLFilter",
|
||||
"whitelistURLFilter",
|
||||
"URLFilterIgnoreList"));
|
||||
|
||||
private static final Set<String> VALUE_ELEMENTS = new HashSet<>(Arrays.asList(
|
||||
Constants.XML_PLIST_BOOLEAN_FALSE,
|
||||
Constants.XML_PLIST_BOOLEAN_TRUE,
|
||||
|
@ -381,7 +421,11 @@ public class ExamConfigXMLParser extends DefaultHandler {
|
|||
return handleKioskMode(name, listIndex, value);
|
||||
}
|
||||
|
||||
log.warn("Unknown attribute. name={} value={}", name, value);
|
||||
if (SEB_EXAM_CONFIG_KEYS_TO_IGNORE.contains(name)) {
|
||||
log.debug("Black-listed attribute. name={} value={}", name, value);
|
||||
} else {
|
||||
log.warn("Unknown attribute. name={} value={}", name, value);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,9 +56,12 @@ import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup.LmsType;
|
|||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.Configuration;
|
||||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationAttribute;
|
||||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationNode;
|
||||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationNode.ConfigurationStatus;
|
||||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationNode.ConfigurationType;
|
||||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationTableValues;
|
||||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationTableValues.TableValue;
|
||||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationValue;
|
||||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.Orientation;
|
||||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.SebClientConfig;
|
||||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.View;
|
||||
import ch.ethz.seb.sebserver.gbl.model.user.PasswordChange;
|
||||
|
@ -112,9 +115,12 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.Ge
|
|||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetOrientationPage;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetOrientations;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetViewList;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetViewPage;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetViews;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.ImportExamConfigOnExistingConfig;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.ImportNewExamConfig;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.NewExamConfig;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.SaveExamConfig;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.SaveExamConfigHistory;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.SaveExamConfigTableValues;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.SaveExamConfigValue;
|
||||
|
@ -1426,18 +1432,68 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest {
|
|||
// Use Case 13: Login as examAdmin2 and use newly created configuration
|
||||
// - change configuration status to "Ready to Use"
|
||||
public void testUsecase13() throws IOException {
|
||||
final RestServiceImpl restService = createRestServiceForUser(
|
||||
"examAdmin2",
|
||||
"examAdmin2",
|
||||
new GetConfigAttributes(),
|
||||
new GetExamConfigNodePage(),
|
||||
new SaveExamConfig());
|
||||
|
||||
// get configuration from page
|
||||
final ConfigurationNode config = restService
|
||||
.getBuilder(GetExamConfigNodePage.class)
|
||||
.call()
|
||||
.getOrThrow().content
|
||||
.get(0);
|
||||
assertEquals("New Exam Config", config.name);
|
||||
|
||||
final ConfigurationNode newConfig = new ConfigurationNode(
|
||||
config.id,
|
||||
config.institutionId,
|
||||
config.templateId,
|
||||
config.name,
|
||||
config.description,
|
||||
ConfigurationType.EXAM_CONFIG,
|
||||
config.owner,
|
||||
ConfigurationStatus.READY_TO_USE);
|
||||
|
||||
final ConfigurationNode savedConfig = restService
|
||||
.getBuilder(SaveExamConfig.class)
|
||||
.withBody(newConfig)
|
||||
.call()
|
||||
.getOrThrow();
|
||||
|
||||
assertTrue(savedConfig.status == ConfigurationStatus.READY_TO_USE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(14)
|
||||
@Order(15)
|
||||
// *************************************
|
||||
// Use Case 14: Login as examAdmin2 and use newly created configuration
|
||||
// - create template from it
|
||||
// - get all templates
|
||||
// - check newly created template
|
||||
public void testUsecase14() throws IOException {
|
||||
// Use Case 15: Login as examAdmin2 and get views and orientations
|
||||
// - test Views API
|
||||
public void testUsecase15() throws IOException {
|
||||
final RestServiceImpl restService = createRestServiceForUser(
|
||||
"examAdmin2",
|
||||
"examAdmin2",
|
||||
new GetViews(),
|
||||
new GetViewPage(),
|
||||
new GetOrientationPage(),
|
||||
new GetOrientations());
|
||||
|
||||
final List<View> views = restService
|
||||
.getBuilder(GetViews.class)
|
||||
.call()
|
||||
.getOrThrow();
|
||||
|
||||
assertNotNull(views);
|
||||
assertTrue(views.size() == 11);
|
||||
|
||||
final List<Orientation> orientations = restService
|
||||
.getBuilder(GetOrientations.class)
|
||||
.call()
|
||||
.getOrThrow();
|
||||
|
||||
assertNotNull(orientations);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue