Package org.apache.abdera.ext.sharing

Examples of org.apache.abdera.ext.sharing.Conflicts


    // there will be two entries in f3, one of which shows a conflict
    for (Entry entry : f3.getEntries()) {
      System.out.println(entry.getId());
      if (SharingHelper.hasConflicts(entry)) {
        Sync sync = SharingHelper.getSync(entry);
        Conflicts conflicts = sync.getConflicts();
        System.out.println("\tNumber of conflicts: " + conflicts.getEntries().size());
      }
    }
   
  }
View Full Code Here


    @Test
    public void testSharingFactory() throws Exception {
        Abdera abdera = new Abdera();
        Factory factory = abdera.getFactory();
        Conflicts conflicts = factory.newElement(SharingHelper.SSE_CONFLICTS);
        assertNotNull(conflicts);
        History history = factory.newElement(SharingHelper.SSE_HISTORY);
        assertNotNull(history);
        Related related = factory.newElement(SharingHelper.SSE_RELATED);
        assertNotNull(related);
View Full Code Here

        SharingHelper.mergeFeeds(f1, f2);

        assertEquals(1, f2.getEntries().size());
        Entry entry = f2.getEntries().get(0);
        Sync sync = SharingHelper.getSync(entry);
        Conflicts conflicts = sync.getConflicts();
        assertNotNull(conflicts);
        assertEquals(1, conflicts.getEntries().size());
        Entry conflict = conflicts.getEntries().get(0);
        assertNotNull(conflict);

        ConflictResolver r = new ConflictResolver() {
            public Entry resolve(Entry entry, List<Entry> conflicts) {
                Sync sync = SharingHelper.getSync(entry, false);
                Conflicts c = sync.getConflicts(false);
                if (c != null)
                    c.discard();
                return entry; // take the latest
            }
        };

        entry = SharingHelper.resolveConflicts(entry, r, "jms");
View Full Code Here

        // there will be two entries in f3, one of which shows a conflict
        for (Entry entry : f3.getEntries()) {
            System.out.println(entry.getId());
            if (SharingHelper.hasConflicts(entry)) {
                Sync sync = SharingHelper.getSync(entry);
                Conflicts conflicts = sync.getConflicts();
                System.out.println("\tNumber of conflicts: " + conflicts.getEntries().size());
            }
        }

    }
View Full Code Here

 
  @Test
  public void testSharingFactory() throws Exception {
    Abdera abdera = new Abdera();
    Factory factory = abdera.getFactory();
    Conflicts conflicts = factory.newElement(SharingHelper.SSE_CONFLICTS);
    assertNotNull(conflicts);
    History history = factory.newElement(SharingHelper.SSE_HISTORY);
    assertNotNull(history);
    Related related = factory.newElement(SharingHelper.SSE_RELATED);
    assertNotNull(related);
View Full Code Here

    SharingHelper.mergeFeeds(f1, f2);
   
    assertEquals(f2.getEntries().size(),1);
    Entry entry = f2.getEntries().get(0);
    Sync sync = SharingHelper.getSync(entry);
    Conflicts conflicts = sync.getConflicts();
    assertNotNull(conflicts);
    assertEquals(conflicts.getEntries().size(),1);
    Entry conflict = conflicts.getEntries().get(0);
    assertNotNull(conflict);
   
    ConflictResolver r = new ConflictResolver() {
      public Entry resolve(Entry entry, List<Entry> conflicts) {
        Sync sync = SharingHelper.getSync(entry,false);
        Conflicts c = sync.getConflicts(false);
        if (c != null) c.discard();
        return entry; // take the latest
      }
    };
   
    entry = SharingHelper.resolveConflicts(entry, r, "jms");
View Full Code Here

    extends TestCase {
 
  public static void testSharingFactory() throws Exception {
    Abdera abdera = new Abdera();
    Factory factory = abdera.getFactory();
    Conflicts conflicts = factory.newElement(SharingHelper.SSE_CONFLICTS);
    assertNotNull(conflicts);
    History history = factory.newElement(SharingHelper.SSE_HISTORY);
    assertNotNull(history);
    Related related = factory.newElement(SharingHelper.SSE_RELATED);
    assertNotNull(related);
View Full Code Here

    SharingHelper.mergeFeeds(f1, f2);
   
    assertEquals(f2.getEntries().size(),1);
    Entry entry = f2.getEntries().get(0);
    Sync sync = SharingHelper.getSync(entry);
    Conflicts conflicts = sync.getConflicts();
    assertNotNull(conflicts);
    assertEquals(conflicts.getEntries().size(),1);
    Entry conflict = conflicts.getEntries().get(0);
    assertNotNull(conflict);
   
    ConflictResolver r = new ConflictResolver() {
      public Entry resolve(Entry entry, List<Entry> conflicts) {
        Sync sync = SharingHelper.getSync(entry,false);
        Conflicts c = sync.getConflicts(false);
        if (c != null) c.discard();
        return entry; // take the latest
      }
    };
    entry = SharingHelper.resolveConflicts(entry, r, "jms");
    sync = SharingHelper.getSync(entry);
View Full Code Here

TOP

Related Classes of org.apache.abdera.ext.sharing.Conflicts

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.