Search in sources :

Example 6 with Feed

use of org.olat.modules.webFeed.Feed in project OpenOLAT by OpenOLAT.

the class FeedManagerImplTest method enrichFeedFromRepositoryEntryShouldReturnUnchangedFeedIfRepositoryIsNull.

@Test
public void enrichFeedFromRepositoryEntryShouldReturnUnchangedFeedIfRepositoryIsNull() {
    Feed feed = new FeedImpl(resourceDummy);
    String title = "Title";
    feed.setTitle(title);
    String description = "Description";
    feed.setDescription(description);
    String authors = "Author";
    feed.setAuthor(authors);
    Feed enrichedFeed = sut.enrichFeedByRepositoryEntry(feed, null);
    assertThat(enrichedFeed).isEqualTo(feed);
    assertThat(enrichedFeed.getTitle()).isEqualTo(title);
    assertThat(enrichedFeed.getDescription()).isEqualTo(description);
    assertThat(enrichedFeed.getAuthor()).isEqualTo(authors);
}
Also used : FeedImpl(org.olat.modules.webFeed.model.FeedImpl) Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Example 7 with Feed

use of org.olat.modules.webFeed.Feed in project OpenOLAT by OpenOLAT.

the class FeedManagerImplTest method enrichFeedFromRepositoryEntryShouldReturnNullIfFeedIsNull.

@Test
public void enrichFeedFromRepositoryEntryShouldReturnNullIfFeedIsNull() {
    RepositoryEntry entry = new RepositoryEntry();
    Feed enrichedFeed = sut.enrichFeedByRepositoryEntry(null, entry);
    assertThat(enrichedFeed).isNull();
}
Also used : RepositoryEntry(org.olat.repository.RepositoryEntry) Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Example 8 with Feed

use of org.olat.modules.webFeed.Feed in project OpenOLAT by OpenOLAT.

the class FeedManagerImplTest method shouldNotUpdateFeedWhenExternalUrlIsTheSame.

@Test
public void shouldNotUpdateFeedWhenExternalUrlIsTheSame() {
    when(feedDAOMock.loadFeed(externalFeed)).thenReturn(externalFeed);
    when(feedDAOMock.updateFeed(externalFeed)).thenReturn(externalFeed);
    Feed updatedFeed = sut.updateExternalFeedUrl(externalFeed, EXTERNAL_URL_OLD);
    assertThat(updatedFeed.getExternalFeedUrl()).isEqualTo(EXTERNAL_URL_OLD);
    assertThat(updatedFeed.getLastModified()).isNotNull();
    verify(feedDAOMock).updateFeed(externalFeed);
}
Also used : Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Example 9 with Feed

use of org.olat.modules.webFeed.Feed in project OpenOLAT by OpenOLAT.

the class RomeFeedFetcherTest method justifiyFeed.

@Test
public void justifiyFeed() {
    String urlOld = "http://example.com/image1.jpg";
    String urlNew = "http://example.com/image2.jpg";
    Feed feed = new FeedImpl(oresMock);
    feed.setExternalImageURL(urlOld);
    when(syndImageMock.getUrl()).thenReturn(urlNew);
    when(syndFeedMock.getImage()).thenReturn(syndImageMock);
    Feed justifiedFeed = sut.justifyFeed(feed, syndFeedMock);
    assertThat(justifiedFeed.getExternalImageURL()).isEqualTo(urlNew);
}
Also used : FeedImpl(org.olat.modules.webFeed.model.FeedImpl) SyndFeed(com.rometools.rome.feed.synd.SyndFeed) Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Example 10 with Feed

use of org.olat.modules.webFeed.Feed in project OpenOLAT by OpenOLAT.

the class RomeFeedFetcherTest method justifiyFeed_null_Feed.

@Test
public void justifiyFeed_null_Feed() {
    Feed justifiedFeed = sut.justifyFeed(null, syndFeedMock);
    assertThat(justifiedFeed).isNull();
}
Also used : SyndFeed(com.rometools.rome.feed.synd.SyndFeed) 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