use of org.olat.repository.model.RepositoryEntryStatistics in project OpenOLAT by OpenOLAT.
the class RepositoryEntryStatisticsDAOTest method createRepositoryEntry.
@Test
public void createRepositoryEntry() {
RepositoryEntry re = repositoryService.create("Rei Ayanami", "-", "Statistics", "", null);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(re);
Assert.assertNotNull(re.getStatistics());
RepositoryEntryStatistics stats = reStatisticsDao.loadStatistics(re);
Assert.assertNotNull(stats);
Assert.assertNotNull(stats.getKey());
Assert.assertNotNull(stats.getCreationDate());
Assert.assertNotNull(stats.getLastModified());
Assert.assertEquals(0, stats.getLaunchCounter());
Assert.assertEquals(0, stats.getDownloadCounter());
Assert.assertNull(stats.getRating());
}
use of org.olat.repository.model.RepositoryEntryStatistics in project OpenOLAT by OpenOLAT.
the class RepositoryEntryStatisticsDAOTest method updateRatingStatistics.
@Test
public void updateRatingStatistics() {
// create an entry
Identity id = JunitTestHelper.createAndPersistIdentityAsAuthor("update-mark-");
RepositoryEntry re = repositoryService.create(id, null, "-", "Statistics", "", null, 0);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(re);
Assert.assertNotNull(re.getStatistics());
// set a rating
userRatingsDao.updateRating(id, re, null, 5);
dbInstance.commitAndCloseSession();
RepositoryEntryStatistics stats = reStatisticsDao.loadStatistics(re);
Assert.assertNotNull(stats);
Assert.assertEquals(5d, stats.getRating(), 0.001);
}
use of org.olat.repository.model.RepositoryEntryStatistics in project OpenOLAT by OpenOLAT.
the class RepositoryEntryStatisticsDAOTest method updateCommentsStatistics.
@Test
public void updateCommentsStatistics() {
// create an entry
Identity id = JunitTestHelper.createAndPersistIdentityAsAuthor("update-comment-");
RepositoryEntry re = repositoryService.create(id, null, "-", "Statistics", "", null, 0);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(re);
Assert.assertNotNull(re.getStatistics());
// set a rating
userCommentsDao.createComment(id, re, null, "Hello, a new comment");
dbInstance.commitAndCloseSession();
RepositoryEntryStatistics stats = reStatisticsDao.loadStatistics(re);
Assert.assertNotNull(stats);
Assert.assertEquals(1, stats.getNumOfComments());
}
use of org.olat.repository.model.RepositoryEntryStatistics in project openolat by klemens.
the class RepositoryEntryStatisticsDAOTest method createRepositoryEntry.
@Test
public void createRepositoryEntry() {
RepositoryEntry re = repositoryService.create("Rei Ayanami", "-", "Statistics", "", null);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(re);
Assert.assertNotNull(re.getStatistics());
RepositoryEntryStatistics stats = reStatisticsDao.loadStatistics(re);
Assert.assertNotNull(stats);
Assert.assertNotNull(stats.getKey());
Assert.assertNotNull(stats.getCreationDate());
Assert.assertNotNull(stats.getLastModified());
Assert.assertEquals(0, stats.getLaunchCounter());
Assert.assertEquals(0, stats.getDownloadCounter());
Assert.assertNull(stats.getRating());
}
use of org.olat.repository.model.RepositoryEntryStatistics in project openolat by klemens.
the class RepositoryEntryStatisticsDAOTest method updateCommentsStatistics.
@Test
public void updateCommentsStatistics() {
// create an entry
Identity id = JunitTestHelper.createAndPersistIdentityAsAuthor("update-comment-");
RepositoryEntry re = repositoryService.create(id, null, "-", "Statistics", "", null, 0);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(re);
Assert.assertNotNull(re.getStatistics());
// set a rating
userCommentsDao.createComment(id, re, null, "Hello, a new comment");
dbInstance.commitAndCloseSession();
RepositoryEntryStatistics stats = reStatisticsDao.loadStatistics(re);
Assert.assertNotNull(stats);
Assert.assertEquals(1, stats.getNumOfComments());
}
Aggregations