more tests
This commit is contained in:
parent
fd64554395
commit
bc69495a17
3 changed files with 45 additions and 1 deletions
|
@ -51,9 +51,14 @@ public class SEBServerMigrationStrategy implements FlywayMigrationStrategy {
|
|||
}
|
||||
|
||||
public void applyMigration() {
|
||||
if (this.webserviceInfo.hasProfile("test")) {
|
||||
SEBServerInit.INIT_LOGGER.info("No migration applies for test profile");
|
||||
return;
|
||||
}
|
||||
|
||||
final String webserviceUUID = this.webserviceInfo.getWebserviceUUID();
|
||||
if (this.migrationApplied) {
|
||||
log.warn("Migration already applied for this webservice: {}", webserviceUUID);
|
||||
SEBServerInit.INIT_LOGGER.warn("Migration already applied for this webservice: {}", webserviceUUID);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,9 +10,12 @@ package ch.ethz.seb.sebserver.webservice;
|
|||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
|
@ -64,6 +67,7 @@ public class WebserviceInfo {
|
|||
private final long distributedUpdateInterval;
|
||||
|
||||
private Map<String, String> lmsExternalAddressAlias;
|
||||
private final Set<String> activeProfiles;
|
||||
|
||||
private final WebserviceInfoDAO webserviceInfoDAO;
|
||||
private boolean isMaster = false;
|
||||
|
@ -89,6 +93,8 @@ public class WebserviceInfo {
|
|||
Long.class,
|
||||
3000L);
|
||||
|
||||
this.activeProfiles = new HashSet<>(Arrays.asList(environment.getActiveProfiles()));
|
||||
|
||||
if (StringUtils.isEmpty(this.webserverName)) {
|
||||
log.warn("NOTE: External server name, property : 'sebserver.webservice.http.external.servername' "
|
||||
+ "is not set from configuration. The external server name is set to the server address!");
|
||||
|
@ -151,6 +157,10 @@ public class WebserviceInfo {
|
|||
return this.testProperty;
|
||||
}
|
||||
|
||||
public boolean hasProfile(final String profile) {
|
||||
return this.activeProfiles.contains(profile);
|
||||
}
|
||||
|
||||
public String getHttpScheme() {
|
||||
return this.httpScheme;
|
||||
}
|
||||
|
|
|
@ -209,6 +209,7 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.useraccount.GetUs
|
|||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.useraccount.GetUserAccountNames;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.useraccount.GetUserDependencies;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.useraccount.NewUserAccount;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.useraccount.RegisterNewUser;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.useraccount.SaveUserAccount;
|
||||
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.SEBClientConfigDAO;
|
||||
|
||||
|
@ -3098,4 +3099,32 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(24)
|
||||
// *************************************
|
||||
// Use Case 24: Register a new User
|
||||
public void testUsecase24_RegisterUser() throws Exception {
|
||||
final RestServiceImpl restService = createRestServiceForUser(
|
||||
"admin",
|
||||
"admin",
|
||||
new RegisterNewUser());
|
||||
|
||||
final UserInfo newUser = restService.getBuilder(RegisterNewUser.class)
|
||||
.withFormParam(Domain.USER.ATTR_INSTITUTION_ID, "1")
|
||||
.withFormParam(Domain.USER.ATTR_NAME, "testSupport1")
|
||||
.withFormParam(Domain.USER.ATTR_USERNAME, "testSupport1")
|
||||
.withFormParam(Domain.USER.ATTR_SURNAME, "testSupport1")
|
||||
.withFormParam(Domain.USER.ATTR_EMAIL, "test@test16.ch")
|
||||
.withFormParam(PasswordChange.ATTR_NAME_NEW_PASSWORD, "testSupport1")
|
||||
.withFormParam(PasswordChange.ATTR_NAME_CONFIRM_NEW_PASSWORD, "testSupport1")
|
||||
.withFormParam(Domain.USER.ATTR_LANGUAGE, Locale.ENGLISH.getLanguage())
|
||||
.withFormParam(Domain.USER.ATTR_TIMEZONE, DateTimeZone.UTC.getID())
|
||||
.call()
|
||||
.getOrThrow();
|
||||
|
||||
assertNotNull(newUser);
|
||||
assertEquals("testSupport1", newUser.name);
|
||||
assertEquals("[EXAM_SUPPORTER]", newUser.getRoles().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue