Search in sources :

Example 41 with BlogFileResource

use of org.olat.fileresource.types.BlogFileResource in project OpenOLAT by OpenOLAT.

the class FeedFileStorgeTest method saveFeedAsXML_new.

@Test
public void saveFeedAsXML_new() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    feed.setAuthor("initialAuthor");
    sut.saveFeedAsXML(feed);
    // check if there is one file in the feed container
    assertThat(sut.getOrCreateFeedContainer(feed).getItems().size()).isEqualTo(1);
    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 42 with BlogFileResource

use of org.olat.fileresource.types.BlogFileResource in project OpenOLAT by OpenOLAT.

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 43 with BlogFileResource

use of org.olat.fileresource.types.BlogFileResource in project OpenOLAT by OpenOLAT.

the class FeedFileStorgeTest method getOrCreateFeedContainer_get.

@Test
public void getOrCreateFeedContainer_get() {
    FeedFileResource ores = new BlogFileResource();
    sut.getOrCreateFeedContainer(ores);
    VFSContainer feedContainer = sut.getOrCreateFeedContainer(ores);
    assertThat(feedContainer).isNotNull();
    fileResourceManager.deleteFileResource(ores);
}
Also used : VFSContainer(org.olat.core.util.vfs.VFSContainer) FeedFileResource(org.olat.fileresource.types.FeedFileResource) BlogFileResource(org.olat.fileresource.types.BlogFileResource) Test(org.junit.Test)

Example 44 with BlogFileResource

use of org.olat.fileresource.types.BlogFileResource in project OpenOLAT by OpenOLAT.

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)

Example 45 with BlogFileResource

use of org.olat.fileresource.types.BlogFileResource in project OpenOLAT by OpenOLAT.

the class FeedFileStorgeTest method deleteFeedXML_not_existing.

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

Aggregations

BlogFileResource (org.olat.fileresource.types.BlogFileResource)74 Test (org.junit.Test)72 Feed (org.olat.modules.webFeed.Feed)60 FeedImpl (org.olat.modules.webFeed.model.FeedImpl)58 Item (org.olat.modules.webFeed.Item)38 ItemImpl (org.olat.modules.webFeed.model.ItemImpl)36 VFSContainer (org.olat.core.util.vfs.VFSContainer)34 FeedFileResource (org.olat.fileresource.types.FeedFileResource)12 File (java.io.File)2 Path (java.nio.file.Path)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2 RepositoryService (org.olat.repository.RepositoryService)2 OLATResource (org.olat.resource.OLATResource)2