Search in sources :

Example 76 with Feed

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

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 77 with Feed

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

the class FeedManagerImplTest method enrichFeedFromRepositoryEntryShouldTransferAtributes.

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

Example 78 with Feed

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

the class ItemDAOTest method createItem.

@Test
public void createItem() {
    OLATResource resource = JunitTestHelper.createRandomResource();
    Feed feed = feedDao.createFeedForResourcable(resource);
    dbInstance.commitAndCloseSession();
    Item item = itemDao.createItem(feed);
    dbInstance.commitAndCloseSession();
    // check values
    assertThat(item.getKey()).isNotNull();
    assertThat(item.getCreationDate()).isNotNull();
    assertThat(item.getLastModified()).isNotNull();
    assertThat(item.getFeed()).isEqualTo(feed);
}
Also used : Item(org.olat.modules.webFeed.Item) OLATResource(org.olat.resource.OLATResource) Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Example 79 with Feed

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

the class ItemDAOTest method loadItemByGuid_Feed_null.

@Test
public void loadItemByGuid_Feed_null() {
    OLATResource resource = JunitTestHelper.createRandomResource();
    Feed feed = feedDao.createFeedForResourcable(resource);
    dbInstance.commitAndCloseSession();
    // create an item
    String guid = "guid-123";
    Item tempItem = new ItemImpl(feed);
    tempItem.setGuid(guid);
    itemDao.createItem(feed, tempItem);
    dbInstance.commitAndCloseSession();
    // reload the item from the database
    Item item = itemDao.loadItemByGuid(null, guid);
    // check values
    assertThat(item).isNull();
}
Also used : Item(org.olat.modules.webFeed.Item) ItemImpl(org.olat.modules.webFeed.model.ItemImpl) OLATResource(org.olat.resource.OLATResource) Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Example 80 with Feed

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

the class ItemDAOTest method createItem_Feed_Item.

@Test
public void createItem_Feed_Item() {
    OLATResource resource = JunitTestHelper.createRandomResource();
    Feed feed = feedDao.createFeedForResourcable(resource);
    dbInstance.commitAndCloseSession();
    Item tempItem = new ItemImpl(feed);
    Item item = itemDao.createItem(feed, tempItem);
    dbInstance.commitAndCloseSession();
    // check values
    assertThat(item.getKey()).isNotNull();
    assertThat(item.getCreationDate()).isNotNull();
    assertThat(item.getLastModified()).isNotNull();
    assertThat(item.getFeed()).isEqualTo(feed);
}
Also used : Item(org.olat.modules.webFeed.Item) ItemImpl(org.olat.modules.webFeed.model.ItemImpl) OLATResource(org.olat.resource.OLATResource) 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