use of org.olat.modules.webFeed.model.ItemImpl in project OpenOLAT by OpenOLAT.
the class ItemDAOTest method createItem_Feed_Item_keepDates.
@Test
public void createItem_Feed_Item_keepDates() {
OLATResource resource = JunitTestHelper.createRandomResource();
Feed feed = feedDao.createFeedForResourcable(resource);
dbInstance.commitAndCloseSession();
Item tempItem = new ItemImpl(feed);
Date created = new GregorianCalendar(2000, 1, 1).getTime();
tempItem.setCreationDate(created);
Date modified = new GregorianCalendar(2000, 2, 2).getTime();
tempItem.setLastModified(modified);
Item item = itemDao.createItem(feed, tempItem);
dbInstance.commitAndCloseSession();
// check values
assertThat(item.getCreationDate()).isCloseTo(created, 1000);
assertThat(item.getLastModified()).isCloseTo(modified, 1000);
}
use of org.olat.modules.webFeed.model.ItemImpl in project OpenOLAT by OpenOLAT.
the class ItemDAOTest method loadItemByGuid_without_feed.
@Test
public void loadItemByGuid_without_feed() {
OLATResource resource = JunitTestHelper.createRandomResource();
Feed feed = feedDao.createFeedForResourcable(resource);
dbInstance.commitAndCloseSession();
// create an item
String guid = "guid-123467890";
Item 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).isNotNull();
// clean up
itemDao.removeItem(item);
}
use of org.olat.modules.webFeed.model.ItemImpl in project openolat by klemens.
the class FeedFileStorgeTest method loadItemFromXML_not_existing.
@Test
public void loadItemFromXML_not_existing() {
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);
VFSContainer itemContainer = sut.getOrCreateItemContainer(item);
Item reloaded = sut.loadItemFromXML(itemContainer);
assertThat(reloaded).isNull();
fileResourceManager.deleteFileResource(resource);
}
use of org.olat.modules.webFeed.model.ItemImpl in project openolat by klemens.
the class FeedFileStorgeTest method getOrCreateItemContainer_Feed_null.
@Test
public void getOrCreateItemContainer_Feed_null() {
Item item = new ItemImpl(null);
item.setGuid("guid");
VFSContainer itemContainer = sut.getOrCreateItemContainer(item);
assertThat(itemContainer).isNull();
}
use of org.olat.modules.webFeed.model.ItemImpl in project openolat by klemens.
the class FeedFileStorgeTest method getOrCreateItemMediaContainer_create.
@Test
public void getOrCreateItemMediaContainer_create() {
BlogFileResource resource = new BlogFileResource();
Feed feed = new FeedImpl(resource);
Item item = new ItemImpl(feed);
item.setGuid("guid");
VFSContainer itemMediaContainer = sut.getOrCreateItemMediaContainer(item);
assertThat(itemMediaContainer).isNotNull();
fileResourceManager.deleteFileResource(resource);
}
Aggregations