use of org.olat.modules.gotomeeting.GoToMeeting in project OpenOLAT by OpenOLAT.
the class GoToMeetingDAOTest method createMeeting_without.
@Test
public void createMeeting_without() {
String username = UUID.randomUUID().toString();
String accessToken = UUID.randomUUID().toString();
String organizerKey = UUID.randomUUID().toString();
GoToOrganizer organizer = organizerDao.createOrganizer("My account", username, accessToken, organizerKey, "Lucas", "de Leyde", null, null, 10l, null);
Assert.assertNotNull(organizer);
Date start = new Date();
Date end = new Date();
String trainingKey = Long.toString(CodeHelper.getForeverUniqueID());
GoToMeeting training = meetingDao.createTraining("New training", null, "Very interessant", trainingKey, start, end, organizer, null, null, null);
dbInstance.commit();
Assert.assertNotNull(training);
Assert.assertNotNull(training.getKey());
Assert.assertNotNull(training.getCreationDate());
Assert.assertNotNull(training.getLastModified());
Assert.assertEquals("New training", training.getName());
Assert.assertEquals("Very interessant", training.getDescription());
Assert.assertNotNull(training.getStartDate());
Assert.assertNotNull(training.getEndDate());
}
use of org.olat.modules.gotomeeting.GoToMeeting in project OpenOLAT by OpenOLAT.
the class GoToRegistrantDAOTest method getRegistrants.
@Test
public void getRegistrants() {
String token = UUID.randomUUID().toString();
Identity trainee = JunitTestHelper.createAndPersistIdentityAsRndUser("trainee-3");
GoToOrganizer organizer = organizerDao.createOrganizer(null, token, token, token, null, null, null, null, 10l, null);
Assert.assertNotNull(organizer);
Date start = new Date();
Date end = new Date();
String trainingKey = Long.toString(CodeHelper.getForeverUniqueID());
GoToMeeting training = meetingDao.createTraining("New training", null, "Very interessant", trainingKey, start, end, organizer, null, null, null);
dbInstance.commit();
// create registrant
String registrantKey = Long.toString(CodeHelper.getForeverUniqueID());
String joinUrl = "http://openolat.com/join/" + registrantKey;
String confirmUrl = "http://openolat.com/confirm/" + registrantKey;
GoToRegistrant registrant = registrantDao.createRegistrant(training, trainee, registrantKey, joinUrl, confirmUrl);
Assert.assertNotNull(registrant);
dbInstance.commit();
// load
List<GoToRegistrant> reloadRegistrants = registrantDao.getRegistrants(trainee, null, null, null);
Assert.assertNotNull(reloadRegistrants);
Assert.assertEquals(1, reloadRegistrants.size());
Assert.assertEquals(registrant, reloadRegistrants.get(0));
}
use of org.olat.modules.gotomeeting.GoToMeeting in project openolat by klemens.
the class GoToMeetingDAOTest method loadMeetingByExternalId.
@Test
public void loadMeetingByExternalId() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
String username = UUID.randomUUID().toString();
String accessToken = UUID.randomUUID().toString();
String organizerKey = UUID.randomUUID().toString();
String externalId = UUID.randomUUID().toString();
GoToOrganizer organizer = organizerDao.createOrganizer(null, username, accessToken, organizerKey, "Levinus", "Memminger", null, null, 10l, null);
Assert.assertNotNull(organizer);
Date start = new Date();
Date end = new Date();
String trainingKey = Long.toString(CodeHelper.getForeverUniqueID());
GoToMeeting training = meetingDao.createTraining("Training by key", externalId, "Load training by external key", trainingKey, start, end, organizer, entry, "d9916", null);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(training);
GoToMeeting reloadedTraining = meetingDao.loadMeetingByExternalId(externalId);
Assert.assertNotNull(reloadedTraining);
Assert.assertEquals(training, reloadedTraining);
}
use of org.olat.modules.gotomeeting.GoToMeeting in project openolat by klemens.
the class GoToMeetingDAOTest method getMeetingsOverlap.
/**
* Check different overlap scenario
*/
@Test
public void getMeetingsOverlap() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
String username = UUID.randomUUID().toString();
String accessToken = UUID.randomUUID().toString();
String organizerKey = UUID.randomUUID().toString();
GoToOrganizer organizer = organizerDao.createOrganizer(null, username, accessToken, organizerKey, "Michael", "Wolgemut", null, null, 10l, null);
Assert.assertNotNull(organizer);
Calendar cal = Calendar.getInstance();
cal.set(2016, 8, 12, 12, 0, 0);
cal.set(Calendar.MILLISECOND, 0);
Date start = cal.getTime();
cal.set(2016, 8, 12, 18, 0, 0);
Date end = cal.getTime();
String trainingKey = Long.toString(CodeHelper.getForeverUniqueID());
GoToMeeting training = meetingDao.createTraining("New training", null, "Very interessant", trainingKey, start, end, organizer, entry, "d9914", null);
dbInstance.commit();
Assert.assertNotNull(training);
// check organizer availability (same date)
List<GoToMeeting> overlaps = meetingDao.getMeetingsOverlap(GoToType.training, organizer, start, end);
Assert.assertNotNull(overlaps);
Assert.assertEquals(1, overlaps.size());
// check organizer availability (end overlap)
cal.set(2016, 8, 12, 10, 0, 0);
Date start_1 = cal.getTime();
cal.set(2016, 8, 12, 14, 0, 0);
Date end_1 = cal.getTime();
List<GoToMeeting> overlaps_1 = meetingDao.getMeetingsOverlap(GoToType.training, organizer, start_1, end_1);
Assert.assertEquals(1, overlaps_1.size());
// check organizer availability (start overlap)
cal.set(2016, 8, 12, 14, 0, 0);
Date start_2 = cal.getTime();
cal.set(2016, 8, 12, 20, 0, 0);
Date end_2 = cal.getTime();
List<GoToMeeting> overlaps_2 = meetingDao.getMeetingsOverlap(GoToType.training, organizer, start_2, end_2);
Assert.assertEquals(1, overlaps_2.size());
// check organizer availability (within)
cal.set(2016, 8, 12, 14, 0, 0);
Date start_3 = cal.getTime();
cal.set(2016, 8, 12, 15, 0, 0);
Date end_3 = cal.getTime();
List<GoToMeeting> overlaps_3 = meetingDao.getMeetingsOverlap(GoToType.training, organizer, start_3, end_3);
Assert.assertNotNull(overlaps_3);
Assert.assertEquals(1, overlaps_3.size());
// check organizer availability (start before, end after)
cal.set(2016, 8, 12, 10, 0, 0);
Date start_4 = cal.getTime();
cal.set(2016, 8, 12, 22, 0, 0);
Date end_4 = cal.getTime();
List<GoToMeeting> overlaps_4 = meetingDao.getMeetingsOverlap(GoToType.training, organizer, start_4, end_4);
Assert.assertNotNull(overlaps_4);
Assert.assertEquals(1, overlaps_4.size());
// check organizer availability (in past)
cal.set(2016, 8, 12, 9, 0, 0);
Date start_5 = cal.getTime();
cal.set(2016, 8, 12, 11, 0, 0);
Date end_5 = cal.getTime();
List<GoToMeeting> overlaps_5 = meetingDao.getMeetingsOverlap(GoToType.training, organizer, start_5, end_5);
Assert.assertEquals(0, overlaps_5.size());
// check organizer availability (in future)
cal.set(2016, 8, 12, 20, 0, 0);
Date start_6 = cal.getTime();
cal.set(2016, 8, 12, 21, 0, 0);
Date end_6 = cal.getTime();
List<GoToMeeting> overlaps_6 = meetingDao.getMeetingsOverlap(GoToType.training, organizer, start_6, end_6);
Assert.assertEquals(0, overlaps_6.size());
}
use of org.olat.modules.gotomeeting.GoToMeeting in project openolat by klemens.
the class GoToMeetingDAOTest method countMeetingsOrganizedBy.
@Test
public void countMeetingsOrganizedBy() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
String username = UUID.randomUUID().toString();
String accessToken = UUID.randomUUID().toString();
String organizerKey = UUID.randomUUID().toString();
String externalId = UUID.randomUUID().toString();
GoToOrganizer organizer = organizerDao.createOrganizer(null, username, accessToken, organizerKey, "Hans", "Pleydenwurff", null, null, 10l, null);
Assert.assertNotNull(organizer);
Date start = new Date();
Date end = new Date();
String trainingKey = Long.toString(CodeHelper.getForeverUniqueID());
GoToMeeting training = meetingDao.createTraining("Training by key", externalId, "Count the meetings organized by this organizer", trainingKey, start, end, organizer, entry, "d9916", null);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(training);
int countOrganizersMeetings = meetingDao.countMeetingsOrganizedBy(organizer);
Assert.assertEquals(1, countOrganizersMeetings);
}
Aggregations