Full export-import implemented. Remove dependency of mongo on picketlink-common
This commit is contained in:
1 parent
e4e02a2615
commit
0801c9c120
100 files changed
+4878
-1004
No files matched your search
@@ -164,6 +164,9 @@ public class AdapterTest extends AbstractModelTest {
|
||||
cred.setValue("password");
|
||||
realmModel.updateCredential(user, cred);
|
||||
|
||||
commit();
|
||||
|
||||
realmModel = identitySession.getRealm("JUGGLER");
|
||||
Assert.assertTrue(realmModel.removeUser("bburke"));
|
||||
Assert.assertFalse(realmModel.removeUser("bburke"));
|
||||
Assert.assertNull(realmModel.getUser("bburke"));
|
||||
@@ -218,6 +221,9 @@ public class AdapterTest extends AbstractModelTest {
|
||||
|
||||
realmModel.addScopeMapping(app, realmRole);
|
||||
|
||||
commit();
|
||||
realmModel = identitySession.getRealm("JUGGLER");
|
||||
|
||||
Assert.assertTrue(realmManager.removeRealm(realmModel));
|
||||
Assert.assertFalse(realmManager.removeRealm(realmModel));
|
||||
Assert.assertNull(realmManager.getRealm(realmModel.getId()));
|
||||
@@ -241,6 +247,10 @@ public class AdapterTest extends AbstractModelTest {
|
||||
RoleModel realmRole = realmModel.addRole("test");
|
||||
realmModel.addScopeMapping(app, realmRole);
|
||||
|
||||
commit();
|
||||
realmModel = identitySession.getRealm("JUGGLER");
|
||||
app = realmModel.getApplicationByName("test-app");
|
||||
|
||||
Assert.assertTrue(realmModel.removeRoleById(realmRole.getId()));
|
||||
Assert.assertFalse(realmModel.removeRoleById(realmRole.getId()));
|
||||
Assert.assertNull(realmModel.getRole(realmRole.getName()));
|
||||
@@ -521,7 +531,7 @@ public class AdapterTest extends AbstractModelTest {
|
||||
}
|
||||
commit(true);
|
||||
|
||||
// Ty to rename realm to duplicate name
|
||||
// Try to rename realm to duplicate name
|
||||
realmManager.createRealm("JUGGLER2");
|
||||
commit();
|
||||
try {
|
||||
|
||||
@@ -64,6 +64,15 @@ public class ApplicationModelTest extends AbstractModelTest {
|
||||
assertEquals(application, copy);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddApplicationWithId() {
|
||||
application = realm.addApplication("app-123", "application2");
|
||||
commit();
|
||||
application = realmManager.getRealm(realm.getId()).getApplicationById("app-123");
|
||||
Assert.assertNotNull(application);
|
||||
}
|
||||
|
||||
|
||||
public static void assertEquals(ApplicationModel expected, ApplicationModel actual) {
|
||||
Assert.assertEquals(expected.getName(), actual.getName());
|
||||
Assert.assertEquals(expected.getBaseUrl(), actual.getBaseUrl());
|
||||
|
||||
@@ -50,6 +50,16 @@ public class ImportTest extends AbstractModelTest {
|
||||
commit();
|
||||
|
||||
realm = realmManager.getRealm("demo");
|
||||
assertDataImportedInRealm(realm);
|
||||
|
||||
commit();
|
||||
|
||||
realm = realmManager.getRealm("demo");
|
||||
realmManager.removeRealm(realm);
|
||||
}
|
||||
|
||||
// Moved to static method, so it's possible to test this from other places too (for example export-import tests)
|
||||
public static void assertDataImportedInRealm(RealmModel realm) {
|
||||
Assert.assertTrue(realm.isVerifyEmail());
|
||||
|
||||
Assert.assertFalse(realm.isUpdateProfileOnInitialSocialLogin());
|
||||
@@ -211,13 +221,6 @@ public class ImportTest extends AbstractModelTest {
|
||||
AuthenticationLinkModel authLink = realm.getAuthenticationLink(socialUser);
|
||||
Assert.assertEquals(AuthProviderConstants.PROVIDER_NAME_PICKETLINK, authLink.getAuthProvider());
|
||||
Assert.assertEquals("myUser1", authLink.getAuthUserId());
|
||||
|
||||
commit();
|
||||
|
||||
realm = realmManager.getRealm("demo");
|
||||
realmManager.removeRealm(realm);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -48,6 +48,10 @@ public class MultipleRealmsTest extends AbstractModelTest {
|
||||
// Test searching
|
||||
Assert.assertEquals(2, realm1.searchForUser("user").size());
|
||||
|
||||
commit();
|
||||
realm1 = identitySession.getRealm("id1");
|
||||
realm2 = identitySession.getRealm("id2");
|
||||
|
||||
realm1.removeUser("user1");
|
||||
realm1.removeUser("user2");
|
||||
Assert.assertEquals(0, realm1.searchForUser("user").size());
|
||||
|
||||
Reference in new issue
Block a user