Package org.rssowl.core.model.internal.types

Examples of org.rssowl.core.model.internal.types.Feed


  @Test
  @SuppressWarnings("nls")
  public void testHTTPFeed() throws Exception {
    ConnectionManager conManager = ConnectionManager.getDefault();
    URL feedUrl = new URL("http://www.rssowl.org/rssowl2dg/tests/connection/rss_2_0.xml");
    IFeed feed = new Feed(feedUrl);

    InputStream inS = conManager.load(feed.getLink());
    assertNotNull(inS);

    Interpreter.getDefault().interpret(inS, feed);
    assertEquals("RSS 2.0", feed.getFormat());
  }
View Full Code Here


  @Test
  @SuppressWarnings("nls")
  public void testHTTPSFeed() throws Exception {
    ConnectionManager conManager = ConnectionManager.getDefault();
    URL feedUrl = new URL("https://sourceforge.net/export/rss2_projnews.php?group_id=141424&rss_fulltext=1");
    IFeed feed = new Feed(feedUrl);

    InputStream inS = conManager.load(feed.getLink());
    assertNotNull(inS);

    Interpreter.getDefault().interpret(inS, feed);
    assertEquals("RSS 2.0", feed.getFormat());
  }
View Full Code Here

  @SuppressWarnings("nls")
  public void testFILEFeed() throws Exception {
    URL pluginLocation = FileLocator.toFileURL(Platform.getBundle("org.rssowl.core.tests").getEntry("/"));
    ConnectionManager conManager = ConnectionManager.getDefault();
    URL feedUrl = pluginLocation.toURI().resolve("data/interpreter/feed_rss.xml").toURL();
    IFeed feed = new Feed(feedUrl);

    InputStream inS = conManager.load(feed.getLink());
    assertNotNull(inS);

    Interpreter.getDefault().interpret(inS, feed);
    assertEquals("RSS 2.0", feed.getFormat());
  }
View Full Code Here

  @Test
  @SuppressWarnings("nls")
  public void testCustomProtocol() throws Exception {
    ConnectionManager conManager = ConnectionManager.getDefault();
    URL feedUrl = new URL("myprotocol://data/interpreter/feed_rss.xml");
    IFeed feed = new Feed(feedUrl);

    InputStream inS = conManager.load(feed.getLink());
    assertNotNull(inS);

    Interpreter.getDefault().interpret(inS, feed);
    assertEquals("RSS 2.0", feed.getFormat());
  }
