Changeset 1751 in josm
- Timestamp:
- 2009-07-08T22:06:58+02:00 (15 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/build.xml
r1683 r1751 1 1 <project name="josm" default="dist" basedir="."> 2 <property name="test.dir" value="test" /> 3 <property name="src.dir" value="src" /> 4 <property name="build.dir" value="build"/> 2 5 3 6 <!-- Java classpath addition (all jar files to compile tests with this) --> … … 9 12 10 13 <target name="dist" depends="compile"> 11 14 12 15 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false"> 13 16 <env key="LANG" value="C"/> … … 39 42 <zipfileset dir="images" prefix="images" /> 40 43 <zipfileset src="lib/josm-translation.jar" /> 41 42 <!-- All jar files necessary to run only JOSM (no tests) --> 44 45 <!-- All jar files necessary to run only JOSM (no tests) --> 43 46 <zipfileset src="lib/gettext-commons-0.9.6.jar" /> 44 47 <zipfileset src="lib/metadata-extractor-2.3.1-nosun.jar" /> … … 77 80 </target> 78 81 82 <path id="test.classpath"> 83 <fileset dir="${test.dir}/lib"> 84 <include name="**/*.jar"/> 85 </fileset> 86 <fileset dir="lib"> 87 <include name="**/*.jar"/> 88 </fileset> 89 </path> 90 91 <target name="test-init"> 92 <mkdir dir="${test.dir}/${build.dir}" /> 93 <mkdir dir="${test.dir}/report" /> 94 </target> 95 96 <target name="test-clean"> 97 <delete dir="${test.dir}/${build.dir}"/> 98 <delete dir="${test.dir}/report"/> 99 </target> 100 101 <target name="test-compile" depends="test-init"> 102 <javac srcdir="${src.dir}:${test.dir}/unit" classpathref="test.classpath" destdir="${test.dir}/${build.dir}" 103 target="1.5" source="1.5" debug="on" encoding="UTF-8"> 104 <compilerarg value="-Xlint:deprecation"/> 105 </javac> 106 </target> 107 108 <target name="test" depends="test-compile"> 109 <junit printsummary="yes"> 110 <sysproperty key="josm.home" value="${test.dir}/config/unit-josm.home"/> 111 <classpath> 112 <path refid="test.classpath"/> 113 <pathelement path="${test.dir}/${build.dir}"/> 114 <pathelement path="${test.dir}/config"/> 115 </classpath> 116 <formatter type="plain"/> 117 <batchtest fork="no" todir="${test.dir}/report"> 118 <fileset dir="${test.dir}/unit" includes="**/*.java"/> 119 </batchtest> 120 </junit> 121 </target> 79 122 80 123 </project> -
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeVisitorTest.java
r1750 r1751 33 33 @BeforeClass 34 34 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); 44 60 } 45 46 // check josm.home47 //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);58 61 Main.pleaseWaitDlg = new PleaseWaitDialog(null); 59 62 Main.pref.init(false); … … 65 68 /** 66 69 * two identical nodes, even in id and version. No confict expected. 67 * 70 * 68 71 * Can happen if data is loaded in two layers and then merged from one layer 69 72 * on the other. … … 104 107 * two nodes, my is unmodified, their is updated and has a higher version 105 108 * => their version is going to be the merged version 106 * 109 * 107 110 */ 108 111 @Test … … 143 146 * node with same id, my is modified, their has a higher version 144 147 * => results in a conflict 145 * 148 * 146 149 * Use case: node which is modified locally and updated by another mapper on 147 150 * the server … … 181 184 * node with same id, my is deleted, their has a higher version 182 185 * => results in a conflict 183 * 186 * 184 187 * Use case: node which is deleted locally and updated by another mapper on 185 188 * the server … … 217 220 * My node is visible, their version has a higher version and is not visible 218 221 * => create a conflict 219 * 222 * 220 223 */ 221 224 @Test … … 251 254 * My node is deleted, their node has the same id and version and is not deleted. 252 255 * => mine has precedence 253 * 256 * 254 257 */ 255 258 @Test … … 281 284 /** 282 285 * My and their node are new but semantically equal. My node is deleted. 283 * 286 * 284 287 * => create a conflict 285 * 288 * 286 289 */ 287 290 @Test … … 309 312 /** 310 313 * My and their node are new but semantically equal. Both are deleted. 311 * 314 * 312 315 * => take mine 313 * 316 * 314 317 */ 315 318 @Test … … 339 342 * their node is not visible and doesn't exist in my data set 340 343 * => ignore their node 341 * 344 * 342 345 */ 343 346 @Test … … 372 375 * their node has no assigned id (id == 0) and is semantically equal to one of my 373 376 * nodes with id == 0 374 * 377 * 375 378 * => merge it onto my node. 376 * 379 * 377 380 */ 378 381 @Test … … 422 425 /** 423 426 * my node is incomplete, their node is complete 424 * 427 * 425 428 * => merge it onto my node. My node becomes complete 426 * 429 * 427 430 */ 428 431 @Test … … 461 464 * their way has a higher version and different tags. the nodes are the same. My 462 465 * way is not modified. Merge is possible. No conflict. 463 * 466 * 464 467 * => merge it onto my way. 465 * 468 * 466 469 */ 467 470 @Test … … 531 534 * their way has a higher version and different tags. And it has more nodes. Two 532 535 * of the existing nodes are modified. 533 * 536 * 534 537 * => merge it onto my way, no conflict 535 * 538 * 536 539 */ 537 540 @Test … … 605 608 /** 606 609 * their way has a higher version and different nodes. My way is modified. 607 * 610 * 608 611 * => merge it onto my way not possbile, conflict 609 * 612 * 610 613 */ 611 614 @Test … … 681 684 /** 682 685 * their way is not visible anymore. 683 * 686 * 684 687 * => conflict 685 * 688 * 686 689 */ 687 690 @Test … … 731 734 * my and their way are semantically equal. so technical attributes of 732 735 * their way can be merged on my way. No conflict. 733 * 734 * 735 * 736 * 737 * 738 * 736 739 */ 737 740 @Test … … 795 798 * my and their way are semantically equal. so technical attributes of 796 799 * their way can be merged on my way. No conflict. 797 * 800 * 798 801 */ 799 802 @Test
Note:
See TracChangeset
for help on using the changeset viewer.