Search in sources :

Example 16 with ModulesUtilsBl

use of cz.metacentrum.perun.core.bl.ModulesUtilsBl in project perun by CESNET.

the class urn_perun_user_attribute_def_def_login_namespace_eduteams_acc_nicknameTest method setUp.

@Before
public void setUp() throws Exception {
    classInstance = new urn_perun_user_attribute_def_def_login_namespace_eduteams_acc_nickname();
    session = mock(PerunSessionImpl.class);
    user = new User();
    attributeToCheck = new Attribute();
    attributeToCheck.setNamespace(AttributesManager.NS_USER_ATTR_DEF);
    attributeToCheck.setFriendlyName("login-namespace:eduteams-acc-nickname");
    PerunBl perunBl = mock(PerunBl.class);
    when(session.getPerunBl()).thenReturn(perunBl);
    ModulesUtilsBl modulesUtilsBl = mock(ModulesUtilsBl.class);
    when(perunBl.getModulesUtilsBl()).thenReturn(modulesUtilsBl);
    UsersManagerBl usersManagerBl = mock(UsersManagerBl.class);
    when(perunBl.getUsersManagerBl()).thenReturn(usersManagerBl);
    PasswordManagerModule module = mock(GenericPasswordManagerModule.class);
    when(session.getPerunBl().getUsersManagerBl().getPasswordManagerModule(session, "eduteams-acc-nickname")).thenReturn(module);
}
Also used : User(cz.metacentrum.perun.core.api.User) ModulesUtilsBl(cz.metacentrum.perun.core.bl.ModulesUtilsBl) Attribute(cz.metacentrum.perun.core.api.Attribute) PasswordManagerModule(cz.metacentrum.perun.core.implApi.modules.pwdmgr.PasswordManagerModule) GenericPasswordManagerModule(cz.metacentrum.perun.core.impl.modules.pwdmgr.GenericPasswordManagerModule) PerunBl(cz.metacentrum.perun.core.bl.PerunBl) PerunSessionImpl(cz.metacentrum.perun.core.impl.PerunSessionImpl) UsersManagerBl(cz.metacentrum.perun.core.bl.UsersManagerBl) Before(org.junit.Before)

Example 17 with ModulesUtilsBl

use of cz.metacentrum.perun.core.bl.ModulesUtilsBl in project perun by CESNET.

the class urn_perun_user_attribute_def_def_login_namespace_eduroam_vsupTest method setUp.

@Before
public void setUp() throws Exception {
    classInstance = new urn_perun_user_attribute_def_def_login_namespace_eduroam_vsup();
    session = mock(PerunSessionImpl.class);
    user = new User();
    attributeToCheck = new Attribute();
    attributeToCheck.setNamespace(AttributesManager.NS_USER_ATTR_DEF);
    attributeToCheck.setFriendlyName("login-namespace:eduroam-vsup");
    attribute = new Attribute();
    attribute.setNamespace(AttributesManager.NS_USER_ATTR_DEF);
    attribute.setFriendlyName("login-namespace:eduroam-vsup");
    attribute.setValue("same_value");
    PerunBl perunBl = mock(PerunBl.class);
    when(session.getPerunBl()).thenReturn(perunBl);
    ModulesUtilsBl modulesUtilsBl = mock(ModulesUtilsBl.class);
    when(perunBl.getModulesUtilsBl()).thenReturn(modulesUtilsBl);
    UsersManagerBl usersManagerBl = mock(UsersManagerBl.class);
    when(perunBl.getUsersManagerBl()).thenReturn(usersManagerBl);
    PasswordManagerModule module = mock(GenericPasswordManagerModule.class);
    when(session.getPerunBl().getUsersManagerBl().getPasswordManagerModule(session, "eduroam-vsup")).thenReturn(module);
    AttributesManagerBl attributesManagerBl = mock(AttributesManagerBl.class);
    when(perunBl.getAttributesManagerBl()).thenReturn(attributesManagerBl);
    when(attributesManagerBl.getAttribute(session, user, AttributesManager.NS_USER_ATTR_DEF + ":login-namespace:vsup")).thenReturn(attribute);
}
Also used : User(cz.metacentrum.perun.core.api.User) ModulesUtilsBl(cz.metacentrum.perun.core.bl.ModulesUtilsBl) Attribute(cz.metacentrum.perun.core.api.Attribute) PasswordManagerModule(cz.metacentrum.perun.core.implApi.modules.pwdmgr.PasswordManagerModule) GenericPasswordManagerModule(cz.metacentrum.perun.core.impl.modules.pwdmgr.GenericPasswordManagerModule) PerunBl(cz.metacentrum.perun.core.bl.PerunBl) PerunSessionImpl(cz.metacentrum.perun.core.impl.PerunSessionImpl) UsersManagerBl(cz.metacentrum.perun.core.bl.UsersManagerBl) AttributesManagerBl(cz.metacentrum.perun.core.bl.AttributesManagerBl) Before(org.junit.Before)

Example 18 with ModulesUtilsBl

use of cz.metacentrum.perun.core.bl.ModulesUtilsBl in project perun by CESNET.

the class urn_perun_vo_attribute_def_def_fromEmailTest method setUp.

