Search in sources :

Example 1 with RepositoryEntryStatistics

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());
}
Also used : RepositoryEntryStatistics(org.olat.repository.model.RepositoryEntryStatistics) RepositoryEntry(org.olat.repository.RepositoryEntry) Test(org.junit.Test)

Example 2 with RepositoryEntryStatistics

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);
}
Also used : RepositoryEntryStatistics(org.olat.repository.model.RepositoryEntryStatistics) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Example 3 with RepositoryEntryStatistics

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());
}
Also used : RepositoryEntryStatistics(org.olat.repository.model.RepositoryEntryStatistics) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Example 4 with RepositoryEntryStatistics

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());
}
Also used : RepositoryEntryStatistics(org.olat.repository.model.RepositoryEntryStatistics) RepositoryEntry(org.olat.repository.RepositoryEntry) Test(org.junit.Test)

Example 5 with RepositoryEntryStatistics

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());
}
Also used : RepositoryEntryStatistics(org.olat.repository.model.RepositoryEntryStatistics) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Aggregations

RepositoryEntryStatistics (org.olat.repository.model.RepositoryEntryStatistics)18 RepositoryEntry (org.olat.repository.RepositoryEntry)14 Date (java.util.Date)8 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)4 Identity (org.olat.core.id.Identity)4 OLATResourceable (org.olat.core.id.OLATResourceable)4 OLATResource (org.olat.resource.OLATResource)4 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 Group (org.olat.basesecurity.Group)2 GroupRoles (org.olat.basesecurity.GroupRoles)2 License (org.olat.core.commons.services.license.License)2 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)2 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)2 ImageComponent (org.olat.core.gui.components.image.ImageComponent)2 RatingWithAverageFormItem (org.olat.core.gui.components.rating.RatingWithAverageFormItem)2 Roles (org.olat.core.id.Roles)2 VFSContainer (org.olat.core.util.vfs.VFSContainer)2