Search in sources :

Example 36 with FeedImpl

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

the class FeedFileStorgeTest method deleteItemXML_not_existing.

@Test
public void deleteItemXML_not_existing() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    Item item = new ItemImpl(feed);
    item.setGuid("123");
    item.setAuthor("autor");
    sut.deleteItemXML(item);
    // check if there is no file in the item container
    assertThat(sut.getOrCreateItemContainer(item).getItems().size()).isEqualTo(0);
    fileResourceManager.deleteFileResource(resource);
}
Also used : Item(org.olat.modules.webFeed.Item) ItemImpl(org.olat.modules.webFeed.model.ItemImpl) FeedImpl(org.olat.modules.webFeed.model.FeedImpl) BlogFileResource(org.olat.fileresource.types.BlogFileResource) Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Example 37 with FeedImpl

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

the class FeedFileStorgeTest method loadItemFromXML.

@Test
public void loadItemFromXML() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    Item item = new ItemImpl(feed);
    String guid = "guid öüä";
    item.setGuid(guid);
    String autor = "autor";
    item.setAuthor(autor);
    sut.saveItemAsXML(item);
    VFSContainer itemContainer = sut.getOrCreateItemContainer(item);
    Item reloaded = sut.loadItemFromXML(itemContainer);
    assertThat(reloaded).isNotNull();
    assertThat(reloaded.getAuthor()).isEqualTo(autor);
    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 38 with FeedImpl

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

the class FeedFileStorgeTest method deleteFeedXML.

@Test
public void deleteFeedXML() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    feed.setAuthor("initialAuthor");
    sut.saveFeedAsXML(feed);
    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)

Example 39 with FeedImpl

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

the class FeedFileStorgeTest method getOrCreateItemContainer_guid_create.

@Test
public void getOrCreateItemContainer_guid_create() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    String guid = "guid 123";
    VFSContainer itemContainer = sut.getOrCreateItemContainer(feed, guid);
    assertThat(itemContainer).isNotNull();
    fileResourceManager.deleteFileResource(resource);
}
Also used : 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 40 with FeedImpl

use of org.olat.modules.webFeed.model.FeedImpl 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)

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