Examples of SyncService


Examples of org.rssowl.ui.internal.services.SyncService

    DynamicDAO.save(root);

    Controller.getDefault().reload(bildBm, null, null);

    SyncService service = new SyncService();
    assertTrue(service.getStatus() == null);

    INews bildNews = bildFeed.getNews().get(0);
    SyncItem item = SyncItem.toSyncItem(bildNews);
    item.setStarred();
    item.addLabel("Foo");
    item.addLabel("Bar");
    item.addLabel("Hello World");
    item.addLabel("World Hello");

    service.testSync(Collections.singleton(item));

    assertNotNull(service.getStatus());
    SyncStatus status = service.getStatus();
    assertEquals(1, status.getItemCount());
    assertEquals(1, status.getTotalItemCount());

    Controller.getDefault().reload(bildBm, null, null);

    final AtomicBoolean listenerCalled = new AtomicBoolean();
    NewsListener listener = new NewsAdapter() {
      @Override
      public void entitiesUpdated(Set<NewsEvent> events) {
        listenerCalled.set(true);
      }
    };
    DynamicDAO.addEntityListener(INews.class, listener);

    try {
      Controller.getDefault().reload(bildBm, null, null);
      assertFalse(listenerCalled.get());
    } finally {
      DynamicDAO.removeEntityListener(INews.class, listener);
    }

    /* Clean Up */
    item = SyncItem.toSyncItem(bildNews);
    item.setUnStarred();
    item.removeLabel("Foo");
    item.removeLabel("Bar");
    item.removeLabel("Hello World");
    item.removeLabel("World Hello");

    service.testSync(Collections.singleton(item));

    assertNotNull(service.getStatus());
    status = service.getStatus();
    assertEquals(1, status.getItemCount());
    assertEquals(2, status.getTotalItemCount());
  }
View Full Code Here

Examples of org.rssowl.ui.internal.services.SyncService

    DynamicDAO.save(root);

    Controller.getDefault().reload(testBm, null, null);

    SyncService service = new SyncService();
    assertTrue(service.getStatus() == null);

    INews testNews = testFeed.getNews().get(0);

    assertEquals(1, testNews.getLabels().size());
    assertEquals("TestFeed", testNews.getLabels().iterator().next().getName());

    SyncItem item = SyncItem.toSyncItem(testNews);
    item.addLabel("Foo");
    item.addLabel("Bar");
    item.addLabel("Hello World");
    item.addLabel("World Hello");

    service.testSync(Collections.singleton(item));

    assertNotNull(service.getStatus());
    SyncStatus status = service.getStatus();
    assertEquals(1, status.getItemCount());
    assertEquals(1, status.getTotalItemCount());

    Controller.getDefault().reload(testBm, null, null);

    assertEquals(5, testNews.getLabels().size());

    testNews.removeLabel(testNews.getLabels().iterator().next());
    DynamicDAO.save(testFeed);

    assertEquals(4, testNews.getLabels().size());

    Controller.getDefault().reload(testBm, null, null);

    assertEquals(5, testNews.getLabels().size());

    item = SyncItem.toSyncItem(testNews);
    item.removeLabel("Foo");
    item.removeLabel("Bar");
    item.addLabel("Bababu");

    service.testSync(Collections.singleton(item));

    Controller.getDefault().reload(testBm, null, null);
    assertEquals(4, testNews.getLabels().size());

    item = SyncItem.toSyncItem(testNews);
    item.removeLabel("Hello World");
    item.removeLabel("World Hello");
    item.removeLabel("Bababu");

    service.testSync(Collections.singleton(item));

    Controller.getDefault().reload(testBm, null, null);
    assertEquals(1, testNews.getLabels().size());
  }
View Full Code Here

Examples of org.rssowl.ui.internal.services.SyncService

    DynamicDAO.save(root);

    Controller.getDefault().reload(slashdotBm, null, null);

    SyncService service = new SyncService();
    assertTrue(service.getStatus() == null);

    int itemCount = slashdotFeed.getNews().size();
    assertTrue(itemCount > 790); //Sometimes seems to hit 799

    List<SyncItem> items = new ArrayList<SyncItem>();
    for (INews news : slashdotFeed.getNews()) {
      SyncItem item = SyncItem.toSyncItem(news);
      item.setStarred();
      item.setMarkedRead();
      items.add(item);

      item = SyncItem.toSyncItem(news);
      item.addLabel("Foo");
      items.add(item);

      item = SyncItem.toSyncItem(news);
      item.addLabel("Hello World");
      items.add(item);
    }

    service.testSync(items);
    assertEquals(itemCount, service.getStatus().getItemCount());
    assertEquals(itemCount, service.getStatus().getTotalItemCount());

    items = new ArrayList<SyncItem>();
    for (INews news : slashdotFeed.getNews()) {
      SyncItem item = SyncItem.toSyncItem(news);
      item.setUnStarred();
      items.add(item);

      item = SyncItem.toSyncItem(news);
      item.removeLabel("Foo");
      items.add(item);

      item = SyncItem.toSyncItem(news);
      item.removeLabel("Hello World");
      items.add(item);
    }

    service.testSync(items);
    assertEquals(itemCount, service.getStatus().getItemCount());
    assertEquals(itemCount * 2, service.getStatus().getTotalItemCount());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.