Search in sources :

Example 6 with BlogFileResource

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

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

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

the class FeedFileStorgeTest method loadItemsFromXML.

@Test
public void loadItemsFromXML() {
    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);
    Item item3 = new ItemImpl(feed);
    String guid3 = "guid 3";
    item3.setGuid(guid3);
    sut.saveItemAsXML(item3);
    List<Item> items = sut.loadItemsFromXML(feed);
    assertThat(items.size()).isEqualTo(3);
    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 8 with BlogFileResource

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

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

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

the class FeedFileStorgeTest method getOrCreateItemContainer_get.

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

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

the class FeedFileStorgeTest method loadFeedFromXML_Ores.

@Test
public void loadFeedFromXML_Ores() {
    BlogFileResource resource = new BlogFileResource();
    Feed feed = new FeedImpl(resource);
    String autor = "autor";
    feed.setAuthor(autor);
    sut.saveFeedAsXML(feed);
    Feed reloaded = sut.loadFeedFromXML(resource);
    assertThat(reloaded).isNotNull();
    assertThat(reloaded.getAuthor()).isEqualTo(autor);
    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