Ignore:
Timestamp:
2015-08-06T16:55:05+02:00 (10 years ago)
Author:
nokutu
Message:

Moved bounds ArrayList from MapillaryLayer to MapillaryData.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/MapillarySequenceDownloadThreadTest.java

    r31454 r31459  
    2121public class MapillarySequenceDownloadThreadTest extends AbstractTest {
    2222
    23     /**
    24      * Test method for {@link org.openstreetmap.josm.plugins.mapillary.downloads.MapillarySequenceDownloadThread#run()}.
    25      *
    26      * This downloads a small area of mapillary-sequences where we know that images already exist.
    27      * When the download-thread finishes, we check if the Mapillary-layer now contains one or more images.
    28      *
    29      * @throws InterruptedException
    30      */
    31     @Test
    32     public void testRun() throws InterruptedException {
    33         System.out.println("[JUnit] MapillarySequenceDownloadThreadTest.testRun()");
    34         //Area around image UjEbeXZYIoyAKOsE-remlg (59.32125452° N 18.06166856° E)
    35         LatLon minLatLon = new LatLon(59.3212545, 18.0616685);
    36         LatLon maxLatLon = new LatLon(59.3212546, 18.0616686);
     23  /**
     24   * Test method for
     25   * {@link org.openstreetmap.josm.plugins.mapillary.downloads.MapillarySequenceDownloadThread#run()}
     26   * .
     27   *
     28   * This downloads a small area of mapillary-sequences where we know that
     29   * images already exist. When the download-thread finishes, we check if the
     30   * Mapillary-layer now contains one or more images.
     31   *
     32   * @throws InterruptedException
     33   */
     34  @Test
     35  public void testRun() throws InterruptedException {
     36    System.out.println("[JUnit] MapillarySequenceDownloadThreadTest.testRun()");
     37    // Area around image UjEbeXZYIoyAKOsE-remlg (59.32125452° N 18.06166856° E)
     38    LatLon minLatLon = new LatLon(59.3212545, 18.0616685);
     39    LatLon maxLatLon = new LatLon(59.3212546, 18.0616686);
    3740
    38         ExecutorService ex = Executors.newSingleThreadExecutor();
    39         String queryString = String.format(
     41    ExecutorService ex = Executors.newSingleThreadExecutor();
     42    String queryString = String
     43        .format(
    4044            Locale.UK,
    4145            "?max_lat=%.8f&max_lon=%.8f&min_lat=%.8f&min_lon=%.8f&limit=10&client_id=%s",
    42             maxLatLon.lat(),
    43             maxLatLon.lon(),
    44             minLatLon.lat(),
    45             minLatLon.lon(),
    46             MapillaryDownloader.CLIENT_ID
    47         );
    48         MapillaryLayer.getInstance().bounds.add(new Bounds(minLatLon, maxLatLon));
     46            maxLatLon.lat(), maxLatLon.lon(), minLatLon.lat(), minLatLon.lon(),
     47            MapillaryDownloader.CLIENT_ID);
     48    MapillaryLayer.getInstance().getData().bounds.add(new Bounds(minLatLon,
     49        maxLatLon));
    4950
    50         int page = 1;
    51         while (!ex.isShutdown() && MapillaryLayer.getInstance().getData().getImages().size() <= 0 && page < 50) {
    52             System.out.println("Sending sequence-request "+page+" to Mapillary-servers…");
    53             Thread downloadThread = new MapillarySequenceDownloadThread(ex, queryString+"&page="+page);
    54             downloadThread.start();
    55             downloadThread.join();
    56             page++;
    57             Thread.sleep(500);
    58         }
    59         assertTrue(MapillaryLayer.getInstance().getData().getImages().size() >= 1);
    60         System.out.println("One or more images were added to the MapillaryLayer within the given bounds.");
     51    int page = 1;
     52    while (!ex.isShutdown()
     53        && MapillaryLayer.getInstance().getData().getImages().size() <= 0
     54        && page < 50) {
     55      System.out.println("Sending sequence-request " + page
     56          + " to Mapillary-servers…");
     57      Thread downloadThread = new MapillarySequenceDownloadThread(ex,
     58          queryString + "&page=" + page);
     59      downloadThread.start();
     60      downloadThread.join();
     61      page++;
     62      Thread.sleep(500);
    6163    }
     64    assertTrue(MapillaryLayer.getInstance().getData().getImages().size() >= 1);
     65    System.out
     66        .println("One or more images were added to the MapillaryLayer within the given bounds.");
     67  }
    6268
    6369}
Note: See TracChangeset for help on using the changeset viewer.