use of org.olat.modules.webFeed.model.ItemImpl in project OpenOLAT by OpenOLAT.
the class FeedFileStorgeTest method deleteItemXML_not_existing.
@Test
public void deleteItemXML_not_existing() {
BlogFileResource resource = new BlogFileResource();
Feed feed = new FeedImpl(resource);
Item item = new ItemImpl(feed);
item.setGuid("123");
item.setAuthor("autor");
sut.deleteItemXML(item);
// check if there is no file in the item container
assertThat(sut.getOrCreateItemContainer(item).getItems().size()).isEqualTo(0);
fileResourceManager.deleteFileResource(resource);
}
use of org.olat.modules.webFeed.model.ItemImpl in project OpenOLAT by OpenOLAT.
the class FeedFileStorgeTest method saveItemAsXML_new.
@Test
public void saveItemAsXML_new() {
BlogFileResource resource = new BlogFileResource();
Feed feed = new FeedImpl(resource);
Item item = new ItemImpl(feed);
item.setGuid("123");
item.setAuthor("autor");
sut.saveItemAsXML(item);
// check if there is one file in the item container
assertThat(sut.getOrCreateItemContainer(item).getItems().size()).isEqualTo(1);
fileResourceManager.deleteFileResource(resource);
}
use of org.olat.modules.webFeed.model.ItemImpl in project OpenOLAT by OpenOLAT.
the class ItemDAOTest method loadItemByGuid_guidTwoTimes.
@Test
public void loadItemByGuid_guidTwoTimes() {
OLATResource resource = JunitTestHelper.createRandomResource();
Feed feed = feedDao.createFeedForResourcable(resource);
OLATResource resource2 = JunitTestHelper.createRandomResource();
Feed feed2 = feedDao.createFeedForResourcable(resource2);
dbInstance.commitAndCloseSession();
// create an item
String guid = "guid-123";
Item tempItem = new ItemImpl(feed);
tempItem.setGuid(guid);
itemDao.createItem(feed, tempItem);
Item tempItem2 = new ItemImpl(feed2);
tempItem2.setGuid(guid);
itemDao.createItem(feed2, tempItem2);
dbInstance.commitAndCloseSession();
// reload the item from the database
Item item = itemDao.loadItemByGuid(feed.getKey(), guid);
// check values
assertThat(item).isNotNull();
}
use of org.olat.modules.webFeed.model.ItemImpl in project OpenOLAT by OpenOLAT.
the class ItemDAOTest method loadItemByGuid.
@Test
public void loadItemByGuid() {
OLATResource resource = JunitTestHelper.createRandomResource();
Feed feed = feedDao.createFeedForResourcable(resource);
dbInstance.commitAndCloseSession();
// create an item
String guid = "guid-123";
Item tempItem = new ItemImpl(feed);
tempItem.setGuid(guid);
itemDao.createItem(feed, tempItem);
dbInstance.commitAndCloseSession();
// reload the item from the database
Item item = itemDao.loadItemByGuid(feed.getKey(), guid);
// check values
assertThat(item).isNotNull();
}
use of org.olat.modules.webFeed.model.ItemImpl in project OpenOLAT by OpenOLAT.
the class ItemDAOTest method loadItemByGuid_Feed_null.
@Test
public void loadItemByGuid_Feed_null() {
OLATResource resource = JunitTestHelper.createRandomResource();
Feed feed = feedDao.createFeedForResourcable(resource);
dbInstance.commitAndCloseSession();
// create an item
String guid = "guid-123";
Item tempItem = new ItemImpl(feed);
tempItem.setGuid(guid);
itemDao.createItem(feed, tempItem);
dbInstance.commitAndCloseSession();
// reload the item from the database
Item item = itemDao.loadItemByGuid(null, guid);
// check values
assertThat(item).isNull();
}
Aggregations