1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.actions;
|
---|
3 |
|
---|
4 | import static org.junit.Assert.assertEquals;
|
---|
5 |
|
---|
6 | import java.util.List;
|
---|
7 |
|
---|
8 | import org.junit.Rule;
|
---|
9 | import org.junit.Test;
|
---|
10 | import org.openstreetmap.josm.Main;
|
---|
11 | import org.openstreetmap.josm.data.imagery.ImageryInfo;
|
---|
12 | import org.openstreetmap.josm.gui.layer.WMSLayer;
|
---|
13 | import org.openstreetmap.josm.testutils.JOSMTestRules;
|
---|
14 |
|
---|
15 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * Unit tests for class {@link AddImageryLayerAction}.
|
---|
19 | */
|
---|
20 | public final class AddImageryLayerActionTestIT {
|
---|
21 | /**
|
---|
22 | * We need prefs for this. We need platform for actions and the OSM API for checking blacklist.
|
---|
23 | * The timeout is set to default httpclient read timeout + connect timeout + a small delay to ignore
|
---|
24 | * common but harmless network issues.
|
---|
25 | */
|
---|
26 | @Rule
|
---|
27 | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
---|
28 | public JOSMTestRules test = new JOSMTestRules().preferences().platform().fakeAPI().timeout(45500);
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * Integration test of {@link AddImageryLayerAction#actionPerformed} - Enabled cases for WMS.
|
---|
32 | */
|
---|
33 | @Test
|
---|
34 | public void testActionPerformedEnabledWms() {
|
---|
35 | new AddImageryLayerAction(new ImageryInfo("wms.openstreetmap.fr", "http://wms.openstreetmap.fr/wms?",
|
---|
36 | "wms_endpoint", null, null)).actionPerformed(null);
|
---|
37 | List<WMSLayer> wmsLayers = Main.getLayerManager().getLayersOfType(WMSLayer.class);
|
---|
38 | assertEquals(1, wmsLayers.size());
|
---|
39 |
|
---|
40 | Main.getLayerManager().removeLayer(wmsLayers.get(0));
|
---|
41 | }
|
---|
42 | }
|
---|