Changeset 36140 in osm for applications


Ignore:
Timestamp:
2023-09-18T14:36:02+02:00 (10 months ago)
Author:
taylor.smock
Message:

Fix #19064: resolve all tools using Apache Ivy (JMapViewer)

JUnit was updated from v4 to v5 as well.

Location:
applications/viewer/jmapviewer
Files:
2 added
4 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • applications/viewer/jmapviewer/build.xml

    r36139 r36140  
    11<?xml version="1.0" encoding="UTF-8" standalone="no"?>
    2 <project default="all" name="jmapviewer" xmlns:jacoco="antlib:org.jacoco.ant" xmlns:if="ant:if" xmlns:unless="ant:unless">
     2<project default="all" name="jmapviewer"
     3         xmlns:jacoco="antlib:org.jacoco.ant"
     4         xmlns:if="ant:if"
     5         xmlns:ivy="antlib:org.apache.ivy.ant"
     6>
    37
    48    <property name="java.lang.version" value="8" />
     
    2731    </condition>
    2832    <path id="test.classpath">
    29         <fileset dir="${tools.dir}/testlib">
    30             <include name="**/*.jar"/>
    31         </fileset>
    3233        <pathelement location="bin"/>
    3334    </path>
     
    8081            </fileset>
    8182        </copy>
     83    </target>
     84
     85    <target name="checkdepsupdate" depends="resolve">
     86        <ivy:checkdepsupdate/>
    8287    </target>
    8388
     
    132137    </target>
    133138
    134     <target name="checkstyle">
    135         <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties" 
    136             classpath="tools/checkstyle/checkstyle-all.jar"/>
     139    <target name="checkstyle" depends="resolve">
     140        <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
     141            classpathref="checkstyle.classpath"/>
    137142        <checkstyle config="tools/checkstyle/jmapviewer_checks.xml">
    138143            <!-- Exclude the module-info since checkstyle currently cannot parse it -->
     
    142147    </target>
    143148
    144     <target name="spotbugs" depends="pack">
     149    <target name="spotbugs" depends="pack,resolve">
    145150        <taskdef name="spotbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
    146             classpath="tools/spotbugs/spotbugs-ant.jar"/>
    147         <path id="spotbugs-classpath">
    148             <fileset dir="tools/spotbugs/">
    149                 <include name="*.jar"/>
    150             </fileset>
    151         </path>
    152         <property name="spotbugs-classpath" refid="spotbugs-classpath"/>
     151            classpathref="spotbugs.classpath"/>
     152        <property name="spotbugs-classpath" refid="spotbugs.classpath"/>
    153153        <spotbugs output="xml"
    154154                outputFile="spotbugs-jmapviewer.xml"
     
    178178    </target>
    179179
    180     <target name="test" depends="clean, build">
    181         <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="${tools.dir}/jacocoant.jar" />
     180    <target name="resolve" description="Resolve Ivy dependencies">
     181        <ivy:resolve/>
     182        <ivy:cachepath pathid="checkstyle.classpath" conf="checkstyle"/>
     183        <ivy:cachepath pathid="testlib.classpath" conf="test"/>
     184        <ivy:cachepath pathid="jacoco.classpath" conf="jacocoant"/>
     185        <ivy:cachepath pathid="spotbugs.classpath" conf="spotbugs"/>
     186    </target>
     187
     188    <target name="test" depends="clean, build, resolve">
     189        <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpathref="jacoco.classpath"/>
    182190        <javac srcdir="test" destdir="bintest"
    183191            target="${java.lang.version}" source="${java.lang.version}" debug="on"
     
    186194            <compilerarg value="-Xlint:-serial"/>
    187195            <classpath>
    188                 <path refid="test.classpath"/>
     196                <path refid="testlib.classpath"/>
     197                <path refid="test.classpath"/>
    189198            </classpath>
    190199        </javac>
    191         <jacoco:coverage enabled="@{coverage}" includes="${jacoco.includes}"
    192             inclbootstrapclasses="${jacoco.inclbootstrapclasses}" inclnolocationclasses="${jacoco.inclnolocationclasses}">
    193             <junit printsummary="yes" fork="true" forkmode="once">
    194                 <jvmarg value="-Dfile.encoding=UTF-8"/>
    195                 <classpath>
    196                     <path refid="test.classpath"/>
    197                     <pathelement location="bintest"/>
    198                 </classpath>
    199                 <formatter type="plain"/>
    200                 <formatter type="xml"/>
    201                 <batchtest fork="yes" todir="report">
    202                     <fileset dir="bintest" includes="**/*Test.class"/>
    203                 </batchtest>
    204             </junit>
    205         </jacoco:coverage>
     200        <jacoco:agent enabled="@{coverage}" includes="${jacoco.includes}"
     201                      inclbootstrapclasses="${jacoco.inclbootstrapclasses}" inclnolocationclasses="${jacoco.inclnolocationclasses}" property="jacocoagent@{testfamily}@{testITsuffix}" if:true="@{coverage}"/>
     202        <junitlauncher printsummary="yes">
     203            <classpath>
     204                <path refid="testlib.classpath"/>
     205                <path refid="test.classpath"/>
     206                <pathelement location="bintest"/>
     207            </classpath>
     208            <testclasses outputdir="report">
     209                <fileset dir="bintest" includes="**/*Test.class"/>
     210                <fork>
     211                    <jvmarg value="-Dfile.encoding=UTF-8"/>
     212                </fork>
     213                <listener type="legacy-brief" sendSysOut="true" sendSysErr="true"/>
     214                <listener type="legacy-plain" />
     215                <listener type="legacy-xml" />
     216            </testclasses>
     217        </junitlauncher>
    206218    </target>
    207219
  • applications/viewer/jmapviewer/test/org/openstreetmap/gui/jmapviewer/TileRangeTest.java

    r34669 r36140  
    22package org.openstreetmap.gui.jmapviewer;
    33
    4 import static org.junit.Assert.assertEquals;
    54
    6 import org.junit.Test;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6
     7import org.junit.jupiter.api.Test;
    78
    89/**
    910 * Unit tests of {@link TileRange} class.
    1011 */
    11 public class TileRangeTest {
     12class TileRangeTest {
    1213
    1314    /**
     
    1516     */
    1617    @Test
    17     public void testSize() {
     18    void testSize() {
    1819        assertEquals(16, new TileRange(
    1920                new TileXY(3, 3),
  • applications/viewer/jmapviewer/test/org/openstreetmap/gui/jmapviewer/tilesources/TemplatedTMSTileSourceTest.java

    r35527 r36140  
    22package org.openstreetmap.gui.jmapviewer.tilesources;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.text.MessageFormat;
     
    1111import java.util.stream.Stream;
    1212
    13 import org.junit.Test;
     13import org.junit.jupiter.api.Test;
    1414
    1515/**
     
    4949     */
    5050    @Test
    51     public void testGetTileUrl() {
     51    void testGetTileUrl() {
    5252        checkGetTileUrl(
    5353                "http://localhost/{z}/{x}/{y}",
     
    6161     */
    6262    @Test
    63     public void testGetTileUrl_positive_zoom() {
     63    void testGetTileUrl_positive_zoom() {
    6464        checkGetTileUrl(
    6565                "http://localhost/{zoom+5}/{x}/{y}",
     
    7373     */
    7474    @Test
    75     public void testGetTileUrl_negative_zoom() {
     75    void testGetTileUrl_negative_zoom() {
    7676        checkGetTileUrl(
    7777                "http://localhost/{zoom-5}/{x}/{y}",
     
    8585     */
    8686    @Test
    87     public void testGetTileUrl_inverse_negative_zoom() {
     87    void testGetTileUrl_inverse_negative_zoom() {
    8888        checkGetTileUrl(
    8989                "http://localhost/{5-zoom}/{x}/{y}",
     
    9797     */
    9898    @Test
    99     public void testGetTileUrl_both_offsets() {
     99    void testGetTileUrl_both_offsets() {
    100100        checkGetTileUrl(
    101101                "http://localhost/{10-zoom-5}/{x}/{y}",
     
    109109     */
    110110    @Test
    111     public void testGetTileUrl_apiKey() {
     111    void testGetTileUrl_apiKey() {
    112112        System.setProperty("id1.api-key", "wololo");
    113113        TileSourceInfo testImageryTMS = new TileSourceInfo("test imagery", "http://localhost/{zoom}/{x}/{y}?token={apikey}&foo=bar", "id1");
     
    120120     */
    121121    @Test
    122     public void testGetTileUrl_switch() {
     122    void testGetTileUrl_switch() {
    123123        TileSourceInfo testImageryTMS = new TileSourceInfo("test imagery", "http://{switch:a,b,c}.localhost/{10-zoom-5}/{x}/{y}", "id1");
    124124        TemplatedTMSTileSource ts = new TemplatedTMSTileSource(testImageryTMS);
     
    159159
    160160    @Test
    161     public void testGetTileUrl_yahoo() {
     161    void testGetTileUrl_yahoo() {
    162162        checkGetTileUrl(
    163163                "http://localhost/{z}/{x}/{!y}",
     
    169169
    170170    @Test
    171     public void testGetTileUrl_negative_y() {
     171    void testGetTileUrl_negative_y() {
    172172        checkGetTileUrl(
    173173                "http://localhost/{z}/{x}/{-y}",
     
    189189     */
    190190    @Test
    191     public void testAllUrls() {
     191    void testAllUrls() {
    192192        for (String[] test: TEST_DATA) {
    193193            TileSourceInfo testImageryTMS = new TileSourceInfo("test imagery", test[0], "id1");
Note: See TracChangeset for help on using the changeset viewer.