use of org.olat.modules.webFeed.model.FeedImpl in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
the class FeedManagerImplTest method enrichFeedFromRepositoryEntryShouldReturnUnchangedFeedIfRepositoryIsNull.
@Test
public void enrichFeedFromRepositoryEntryShouldReturnUnchangedFeedIfRepositoryIsNull() {
Feed feed = new FeedImpl(resourceDummy);
String title = "Title";
feed.setTitle(title);
String description = "Description";
feed.setDescription(description);
String authors = "Author";
feed.setAuthor(authors);
Feed enrichedFeed = sut.enrichFeedByRepositoryEntry(feed, null);
assertThat(enrichedFeed).isEqualTo(feed);
assertThat(enrichedFeed.getTitle()).isEqualTo(title);
assertThat(enrichedFeed.getDescription()).isEqualTo(description);
assertThat(enrichedFeed.getAuthor()).isEqualTo(authors);
}
use of org.olat.modules.webFeed.model.FeedImpl in project OpenOLAT by OpenOLAT.
the class RomeFeedFetcherTest method justifiyFeed.
@Test
public void justifiyFeed() {
String urlOld = "http://example.com/image1.jpg";
String urlNew = "http://example.com/image2.jpg";
Feed feed = new FeedImpl(oresMock);
feed.setExternalImageURL(urlOld);
when(syndImageMock.getUrl()).thenReturn(urlNew);
when(syndFeedMock.getImage()).thenReturn(syndImageMock);
Feed justifiedFeed = sut.justifyFeed(feed, syndFeedMock);
assertThat(justifiedFeed.getExternalImageURL()).isEqualTo(urlNew);
}
use of org.olat.modules.webFeed.model.FeedImpl in project OpenOLAT by OpenOLAT.
the class RomeFeedFetcherTest method justifiyFeed_Feed_null.
@Test
public void justifiyFeed_Feed_null() {
String urlOld = "http://example.com/image1.jpg";
Feed feed = new FeedImpl(oresMock);
feed.setExternalImageURL(urlOld);
Feed justifiedFeed = sut.justifyFeed(feed, null);
assertThat(justifiedFeed.getExternalImageURL()).isEqualTo(urlOld);
}
use of org.olat.modules.webFeed.model.FeedImpl in project OpenOLAT by OpenOLAT.
the class FeedDAO method createFeedForResourcable.
public Feed createFeedForResourcable(OLATResourceable ores) {
if (ores == null)
return null;
Feed feed = new FeedImpl(ores);
feed.setCreationDate(new Date());
feed.setLastModified(feed.getCreationDate());
dbInstance.getCurrentEntityManager().persist(feed);
return feed;
}
Aggregations