use of org.olat.modules.webFeed.model.FeedImpl in project OpenOLAT by OpenOLAT.
the class FeedManagerImplTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
when(coordinaterManagerMock.getCoordinator()).thenReturn(coordinaterMock);
when(coordinaterMock.getSyncer()).thenReturn(syncerDummy);
sut = new FeedManagerImpl(resourceManagerMock, fileResourceManagerMock, coordinaterManagerMock);
feedDAOMock = mock(FeedDAO.class);
ReflectionTestUtils.setField(sut, "feedDAO", feedDAOMock);
ReflectionTestUtils.setField(sut, "itemDAO", itemDAOMock);
ReflectionTestUtils.setField(sut, "feedFileStorage", feedFileStorageMock);
ReflectionTestUtils.setField(sut, "externalFeedFetcher", feedFetcherMock);
ReflectionTestUtils.setField(sut, "repositoryManager", repositoryManager);
ReflectionTestUtils.setField(sut, "notificationsManager", notificationsManagerMock);
when(internatFeedMock.getKey()).thenReturn(FEED_KEY);
when(internatFeedMock.getResourceableTypeName()).thenReturn(RESOURCEABLE_TYPE_NAME);
when(internatFeedMock.getResourceableId()).thenReturn(RESOURCABLE_ID);
when(internatFeedMock.isInternal()).thenReturn(true);
when(internalItemMock.getKey()).thenReturn(ITEM_KEY);
when(internalItemMock.getFeed()).thenReturn(internatFeedMock);
externalFeed = new FeedImpl(resourceDummy);
externalFeed.setKey(FEED_KEY);
externalFeed.setExternal(true);
externalFeed.setExternalFeedUrl(EXTERNAL_URL_OLD);
}
use of org.olat.modules.webFeed.model.FeedImpl in project OpenOLAT by OpenOLAT.
the class FeedManagerImplTest method enrichFeedFromRepositoryEntryShouldTransferAtributes.
@Test
public void enrichFeedFromRepositoryEntryShouldTransferAtributes() {
Feed feed = new FeedImpl(resourceDummy);
RepositoryEntry entry = new RepositoryEntry();
String title = "Title";
entry.setDisplayname(title);
String description = "Description";
entry.setDescription(description);
String authors = "Author";
entry.setAuthors(authors);
Feed enrichedFeed = sut.enrichFeedByRepositoryEntry(feed, entry);
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_externalImageIsNull.
@Test
public void justifiyFeed_externalImageIsNull() {
String urlOld = "http://example.com/image1.jpg";
Feed feed = new FeedImpl(oresMock);
feed.setExternalImageURL(urlOld);
when(syndFeedMock.getImage()).thenReturn(null);
Feed justifiedFeed = sut.justifyFeed(feed, syndFeedMock);
assertThat(justifiedFeed.getExternalImageURL()).isNull();
}
use of org.olat.modules.webFeed.model.FeedImpl in project OpenOLAT by OpenOLAT.
the class RomeFeedFetcherTest method justifiyFeed_externalImageUrlIsNull.
@Test
public void justifiyFeed_externalImageUrlIsNull() {
String urlOld = "http://example.com/image1.jpg";
String urlNew = null;
Feed feed = new FeedImpl(oresMock);
feed.setExternalImageURL(urlOld);
when(syndFeedMock.getImage()).thenReturn(syndImageMock);
when(syndImageMock.getUrl()).thenReturn(urlNew);
Feed justifiedFeed = sut.justifyFeed(feed, syndFeedMock);
assertThat(justifiedFeed.getExternalImageURL()).isNull();
}
use of org.olat.modules.webFeed.model.FeedImpl in project OpenOLAT by OpenOLAT.
the class FeedDAO method copyFeed.
public Feed copyFeed(OLATResourceable source, OLATResourceable target) {
if (source == null || target == null)
return null;
FeedImpl feed = (FeedImpl) loadFeed(source);
dbInstance.getCurrentEntityManager().detach(feed);
feed.setKey(null);
feed.setResourceableId(target.getResourceableId());
feed.setResourceableType(target.getResourceableTypeName());
dbInstance.getCurrentEntityManager().persist(feed);
return feed;
}
Aggregations