Search in sources :

Example 76 with FeedImpl

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

the class FeedFileStorgeTest method loadItemsFromXML_empty.

@Test
public void loadItemsFromXML_empty() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    List<Item> items = sut.loadItemsFromXML(feed);
    assertThat(items.size()).isEqualTo(0);
    fileResourceManager.deleteFileResource(resource);
}
Also used : Item(org.olat.modules.webFeed.Item) FeedImpl(org.olat.modules.webFeed.model.FeedImpl) BlogFileResource(org.olat.fileresource.types.BlogFileResource) Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Example 77 with FeedImpl

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

the class FeedFileStorgeTest method getOrCreateItemContainer_create.

@Test
public void getOrCreateItemContainer_create() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    Item item = new ItemImpl(feed);
    item.setGuid("guid");
    VFSContainer itemContainer = sut.getOrCreateItemContainer(item);
    assertThat(itemContainer).isNotNull();
    fileResourceManager.deleteFileResource(resource);
}
Also used : Item(org.olat.modules.webFeed.Item) ItemImpl(org.olat.modules.webFeed.model.ItemImpl) VFSContainer(org.olat.core.util.vfs.VFSContainer) FeedImpl(org.olat.modules.webFeed.model.FeedImpl) BlogFileResource(org.olat.fileresource.types.BlogFileResource) Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Example 78 with FeedImpl

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

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 79 with FeedImpl

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

the class RomeFeedFetcherTest method justifiyFeed_Feed_null.

@Test
public void justifiyFeed_Feed_null() {
    String urlOld = "http://example.com/image1.jpg";
    Feed feed = new FeedImpl(oresMock);
    feed.setExternalImageURL(urlOld);
    Feed justifiedFeed = sut.justifyFeed(feed, null);
    assertThat(justifiedFeed.getExternalImageURL()).isEqualTo(urlOld);
}
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 80 with FeedImpl

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

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)

Aggregations

FeedImpl (org.olat.modules.webFeed.model.FeedImpl)82 Feed (org.olat.modules.webFeed.Feed)76 Test (org.junit.Test)74 BlogFileResource (org.olat.fileresource.types.BlogFileResource)58 Item (org.olat.modules.webFeed.Item)38 ItemImpl (org.olat.modules.webFeed.model.ItemImpl)36 VFSContainer (org.olat.core.util.vfs.VFSContainer)22 SyndFeed (com.rometools.rome.feed.synd.SyndFeed)8 Date (java.util.Date)6 OLATResource (org.olat.resource.OLATResource)4 Path (java.nio.file.Path)2 GregorianCalendar (java.util.GregorianCalendar)2 Before (org.junit.Before)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2