use of org.olat.fileresource.types.BlogFileResource in project OpenOLAT by OpenOLAT.
the class FeedFileStorgeTest method deleteItemContainer_not_existing.
@Test
public void deleteItemContainer_not_existing() {
BlogFileResource resource = new BlogFileResource();
Feed feed = new FeedImpl(resource);
Item item1 = new ItemImpl(feed);
item1.setGuid("guid 1");
Item item2 = new ItemImpl(feed);
item2.setGuid("guid 2");
sut.getOrCreateItemContainer(item2);
sut.deleteItemContainer(item1);
// check if there is only one item container left
assertThat(sut.getOrCreateFeedItemsContainer(feed).getItems().size()).isEqualTo(1);
fileResourceManager.deleteFileResource(resource);
}
use of org.olat.fileresource.types.BlogFileResource in project openolat by klemens.
the class BlogHandler method importResource.
@Override
public RepositoryEntry importResource(Identity initialAuthor, String initialAuthorAlt, String displayname, String description, boolean withReferences, Locale locale, File file, String filename) {
OLATResource resource = OLATResourceManager.getInstance().createAndPersistOLATResourceInstance(new BlogFileResource());
File fResourceFileroot = FileResourceManager.getInstance().getFileResourceRootImpl(resource).getBasefile();
File blogRoot = new File(fResourceFileroot, FeedManager.getInstance().getFeedKind(resource));
FileResource.copyResource(file, filename, blogRoot);
FeedManager.getInstance().importFeedFromXML(resource, true);
RepositoryEntry re = CoreSpringFactory.getImpl(RepositoryService.class).create(initialAuthor, null, "", displayname, description, resource, RepositoryEntry.ACC_OWNERS);
DBFactory.getInstance().commit();
return re;
}
use of org.olat.fileresource.types.BlogFileResource in project openolat by klemens.
the class FeedFileStorgeTest method getOrCreateItemContainer_get.
@Test
public void getOrCreateItemContainer_get() {
BlogFileResource resource = new BlogFileResource();
Feed feed = new FeedImpl(resource);
Item item = new ItemImpl(feed);
item.setGuid("guid");
sut.getOrCreateItemContainer(item);
VFSContainer itemContainer = sut.getOrCreateItemContainer(item);
assertThat(itemContainer).isNotNull();
fileResourceManager.deleteFileResource(resource);
}
use of org.olat.fileresource.types.BlogFileResource in project openolat by klemens.
the class FeedFileStorgeTest method loadItemsFromXML.
@Test
public void loadItemsFromXML() {
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);
Item item3 = new ItemImpl(feed);
String guid3 = "guid 3";
item3.setGuid(guid3);
sut.saveItemAsXML(item3);
List<Item> items = sut.loadItemsFromXML(feed);
assertThat(items.size()).isEqualTo(3);
fileResourceManager.deleteFileResource(resource);
}
use of org.olat.fileresource.types.BlogFileResource in project openolat by klemens.
the class FeedFileStorgeTest method getOrCreateItemMediaContainer_Guid_empty.
@Test
public void getOrCreateItemMediaContainer_Guid_empty() {
BlogFileResource resource = new BlogFileResource();
Feed feed = new FeedImpl(resource);
Item item = new ItemImpl(feed);
item.setGuid("");
VFSContainer itemMediaContainer = sut.getOrCreateItemMediaContainer(item);
assertThat(itemMediaContainer).isNull();
fileResourceManager.deleteFileResource(resource);
}
Aggregations