Changeset 14190 in josm for trunk/test/functional/org


Ignore:
Timestamp:
2018-08-28T21:29:03+02:00 (6 years ago)
Author:
Don-vip
Message:

see #16688 - skip some unit tests if preconditions are not met

Location:
trunk/test/functional/org/openstreetmap/josm/io
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java

    r12850 r14190  
    2222import java.util.logging.Logger;
    2323
     24import org.junit.Assume;
    2425import org.junit.Before;
    2526import org.junit.BeforeClass;
     
    2829import org.junit.rules.Timeout;
    2930import org.openstreetmap.josm.JOSMFixture;
     31import org.openstreetmap.josm.TestUtils;
    3032import org.openstreetmap.josm.data.coor.LatLon;
    3133import org.openstreetmap.josm.data.osm.Changeset;
     
    150152    @BeforeClass
    151153    public static void init() throws Exception {
     154        if (!TestUtils.areCredentialsProvided()) {
     155            logger.severe("OSM DEV API credentials not provided. Please define them with -Dosm.username and -Dosm.password");
     156            return;
     157        }
    152158        logger.info("initializing ...");
    153159        JOSMFixture.createFunctionalTestFixture().init();
     
    200206    @Before
    201207    public void setUp() throws IOException, IllegalDataException, FileNotFoundException {
     208        if (!TestUtils.areCredentialsProvided()) {
     209            return;
     210        }
    202211        File f = new File(System.getProperty("java.io.tmpdir"), MultiFetchServerObjectReaderTest.class.getName() + ".dataset");
    203212        logger.info(MessageFormat.format("reading cached dataset ''{0}''", f.toString()));
     
    214223    @Test
    215224    public void testMultiGet10Nodes() throws OsmTransferException {
     225        Assume.assumeTrue(TestUtils.areCredentialsProvided());
    216226        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    217227        ArrayList<Node> nodes = new ArrayList<>(ds.getNodes());
     
    235245    @Test
    236246    public void testMultiGet10Ways() throws OsmTransferException {
     247        Assume.assumeTrue(TestUtils.areCredentialsProvided());
    237248        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    238249        ArrayList<Way> ways = new ArrayList<>(ds.getWays());
     
    257268    @Test
    258269    public void testMultiGet10Relations() throws OsmTransferException {
     270        Assume.assumeTrue(TestUtils.areCredentialsProvided());
    259271        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    260272        ArrayList<Relation> relations = new ArrayList<>(ds.getRelations());
     
    279291    @Test
    280292    public void testMultiGet800Nodes() throws OsmTransferException {
     293        Assume.assumeTrue(TestUtils.areCredentialsProvided());
    281294        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    282295        ArrayList<Node> nodes = new ArrayList<>(ds.getNodes());
     
    300313    @Test
    301314    public void testMultiGetWithNonExistingNode() throws OsmTransferException {
     315        Assume.assumeTrue(TestUtils.areCredentialsProvided());
    302316        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    303317        ArrayList<Node> nodes = new ArrayList<>(ds.getNodes());
  • trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java

    r14120 r14190  
    2222import java.util.logging.Logger;
    2323
     24import org.junit.Assume;
    2425import org.junit.Before;
    2526import org.junit.BeforeClass;
    2627import org.junit.Test;
    2728import org.openstreetmap.josm.JOSMFixture;
     29import org.openstreetmap.josm.TestUtils;
    2830import org.openstreetmap.josm.data.APIDataSet;
    2931import org.openstreetmap.josm.data.coor.LatLon;
     
    158160    @BeforeClass
    159161    public static void setUpBeforeClass() throws OsmTransferException, CyclicUploadDependencyException, IOException {
     162        if (!TestUtils.areCredentialsProvided()) {
     163            logger.severe("OSM DEV API credentials not provided. Please define them with -Dosm.username and -Dosm.password");
     164            return;
     165        }
    160166        logger.info("initializing ...");
    161167
     
    213219    @Before
    214220    public void setUp() throws IOException, IllegalDataException, FileNotFoundException {
     221        if (!TestUtils.areCredentialsProvided()) {
     222            return;
     223        }
    215224        File f = new File(System.getProperty("java.io.tmpdir"), MultiFetchServerObjectReaderTest.class.getName() + ".dataset");
    216225        logger.info(MessageFormat.format("reading cached dataset ''{0}''", f.toString()));
     
    227236    @Test
    228237    public void testBackreferenceForNode() throws OsmTransferException {
     238        Assume.assumeTrue(TestUtils.areCredentialsProvided());
    229239        Node n = lookupNode(ds, 0);
    230240        assertNotNull(n);
     
    284294    @Test
    285295    public void testBackreferenceForNodeFull() throws OsmTransferException {
     296        Assume.assumeTrue(TestUtils.areCredentialsProvided());
    286297        Node n = lookupNode(ds, 0);
    287298        assertNotNull(n);
     
    332343    @Test
    333344    public void testBackreferenceForWay() throws OsmTransferException {
     345        Assume.assumeTrue(TestUtils.areCredentialsProvided());
    334346        Way w = lookupWay(ds, 1);
    335347        assertNotNull(w);
     
    376388    @Test
    377389    public void testBackreferenceForWayFull() throws OsmTransferException {
     390        Assume.assumeTrue(TestUtils.areCredentialsProvided());
    378391        Way w = lookupWay(ds, 1);
    379392        assertNotNull(w);
     
    414427    @Test
    415428    public void testBackreferenceForRelation() throws OsmTransferException {
     429        Assume.assumeTrue(TestUtils.areCredentialsProvided());
    416430        Relation r = lookupRelation(ds, 1);
    417431        assertNotNull(r);
     
    533547    @Test
    534548    public void testBackreferenceForRelationFull() throws OsmTransferException {
     549        Assume.assumeTrue(TestUtils.areCredentialsProvided());
    535550        Relation r = lookupRelation(ds, 1);
    536551        assertNotNull(r);
Note: See TracChangeset for help on using the changeset viewer.