Search in sources :

Example 51 with ItemImpl

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

the class ItemDAOTest method createItem_Feed_Null.

@Test
public void createItem_Feed_Null() {
    Item tempItem = new ItemImpl(null);
    Item item = itemDao.createItem(null, tempItem);
    dbInstance.commitAndCloseSession();
    // check values
    assertThat(item).isNull();
}
Also used : Item(org.olat.modules.webFeed.Item) ItemImpl(org.olat.modules.webFeed.model.ItemImpl) Test(org.junit.Test)

Example 52 with ItemImpl

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

the class ItemDAOTest method loadItemByGuid_without_feed_multiple_guids.

@Test
public void loadItemByGuid_without_feed_multiple_guids() {
    OLATResource resource = JunitTestHelper.createRandomResource();
    Feed feed = feedDao.createFeedForResourcable(resource);
    dbInstance.commitAndCloseSession();
    // create an item
    String guid = "guid-12345";
    Item tempItem = new ItemImpl(feed);
    tempItem.setGuid(guid);
    itemDao.createItem(feed, tempItem);
    dbInstance.commitAndCloseSession();
    tempItem = new ItemImpl(feed);
    tempItem.setGuid(guid);
    itemDao.createItem(feed, tempItem);
    dbInstance.commitAndCloseSession();
    // reload the item from the database
    Item item = itemDao.loadItemByGuid(guid);
    // check values
    assertThat(item).isNull();
}
Also used : Item(org.olat.modules.webFeed.Item) ItemImpl(org.olat.modules.webFeed.model.ItemImpl) OLATResource(org.olat.resource.OLATResource) Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Example 53 with ItemImpl

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

the class ItemDAOTest method createItem_Feed_Item.

@Test
public void createItem_Feed_Item() {
    OLATResource resource = JunitTestHelper.createRandomResource();
    Feed feed = feedDao.createFeedForResourcable(resource);
    dbInstance.commitAndCloseSession();
    Item tempItem = new ItemImpl(feed);
    Item item = itemDao.createItem(feed, tempItem);
    dbInstance.commitAndCloseSession();
    // check values
    assertThat(item.getKey()).isNotNull();
    assertThat(item.getCreationDate()).isNotNull();
    assertThat(item.getLastModified()).isNotNull();
    assertThat(item.getFeed()).isEqualTo(feed);
}
Also used : Item(org.olat.modules.webFeed.Item) ItemImpl(org.olat.modules.webFeed.model.ItemImpl) OLATResource(org.olat.resource.OLATResource) Feed(org.olat.modules.webFeed.Feed) Test(org.junit.Test)

Example 54 with ItemImpl

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

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 55 with ItemImpl

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

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)

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