Search in sources :

Example 21 with ItemImpl

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

the class FeedFileStorgeTest method saveItemAsXML_overwrite.

@Test
public void saveItemAsXML_overwrite() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    Item item = new ItemImpl(feed);
    item.setGuid("123");
    item.setAuthor("autor");
    sut.saveItemAsXML(item);
    item.setAuthor("secondAuthor");
    sut.saveItemAsXML(item);
    // check if there is one file in the item container
    assertThat(sut.getOrCreateItemContainer(item).getItems().size()).isEqualTo(1);
    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 22 with ItemImpl

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

the class FeedFileStorgeTest method saveItemAsXML_new.

@Test
public void saveItemAsXML_new() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    Item item = new ItemImpl(feed);
    item.setGuid("123");
    item.setAuthor("autor");
    sut.saveItemAsXML(item);
    // check if there is one file in the item container
    assertThat(sut.getOrCreateItemContainer(item).getItems().size()).isEqualTo(1);
    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 23 with ItemImpl

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

the class FeedFileStorgeTest method getOrCreateItemContainer_Guid_empty.

@Test
public void getOrCreateItemContainer_Guid_empty() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    Item item = new ItemImpl(feed);
    item.setGuid("");
    VFSContainer itemContainer = sut.getOrCreateItemContainer(item);
    assertThat(itemContainer).isNull();
    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 24 with ItemImpl

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

the class FeedFileStorgeTest method deleteItemContainer_null.

@Test
public void deleteItemContainer_null() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    Item item1 = new ItemImpl(feed);
    item1.setGuid("guid 1");
    sut.getOrCreateItemContainer(item1);
    sut.deleteItemContainer(null);
    // check if there is one item container left
    assertThat(sut.getOrCreateFeedItemsContainer(feed).getItems().size()).isEqualTo(1);
    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 25 with ItemImpl

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

the class FeedFileStorgeTest method deleteItemContainer_not_existing.

@Test
public void deleteItemContainer_not_existing() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    Item item1 = new ItemImpl(feed);
    item1.setGuid("guid 1");
    Item item2 = new ItemImpl(feed);
    item2.setGuid("guid 2");
    sut.getOrCreateItemContainer(item2);
    sut.deleteItemContainer(item1);
    // check if there is only one item container left
    assertThat(sut.getOrCreateFeedItemsContainer(feed).getItems().size()).isEqualTo(1);
    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)

Aggregations

ItemImpl (org.olat.modules.webFeed.model.ItemImpl)70 Item (org.olat.modules.webFeed.Item)64 Test (org.junit.Test)58 Feed (org.olat.modules.webFeed.Feed)52 BlogFileResource (org.olat.fileresource.types.BlogFileResource)36 FeedImpl (org.olat.modules.webFeed.model.FeedImpl)36 VFSContainer (org.olat.core.util.vfs.VFSContainer)20 OLATResource (org.olat.resource.OLATResource)16 Date (java.util.Date)10 LocalDate (java.time.LocalDate)4 SyndContent (com.rometools.rome.feed.synd.SyndContent)2 SyndEnclosure (com.rometools.rome.feed.synd.SyndEnclosure)2 XStream (com.thoughtworks.xstream.XStream)2 GregorianCalendar (java.util.GregorianCalendar)2 Link (org.olat.core.gui.components.link.Link)2 Identity (org.olat.core.id.Identity)2 Filter (org.olat.core.util.filter.Filter)2