use of org.olat.modules.webFeed.model.FeedImpl in project OpenOLAT by OpenOLAT.
the class FeedFileStorgeTest method loadFeedFromXML_shortening_values.
@Test
public void loadFeedFromXML_shortening_values() {
StringBuffer sb = new StringBuffer(5000);
for (int i = 0; i < 5000; i++) {
sb.append("A");
}
String stringWith5000Chars = sb.toString();
BlogFileResource resource = new BlogFileResource();
Feed feed = new FeedImpl(resource);
feed.setAuthor(stringWith5000Chars);
feed.setDescription(stringWith5000Chars);
feed.setTitle(stringWith5000Chars);
feed.setExternalFeedUrl(stringWith5000Chars);
feed.setExternalImageURL(stringWith5000Chars);
sut.saveFeedAsXML(feed);
Feed reloaded = sut.loadFeedFromXML(resource);
assertThat(reloaded).isNotNull();
assertThat(reloaded.getAuthor()).hasSize(255);
assertThat(reloaded.getTitle()).hasSize(1024);
assertThat(reloaded.getDescription()).hasSize(4000);
assertThat(reloaded.getExternalFeedUrl()).isNull();
assertThat(reloaded.getExternalImageURL()).isNull();
assertThat(reloaded.getImageName()).isNull();
fileResourceManager.deleteFileResource(resource);
}
use of org.olat.modules.webFeed.model.FeedImpl in project OpenOLAT by OpenOLAT.
the class FeedFileStorgeTest method loadItemsFromXML_shortening.
@Test
public void loadItemsFromXML_shortening() {
StringBuffer sb = new StringBuffer(5000);
for (int i = 0; i < 5000; i++) {
sb.append("A");
}
String stringWith5000Chars = sb.toString();
BlogFileResource resource = new BlogFileResource();
Feed feed = new FeedImpl(resource);
Item item = new ItemImpl(feed);
String guid1 = "guid 1";
item.setGuid(guid1);
item.setAuthor(stringWith5000Chars);
item.setExternalLink(stringWith5000Chars);
item.setTitle(stringWith5000Chars);
sut.saveItemAsXML(item);
List<Item> items = sut.loadItemsFromXML(feed);
Item reloadedItem = items.get(0);
assertThat(reloadedItem.getAuthor()).hasSize(255);
assertThat(reloadedItem.getExternalLink()).isNull();
assertThat(reloadedItem.getTitle()).hasSize(1024);
fileResourceManager.deleteFileResource(resource);
}
use of org.olat.modules.webFeed.model.FeedImpl in project OpenOLAT by OpenOLAT.
the class FeedFileStorgeTest method saveFeedAsXML_new.
@Test
public void saveFeedAsXML_new() {
BlogFileResource resource = new BlogFileResource();
Feed feed = new FeedImpl(resource);
feed.setAuthor("initialAuthor");
sut.saveFeedAsXML(feed);
// check if there is one file in the feed container
assertThat(sut.getOrCreateFeedContainer(feed).getItems().size()).isEqualTo(1);
fileResourceManager.deleteFileResource(resource);
}
use of org.olat.modules.webFeed.model.FeedImpl in project OpenOLAT by OpenOLAT.
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.model.FeedImpl in project OpenOLAT by OpenOLAT.
the class FeedFileStorgeTest method getOrCreateItemContainer_guid_Guid_empty.
@Test
public void getOrCreateItemContainer_guid_Guid_empty() {
BlogFileResource resource = new BlogFileResource();
Feed feed = new FeedImpl(resource);
VFSContainer itemContainer = sut.getOrCreateItemContainer(feed, null);
assertThat(itemContainer).isNull();
fileResourceManager.deleteFileResource(resource);
}
Aggregations