use of org.olat.modules.webFeed.Feed in project OpenOLAT by OpenOLAT.
the class FeedDAOTest method loadFeed_Long.
@Test
public void loadFeed_Long() {
OLATResource resource = JunitTestHelper.createRandomResource();
Feed feed = feedDao.createFeedForResourcable(resource);
dbInstance.commitAndCloseSession();
Feed reloaded = feedDao.loadFeed(feed.getKey());
// check values
Assert.assertEquals(feed.getKey(), reloaded.getKey());
Assert.assertEquals(resource.getResourceableId(), reloaded.getResourceableId());
Assert.assertEquals(resource.getResourceableTypeName(), reloaded.getResourceableTypeName());
// It's ok when the date is about the same in the database.
Assert.assertTrue("Dates aren't close enough to each other!", (feed.getCreationDate().getTime() - reloaded.getCreationDate().getTime()) < 1000);
}
use of org.olat.modules.webFeed.Feed in project OpenOLAT by OpenOLAT.
the class FeedDAOTest method createFeed_feed.
@Test
public void createFeed_feed() {
OLATResource resource = JunitTestHelper.createRandomResource();
Feed tempFeed = new FeedImpl(resource);
Feed feed = feedDao.createFeed(tempFeed);
Assert.assertNotNull(feed);
dbInstance.commitAndCloseSession();
// check values
Assert.assertNotNull(feed.getKey());
Assert.assertNotNull(feed.getCreationDate());
Assert.assertNotNull(feed.getLastModified());
Assert.assertEquals(resource.getResourceableId(), feed.getResourceableId());
Assert.assertEquals(resource.getResourceableTypeName(), feed.getResourceableTypeName());
}
use of org.olat.modules.webFeed.Feed in project OpenOLAT by OpenOLAT.
the class FeedDAOTest method copyFeed.
@Test
public void copyFeed() {
OLATResource source = JunitTestHelper.createRandomResource();
OLATResource target = JunitTestHelper.createRandomResource();
Feed feed = feedDao.createFeedForResourcable(source);
dbInstance.commitAndCloseSession();
Feed copy = feedDao.copyFeed(feed, target);
dbInstance.commitAndCloseSession();
assertThat(copy.getKey()).isNotEqualTo(feed.getKey());
assertThat(copy.getResourceableId()).isNotEqualTo(feed.getResourceableId());
assertThat(copy.getCreationDate()).isCloseTo(feed.getCreationDate(), 1000);
assertThat(copy.getLastModified()).isCloseTo(feed.getLastModified(), 1000);
}
use of org.olat.modules.webFeed.Feed in project OpenOLAT by OpenOLAT.
the class FeedDAOTest method updateFeed_null.
@Test
public void updateFeed_null() {
OLATResource resource = JunitTestHelper.createRandomResource();
// create and save a feed
feedDao.createFeedForResourcable(resource);
dbInstance.commitAndCloseSession();
// update null
Feed updated = feedDao.updateFeed(null);
// check values
Assert.assertNull(updated);
}
use of org.olat.modules.webFeed.Feed in project OpenOLAT by OpenOLAT.
the class FeedDAOTest method createFeed_ores.
@Test
public void createFeed_ores() {
OLATResource resource = JunitTestHelper.createRandomResource();
Feed feed = feedDao.createFeedForResourcable(resource);
Assert.assertNotNull(feed);
dbInstance.commitAndCloseSession();
// check values
Assert.assertNotNull(feed.getKey());
Assert.assertNotNull(feed.getCreationDate());
Assert.assertNotNull(feed.getLastModified());
Assert.assertEquals(resource.getResourceableId(), feed.getResourceableId());
Assert.assertEquals(resource.getResourceableTypeName(), feed.getResourceableTypeName());
}
Aggregations