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();
}
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();
}
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);
}
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);
}
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);
}
Aggregations