Search in sources :

Example 51 with Feed

use of org.olat.modules.webFeed.Feed in project openolat by klemens.

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);
}
Also used : OLATResource(org.olat.resource.OLATResource) Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Example 52 with Feed

use of org.olat.modules.webFeed.Feed in project openolat by klemens.

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());
}
Also used : OLATResource(org.olat.resource.OLATResource) FeedImpl(org.olat.modules.webFeed.model.FeedImpl) Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Example 53 with Feed

use of org.olat.modules.webFeed.Feed in project openolat by klemens.

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);
}
Also used : OLATResource(org.olat.resource.OLATResource) Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Example 54 with Feed

use of org.olat.modules.webFeed.Feed in project openolat by klemens.

the class FeedDAOTest method loadFeed_notExisting.

@Test
public void loadFeed_notExisting() {
    // load feed for a non existing key
    Feed feed = feedDao.loadFeed(-1L);
    Assert.assertNull(feed);
}
Also used : Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Example 55 with Feed

use of org.olat.modules.webFeed.Feed in project openolat by klemens.

the class FeedDAOTest method createFeed_feed_keepDates.

@Test
public void createFeed_feed_keepDates() {
    OLATResource resource = JunitTestHelper.createRandomResource();
    Feed tempFeed = new FeedImpl(resource);
    Date created = new GregorianCalendar(2000, 1, 1).getTime();
    tempFeed.setCreationDate(created);
    Date modified = new GregorianCalendar(2000, 2, 2).getTime();
    tempFeed.setLastModified(modified);
    Feed feed = feedDao.createFeed(tempFeed);
    dbInstance.commitAndCloseSession();
    // check values
    assertThat(feed.getCreationDate()).isCloseTo(created, 1000);
    assertThat(feed.getLastModified()).isCloseTo(modified, 1000);
}
Also used : GregorianCalendar(java.util.GregorianCalendar) OLATResource(org.olat.resource.OLATResource) FeedImpl(org.olat.modules.webFeed.model.FeedImpl) Date(java.util.Date) Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Aggregations

Feed (org.olat.modules.webFeed.Feed)216 Test (org.junit.Test)162 Item (org.olat.modules.webFeed.Item)98 FeedImpl (org.olat.modules.webFeed.model.FeedImpl)76 OLATResource (org.olat.resource.OLATResource)72 BlogFileResource (org.olat.fileresource.types.BlogFileResource)60 ItemImpl (org.olat.modules.webFeed.model.ItemImpl)52 SyndFeed (com.rometools.rome.feed.synd.SyndFeed)36 VFSContainer (org.olat.core.util.vfs.VFSContainer)28 RSSFeed (org.olat.modules.webFeed.RSSFeed)24 Date (java.util.Date)22 RepositoryEntry (org.olat.repository.RepositoryEntry)12 OLATResourceable (org.olat.core.id.OLATResourceable)8 Path (java.nio.file.Path)6 LocalDate (java.time.LocalDate)6 VFSItem (org.olat.core.util.vfs.VFSItem)6 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)6 FeedItemDocument (org.olat.modules.webFeed.search.document.FeedItemDocument)6 OlatDocument (org.olat.search.model.OlatDocument)6 IOException (java.io.IOException)4