Changeset 7150 in josm for trunk/test/functional/org/openstreetmap
- Timestamp:
- 2014-05-20T14:21:46+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java
r7082 r7150 14 14 import java.nio.charset.StandardCharsets; 15 15 import java.text.MessageFormat; 16 import java.util.ArrayList;17 16 import java.util.HashSet; 18 17 import java.util.Set; … … 24 23 import org.openstreetmap.josm.JOSMFixture; 25 24 import org.openstreetmap.josm.Main; 25 import org.openstreetmap.josm.actions.upload.CyclicUploadDependencyException; 26 import org.openstreetmap.josm.data.APIDataSet; 26 27 import org.openstreetmap.josm.data.coor.LatLon; 27 28 import org.openstreetmap.josm.data.osm.Changeset; 28 29 import org.openstreetmap.josm.data.osm.DataSet; 29 30 import org.openstreetmap.josm.data.osm.Node; 30 import org.openstreetmap.josm.data.osm.OsmPrimitive;31 31 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 32 32 import org.openstreetmap.josm.data.osm.Relation; … … 128 128 * @throws OsmTransferException 129 129 */ 130 static public void createDataSetOnServer( DataSet ds) throws OsmTransferException {130 static public void createDataSetOnServer(APIDataSet ds) throws OsmTransferException, CyclicUploadDependencyException { 131 131 logger.info("creating data set on the server ..."); 132 ArrayList<OsmPrimitive> primitives = new ArrayList<>(); 133 primitives.addAll(ds.getNodes()); 134 primitives.addAll(ds.getWays()); 135 primitives.addAll(ds.getRelations()); 132 ds.adjustRelationUploadOrder(); 136 133 OsmServerWriter writer = new OsmServerWriter(); 137 134 Changeset cs = new Changeset(); 138 writer.uploadOsm(new UploadStrategySpecification().setStrategy(UploadStrategy.SINGLE_REQUEST_STRATEGY), primitives, cs, NullProgressMonitor.INSTANCE); 135 writer.uploadOsm( 136 new UploadStrategySpecification().setStrategy(UploadStrategy.SINGLE_REQUEST_STRATEGY), 137 ds.getPrimitives(), cs, NullProgressMonitor.INSTANCE); 139 138 OsmApi.getOsmApi().closeChangeset(cs, NullProgressMonitor.INSTANCE); 140 139 } … … 143 142 144 143 @BeforeClass 145 public static void init() throws OsmTransferException {144 public static void init() throws OsmTransferException, CyclicUploadDependencyException { 146 145 logger.info("initializing ..."); 147 146 … … 169 168 testDataSet = buildTestDataSet(); 170 169 logger.info("uploading test data set ..."); 171 createDataSetOnServer( testDataSet);170 createDataSetOnServer(new APIDataSet(testDataSet)); 172 171 173 172 try ( … … 212 211 reader.setReadFull(false); 213 212 DataSet referers = reader.parseOsm(NullProgressMonitor.INSTANCE); 213 printNumberOfPrimitives(referers); 214 214 assertEquals(10, referers.getNodes().size()); 215 215 assertEquals(1, referers.getWays().size()); … … 221 221 } 222 222 223 private void printNumberOfPrimitives(DataSet referers) { 224 System.out.println("#nodes=" + referers.getNodes().size() + 225 " #ways=" + referers.getWays().size() + 226 " #relations=" + referers.getRelations().size()); 227 } 228 223 229 @Test 224 230 public void testBackrefrenceForNode_Full() throws OsmTransferException { … … 231 237 reader.setReadFull(true); 232 238 DataSet referers = reader.parseOsm(NullProgressMonitor.INSTANCE); 239 printNumberOfPrimitives(referers); 233 240 assertEquals(10, referers.getNodes().size()); 234 241 assertEquals(1, referers.getWays().size()); … … 251 258 reader.setReadFull(false); 252 259 DataSet referers = reader.parseOsm(NullProgressMonitor.INSTANCE); 260 printNumberOfPrimitives(referers); 253 261 assertEquals(0, referers.getNodes().size()); // no nodes loaded 254 262 assertEquals(6, referers.getWays().size()); // 6 ways referred by two relations … … 310 318 reader.setReadFull(false); 311 319 DataSet referers = reader.parseOsm(NullProgressMonitor.INSTANCE); 320 printNumberOfPrimitives(referers); 312 321 313 322 Set<Long> referringRelationsIds = new HashSet<>();
Note:
See TracChangeset
for help on using the changeset viewer.