use of org.olat.modules.webFeed.model.FeedImpl in project OpenOLAT by OpenOLAT.
the class FeedDAO method createFeed.
public Feed createFeed(Feed feed) {
if (feed == null)
return null;
FeedImpl feedImpl = (FeedImpl) feed;
if (feedImpl.getCreationDate() == null) {
feedImpl.setCreationDate(new Date());
}
if (feedImpl.getLastModified() == null) {
feedImpl.setLastModified(feedImpl.getCreationDate());
}
dbInstance.getCurrentEntityManager().persist(feedImpl);
return feed;
}
use of org.olat.modules.webFeed.model.FeedImpl in project OpenOLAT by OpenOLAT.
the class FeedFileStorgeTest method saveItemAsXML_overwrite.
@Test
public void saveItemAsXML_overwrite() {
BlogFileResource resource = new BlogFileResource();
Feed feed = new FeedImpl(resource);
Item item = new ItemImpl(feed);
item.setGuid("123");
item.setAuthor("autor");
sut.saveItemAsXML(item);
item.setAuthor("secondAuthor");
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 OpenOLAT.
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);
}
use of org.olat.modules.webFeed.model.FeedImpl in project OpenOLAT by OpenOLAT.
the class FeedFileStorgeTest method loadItemsFromXML_empty.
@Test
public void loadItemsFromXML_empty() {
BlogFileResource resource = new BlogFileResource();
Feed feed = new FeedImpl(resource);
List<Item> items = sut.loadItemsFromXML(feed);
assertThat(items.size()).isEqualTo(0);
fileResourceManager.deleteFileResource(resource);
}
use of org.olat.modules.webFeed.model.FeedImpl in project OpenOLAT by OpenOLAT.
the class FeedFileStorgeTest method getOrCreateItemContainer_Guid_empty.
@Test
public void getOrCreateItemContainer_Guid_empty() {
BlogFileResource resource = new BlogFileResource();
Feed feed = new FeedImpl(resource);
Item item = new ItemImpl(feed);
item.setGuid("");
VFSContainer itemContainer = sut.getOrCreateItemContainer(item);
assertThat(itemContainer).isNull();
fileResourceManager.deleteFileResource(resource);
}
Aggregations