Search in sources :

Example 51 with Realm

use of org.apache.syncope.core.persistence.api.entity.Realm in project syncope by apache.

the class RealmTest method test.

@Test
public void test() {
    Realm realm = realmDAO.findByFullPath("/odd");
    assertNotNull(realm);
    // need to remove this group in order to remove the realm, which is otherwise empty
    Group group = groupDAO.findByName("fake");
    assertNotNull(group);
    assertEquals(realm, group.getRealm());
    groupDAO.delete(group);
    Role role = roleDAO.find("User reviewer");
    assertTrue(role.getRealms().contains(realm));
    int beforeSize = role.getRealms().size();
    realmDAO.delete(realm);
    realmDAO.flush();
    role = roleDAO.find("User reviewer");
    assertEquals(beforeSize - 1, role.getRealms().size());
}
Also used : Role(org.apache.syncope.core.persistence.api.entity.Role) Group(org.apache.syncope.core.persistence.api.entity.group.Group) Realm(org.apache.syncope.core.persistence.api.entity.Realm) Test(org.junit.jupiter.api.Test) AbstractTest(org.apache.syncope.core.persistence.jpa.AbstractTest)

Aggregations

Realm (org.apache.syncope.core.persistence.api.entity.Realm)51 SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)21 ArrayList (java.util.ArrayList)14 RealmTO (org.apache.syncope.common.lib.to.RealmTO)12 Group (org.apache.syncope.core.persistence.api.entity.group.Group)11 Transactional (org.springframework.transaction.annotation.Transactional)11 List (java.util.List)10 AnyUtils (org.apache.syncope.core.persistence.api.entity.AnyUtils)10 Collections (java.util.Collections)9 PropagationByResource (org.apache.syncope.core.provisioning.api.PropagationByResource)9 Autowired (org.springframework.beans.factory.annotation.Autowired)9 HashSet (java.util.HashSet)8 Set (java.util.Set)8 Collectors (java.util.stream.Collectors)7 StringUtils (org.apache.commons.lang3.StringUtils)7 Entity (org.apache.syncope.core.persistence.api.entity.Entity)7 AnyObject (org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject)7 PasswordPolicy (org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy)7 User (org.apache.syncope.core.persistence.api.entity.user.User)7 Date (java.util.Date)6