Search in sources :

Example 6 with Invitation

use of org.olat.basesecurity.Invitation in project OpenOLAT by OpenOLAT.

the class InvitationDAOTest method findInvitation_token.

@Test
public void findInvitation_token() {
    Invitation invitation = invitationDao.createAndPersistInvitation();
    Assert.assertNotNull(invitation);
    dbInstance.commitAndCloseSession();
    Invitation reloadedInvitation = invitationDao.findInvitation(invitation.getToken());
    Assert.assertNotNull(reloadedInvitation);
    Assert.assertNotNull(reloadedInvitation.getKey());
    Assert.assertNotNull(reloadedInvitation.getBaseGroup());
    Assert.assertEquals(invitation, reloadedInvitation);
    Assert.assertEquals(invitation.getToken(), reloadedInvitation.getToken());
}
Also used : Invitation(org.olat.basesecurity.Invitation) Test(org.junit.Test)

Example 7 with Invitation

use of org.olat.basesecurity.Invitation in project OpenOLAT by OpenOLAT.

the class InvitationDAOTest method loadOrCreateIdentityAndPersistInvitation.

@Test
public void loadOrCreateIdentityAndPersistInvitation() {
    Invitation invitation = invitationDao.createAndPersistInvitation();
    String uuid = UUID.randomUUID().toString().replace("-", "");
    invitation = invitationDao.update(invitation, "Flora", uuid, uuid + "@frentix.com");
    Group group = groupDao.createGroup();
    dbInstance.commit();
    // use the create part of the method
    Identity identity = invitationDao.loadOrCreateIdentityAndPersistInvitation(invitation, group, Locale.ENGLISH);
    Assert.assertNotNull(identity);
    Assert.assertNotNull(identity.getKey());
    dbInstance.commitAndCloseSession();
    // reload and check
    Identity reloadIdentity = securityManager.loadIdentityByKey(identity.getKey());
    Assert.assertNotNull(reloadIdentity);
    Assert.assertNotNull(reloadIdentity.getUser());
    Assert.assertEquals(identity.getKey(), reloadIdentity.getKey());
    Assert.assertEquals("Flora", reloadIdentity.getUser().getFirstName());
    Assert.assertEquals(uuid, reloadIdentity.getUser().getLastName());
    Assert.assertEquals(uuid + "@frentix.com", reloadIdentity.getUser().getEmail());
}
Also used : Group(org.olat.basesecurity.Group) Invitation(org.olat.basesecurity.Invitation) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Example 8 with Invitation

use of org.olat.basesecurity.Invitation in project OpenOLAT by OpenOLAT.

the class InvitationDAOTest method createIdentityFrom_invitation.

@Test
public void createIdentityFrom_invitation() {
    Invitation invitation = invitationDao.createAndPersistInvitation();
    String uuid = UUID.randomUUID().toString().replace("-", "");
    invitation = invitationDao.update(invitation, "Clara", uuid, uuid + "@frentix.com");
    dbInstance.commit();
    // create the identity of the invitee
    Identity invitee = invitationDao.createIdentityFrom(invitation, Locale.ENGLISH);
    Assert.assertNotNull(invitee);
    Assert.assertNotNull(invitee.getKey());
    dbInstance.commitAndCloseSession();
    // reload and check
    Identity reloadIdentity = securityManager.loadIdentityByKey(invitee.getKey());
    Assert.assertNotNull(reloadIdentity);
    Assert.assertNotNull(reloadIdentity.getUser());
    Assert.assertEquals(invitee.getKey(), reloadIdentity.getKey());
    Assert.assertEquals("Clara", reloadIdentity.getUser().getFirstName());
    Assert.assertEquals(uuid, reloadIdentity.getUser().getLastName());
    Assert.assertEquals(uuid + "@frentix.com", reloadIdentity.getUser().getEmail());
}
Also used : Invitation(org.olat.basesecurity.Invitation) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Example 9 with Invitation

use of org.olat.basesecurity.Invitation in project OpenOLAT by OpenOLAT.

the class InvitationDAOTest method countInvitations.

@Test
public void countInvitations() {
    Invitation invitation = invitationDao.createAndPersistInvitation();
    dbInstance.commit();
    Assert.assertNotNull(invitation);
    long numOfInvitations = invitationDao.countInvitations();
    Assert.assertTrue(numOfInvitations > 0l);
}
Also used : Invitation(org.olat.basesecurity.Invitation) Test(org.junit.Test)

Example 10 with Invitation

use of org.olat.basesecurity.Invitation in project OpenOLAT by OpenOLAT.

the class InvitationDAOTest method createAndUpdateInvitation.

@Test
public void createAndUpdateInvitation() {
    Invitation invitation = invitationDao.createAndPersistInvitation();
    dbInstance.commit();
    Invitation updatedInvitation = invitationDao.update(invitation, "Kanu", "Unchou", "kanu.unchou@frentix.com");
    dbInstance.commit();
    Assert.assertEquals("Kanu", updatedInvitation.getFirstName());
    Assert.assertEquals("Unchou", updatedInvitation.getLastName());
    Assert.assertEquals("kanu.unchou@frentix.com", updatedInvitation.getMail());
    Invitation reloadedInvitation = invitationDao.findInvitation(invitation.getToken());
    Assert.assertEquals("Kanu", reloadedInvitation.getFirstName());
    Assert.assertEquals("Unchou", reloadedInvitation.getLastName());
    Assert.assertEquals("kanu.unchou@frentix.com", reloadedInvitation.getMail());
}
Also used : Invitation(org.olat.basesecurity.Invitation) Test(org.junit.Test)

Aggregations

Invitation (org.olat.basesecurity.Invitation)48 Identity (org.olat.core.id.Identity)26 ArrayList (java.util.ArrayList)24 Test (org.junit.Test)22 AccessRights (org.olat.modules.portfolio.model.AccessRights)14 PortfolioStructureMap (org.olat.portfolio.model.structel.PortfolioStructureMap)8 BusinessGroup (org.olat.group.BusinessGroup)6 EPMapPolicy (org.olat.portfolio.manager.EPMapPolicy)6 Group (org.olat.basesecurity.Group)4 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)4 EPStructureElementToGroupRelation (org.olat.portfolio.model.structel.EPStructureElementToGroupRelation)4 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)4 Calendar (java.util.Calendar)2 Date (java.util.Date)2 SecurityGroup (org.olat.basesecurity.SecurityGroup)2 DateChooser (org.olat.core.gui.components.form.flexible.elements.DateChooser)2 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)2 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)2 StaticTextElement (org.olat.core.gui.components.form.flexible.elements.StaticTextElement)2 BusinessControlFactory (org.olat.core.id.context.BusinessControlFactory)2