Package com.agiletec.plugins.jprss.aps.system.services.rss

Examples of com.agiletec.plugins.jprss.aps.system.services.rss.Channel


  protected void tearDown() throws Exception {
    try {
      List<Channel> fullList = this.getRssManager().getChannels(Channel.STATUS_ALL);
      Iterator<Channel> it = fullList.iterator();
      while (it.hasNext()) {
        Channel current = it.next();
        int id = current.getId();
        this.getRssManager().deleteChannel(id);
      }
      fullList = this.getRssManager().getChannels(Channel.STATUS_ALL);
      assertTrue(fullList.isEmpty());
      IContentManager contentManager = (IContentManager) this.getService(JacmsSystemConstants.CONTENT_MANAGER);
View Full Code Here


    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);
View Full Code Here

  }
 
  @Override
  public String save() {
    try {
      Channel channel = this.buildChannel();
      if (this.getStrutsAction() == ApsAdminSystemConstants.ADD) {
        this.getRssManager().addChannel(channel);
      } else if (this.getStrutsAction() == ApsAdminSystemConstants.EDIT) {
        this.getRssManager().updateChannel(channel);
      }
View Full Code Here

      if (0 == this.getId()) {
        this.addActionError(this.getText("jprss.message.rss.invalidId"));
        return INPUT;
      }
      this.setStrutsAction(ApsAdminSystemConstants.EDIT);
      Channel channel = this.getRssManager().getChannel(this.getId());
      this.setActive(channel.isActive());
      this.setCategory(channel.getCategory());
      this.setContentType(channel.getContentType());
      this.setDescription(channel.getDescription());
      this.setFeedType(channel.getFeedType());
      this.setFilters(channel.getFilters());
      this.setTitle(channel.getTitle());
      this.setMaxContentsSize(channel.getMaxContentsSize());
      this.setFiltersProperties(this.buildFilterProperties());
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "edit");
      return FAILURE;
    }
View Full Code Here

      if (!isnumeric) {
        log.info("JpRssPortalAction - Wrong channel id.");
        return null;
      }
      int channelId = new Integer(this.getId()).intValue();
      Channel channel = this.getRssManager().getChannel(channelId);
      if (null == channel || !channel.isActive()) {
        log.info("JpRssPortalAction - Channel " + channelId + " not found");
        return null;
      }
      String feedLink = this.getFeedLink();
      SyndFeed syndFeed = this.getRssManager().getSyndFeed(channel, this.getLang(), feedLink, this.getRequest(), this.getServletResponse());
      this.setSyndFeed(syndFeed);
      this.setFeedType(channel.getFeedType());
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "show");
      return FAILURE;
    }
    return SUCCESS;
View Full Code Here

      if (0 == this.getId()) {
        this.addActionError(this.getText("jprss.message.rss.invalidId"));
        return INPUT;
      }
      this.setStrutsAction(ApsAdminSystemConstants.DELETE);
      Channel channel = this.getRssManager().getChannel(this.getId());
      this.setActive(channel.isActive());
      this.setCategory(channel.getCategory());
      this.setContentType(channel.getContentType());
      this.setDescription(channel.getDescription());
      this.setFeedType(channel.getFeedType());
      this.setFilters(channel.getFilters());
      this.setTitle(channel.getTitle());
      this.setMaxContentsSize(channel.getMaxContentsSize());
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "trash");
      return FAILURE;
    }
    return SUCCESS;
View Full Code Here

    }
    return SUCCESS;
  }
 
  private Channel buildChannel() {
    Channel channel = new Channel();
    channel.setActive(this.isActive());
    channel.setCategory(this.getCategory());
    channel.setContentType(this.getContentType());
    channel.setDescription(this.getDescription());
    channel.setFeedType(this.getFeedType());
    channel.setTitle(this.getTitle());
    channel.setFilters(this.getFilters());
    if (this.getStrutsAction() == ApsAdminSystemConstants.EDIT) {
      channel.setId(this.getId());
    }
    if (this.getMaxContentsSize() > 0) {
      channel.setMaxContentsSize(this.getMaxContentsSize());
    }
    return channel;
  }
View Full Code Here

    assertTrue(notActiveList.isEmpty());
    assertTrue(fullList.isEmpty());
  }
 
  private Channel createTestChannel() {
    Channel channel = new Channel();
    channel.setActive(true);
    channel.setCategory("cat1");
    channel.setContentType("ART");
    channel.setDescription("test channel");
    channel.setFeedType("rss_2.0");
    channel.setTitle("test title");
    return channel;
  }
View Full Code Here

    super.setUp();
    this.init();
  }
 
  public void testShowAction() throws Throwable {
    Channel channel = this.createTestChannel("title", "descr", true);
    this.getRssManager().addChannel(channel);
    this.initAction(NAMESPACE, "show");
    this.addParameter("id", channel.getId());
    String result = this.executeAction();
    assertEquals(Action.SUCCESS, result);
  }
View Full Code Here

    result = this.executeAction();
    assertEquals(Action.SUCCESS, result);
   
    List<Channel> channels = this.getRssManager().getChannels(Channel.STATUS_ALL);
    assertTrue(channels.size() == 1);
    Channel current = channels.get(0);
    assertTrue(!current.isActive());
    assertEquals("ART", current.getContentType());
    assertEquals("test rss title", current.getTitle());
    assertEquals("test rss descr", current.getDescription());
    assertEquals(JpRssSystemConstants.FEED_TYPE_RSS_20, current.getFeedType());
    assertNull(current.getFilters());
  }
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jprss.aps.system.services.rss.Channel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.