View Full Code Here

  @Test
  @SuppressWarnings("nls")
  public void testConditionalGet() throws Exception {
    ConnectionManager conManager = ConnectionManager.getDefault();
    URL feedUrl = new URL("http://rss.slashdot.org/Slashdot/slashdot/to");
    IFeed feed = new Feed(feedUrl);
    NotModifiedException e = null;

    InputStream inS = conManager.load(feed.getLink());
    assertNotNull(inS);

    String ifModifiedSince = null;
    String ifNoneMatch = null;
    if (inS instanceof IConditionalGetCompatible) {
      ifModifiedSince = ((IConditionalGetCompatible) inS).getIfModifiedSince();
      ifNoneMatch = ((IConditionalGetCompatible) inS).getIfNoneMatch();
    }
    IConditionalGet conditionalGet = NewsModel.getDefault().getTypesFactory().createConditionalGet(ifModifiedSince, feedUrl, ifNoneMatch);

    Map<Object, Object> conProperties = new HashMap<Object, Object>();
    ifModifiedSince = conditionalGet.getIfModifiedSince();
    if (ifModifiedSince != null)
      conProperties.put(IConnectionPropertyConstants.IF_MODIFIED_SINCE, ifModifiedSince);

    ifNoneMatch = conditionalGet.getIfNoneMatch();
    if (ifNoneMatch != null)
      conProperties.put(IConnectionPropertyConstants.IF_NONE_MATCH, ifNoneMatch);

    try {
      conManager.load(feed.getLink(), conProperties);
    } catch (NotModifiedException e1) {
      e = e1;
    }

    assertNotNull(e);
View Full Code Here

  @Test
  @SuppressWarnings("nls")
  public void testCredentialProviderContribution() throws Exception {
    ConnectionManager conManager = ConnectionManager.getDefault();
    URL feedUrl = new URL("http://www.rssowl.org/rssowl2dg/tests/connection/authrequired/feed_rdf.xml");
    IFeed feed = new Feed(feedUrl);
    AuthenticationRequiredException e = null;

    try {
      conManager.load(feed.getLink());
    } catch (AuthenticationRequiredException e1) {
      e = e1;
    }

    assertNull(e);
View Full Code Here

  @Test
  @SuppressWarnings("nls")
  public void testProxyCredentialProvider() throws Exception {
    ConnectionManager conManager = ConnectionManager.getDefault();
    URL feedUrl = new URL("http://www.rssowl.org/rssowl2dg/tests/connection/authrequired/feed_rdf.xml");
    IFeed feed = new Feed(feedUrl);

    IProxyCredentials proxyCredentials = conManager.getProxyCredentials(feed.getLink());

    assertEquals("", proxyCredentials.getDomain());
    assertEquals("bpasero", proxyCredentials.getUsername());
    assertEquals("admin", proxyCredentials.getPassword());
    assertEquals("127.0.0.1", proxyCredentials.getHost());
View Full Code Here

   */
  @Test
  @SuppressWarnings("nls")
  public void testAtom() throws Exception {
    InputStream inS = getClass().getResourceAsStream("/data/interpreter/feed_atom.xml");
    IFeed feed = new Feed(new URL("http://www.data.interpreter.feed_atom.xml"));
    Interpreter.getDefault().interpret(inS, feed);

    assertEquals("Atom 1.0", feed.getFormat());
    assertEquals("atom_title", feed.getTitle());
    assertEquals("atom_subtitle", feed.getDescription());
    assertEquals(new URI("atom_link_html"), feed.getHomepage());
    assertEquals("atom_generator", feed.getGenerator());
    assertEquals("en-us", feed.getLanguage());
    assertEquals(new URI("http://www.feed-uri.de"), feed.getBase());

    assertNotNull(feed.getImage());
    assertEquals(new URI("atom_logo"), feed.getImage().getUrl());

    assertNotNull(feed.getLastModifiedDate());

    assertEquals(1, feed.getCategories().size());
    assertEquals("atom_category.label", feed.getCategories().get(0).getName());
    assertEquals("atom_category.term", feed.getCategories().get(0).getDomain());
    assertEquals("atom_copyright", feed.getCopyright());

    assertNotNull(feed.getAuthor());
    assertEquals("atom_author.name", feed.getAuthor().getName());
    assertEquals(new URI("atom_author.uri"), feed.getAuthor().getUri());
    assertEquals(new URI("atom_author.email"), feed.getAuthor().getEmail());

    assertEquals(5, feed.getNews().size());

    INews news1 = feed.getNews().get(0);
    assertEquals("atom_entry1.title", news1.getTitle());
    assertEquals("atom_entry1.description", news1.getDescription());
    assertEquals(new URI("http://www.entry-uri.de"), news1.getBase());

    assertNotNull(news1.getCategories());
    assertEquals("atom_entry1.category.label", news1.getCategories().get(0).getName());
    assertEquals("atom_entry1.category.term", news1.getCategories().get(0).getDomain());

    assertNotNull(news1.getGuid());
    assertEquals("atom_entry1.id", news1.getGuid().getValue());

    assertEquals(new URI("atom_entry1.link.href"), news1.getLink());

    assertEquals(2, news1.getAttachments().size());
    assertEquals(new URI("atom_entry1.enclosure1.href"), news1.getAttachments().get(0).getUrl());
    assertEquals("mp3", news1.getAttachments().get(0).getType());
    assertEquals(4500000, news1.getAttachments().get(0).getLength());
    assertEquals(new URI("atom_entry1.enclosure2.href"), news1.getAttachments().get(1).getUrl());
    assertEquals("wav", news1.getAttachments().get(1).getType());
    assertEquals(2500000, news1.getAttachments().get(1).getLength());

    assertNotNull(news1.getPublishDate());
    assertNotNull(news1.getModifiedDate());

    assertNotNull(news1.getSource());
    assertEquals("atom_entry1.source.title", news1.getSource().getName());
    assertEquals(new URI("atom_entry1.source.id"), news1.getSource().getUrl());

    assertNotNull(news1.getAuthor());
    assertEquals("atom_entry1.author.name", news1.getAuthor().getName());
    assertEquals(new URI("atom_entry1.author.uri"), news1.getAuthor().getUri());
    assertEquals(new URI("atom_entry1.author.email"), news1.getAuthor().getEmail());

    INews news2 = feed.getNews().get(1);
    assertEquals("<p>atom_entry2.title</p>", news2.getTitle());
    assertEquals("<p>atom_entry2.description</p>", news2.getDescription());
    assertEquals(new URI("http://www.feed-uri.de"), news2.getBase());

    INews news3 = feed.getNews().get(2);
    assertEquals("<p xmlns=\"http://www.w3.org/1999/xhtml\">atom_entry3.title</p>", news3.getTitle());
    assertEquals("<p xmlns=\"http://www.w3.org/1999/xhtml\">atom_entry3.description</p>", news3.getDescription());
    assertEquals(new URI("http://www.feed-uri.de"), news3.getBase());

    INews news4 = feed.getNews().get(3);
    assertEquals(new URI("atom_entry4.link.href"), news4.getLink());

    INews news5 = feed.getNews().get(4);
    assertEquals("<p xmlns=\"http://www.w3.org/1999/xhtml\">atom_entry5.title</p>", news5.getTitle());
    assertEquals("<p xmlns=\"http://www.w3.org/1999/xhtml\">atom_entry5.description</p>", news5.getDescription());
  }
View Full Code Here

      final int c = i;
      tasks.add(new TaskAdapter() {
        public IStatus run(IProgressMonitor monitor) {
          try {
            URL feedUrl = fPluginLocation.toURI().resolve("data/performance/" + c + ".xml").toURL();
            IFeed feed = new Feed(feedUrl);

            InputStream inS = fConManager.load(feed.getLink());
            Interpreter.getDefault().interpret(inS, feed);
          } catch (Exception e) {
            ex.add(e);
          }
          return Status.OK_STATUS;
View Full Code Here

  private List<IFeed> interpretFeedsHelper() {
    List<IFeed> feeds = new ArrayList<IFeed>();
    for (int i = 1; i < FEEDS + 1; i++) {
      try {
        URL feedUrl = fPluginLocation.toURI().resolve("data/performance/" + i + ".xml").toURL();
        IFeed feed = new Feed(feedUrl);

        InputStream inS = fConManager.load(feed.getLink());
        Interpreter.getDefault().interpret(inS, feed);

        feeds.add(feed);
      } catch (Exception e) {
        Activator.getDefault().logError(e.getMessage(), e);
View Full Code Here

TOP

Related Classes of org.rssowl.core.model.internal.types.Feed

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.