Changeset 1951 in josm for trunk/test
- Timestamp:
- 2009-08-10T20:36:40+02:00 (15 years ago)
- Location:
- trunk/test
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/functional/org/openstreetmap/josm/gui/conflict/relation/RelationMemberMergerTest.java
r1707 r1951 10 10 import org.openstreetmap.josm.data.osm.RelationMember; 11 11 import org.openstreetmap.josm.data.osm.Way; 12 import org.openstreetmap.josm.gui.conflict.nodes.NodeListMerger;13 import org.openstreetmap.josm.gui.conflict.nodes.NodeListMergerTest;14 12 15 13 public class RelationMemberMergerTest extends JFrame { 16 14 17 15 private RelationMemberMerger merger; 18 16 19 17 protected void populate() { 20 18 Relation r1 = new Relation(); 21 r1. members.add(new RelationMember("role1", new Node(1)));22 r1. members.add(new RelationMember("role2", new Way(2)));23 r1. members.add(new RelationMember("role3", new Relation(3)));19 r1.addMember(new RelationMember("role1", new Node(1))); 20 r1.addMember(new RelationMember("role2", new Way(2))); 21 r1.addMember(new RelationMember("role3", new Relation(3))); 24 22 25 23 26 24 Relation r2 = new Relation(); 27 r2. members.add(new RelationMember("role1", new Node(1)));28 r2. members.add(new RelationMember("role2", new Way(2)));29 r2. members.add(new RelationMember("role3", new Relation(3)));30 25 r2.addMember(new RelationMember("role1", new Node(1))); 26 r2.addMember(new RelationMember("role2", new Way(2))); 27 r2.addMember(new RelationMember("role3", new Relation(3))); 28 31 29 merger.populate(r1, r2); 32 30 33 31 } 34 32 35 33 protected void build() { 36 34 merger = new RelationMemberMerger(); … … 38 36 getContentPane().add(merger, BorderLayout.CENTER); 39 37 } 40 38 41 39 public RelationMemberMergerTest() { 42 40 build(); 43 41 populate(); 44 42 } 45 43 46 44 static public void main(String args[]) { 47 45 RelationMemberMergerTest test = new RelationMemberMergerTest(); -
trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java
r1928 r1951 95 95 int idx = (start + j) % 500; 96 96 Node n = nodes.get(idx); 97 r. members.add(new RelationMember("role-" + j, n));97 r.addMember(new RelationMember("role-" + j, n)); 98 98 } 99 99 int numWaysInRelation = (int)Math.round(Math.random() * 10); … … 102 102 int idx = (start + j) % 500; 103 103 Way w = ways.get(idx); 104 r. members.add(new RelationMember("role-" + j, w));104 r.addMember(new RelationMember("role-" + j, w)); 105 105 } 106 106 ds.addPrimitive(r); … … 288 288 Relation r2 = (Relation)ds.getPrimitiveById(r1.id); 289 289 assertNotNull(r2); 290 assertEquals(r2. members.size(), r1.members.size());290 assertEquals(r2.getMembersCount(), r1.getMembersCount()); 291 291 assertEquals(r2.get("name"),r2.get("name")); 292 292 } -
trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java
r1938 r1951 88 88 for (int j =0; j < 10; j++) { 89 89 RelationMember member = new RelationMember("node-" + j, lookupNode(ds, i + j)); 90 r. members.add(member);90 r.addMember(member); 91 91 } 92 92 for (int j =0; j < 5; j++) { 93 93 RelationMember member = new RelationMember("way-" + j, lookupWay(ds, i + j)); 94 r. members.add(member);94 r.addMember(member); 95 95 } 96 96 if (i > 5) { … … 98 98 RelationMember member = new RelationMember("relation-" + j, lookupRelation(ds, j)); 99 99 logger.info(MessageFormat.format("adding relation {0} to relation {1}", j, i)); 100 r. members.add(member);100 r.addMember(member); 101 101 } 102 102 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java
r1926 r1951 153 153 Relation r1 = new Relation(1); 154 154 Node n20 = new Node(20); 155 r1. members.add(new RelationMember("node-20",n20));155 r1.addMember(new RelationMember("node-20",n20)); 156 156 Way w30 = new Way(30); 157 157 Node n21; … … 159 159 Node n22; 160 160 w30.addNode(n22 = new Node(22)); 161 r1. members.add(new RelationMember("way-30",w30));161 r1.addMember(new RelationMember("way-30",w30)); 162 162 Relation r40 = new Relation(40); 163 r1. members.add(new RelationMember("relation-40", r40));163 r1.addMember(new RelationMember("relation-40", r40)); 164 164 source.nodes.add(n20); 165 165 source.nodes.add(n21); … … 199 199 assertEquals(3, r.getMembersCount()); 200 200 RelationMember m = new RelationMember("node-20", hull.getPrimitiveById(20)); 201 assertTrue(r. members.contains(m));201 assertTrue(r.getMembers().contains(m)); 202 202 m = new RelationMember("way-30", hull.getPrimitiveById(30)); 203 assertTrue(r. members.contains(m));203 assertTrue(r.getMembers().contains(m)); 204 204 m = new RelationMember("relation-40", hull.getPrimitiveById(40)); 205 assertTrue(r. members.contains(m));205 assertTrue(r.getMembers().contains(m)); 206 206 } 207 207 … … 211 211 Relation r1 = new Relation(1); 212 212 Node n20 = new Node(20); 213 r1. members.add(new RelationMember("node-20",n20));213 r1.addMember(new RelationMember("node-20",n20)); 214 214 Way w30 = new Way(30); 215 215 Node n21; … … 217 217 Node n22; 218 218 w30.addNode(n22 = new Node(22)); 219 r1. members.add(new RelationMember("way-30",w30));219 r1.addMember(new RelationMember("way-30",w30)); 220 220 Relation r40 = new Relation(40); 221 r1. members.add(new RelationMember("relation-40", r40));221 r1.addMember(new RelationMember("relation-40", r40)); 222 222 source.nodes.add(n20); 223 223 source.nodes.add(n21); … … 258 258 assertEquals(3, r.getMembersCount()); 259 259 RelationMember m = new RelationMember("node-20", hull.getPrimitiveById(20)); 260 assertTrue(r. members.contains(m));260 assertTrue(r.getMembers().contains(m)); 261 261 m = new RelationMember("way-30", hull.getPrimitiveById(30)); 262 assertTrue(r. members.contains(m));262 assertTrue(r.getMembers().contains(m)); 263 263 m = new RelationMember("relation-40", hull.getPrimitiveById(40)); 264 assertTrue(r. members.contains(m));264 assertTrue(r.getMembers().contains(m)); 265 265 } 266 266 … … 272 272 Node n20 = new Node(new LatLon(20.0,20.0)); 273 273 n20.put("name", "n20"); 274 r1. members.add(new RelationMember("node-20",n20));274 r1.getMembers().add(new RelationMember("node-20",n20)); 275 275 Way w30 = new Way(); 276 276 w30.put("name", "w30"); … … 281 281 w30.addNode(n22 = new Node(new LatLon(22.0,22.0))); 282 282 n22.put("name","n22"); 283 r1. members.add(new RelationMember("way-30",w30));283 r1.addMember(new RelationMember("way-30",w30)); 284 284 Relation r40 = new Relation(); 285 285 r40.put("name", "r40"); 286 r1. members.add(new RelationMember("relation-40", r40));286 r1.addMember(new RelationMember("relation-40", r40)); 287 287 source.nodes.add(n20); 288 288 source.nodes.add(n21); … … 323 323 assertEquals(3, r.getMembersCount()); 324 324 RelationMember m = new RelationMember("node-20", lookupByName(hull.nodes, "n20")); 325 assertTrue(r. members.contains(m));325 assertTrue(r.getMembers().contains(m)); 326 326 m = new RelationMember("way-30", lookupByName(hull.ways, "w30")); 327 assertTrue(r. members.contains(m));327 assertTrue(r.getMembers().contains(m)); 328 328 m = new RelationMember("relation-40", lookupByName(hull.relations, "r40")); 329 assertTrue(r. members.contains(m));329 assertTrue(r.getMembers().contains(m)); 330 330 } 331 331 … … 334 334 DataSet source = new DataSet(); 335 335 Relation r1 = new Relation(1); 336 r1. members.add(new RelationMember("relation-1",r1));336 r1.addMember(new RelationMember("relation-1",r1)); 337 337 source.relations.add(r1); 338 338 source.setSelected(r1); … … 346 346 assertNotNull(r); 347 347 assertEquals(1, r.getMembersCount()); 348 assertTrue(r. members.contains(new RelationMember("relation-1",r)));348 assertTrue(r.getMembers().contains(new RelationMember("relation-1",r))); 349 349 } 350 350 … … 354 354 Relation r1 = new Relation(); 355 355 r1.put("name", "r1"); 356 r1. members.add(new RelationMember("relation-1",r1));356 r1.addMember(new RelationMember("relation-1",r1)); 357 357 source.relations.add(r1); 358 358 source.setSelected(r1); … … 366 366 assertNotNull(r); 367 367 assertEquals(1, r.getMembersCount()); 368 assertTrue(r. members.contains(new RelationMember("relation-1",r)));368 assertTrue(r.getMembers().contains(new RelationMember("relation-1",r))); 369 369 } 370 370 … … 374 374 Relation r1 = new Relation(1); 375 375 Relation r2 = new Relation(2); 376 r1. members.add(new RelationMember("relation-2",r2));377 r2. members.add(new RelationMember("relation-1",r1));376 r1.addMember(new RelationMember("relation-2",r2)); 377 r2.addMember(new RelationMember("relation-1",r1)); 378 378 source.relations.add(r1); 379 379 source.relations.add(r2); … … 390 390 assertNotNull(r2); 391 391 assertEquals(1, r1.getMembersCount()); 392 assertTrue(r1. members.contains(new RelationMember("relation-2",r2)));392 assertTrue(r1.getMembers().contains(new RelationMember("relation-2",r2))); 393 393 assertEquals(1, r2.getMembersCount()); 394 assertTrue(r2. members.contains(new RelationMember("relation-1",r1)));394 assertTrue(r2.getMembers().contains(new RelationMember("relation-1",r1))); 395 395 } 396 396 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeVisitorTest.java
r1948 r1951 965 965 theirRelation.id = 4; 966 966 theirRelation.version = 1; 967 theirRelation. members.add(new RelationMember("", n3));968 theirRelation. members.add(new RelationMember("", n4));969 theirRelation. members.add(new RelationMember("", n5));967 theirRelation.addMember(new RelationMember("", n3)); 968 theirRelation.addMember(new RelationMember("", n4)); 969 theirRelation.addMember(new RelationMember("", n5)); 970 970 their.addPrimitive(theirRelation); 971 971
Note:
See TracChangeset
for help on using the changeset viewer.