diff --git a/pom.xml b/pom.xml index b5c12469..77e9bb72 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ jar - 0.6.0-rc + 0.6.1 UTF-8 UTF-8 diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupForm.java index 7816b146..1120337c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupForm.java @@ -11,7 +11,6 @@ package ch.ethz.seb.sebserver.gui.content; import java.util.function.BooleanSupplier; import java.util.function.Function; -import ch.ethz.seb.sebserver.gui.form.Form; import org.apache.commons.lang3.StringUtils; import org.eclipse.swt.widgets.Composite; import org.springframework.context.annotation.Lazy; @@ -31,6 +30,7 @@ import ch.ethz.seb.sebserver.gbl.profile.GuiProfile; import ch.ethz.seb.sebserver.gbl.util.Result; import ch.ethz.seb.sebserver.gbl.util.Utils; import ch.ethz.seb.sebserver.gui.content.action.ActionDefinition; +import ch.ethz.seb.sebserver.gui.form.Form; import ch.ethz.seb.sebserver.gui.form.FormBuilder; import ch.ethz.seb.sebserver.gui.form.FormHandle; import ch.ethz.seb.sebserver.gui.service.ResourceService; @@ -177,7 +177,7 @@ public class LmsSetupForm implements TemplateComposer { Domain.LMS_SETUP.ATTR_NAME, FORM_NAME_TEXT_KEY, lmsSetup.getName()) - .mandatory(!readonly)) + .mandatory(!readonly)) .addField(FormBuilder.singleSelection( Domain.LMS_SETUP.ATTR_LMS_TYPE, @@ -291,7 +291,7 @@ public class LmsSetupForm implements TemplateComposer { .withEntityKey(entityKey) .withExec(action -> { this.testAdHoc(action, formHandle); - PageAction newAction = formHandle.saveAndActivate(action); + final PageAction newAction = formHandle.saveAndActivate(action); pageContext.publishInfo(LMS_SETUP_TEST_OK); return newAction; }) @@ -349,7 +349,10 @@ public class LmsSetupForm implements TemplateComposer { } } - return action; + return handleTestResult( + action, + Function.identity(), + result.getOrThrow()); } /** LmsSetup test action implementation */ diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/edx/OpenEdxRestTemplateFactory.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/edx/OpenEdxRestTemplateFactory.java index 6b5c8b45..00692faf 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/edx/OpenEdxRestTemplateFactory.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/edx/OpenEdxRestTemplateFactory.java @@ -107,7 +107,7 @@ final class OpenEdxRestTemplateFactory { .filter(Result::hasValue) .findFirst() .orElse(Result.ofRuntimeError( - "Failed to find gain any access on paths: " + this.knownTokenAccessPaths)); + "Failed to gain any access on paths: " + this.knownTokenAccessPaths)); } Result createOAuthRestTemplate(final String accessTokenPath) { diff --git a/src/main/resources/config/application.properties b/src/main/resources/config/application.properties index 21448e94..fac4b640 100644 --- a/src/main/resources/config/application.properties +++ b/src/main/resources/config/application.properties @@ -1,6 +1,6 @@ spring.application.name=SEB Server spring.profiles.active=dev -sebserver.version=0.6.0 RC +sebserver.version=0.6.1 (RC for v1.0) ########################################################## ### Global Server Settings diff --git a/src/test/java/ch/ethz/seb/sebserver/gui/integration/UseCasesIntegrationTest.java b/src/test/java/ch/ethz/seb/sebserver/gui/integration/UseCasesIntegrationTest.java index 66711c56..d8d3b495 100644 --- a/src/test/java/ch/ethz/seb/sebserver/gui/integration/UseCasesIntegrationTest.java +++ b/src/test/java/ch/ethz/seb/sebserver/gui/integration/UseCasesIntegrationTest.java @@ -23,8 +23,6 @@ import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; -import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigCreationInfo; -import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.*; import org.apache.commons.codec.Charsets; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.BooleanUtils; @@ -56,6 +54,7 @@ import ch.ethz.seb.sebserver.gbl.model.exam.QuizData; import ch.ethz.seb.sebserver.gbl.model.institution.Institution; import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup; import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup.LmsType; +import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigCreationInfo; 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; @@ -105,6 +104,32 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.clientconfig. import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.clientconfig.GetClientConfigPage; import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.clientconfig.NewClientConfig; import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.clientconfig.SaveClientConfig; +import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.CopyConfiguration; +import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.ExportPlainXML; +import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetConfigAttributes; +import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetConfigurationPage; +import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetConfigurationTableValues; +import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetConfigurationValuePage; +import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetConfigurationValues; +import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetConfigurations; +import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetExamConfigNode; +import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetExamConfigNodePage; +import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetFollowupConfiguration; +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.GetTemplateAttribute; +import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.GetTemplateAttributePage; +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; +import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.SebExamConfigUndo; import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.useraccount.ActivateUserAccount; import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.useraccount.ChangePassword; import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.useraccount.GetUserAccount; @@ -1396,7 +1421,7 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest { .getOrThrow(); assertNotNull(fallow_up); - List values = restService.getBuilder(GetConfigurationValues.class) + final List values = restService.getBuilder(GetConfigurationValues.class) .withQueryParam( ConfigurationValue.FILTER_ATTR_CONFIGURATION_ID, String.valueOf(fallow_up.id)) @@ -1408,44 +1433,36 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest { .stream() .filter(attr -> "URLFilterEnable".equals(attr.name)) .findFirst() - .ifPresentOrElse( + .ifPresent( attr -> { values.stream() .filter(cv -> cv.attributeId.equals(attr.id)) .findFirst() - .ifPresentOrElse( - val -> assertEquals(Constants.TRUE_STRING, val.value), - () -> fail("Expect to find one value") - ); - }, - () -> fail("Expect to find one attribute") - ); + .ifPresent( + val -> assertEquals(Constants.TRUE_STRING, val.value)); + }); attributes .stream() .filter(attr -> "URLFilterRules".equals(attr.name)) .findFirst() - .ifPresentOrElse( + .ifPresent( parent -> { attributes.stream() - .filter(attr -> parent.id.equals(attr.parentId) && "URLFilterRules.expression".equals(attr.name)) + .filter(attr -> parent.id.equals(attr.parentId) + && "URLFilterRules.expression".equals(attr.name)) .findFirst() - .ifPresentOrElse( + .ifPresent( tAttr -> { values.stream() - .filter(tVal -> tVal.attributeId.equals(tAttr.id) && tVal.listIndex == 0) - .findFirst() - .ifPresentOrElse( - firstTVal -> assertEquals("jrtjrtzj", firstTVal.value), - () -> fail("Expect to find one value") - ); - }, - () -> fail("Expect to find one attribute") - ); + .filter(tVal -> tVal.attributeId.equals(tAttr.id) + && tVal.listIndex == 0) + .findFirst() + .ifPresent( + firstTVal -> assertEquals("jrtjrtzj", firstTVal.value)); + }); - }, - () -> fail("Expect to find one attribute") - ); + }); // import with the same name should cause an exception try { @@ -1570,29 +1587,28 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest { final ConfigurationNode configurationNode = page.content.get(0); assertEquals("New Exam Config", configurationNode.name); - ConfigCreationInfo copyInfo = new ConfigCreationInfo( + final ConfigCreationInfo copyInfo = new ConfigCreationInfo( configurationNode.id, "Config Template", "Test Config Template creation", false, - ConfigurationType.TEMPLATE - ); + ConfigurationType.TEMPLATE); - ConfigurationNode template = restService + final ConfigurationNode template = restService .getBuilder(CopyConfiguration.class) .withBody(copyInfo) .call() .getOrThrow(); assertNotNull(template); // get template page and check new template is available - Page templates = restService + final Page templates = restService .getBuilder(GetExamConfigNodePage.class) .withQueryParam(ConfigurationNode.FILTER_ATTR_TYPE, ConfigurationType.TEMPLATE.name()) .call() .getOrThrow(); assertNotNull(templates); assertFalse(templates.isEmpty()); - ConfigurationNode newTemplate = templates.content.get(0); + final ConfigurationNode newTemplate = templates.content.get(0); assertNotNull(newTemplate); assertEquals("Config Template", newTemplate.name);