Changeset 2381 in josm for trunk/test/unit/org
- Timestamp:
- 2009-11-02T07:51:28+01:00 (15 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/data/osm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/APIDataSetTest.java
r2168 r2381 20 20 r.incomplete = false; 21 21 DataSet ds = new DataSet(); 22 ds. relations.add(r);22 ds.addPrimitive(r); 23 23 24 24 APIDataSet apiDataSet = new APIDataSet(); … … 48 48 49 49 DataSet ds = new DataSet(); 50 ds. relations.add(r1);51 ds. relations.add(r2);50 ds.addPrimitive(r1); 51 ds.addPrimitive(r2); 52 52 53 53 APIDataSet apiDataSet = new APIDataSet(); … … 88 88 89 89 DataSet ds = new DataSet(); 90 ds. relations.add(r1);91 ds. relations.add(r2);92 ds. relations.add(r3);93 ds. relations.add(r4);90 ds.addPrimitive(r1); 91 ds.addPrimitive(r2); 92 ds.addPrimitive(r3); 93 ds.addPrimitive(r4); 94 94 95 95 APIDataSet apiDataSet = new APIDataSet(); … … 130 130 131 131 DataSet ds = new DataSet(); 132 ds. relations.add(r1);133 ds. relations.add(r2);134 ds. relations.add(r3);132 ds.addPrimitive(r1); 133 ds.addPrimitive(r2); 134 ds.addPrimitive(r3); 135 135 136 136 APIDataSet apiDataSet = new APIDataSet(); … … 167 167 168 168 DataSet ds = new DataSet(); 169 ds. relations.add(r1);170 ds. relations.add(r2);171 ds. relations.add(r3);169 ds.addPrimitive(r1); 170 ds.addPrimitive(r2); 171 ds.addPrimitive(r3); 172 172 173 173 APIDataSet apiDataSet = new APIDataSet(); -
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java
r2077 r2381 40 40 Node n4 = new Node(new LatLon(20.0,20.0)); 41 41 n4.put("name","n4"); 42 source. nodes.add(n1);43 source. nodes.add(n2);44 source. nodes.add(n3);45 source. nodes.add(n4);42 source.addPrimitive(n1); 43 source.addPrimitive(n2); 44 source.addPrimitive(n3); 45 source.addPrimitive(n4); 46 46 source.setSelected(n1,n2); 47 47 … … 49 49 DataSet hull = builder.build(); 50 50 assertNotNull(hull); 51 assertEquals(2, hull. nodes.size());51 assertEquals(2, hull.getNodes().size()); 52 52 53 53 OsmPrimitive p = hull.getPrimitiveById(1,OsmPrimitiveType.NODE); … … 58 58 assertNull(p); 59 59 60 p = lookupByName(hull. nodes, "n2");61 assertNotNull(p); 62 63 p = lookupByName(hull. nodes, "n4");60 p = lookupByName(hull.getNodes(), "n2"); 61 assertNotNull(p); 62 63 p = lookupByName(hull.getNodes(), "n4"); 64 64 assertNull(p); 65 65 } … … 75 75 w1.addNode(n1); 76 76 w1.addNode(n2); 77 source. nodes.add(n1);78 source. nodes.add(n2);79 source. ways.add(w1);77 source.addPrimitive(n1); 78 source.addPrimitive(n2); 79 source.addPrimitive(w1); 80 80 source.setSelected(w1); 81 81 … … 83 83 DataSet hull = builder.build(); 84 84 assertNotNull(hull); 85 assertEquals(1, hull. ways.size());86 assertEquals(2, hull. nodes.size());85 assertEquals(1, hull.getWays().size()); 86 assertEquals(2, hull.getNodes().size()); 87 87 88 88 OsmPrimitive p = hull.getPrimitiveById(1,OsmPrimitiveType.NODE); … … 108 108 w1.addNode(n1); 109 109 w1.addNode(n2); 110 source. nodes.add(n1);111 source. nodes.add(n2);112 source. ways.add(w1);110 source.addPrimitive(n1); 111 source.addPrimitive(n2); 112 source.addPrimitive(w1); 113 113 source.setSelected(w1,n1,n2); 114 114 … … 116 116 DataSet hull = builder.build(); 117 117 assertNotNull(hull); 118 assertEquals(1, hull. ways.size());119 assertEquals(2, hull. nodes.size());118 assertEquals(1, hull.getWays().size()); 119 assertEquals(2, hull.getNodes().size()); 120 120 121 121 OsmPrimitive p = hull.getPrimitiveById(1,OsmPrimitiveType.NODE); … … 137 137 Way w1 = new Way(3); 138 138 w1.incomplete = true; 139 source. ways.add(w1);139 source.addPrimitive(w1); 140 140 source.setSelected(w1); 141 141 … … 143 143 DataSet hull = builder.build(); 144 144 assertNotNull(hull); 145 assertEquals(1, hull. ways.size());145 assertEquals(1, hull.getWays().size()); 146 146 147 147 OsmPrimitive p = hull.getPrimitiveById(3, OsmPrimitiveType.WAY); … … 167 167 Relation r40 = new Relation(40); 168 168 r1.addMember(new RelationMember("relation-40", r40)); 169 source. nodes.add(n20);170 source. nodes.add(n21);171 source. nodes.add(n22);172 source. ways.add(w30);173 source. relations.add(r1);174 source. relations.add(r40);169 source.addPrimitive(n20); 170 source.addPrimitive(n21); 171 source.addPrimitive(n22); 172 source.addPrimitive(w30); 173 source.addPrimitive(r1); 174 source.addPrimitive(r40); 175 175 source.setSelected(r1,n20,w30,r40); 176 176 … … 178 178 DataSet hull = builder.build(); 179 179 assertNotNull(hull); 180 assertEquals(1, hull. ways.size());181 assertEquals(3, hull. nodes.size());182 assertEquals(2, hull. relations.size());180 assertEquals(1, hull.getWays().size()); 181 assertEquals(3, hull.getNodes().size()); 182 assertEquals(2, hull.getRelations().size()); 183 183 184 184 OsmPrimitive p = hull.getPrimitiveById(1, OsmPrimitiveType.RELATION); … … 226 226 Relation r40 = new Relation(40); 227 227 r1.addMember(new RelationMember("relation-40", r40)); 228 source. nodes.add(n20);229 source. nodes.add(n21);230 source. nodes.add(n22);231 source. ways.add(w30);232 source. relations.add(r1);233 source. relations.add(r40);228 source.addPrimitive(n20); 229 source.addPrimitive(n21); 230 source.addPrimitive(n22); 231 source.addPrimitive(w30); 232 source.addPrimitive(r1); 233 source.addPrimitive(r40); 234 234 source.setSelected(r1); 235 235 … … 237 237 DataSet hull = builder.build(); 238 238 assertNotNull(hull); 239 assertEquals(1, hull. ways.size());240 assertEquals(1, hull. nodes.size());241 assertEquals(2, hull. relations.size());239 assertEquals(1, hull.getWays().size()); 240 assertEquals(1, hull.getNodes().size()); 241 assertEquals(2, hull.getRelations().size()); 242 242 243 243 OsmPrimitive p = hull.getPrimitiveById(1, OsmPrimitiveType.RELATION); … … 293 293 r1.addMember(new RelationMember("relation-40", r40)); 294 294 295 source. nodes.add(n20);296 source. nodes.add(n21);297 source. nodes.add(n22);298 source. ways.add(w30);299 source. relations.add(r1);300 source. relations.add(r40);295 source.addPrimitive(n20); 296 source.addPrimitive(n21); 297 source.addPrimitive(n22); 298 source.addPrimitive(w30); 299 source.addPrimitive(r1); 300 source.addPrimitive(r40); 301 301 source.setSelected(r1); 302 302 … … 304 304 DataSet hull = builder.build(); 305 305 assertNotNull(hull); 306 assertEquals(1, hull. ways.size());307 assertEquals(3, hull. nodes.size());308 assertEquals(2, hull. relations.size());309 310 OsmPrimitive p = lookupByName(hull. relations, "r1");306 assertEquals(1, hull.getWays().size()); 307 assertEquals(3, hull.getNodes().size()); 308 assertEquals(2, hull.getRelations().size()); 309 310 OsmPrimitive p = lookupByName(hull.getRelations(), "r1"); 311 311 assertNotNull(p); 312 312 assertEquals(p.getClass(), Relation.class); 313 313 314 Way w = (Way)lookupByName(hull. ways, "w30");314 Way w = (Way)lookupByName(hull.getWays(), "w30"); 315 315 assertNotNull(w); 316 316 assertEquals(2, w.getNodesCount()); 317 317 318 Node n = (Node)lookupByName(hull. nodes, "n21");318 Node n = (Node)lookupByName(hull.getNodes(), "n21"); 319 319 assertNotNull(n); 320 320 assertTrue(w.containsNode(n)); 321 321 322 n = (Node)lookupByName(hull. nodes, "n22");322 n = (Node)lookupByName(hull.getNodes(), "n22"); 323 323 assertNotNull(n); 324 324 assertTrue(w.containsNode(n)); 325 325 326 Relation r = (Relation)lookupByName(hull. relations, "r40");327 assertNotNull(r); 328 329 r = (Relation)lookupByName(hull. relations, "r1");326 Relation r = (Relation)lookupByName(hull.getRelations(), "r40"); 327 assertNotNull(r); 328 329 r = (Relation)lookupByName(hull.getRelations(), "r1"); 330 330 assertNotNull(r); 331 331 assertEquals(3, r.getMembersCount()); 332 RelationMember m = new RelationMember("node-20", lookupByName(hull. nodes, "n20"));332 RelationMember m = new RelationMember("node-20", lookupByName(hull.getNodes(), "n20")); 333 333 assertTrue(r.getMembers().contains(m)); 334 334 m = new RelationMember("way-30", lookupByName(hull.ways, "w30")); … … 343 343 Relation r1 = new Relation(1); 344 344 r1.addMember(new RelationMember("relation-1",r1)); 345 source. relations.add(r1);345 source.addPrimitive(r1); 346 346 source.setSelected(r1); 347 347 … … 349 349 DataSet hull = builder.build(); 350 350 assertNotNull(hull); 351 assertEquals(1, hull. relations.size());351 assertEquals(1, hull.getRelations().size()); 352 352 353 353 Relation r = (Relation)hull.getPrimitiveById(1, OsmPrimitiveType.RELATION); … … 363 363 r1.put("name", "r1"); 364 364 r1.addMember(new RelationMember("relation-1",r1)); 365 source. relations.add(r1);365 source.addPrimitive(r1); 366 366 source.setSelected(r1); 367 367 … … 369 369 DataSet hull = builder.build(); 370 370 assertNotNull(hull); 371 assertEquals(1, hull. relations.size());372 373 Relation r = (Relation)lookupByName(hull. relations, "r1");371 assertEquals(1, hull.getRelations().size()); 372 373 Relation r = (Relation)lookupByName(hull.getRelations(), "r1"); 374 374 assertNotNull(r); 375 375 assertEquals(1, r.getMembersCount()); … … 384 384 r1.addMember(new RelationMember("relation-2",r2)); 385 385 r2.addMember(new RelationMember("relation-1",r1)); 386 source. relations.add(r1);387 source. relations.add(r2);386 source.addPrimitive(r1); 387 source.addPrimitive(r2); 388 388 source.setSelected(r1,r2); 389 389 … … 391 391 DataSet hull = builder.build(); 392 392 assertNotNull(hull); 393 assertEquals(2, hull. relations.size());393 assertEquals(2, hull.getRelations().size()); 394 394 395 395 r1 = (Relation)hull.getPrimitiveById(1, OsmPrimitiveType.RELATION); -
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeVisitorTest.java
r2292 r2381 8 8 9 9 import java.io.File; 10 import java.net.URLEncoder;11 10 import java.text.MessageFormat; 12 11 import java.util.Arrays; … … 358 357 Node n2 = (Node)my.getPrimitiveById(1,OsmPrimitiveType.NODE); 359 358 assertEquals(0,visitor.getConflicts().size()); 360 assertEquals(2, my.nodes.size());359 assertEquals(2, my.getNodes().size()); 361 360 assertEquals(n,n2); 362 361 } … … 402 401 visitor.merge(); 403 402 404 Node n2 = my. nodes.iterator().next();403 Node n2 = my.getNodes().iterator().next(); 405 404 assertEquals(0,visitor.getConflicts().size()); 406 405 assertEquals("value1",n2.get("key1")); … … 440 439 visitor.merge(); 441 440 442 Node n2 = my. nodes.iterator().next();441 Node n2 = my.getNodes().iterator().next(); 443 442 assertEquals(0,visitor.getConflicts().size()); 444 443 assertEquals("value1",n2.get("key1"));
Note:
See TracChangeset
for help on using the changeset viewer.