Search in sources :

Example 71 with FeedImpl

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

the class FeedFileStorgeTest method deleteItemContainer.

@Test
public void deleteItemContainer() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    Item item1 = new ItemImpl(feed);
    item1.setGuid("guid 1");
    sut.getOrCreateItemContainer(item1);
    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)

Example 72 with FeedImpl

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

the class FeedFileStorgeTest method deleteItemXML.

@Test
public void deleteItemXML() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    Item item = new ItemImpl(feed);
    item.setGuid("123");
    item.setAuthor("autor");
    sut.saveItemAsXML(item);
    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 73 with FeedImpl

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

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

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

the class FeedFileStorgeTest method getOrCreateItemContainer_guid_get.

@Test
public void getOrCreateItemContainer_guid_get() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    String guid = "guid 123";
    sut.getOrCreateItemContainer(feed, guid);
    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 75 with FeedImpl

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

the class FeedFileStorgeTest method getOrCreateItemContainer_guid_Guid_empty.

@Test
public void getOrCreateItemContainer_guid_Guid_empty() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    VFSContainer itemContainer = sut.getOrCreateItemContainer(feed, null);
    assertThat(itemContainer).isNull();
    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)

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