@Before
public void setUp() {
    classInstance = new urn_perun_vo_attribute_def_def_fromEmail();
    session = mock(PerunSessionImpl.class);
    attributeToCheck = new Attribute();
    vo = new Vo();
    PerunBl perunBl = mock(PerunBl.class);
    when(session.getPerunBl()).thenReturn(perunBl);
    ModulesUtilsBl modulesUtilsBl = mock(ModulesUtilsBl.class);
    when(perunBl.getModulesUtilsBl()).thenReturn(modulesUtilsBl);
    when(session.getPerunBl().getModulesUtilsBl().isNameOfEmailValid(session, correctEmail)).thenReturn(true);
    when(session.getPerunBl().getModulesUtilsBl().isNameOfEmailValid(session, correctEmailWithHeader)).thenReturn(false);
    when(session.getPerunBl().getModulesUtilsBl().isNameOfEmailValid(session, incorrectEmail)).thenReturn(false);
}
Also used : ModulesUtilsBl(cz.metacentrum.perun.core.bl.ModulesUtilsBl) Attribute(cz.metacentrum.perun.core.api.Attribute) Vo(cz.metacentrum.perun.core.api.Vo) PerunBl(cz.metacentrum.perun.core.bl.PerunBl) PerunSessionImpl(cz.metacentrum.perun.core.impl.PerunSessionImpl) Before(org.junit.Before)

Example 19 with ModulesUtilsBl

use of cz.metacentrum.perun.core.bl.ModulesUtilsBl in project perun by CESNET.

the class urn_perun_user_attribute_def_virt_institutionsCountriesTest method setUp.

@Before
public void setUp() throws Exception {
    dnsMap.put(".cz", "Czech Rep");
    dnsMap.put("muni.cz", "MU");
    dnsMap.put("ics.muni.cz", "UVT");
    AttributeDefinition schacHomeOrgDef = new AttributeDefinition();
    schacHomeOrgDef.setId(5);
    schacHomeOrgDef.setFriendlyName("schacHomeOrganization");
    schacHomeOrgDef.setNamespace(AttributesManager.NS_UES_ATTR_DEF);
    schacHomeOrgDef.setType("java.lang.String");
    schacHomeOrg = new Attribute(schacHomeOrgDef);
    // prepare mocks
    sess = mock(PerunSessionImpl.class);
    PerunBl perunBl = mock(PerunBl.class);
    AttributesManagerBl am = mock(AttributesManagerBl.class);
    UsersManagerBl um = mock(UsersManagerBl.class);
    ModulesUtilsBl mu = mock(ModulesUtilsBl.class);
    when(sess.getPerunBl()).thenReturn(perunBl);
    when(perunBl.getAttributesManagerBl()).thenReturn(am);
    when(perunBl.getUsersManagerBl()).thenReturn(um);
    when(perunBl.getModulesUtilsBl()).thenReturn(mu);
    when(mu.getUserFromMessage(eq(sess), any(String.class))).thenReturn(user);
    when(am.getEntitylessStringAttributeMapping(sess, "urn:perun:entityless:attribute-def:def:dnsStateMapping")).thenReturn(dnsMap);
    when(um.getUserExtSources(sess, user)).thenReturn(userExtSources);
}
Also used : ModulesUtilsBl(cz.metacentrum.perun.core.bl.ModulesUtilsBl) Attribute(cz.metacentrum.perun.core.api.Attribute) AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition) PerunBl(cz.metacentrum.perun.core.bl.PerunBl) PerunSessionImpl(cz.metacentrum.perun.core.impl.PerunSessionImpl) UsersManagerBl(cz.metacentrum.perun.core.bl.UsersManagerBl) AttributesManagerBl(cz.metacentrum.perun.core.bl.AttributesManagerBl) Before(org.junit.Before)

Aggregations

ModulesUtilsBl (cz.metacentrum.perun.core.bl.ModulesUtilsBl)19 PerunBl (cz.metacentrum.perun.core.bl.PerunBl)19 PerunSessionImpl (cz.metacentrum.perun.core.impl.PerunSessionImpl)19 Before (org.junit.Before)19 Attribute (cz.metacentrum.perun.core.api.Attribute)18 UsersManagerBl (cz.metacentrum.perun.core.bl.UsersManagerBl)9 User (cz.metacentrum.perun.core.api.User)8 PasswordManagerModule (cz.metacentrum.perun.core.implApi.modules.pwdmgr.PasswordManagerModule)8 GenericPasswordManagerModule (cz.metacentrum.perun.core.impl.modules.pwdmgr.GenericPasswordManagerModule)7 AttributesManagerBl (cz.metacentrum.perun.core.bl.AttributesManagerBl)6 GroupsManagerBl (cz.metacentrum.perun.core.bl.GroupsManagerBl)4 ResourcesManagerBl (cz.metacentrum.perun.core.bl.ResourcesManagerBl)4 Vo (cz.metacentrum.perun.core.api.Vo)3 AttributeDefinition (cz.metacentrum.perun.core.api.AttributeDefinition)1 CoreConfig (cz.metacentrum.perun.core.api.CoreConfig)1 EinfraPasswordManagerModule (cz.metacentrum.perun.core.impl.modules.pwdmgr.EinfraPasswordManagerModule)1 Pattern (java.util.regex.Pattern)1