コード例 #1
0
 public final void testAddArticle() throws CoreException {
   AggregatorCollection collection = getCollection();
   // Create the feed
   Subscription feed = TestUtils.createNewFeed("Feed title"); // $NON-NLS-1$
   // This should also add a new folder automatically as we did not specify
   // the location for the feed.
   Folder folder = collection.addNew(feed);
   // Create the article
   Article article_a =
       new Article((AggregatorItemParent) folder, UUID.randomUUID(), feed.getUUID());
   article_a.setGuid("myGUID"); // $NON-NLS-1$
   // Add it to the collection
   collection.addNew(new Article[] {article_a});
   // See that it's there (at position 0 in the folder)
   AggregatorItem item = folder.getChildAt(EnumSet.allOf(ItemType.class), 0);
   if (item == null) {
     fail("Article item could not be retrieved"); // $NON-NLS-1$
   }
   // And that the item is a folder
   if (!(item instanceof Article)) {
     fail("Returned item is not article"); // $NON-NLS-1$
   }
   Article folder_b = (Article) item;
   // Compare the basics
   compareAggregatorItems(article_a, folder_b);
 }
コード例 #2
0
 /**
  * Note that this test takes significantly longer time when we have change listeners as these most
  * likely will update the UI.
  *
  * @throws CoreException
  */
 public final void testAdd1000Articles() throws CoreException {
   AggregatorCollection collection = getCollection();
   Subscription feed = TestUtils.createNewFeed("1000 articles"); // $NON-NLS-1$
   Folder folder = collection.addNew(feed);
   for (int a = 0; a < 1000; a++) {
     Article article = new Article(folder, UUID.randomUUID(), feed.getUUID());
     article.setTitle("Article #" + a); // $NON-NLS-1$
     article.setGuid(article.getUUID().toString());
     article.internalSetText(""); // $NON-NLS-1$
     article.setLink(""); // $NON-NLS-1$
     collection.addNew(new Article[] {article});
   }
 }