Search in sources :

Example 56 with Feed

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

the class FeedDAOTest method copyFeed_Source_null.

@Test
public void copyFeed_Source_null() {
    OLATResource target = JunitTestHelper.createRandomResource();
    Feed copy = feedDao.copyFeed(null, target);
    dbInstance.commitAndCloseSession();
    assertThat(copy).isNull();
}
Also used : OLATResource(org.olat.resource.OLATResource) Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Example 57 with Feed

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

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

Example 58 with Feed

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

the class FeedDAOTest method removeFeed.

@Test
public void removeFeed() {
    // store 3 feeds
    OLATResource resource1 = JunitTestHelper.createRandomResource();
    OLATResource resource2 = JunitTestHelper.createRandomResource();
    OLATResource resource3 = JunitTestHelper.createRandomResource();
    Feed feed1 = feedDao.createFeedForResourcable(resource1);
    Feed feed2 = feedDao.createFeedForResourcable(resource2);
    Feed feed3 = feedDao.createFeedForResourcable(resource3);
    dbInstance.commitAndCloseSession();
    // delete 1 feed
    feedDao.removeFeedForResourceable(feed2);
    dbInstance.commitAndCloseSession();
    // check if one feed is deleted and two feeds are still in the database
    Feed reloaded1 = feedDao.loadFeed(feed1.getKey());
    Assert.assertNotNull(reloaded1);
    Feed reloaded2 = feedDao.loadFeed(feed2.getKey());
    Assert.assertNull(reloaded2);
    Feed reloaded3 = feedDao.loadFeed(feed3.getKey());
    Assert.assertNotNull(reloaded3);
}
Also used : OLATResource(org.olat.resource.OLATResource) Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Example 59 with Feed

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

the class FeedFileStorgeTest method loadFeedFromXML_Path_not_existing.

@Test
public void loadFeedFromXML_Path_not_existing() {
    Path feedDir = Paths.get("abc");
    Feed reloaded = FeedManager.getInstance().loadFeedFromXML(feedDir);
    assertThat(reloaded).isNull();
}
Also used : Path(java.nio.file.Path) Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Example 60 with Feed

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

the class FeedFileStorgeTest method deleteFeedXML_not_existing.

@Test
public void deleteFeedXML_not_existing() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    feed.setAuthor("initialAuthor");
    sut.deleteFeedXML(feed);
    // check if there is no file in the feed container
    assertThat(sut.getOrCreateFeedContainer(feed).getItems().size()).isEqualTo(0);
    fileResourceManager.deleteFileResource(resource);
}
Also used : FeedImpl(org.olat.modules.webFeed.model.FeedImpl) BlogFileResource(org.olat.fileresource.types.BlogFileResource) 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