use of org.olat.modules.webFeed.Enclosure in project OpenOLAT by OpenOLAT.
the class RomeFeedFetcherTest method convertEnclosures_emptyList.
@Test
public void convertEnclosures_emptyList() {
List<SyndEnclosure> enclosures = new ArrayList<>();
Enclosure enclosure = sut.convertEnclosures(enclosures);
assertThat(enclosure).isNull();
}
use of org.olat.modules.webFeed.Enclosure in project OpenOLAT by OpenOLAT.
the class RomeFeedFetcherTest method convertEnclosures_Url_null.
@Test
public void convertEnclosures_Url_null() {
when(syndEnclosureMock.getUrl()).thenReturn(null);
List<SyndEnclosure> enclosures = Arrays.asList(syndEnclosureMock);
Enclosure enclosure = sut.convertEnclosures(enclosures);
assertThat(enclosure).isNull();
}
use of org.olat.modules.webFeed.Enclosure in project OpenOLAT by OpenOLAT.
the class RomeFeedFetcherTest method convertEnclosures_null.
@Test
public void convertEnclosures_null() {
Enclosure enclosure = sut.convertEnclosures(null);
assertThat(enclosure).isNull();
}
use of org.olat.modules.webFeed.Enclosure in project OpenOLAT by OpenOLAT.
the class RomeFeedFetcherTest method convertEnclosures.
@Test
public void convertEnclosures() {
Long length = 1l;
when(syndEnclosureMock.getLength()).thenReturn(length);
String type = "type";
when(syndEnclosureMock.getType()).thenReturn(type);
String url = "url";
when(syndEnclosureMock.getUrl()).thenReturn(url);
List<SyndEnclosure> enclosures = Arrays.asList(syndEnclosureMock);
Enclosure enclosure = sut.convertEnclosures(enclosures);
assertThat(enclosure.getExternalUrl()).isEqualTo(url);
assertThat(enclosure.getLength()).isEqualTo(length);
assertThat(enclosure.getType()).isEqualTo(type);
}
use of org.olat.modules.webFeed.Enclosure in project OpenOLAT by OpenOLAT.
the class FeedFileStorge method loadItemMedia.
/**
* Load the media file of the item.
*
* @param item
* @return
*/
public File loadItemMedia(Item item) {
File file = null;
Enclosure enclosure = item.getEnclosure();
VFSContainer mediaDir = getOrCreateItemMediaContainer(item);
if (mediaDir != null && enclosure != null) {
VFSLeaf mediaFile = (VFSLeaf) mediaDir.resolve(enclosure.getFileName());
if (mediaFile != null && mediaFile instanceof LocalFileImpl) {
file = ((LocalFileImpl) mediaFile).getBasefile();
}
}
return file;
}
Aggregations