Search in sources :

Example 91 with Item

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

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 92 with Item

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

the class FeedFileStorgeTest method loadItemsFromXML_missing_XML.

@Test
public void loadItemsFromXML_missing_XML() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    Item item1 = new ItemImpl(feed);
    String guid1 = "guid 1";
    item1.setGuid(guid1);
    sut.saveItemAsXML(item1);
    Item item2 = new ItemImpl(feed);
    String guid2 = "guid 2";
    item2.setGuid(guid2);
    sut.saveItemAsXML(item2);
    sut.deleteItemXML(item1);
    List<Item> items = sut.loadItemsFromXML(feed);
    assertThat(items.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 93 with Item

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

the class FeedFileStorgeTest method loadItemFromXML_null.

@Test
public void loadItemFromXML_null() {
    Item reloaded = sut.loadItemFromXML(null);
    assertThat(reloaded).isNull();
}
Also used : Item(org.olat.modules.webFeed.Item) Test(org.junit.Test)

Example 94 with Item

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

the class FeedFileStorgeTest method getOrCreateItemMediaContainer_get.

@Test
public void getOrCreateItemMediaContainer_get() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    Item item = new ItemImpl(feed);
    item.setGuid("guid");
    sut.getOrCreateItemMediaContainer(item);
    VFSContainer itemMediaContainer = sut.getOrCreateItemMediaContainer(item);
    assertThat(itemMediaContainer).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 95 with Item

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

the class FeedFileStorgeTest method loadItemFromXML_not_existing.

@Test
public void loadItemFromXML_not_existing() {
    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);
    VFSContainer itemContainer = sut.getOrCreateItemContainer(item);
    Item reloaded = sut.loadItemFromXML(itemContainer);
    assertThat(reloaded).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)

Aggregations

Item (org.olat.modules.webFeed.Item)142 Test (org.junit.Test)98 Feed (org.olat.modules.webFeed.Feed)98 ItemImpl (org.olat.modules.webFeed.model.ItemImpl)64 OLATResource (org.olat.resource.OLATResource)44 BlogFileResource (org.olat.fileresource.types.BlogFileResource)38 FeedImpl (org.olat.modules.webFeed.model.FeedImpl)38 VFSContainer (org.olat.core.util.vfs.VFSContainer)26 Date (java.util.Date)16 VFSItem (org.olat.core.util.vfs.VFSItem)14 ArrayList (java.util.ArrayList)8 OLATResourceable (org.olat.core.id.OLATResourceable)8 RepositoryEntry (org.olat.repository.RepositoryEntry)8 SyndFeed (com.rometools.rome.feed.synd.SyndFeed)6 LocalDate (java.time.LocalDate)6 RSSFeed (org.olat.modules.webFeed.RSSFeed)6 FeedItemDocument (org.olat.modules.webFeed.search.document.FeedItemDocument)6 OlatDocument (org.olat.search.model.OlatDocument)6 SyndContent (com.rometools.rome.feed.synd.SyndContent)4 SyndEnclosure (com.rometools.rome.feed.synd.SyndEnclosure)4