String descr = availableContentTypes.get(key);
assertEquals("Articolo rassegna stampa", descr);
}
public void testCRUDChannel() throws Throwable {
Channel testChannel = this.createTestChannel();
//ADD CHANNEL
this.getRssManager().addChannel(testChannel);
assertTrue(testChannel.getId() > 0);
//GET LIST
List<Channel> activeList = this.getRssManager().getChannels(Channel.STATUS_ACTIVE);
List<Channel> notActiveList = this.getRssManager().getChannels(Channel.STATUS_NOT_ACTIVE);
List<Channel> fullList = this.getRssManager().getChannels(Channel.STATUS_ALL);
assertNotNull(activeList);
assertEquals(1, activeList.size());
assertNotNull(notActiveList);
assertEquals(0, notActiveList.size());
assertNotNull(fullList);
assertEquals(1, fullList.size());
//GET ONE
Channel channel = activeList.get(0);
assertEquals(channel.getCategory(), testChannel.getCategory());
assertEquals(channel.getContentType(), testChannel.getContentType());
assertEquals(channel.getDescription(), testChannel.getDescription());
assertEquals(channel.getFeedType(), testChannel.getFeedType());
assertEquals(channel.getId(), testChannel.getId());
assertEquals(channel.getTitle(), testChannel.getTitle());
assertEquals(channel.isActive(), testChannel.isActive());
channel.setCategory("evento");
channel.setDescription("updated_test channel");
channel.setTitle("updated_test title");
channel.setFeedType("rss_1.0");
channel.setActive(false);
this.getRssManager().updateChannel(channel);
Channel updated = this.getRssManager().getChannel(channel.getId());
assertEquals(updated.getCategory(), channel.getCategory());
assertEquals(updated.getContentType(), channel.getContentType());
assertEquals(updated.getDescription(), channel.getDescription());
assertEquals(updated.getFeedType(), channel.getFeedType());
assertEquals(updated.getId(), channel.getId());
assertEquals(updated.getTitle(), channel.getTitle());
assertEquals(updated.isActive(), channel.isActive());
notActiveList = this.getRssManager().getChannels(Channel.STATUS_NOT_ACTIVE);
activeList = this.getRssManager().getChannels(Channel.STATUS_ACTIVE);
assertTrue(notActiveList.size() == 1);
assertTrue(activeList.isEmpty());
this.getRssManager().deleteChannel(updated.getId());
activeList = this.getRssManager().getChannels(Channel.STATUS_ACTIVE);
notActiveList = this.getRssManager().getChannels(Channel.STATUS_NOT_ACTIVE);
fullList = this.getRssManager().getChannels(Channel.STATUS_ALL);