Changeset 1751 in josm for trunk/test/unit


Ignore:
Timestamp:
2009-07-08T22:06:58+02:00 (15 years ago)
Author:
Gubaer
Message:

patch by dmuecke - improved unit tests and test targets in build.xml

Location:
trunk/test/unit
Files:
1 deleted
1 edited

Legend:

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

    r1750 r1751  
    3333    @BeforeClass
    3434    static public void init() {
    35         testProperties = new Properties();
    36 
    37         // load properties
    38         //
    39         try {
    40             testProperties.load(MergeVisitorTest.class.getResourceAsStream("/test-unit-env.properties"));
    41         } catch(Exception e){
    42             logger.log(Level.SEVERE, MessageFormat.format("failed to load property file ''{0}''", "/test-unit-env.properties"));
    43             fail(MessageFormat.format("failed to load property file ''{0}''", "/test-unit-env.properties"));
     35
     36        if(System.getProperty("josm.home") == null){
     37            testProperties = new Properties();
     38
     39            // load properties
     40            //
     41            try {
     42                testProperties.load(MergeVisitorTest.class.getResourceAsStream("/test-unit-env.properties"));
     43            } catch(Exception e){
     44                logger.log(Level.SEVERE, MessageFormat.format("failed to load property file ''{0}''", "/test-unit-env.properties"));
     45                fail(MessageFormat.format("failed to load property file ''{0}''", "/test-unit-env.properties"));
     46            }
     47
     48            // check josm.home
     49            //
     50            String josmHome = testProperties.getProperty("josm.home");
     51            if (josmHome == null) {
     52                fail(MessageFormat.format("property ''{0}'' not set in test environment", "josm.home"));
     53            } else {
     54                File f = new File(josmHome);
     55                if (! f.exists() || ! f.canRead()) {
     56                    fail(MessageFormat.format("property ''{0}'' points to ''{1}'' which is either not existing or not readable", "josm.home", josmHome));
     57                }
     58            }
     59            System.setProperty("josm.home", josmHome);
    4460        }
    45 
    46         // check josm.home
    47         //
    48         String josmHome = testProperties.getProperty("josm.home");
    49         if (josmHome == null) {
    50             fail(MessageFormat.format("property ''{0}'' not set in test environment", "josm.home"));
    51         } else {
    52             File f = new File(josmHome);
    53             if (! f.exists() || ! f.canRead()) {
    54                 fail(MessageFormat.format("property ''{0}'' points to ''{1}'' which is either not existing or not readable", "josm.home", josmHome));
    55             }
    56         }
    57         System.setProperty("josm.home", josmHome);
    5861        Main.pleaseWaitDlg = new PleaseWaitDialog(null);
    5962        Main.pref.init(false);
     
    6568    /**
    6669     * two identical nodes, even in id and version. No confict expected.
    67      * 
     70     *
    6871     * Can happen if data is loaded in two layers and then merged from one layer
    6972     * on the other.
     
    104107     * two  nodes, my is unmodified, their is updated and has a higher version
    105108     * => their version is going to be the merged version
    106      * 
     109     *
    107110     */
    108111    @Test
     
    143146     * node with same id, my is modified, their has a higher version
    144147     * => results in a conflict
    145      * 
     148     *
    146149     * Use case: node which is modified locally and updated by another mapper on
    147150     * the server
     
    181184     * node with same id, my is deleted, their has a higher version
    182185     * => results in a conflict
    183      * 
     186     *
    184187     * Use case: node which is deleted locally and updated by another mapper on
    185188     * the server
     
    217220     * My node is visible, their version has a higher version and is not visible
    218221     * => create a conflict
    219      * 
     222     *
    220223     */
    221224    @Test
     
    251254     * My node is deleted, their node has the same id and version and is not deleted.
    252255     * => mine has precedence
    253      * 
     256     *
    254257     */
    255258    @Test
     
    281284    /**
    282285     * My and their node are new but semantically equal. My node is deleted.
    283      * 
     286     *
    284287     * => create a conflict
    285      * 
     288     *
    286289     */
    287290    @Test
     
    309312    /**
    310313     * My and their node are new but semantically equal. Both are deleted.
    311      * 
     314     *
    312315     * => take mine
    313      * 
     316     *
    314317     */
    315318    @Test
     
    339342     * their node is not visible and doesn't exist in my data set
    340343     * => ignore their node
    341      * 
     344     *
    342345     */
    343346    @Test
     
    372375     * their node has no assigned id (id == 0) and is semantically equal to one of my
    373376     * nodes with id == 0
    374      * 
     377     *
    375378     * => merge it onto my node.
    376      * 
     379     *
    377380     */
    378381    @Test
     
    422425    /**
    423426     * my node is incomplete, their node is complete
    424      * 
     427     *
    425428     * => merge it onto my node. My node becomes complete
    426      * 
     429     *
    427430     */
    428431    @Test
     
    461464     * their way has a higher version and different tags. the nodes are the same. My
    462465     * way is not modified. Merge is possible. No conflict.
    463      * 
     466     *
    464467     * => merge it onto my way.
    465      * 
     468     *
    466469     */
    467470    @Test
     
    531534     * their way has a higher version and different tags. And it has more nodes. Two
    532535     * of the existing nodes are modified.
    533      * 
     536     *
    534537     * => merge it onto my way, no conflict
    535      * 
     538     *
    536539     */
    537540    @Test
     
    605608    /**
    606609     * their way has a higher version and different nodes. My way is modified.
    607      * 
     610     *
    608611     * => merge it onto my way not possbile, conflict
    609      * 
     612     *
    610613     */
    611614    @Test
     
    681684    /**
    682685     * their way is not visible anymore.
    683      * 
     686     *
    684687     * => conflict
    685      * 
     688     *
    686689     */
    687690    @Test
     
    731734     * my and  their way are semantically equal. so technical attributes of
    732735     * their way can be merged on my way. No conflict.
    733      * 
    734      * 
    735      * 
     736     *
     737     *
     738     *
    736739     */
    737740    @Test
     
    795798     * my and  their way are semantically equal. so technical attributes of
    796799     * their way can be merged on my way. No conflict.
    797      * 
     800     *
    798801     */
    799802    @Test
Note: See TracChangeset for help on using the changeset viewer.