use of org.olat.modules.webFeed.Item in project openolat by klemens.
the class FeedFileStorgeTest method loadItemsFromXML_missing_XML.
@Test
public void loadItemsFromXML_missing_XML() {
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);
sut.deleteItemXML(item1);
List<Item> items = sut.loadItemsFromXML(feed);
assertThat(items.size()).isEqualTo(1);
fileResourceManager.deleteFileResource(resource);
}
use of org.olat.modules.webFeed.Item in project openolat by klemens.
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.Item in project openolat by klemens.
the class FeedFileStorgeTest method loadItemFromXML.
@Test
public void loadItemFromXML() {
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);
sut.saveItemAsXML(item);
VFSContainer itemContainer = sut.getOrCreateItemContainer(item);
Item reloaded = sut.loadItemFromXML(itemContainer);
assertThat(reloaded).isNotNull();
assertThat(reloaded.getAuthor()).isEqualTo(autor);
fileResourceManager.deleteFileResource(resource);
}
use of org.olat.modules.webFeed.Item in project openolat by klemens.
the class ItemDAOTest method createItem.
@Test
public void createItem() {
OLATResource resource = JunitTestHelper.createRandomResource();
Feed feed = feedDao.createFeedForResourcable(resource);
dbInstance.commitAndCloseSession();
Item item = itemDao.createItem(feed);
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.Item in project openolat by klemens.
the class ItemDAOTest method updateItem_null.
@Test
public void updateItem_null() {
OLATResource resource = JunitTestHelper.createRandomResource();
feedDao.createFeedForResourcable(resource);
dbInstance.commitAndCloseSession();
Item item = itemDao.createItem(null);
dbInstance.commitAndCloseSession();
Item updated = itemDao.updateItem(item);
assertThat(updated).isNull();
}
Aggregations