Package org.rssowl.core.internal.persist

Examples of org.rssowl.core.internal.persist.Label


  /**
   * @throws Exception
   */
  @Test
  public void testIsLabelChangeMulti() throws Exception {
    ILabel label1 = new Label(null, "Label1");
    ILabel label2 = new Label(null, "Label2");
    ILabel label3 = new Label(null, "Label3");

    IFeed feed = new Feed(new URI("http://www.link.com"));
    INews news1 = new News(null, feed, new Date());
    news1.addLabel(label1);
    news1.addLabel(label3);
View Full Code Here


   * Checks: - Addition of label - That ADD event is issued - Updating of label
   * - That UPDATE event is issued - Getting of label
   */
  @Test
  public void testAddUpdateAndGetLabel() {
    final Label initialLabel = (Label) createLabel();
    final Label[] updatedLabel = new Label[1];
    final boolean[] labelAddedCalled = new boolean[] { false };
    final boolean[] labelUpdatedCalled = new boolean[] { false };
    LabelListener labelListener = null;
    try {
      labelListener = new LabelAdapter() {
        @Override
        public void entitiesAdded(Set<LabelEvent> events) {
          for (LabelEvent event : events) {
            labelAddedCalled[0] = true;
            Label dbLabel = (Label) event.getEntity();
            initialLabel.setId(dbLabel.getId());
            assertTrue(initialLabel.isIdentical(dbLabel));
          }
        }

        @Override
        public void entitiesUpdated(Set<LabelEvent> events) {
          LabelEvent event = events.iterator().next();
          labelUpdatedCalled[0] = true;
          Label dbLabel = (Label) event.getEntity();
          assertTrue(updatedLabel[0].isIdentical(dbLabel));
        }
      };
      DynamicDAO.addEntityListener(ILabel.class, labelListener);
      long savedLabelId = DynamicDAO.save(initialLabel).getId().longValue();
      System.gc();
      ILabel dbLabel = DynamicDAO.load(ILabel.class, savedLabelId);
      initialLabel.setId(dbLabel.getId());
      assertTrue(initialLabel.isIdentical(dbLabel));
      dbLabel.setColor("255,255,137");
      updatedLabel[0] = (Label) dbLabel;
      DynamicDAO.save(dbLabel);
      assertTrue(labelAddedCalled[0]);
      assertTrue(labelUpdatedCalled[0]);
      DynamicDAO.delete(updatedLabel[0]);
View Full Code Here

TOP

Related Classes of org.rssowl.core.internal.persist.Label

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.