Changeset 3362 in josm for trunk/test


Ignore:
Timestamp:
2010-07-03T22:08:57+02:00 (10 years ago)
Author:
stoecker
Message:

fix #5182 - Conflict system simplification - patch by Upliner

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java

    r3283 r3362  
    234234
    235235    /**
    236      * My node is visible, their version has a higher version and is not visible
    237      * => create a conflict
    238      *
    239      */
    240     @Test
    241     public void nodeSimple_VisibleConflict() {
    242         Node n = new Node(new LatLon(0,0));
    243         n.setOsmId(1,1);
    244         n.setModified(false);
    245         n.setVisible(true);
    246         my.addPrimitive(n);
    247 
    248         Node n1 = new Node(new LatLon(0,0));
    249         n1.setOsmId(1,2);
    250 
    251         n1.setModified(false);
    252         n1.setVisible(false);
    253         their.addPrimitive(n1);
    254 
    255 
    256         DataSetMerger visitor = new DataSetMerger(my,their);
    257         visitor.merge();
    258 
    259         Node n2 = (Node)my.getPrimitiveById(1,OsmPrimitiveType.NODE);
    260         assertEquals(1,visitor.getConflicts().size());
    261         assertEquals(true, n2.isVisible());
    262         assertTrue(n == n2);
    263         assertTrue(n1 != n2);
    264         assertTrue(n1.getDataSet() == their);
    265     }
    266 
    267     /**
    268236     * My node is deleted, their node has the same id and version and is not deleted.
    269237     * => mine has precedence
     
    340308        assertTrue(n2 == n);
    341309        assertTrue(n2.isDeleted());
    342     }
    343 
    344     /**
    345      * their node is not visible and doesn't exist in my data set
    346      * => we can't ignore it because we'd run into troubles in case of multi fetch
    347      * which can return invisible objects
    348      *
    349      */
    350     @Test
    351     public void nodeSimple_InvisibleNodeInTheirDataset() {
    352         Node n = new Node(new LatLon(0,0));
    353         n.setOsmId(1,1);
    354         n.setDeleted(true);
    355         my.addPrimitive(n);
    356 
    357         Node n1 = new Node(new LatLon(0,0));
    358         n1.setOsmId(2,1);
    359         n1.setVisible(false);
    360         their.addPrimitive(n1);
    361 
    362 
    363         DataSetMerger visitor = new DataSetMerger(my,their);
    364         visitor.merge();
    365 
    366         Node n2 = (Node)my.getPrimitiveById(1,OsmPrimitiveType.NODE);
    367         assertEquals(0,visitor.getConflicts().size());
    368         assertEquals(2, my.getNodes().size());
    369         assertEquals(n,n2);
    370310    }
    371311
     
    688628        theirWay.setOsmId(3,2);
    689629        theirWay.setVisible(false);
     630        /* Invisible objects fetched from the server should be marked as "deleted".
     631         * Otherwise it's an error.
     632         */
     633        theirWay.setDeleted(true);
    690634        their.addPrimitive(theirWay);
    691635
Note: See TracChangeset for help on using the changeset viewer.