adjusted non Selenium Tests to userStore startup changes

This commit is contained in:
Kai Börnert committed 2019-01-17 12:12:36 +01:00
1 parent 156dd9bc6b
commit 6b09b095f0
7 files changed
+16

No files matched your search

@@ -35,6 +35,8 @@ public abstract class AbstractSecurityReplicationTest extends AbstractServerWith
protected SecurityServiceImpl createNewMaster() throws MalformedURLException, IOException, InterruptedException,
UserManagementException, MailException, UserGroupManagementException {
final UserStoreImpl userStore = new UserStoreImpl("TestDefaultTenant");
userStore.ensureDefaultRolesExist();
userStore.loadAndMigrateUsers();
final AccessControlStore accessControlStore = new AccessControlStoreImpl(userStore);
SecurityServiceImpl result = new SecurityServiceImpl(userStore, accessControlStore);
return result;
@@ -43,6 +45,8 @@ public abstract class AbstractSecurityReplicationTest extends AbstractServerWith
@Override
protected SecurityServiceImpl createNewReplica() throws UserGroupManagementException, UserManagementException, MalformedURLException, IOException, InterruptedException {
final UserStoreImpl userStore = new UserStoreImpl("TestDefaultTenant");
userStore.ensureDefaultRolesExist();
userStore.loadAndMigrateUsers();
final AccessControlStore accessControlStore = new AccessControlStoreImpl(userStore);
return new SecurityServiceImpl(userStore, accessControlStore);
}
@@ -56,6 +56,8 @@ public class SecurityReplicationLeadingToEmailReplicationTest extends AbstractSe
ServiceTracker<MailService, MailService> trackerMock = mock(ServiceTracker.class);
doReturn(masterMailService).when(trackerMock).getService();
final UserStoreImpl userStore = new UserStoreImpl("TestDefaultTenant");
userStore.ensureDefaultRolesExist();
userStore.loadAndMigrateUsers();
final AccessControlStore accessControlStore = new AccessControlStoreImpl(userStore);
SecurityServiceImpl result = new SecurityServiceImpl(trackerMock, userStore, accessControlStore);
return result;
@@ -35,6 +35,8 @@ public class SecurityServiceInitialLoadTest extends AbstractServerWithSingleServ
throws MalformedURLException, IOException, InterruptedException, UserManagementException, MailException, UserGroupManagementException {
final UserStore userStore = new UserStoreImpl(PersistenceFactory.INSTANCE.getDefaultDomainObjectFactory(),
PersistenceFactory.INSTANCE.getDefaultMongoObjectFactory(), "TestDefaultTenant");
userStore.ensureDefaultRolesExist();
userStore.loadAndMigrateUsers();
final AccessControlStore accessControlStore = new AccessControlStoreImpl(PersistenceFactory.INSTANCE.getDefaultDomainObjectFactory(),
PersistenceFactory.INSTANCE.getDefaultMongoObjectFactory(), userStore);
final SecurityServiceImpl newMaster = new SecurityServiceImpl(userStore, accessControlStore);
@@ -51,6 +51,8 @@ public class SecurityResourceTest {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
try {
store = new UserStoreImpl("TestDefaultTenant");
store.ensureDefaultRolesExist();
store.loadAndMigrateUsers();
accessControlStore = new AccessControlStoreImpl(store);
Activator.setTestStores(store, accessControlStore);
service = new SecurityServiceImpl(/* mailServiceTracker */ null,
@@ -51,6 +51,8 @@ public class LoginTest {
db.getCollection(CollectionNames.SETTINGS.name()).drop();
db.getCollection(CollectionNames.PREFERENCES.name()).drop();
userStore = new UserStoreImpl(DEFAULT_TENANT_NAME);
userStore.ensureDefaultRolesExist();
userStore.loadAndMigrateUsers();
accessControlStore = new AccessControlStoreImpl(userStore);
Activator.setTestStores(userStore, accessControlStore);
@@ -67,6 +67,8 @@ public class PermissionCheckerTest {
public void setUp() throws UserGroupManagementException, UserManagementException {
final String adminTenantName = "admin-tenant";
userStore = new UserStoreImpl(adminTenantName);
userStore.ensureDefaultRolesExist();
userStore.loadAndMigrateUsers();
accessControlStore = new AccessControlStoreImpl(userStore);
AbstractCompositeAuthorizingRealm.setTestStores(userStore, accessControlStore);
realm = new UsernamePasswordRealm();
@@ -78,6 +78,8 @@ public class UserStoreWithPersistenceTest {
private void newStore() {
try {
store = new UserStoreImpl("TestDefaultTenant");
store.ensureDefaultRolesExist();
store.loadAndMigrateUsers();
} catch (UserGroupManagementException | UserManagementException e) {
throw new RuntimeException(e);
}