use of org.olat.modules.webFeed.model.FeedImpl 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.FeedImpl in project openolat by klemens.
the class FeedDAOTest method createFeed_feed.
@Test
public void createFeed_feed() {
OLATResource resource = JunitTestHelper.createRandomResource();
Feed tempFeed = new FeedImpl(resource);
Feed feed = feedDao.createFeed(tempFeed);
Assert.assertNotNull(feed);
dbInstance.commitAndCloseSession();
// check values
Assert.assertNotNull(feed.getKey());
Assert.assertNotNull(feed.getCreationDate());
Assert.assertNotNull(feed.getLastModified());
Assert.assertEquals(resource.getResourceableId(), feed.getResourceableId());
Assert.assertEquals(resource.getResourceableTypeName(), feed.getResourceableTypeName());
}
use of org.olat.modules.webFeed.model.FeedImpl in project openolat by klemens.
the class FeedDAOTest method createFeed_feed_keepDates.
@Test
public void createFeed_feed_keepDates() {
OLATResource resource = JunitTestHelper.createRandomResource();
Feed tempFeed = new FeedImpl(resource);
Date created = new GregorianCalendar(2000, 1, 1).getTime();
tempFeed.setCreationDate(created);
Date modified = new GregorianCalendar(2000, 2, 2).getTime();
tempFeed.setLastModified(modified);
Feed feed = feedDao.createFeed(tempFeed);
dbInstance.commitAndCloseSession();
// check values
assertThat(feed.getCreationDate()).isCloseTo(created, 1000);
assertThat(feed.getLastModified()).isCloseTo(modified, 1000);
}
use of org.olat.modules.webFeed.model.FeedImpl in project openolat by klemens.
the class FeedFileStorgeTest method deleteFeedXML_not_existing.
@Test
public void deleteFeedXML_not_existing() {
BlogFileResource resource = new BlogFileResource();
Feed feed = new FeedImpl(resource);
feed.setAuthor("initialAuthor");
sut.deleteFeedXML(feed);
// check if there is no file in the feed container
assertThat(sut.getOrCreateFeedContainer(feed).getItems().size()).isEqualTo(0);
fileResourceManager.deleteFileResource(resource);
}
use of org.olat.modules.webFeed.model.FeedImpl 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);
}
Aggregations