Ticket #16567: 16567.9.patch

File 16567.9.patch, 13.6 KB (added by taylor.smock, 6 years ago)

Update for Ivy dependencies

  • .classpath

     
    2222                        <attribute name="test" value="true"/>
    2323                </attributes>
    2424        </classpathentry>
    25         <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4">
     25        <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5">
    2626                <attributes>
    2727                        <attribute name="test" value="true"/>
    2828                </attributes>
    2929        </classpathentry>
    30         <classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?project=JOSM&amp;ivyXmlPath=ivy.xml&amp;confs=*&amp;ivySettingsPath=ivysettings.xml&amp;loadSettingsOnDemand=false&amp;ivyUserDir=&amp;propertyFiles="/>
     30        <classpathentry exported="true" kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?project=JOSM&amp;ivyXmlPath=ivy.xml&amp;confs=*&amp;ivySettingsPath=ivysettings.xml&amp;loadSettingsOnDemand=false&amp;ivyUserDir=&amp;propertyFiles="/>
    3131        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
    3232                <attributes>
    3333                        <attribute name="module" value="true"/>
  • build.xml

     
    460460        <attribute name="excludes" default="${default-junit@{testITsuffix}-excludes}"/>
    461461        <sequential>
    462462            <echo message="Running @{testfamily}@{testITsuffix} tests with JUnit"/>
    463             <jacoco:coverage destfile="${test.dir}/jacoco@{testITsuffix}.exec" enabled="@{coverage}" includes="${jacoco.includes}"
    464                 inclbootstrapclasses="${jacoco.inclbootstrapclasses}" inclnolocationclasses="${jacoco.inclnolocationclasses}">
    465                 <junit printsummary="${junit.printsummary}" fork="true" forkmode="once" failureproperty="test.@{testfamily}@{testITsuffix}.failed">
    466                     <jvmarg value="-Dfile.encoding=UTF-8"/>
    467                     <jvmarg value="-javaagent:${test.dir}/lib/jmockit.jar"/>
    468                     <jvmarg value="--add-modules" if:set="isJava9" unless:set="isJava11" />
    469                     <jvmarg value="java.activation,java.se.ee" if:set="isJava9" unless:set="isJava11" />
    470                     <jvmarg value="--add-exports" if:set="isJava9" unless:set="noJavaFX" />
    471                     <jvmarg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" unless:set="noJavaFX" />
    472                     <jvmarg value="--add-exports" if:set="isJava9" unless:set="isJava11" />
    473                     <jvmarg value="jdk.deploy/com.sun.deploy.config=ALL-UNNAMED" if:set="isJava9" unless:set="isJava11" />
    474                     <jvmarg value="--add-opens" if:set="isJava9" />
    475                     <jvmarg value="java.base/java.io=ALL-UNNAMED" if:set="isJava9" />
    476                     <jvmarg value="--add-opens" if:set="isJava9" />
    477                     <jvmarg value="java.base/java.lang=ALL-UNNAMED" if:set="isJava9" />
    478                     <jvmarg value="--add-opens" if:set="isJava9" />
    479                     <jvmarg value="java.base/java.nio=ALL-UNNAMED" if:set="isJava9" />
    480                     <jvmarg value="--add-opens" if:set="isJava9" />
    481                     <jvmarg value="java.base/java.text=ALL-UNNAMED" if:set="isJava9" />
    482                     <jvmarg value="--add-opens" if:set="isJava9" />
    483                     <jvmarg value="java.base/java.util=ALL-UNNAMED" if:set="isJava9" />
    484                     <jvmarg value="--add-opens" if:set="isJava9" />
    485                     <jvmarg value="java.base/jdk.internal.loader=ALL-UNNAMED" if:set="isJava9" />
    486                     <jvmarg value="--add-opens" if:set="isJava9" />
    487                     <jvmarg value="java.desktop/java.awt=ALL-UNNAMED" if:set="isJava9" />
    488                     <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
    489                     <sysproperty key="josm.test.data" value="${test.dir}/data"/>
    490                     <sysproperty key="java.awt.headless" value="${test.headless}"/>
    491                     <sysproperty key="glass.platform" value="Monocle"/>
    492                     <sysproperty key="monocle.platform" value="Headless"/>
    493                     <sysproperty key="prism.order" value="sw"/>
    494                     <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
    495                     <classpath>
    496                         <path refid="test.classpath"/>
    497                         <pathelement path="${test.dir}/build/unit"/>
    498                         <pathelement path="${test.dir}/build/@{testfamily}"/>
    499                         <pathelement path="${test.dir}/config"/>
    500                     </classpath>
    501                     <formatter type="plain"/>
    502                     <formatter type="xml"/>
    503                     <batchtest fork="yes" todir="${test.dir}/report">
    504                         <fileset dir="${test.dir}/build/@{testfamily}" includes="@{includes}" excludes="@{excludes}"/>
    505                     </batchtest>
    506                 </junit>
    507             </jacoco:coverage>
     463            <jacoco:agent destfile="${test.dir}/jacoco@{testITsuffix}.exec" enabled="@{coverage}" includes="${jacoco.includes}" dumponexit="true"
     464                    inclbootstrapclasses="${jacoco.inclbootstrapclasses}" inclnolocationclasses="${jacoco.inclnolocationclasses}" property="jacocoagent@{testfamily}@{testITsuffix}" />
     465            <junitlauncher printsummary="${junit.printsummary}" failureproperty="test.@{testfamily}@{testITsuffix}.failed">
     466                <classpath>
     467                    <path refid="test.classpath"/>
     468                    <pathelement path="${test.dir}/build/unit"/> <!-- required for functional/etc to have JOSMTestRules -->
     469                    <pathelement path="${test.dir}/build/@{testfamily}"/>
     470                </classpath>
     471                <testclasses outputDir="${test.dir}/report">
     472                    <fileset dir="${test.dir}/build/@{testfamily}" includes="@{includes}" excludes="@{excludes}"/>
     473                        <fork>
     474                            <jvmarg value="${jacocoagent@{testfamily}@{testITsuffix}}" if:set="jacocoagent@{testfamily}@{testITsuffix}" />
     475                            <jvmarg value="-Dfile.encoding=UTF-8"/>
     476                            <jvmarg value="-javaagent:${test.dir}/lib/jmockit.jar"/>
     477                            <jvmarg value="--add-modules" if:set="isJava9" unless:set="isJava11" />
     478                            <jvmarg value="java.activation,java.se.ee" if:set="isJava9" unless:set="isJava11" />
     479                            <jvmarg value="--add-exports" if:set="isJava9" unless:set="noJavaFX" />
     480                            <jvmarg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" unless:set="noJavaFX" />
     481                            <jvmarg value="--add-exports" if:set="isJava9" unless:set="isJava11" />
     482                            <jvmarg value="jdk.deploy/com.sun.deploy.config=ALL-UNNAMED" if:set="isJava9" unless:set="isJava11" />
     483                            <jvmarg value="--add-opens" if:set="isJava9" />
     484                            <jvmarg value="java.base/java.io=ALL-UNNAMED" if:set="isJava9" />
     485                            <jvmarg value="--add-opens" if:set="isJava9" />
     486                            <jvmarg value="java.base/java.lang=ALL-UNNAMED" if:set="isJava9" />
     487                            <jvmarg value="--add-opens" if:set="isJava9" />
     488                            <jvmarg value="java.base/java.nio=ALL-UNNAMED" if:set="isJava9" />
     489                            <jvmarg value="--add-opens" if:set="isJava9" />
     490                            <jvmarg value="java.base/java.text=ALL-UNNAMED" if:set="isJava9" />
     491                            <jvmarg value="--add-opens" if:set="isJava9" />
     492                            <jvmarg value="java.base/java.util=ALL-UNNAMED" if:set="isJava9" />
     493                            <jvmarg value="--add-opens" if:set="isJava9" />
     494                            <jvmarg value="java.base/jdk.internal.loader=ALL-UNNAMED" if:set="isJava9" />
     495                            <jvmarg value="--add-opens" if:set="isJava9" />
     496                            <jvmarg value="java.desktop/java.awt=ALL-UNNAMED" if:set="isJava9" />
     497                            <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
     498                            <sysproperty key="josm.test.data" value="${test.dir}/data"/>
     499                            <sysproperty key="java.awt.headless" value="${test.headless}"/>
     500                            <sysproperty key="glass.platform" value="Monocle"/>
     501                            <sysproperty key="monocle.platform" value="Headless"/>
     502                            <sysproperty key="prism.order" value="sw"/>
     503                            <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
     504                        </fork>
     505                    <listener type="legacy-plain" />
     506                    <listener type="legacy-xml" />
     507                </testclasses>
     508            </junitlauncher>
    508509        </sequential>
    509510    </macrodef>
    510511    <target name="test" depends="test-compile" unless="test.notRequired"
     
    617618
    618619        # Keep serialization code
    619620        -keepclassmembers class * implements java.io.Serializable {
    620             static final long serialVersionUID; 
     621            static final long serialVersionUID;
    621622            private static final java.io.ObjectStreamField[] serialPersistentFields;
    622623            private void writeObject(java.io.ObjectOutputStream);
    623624            private void readObject(java.io.ObjectInputStream);
    624             java.lang.Object writeReplace(); 
     625            java.lang.Object writeReplace();
    625626            java.lang.Object readResolve();
    626627        }
    627628
  • ivy.xml

     
    5656        </dependency>
    5757        <dependency conf="test->default" org="com.github.tomakehurst" name="wiremock" rev="2.26.3"/>
    5858        <dependency conf="test->default" org="io.github.classgraph" name="classgraph" rev="4.8.67"/>
    59         <dependency conf="test->default" org="junit" name="junit" rev="4.12"/>
     59        <dependency conf="test->default" org="org.junit.platform" name="junit-platform-launcher" rev="1.6.2"/>
     60        <dependency conf="test->default" org="org.junit.vintage" name="junit-vintage-engine" rev="5.6.2"/>
     61        <dependency conf="test->default" org="org.junit.jupiter" name="junit-jupiter-api" rev="5.6.2"/>
     62        <dependency conf="test->default" org="org.junit.jupiter" name="junit-jupiter-engine" rev="5.6.2"/>
     63        <dependency conf="test->default" org="org.junit.jupiter" name="junit-jupiter-migrationsupport" rev="5.6.2"/>
    6064        <dependency conf="test->default" org="net.trajano.commons" name="commons-testing" rev="2.1.0"/>
    6165        <dependency conf="test->default" org="nl.jqno.equalsverifier" name="equalsverifier" rev="3.1.13"/>
    6266        <dependency conf="test->default" org="org.apache.commons" name="commons-lang3" rev="3.10"/>
  • test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java

     
    44import static org.CustomMatchers.hasSize;
    55import static org.CustomMatchers.isEmpty;
    66import static org.hamcrest.CoreMatchers.not;
     7import static org.hamcrest.MatcherAssert.assertThat;
    78import static org.junit.Assert.assertEquals;
    89import static org.junit.Assert.assertNotNull;
    9 import static org.junit.Assert.assertThat;
    1010import static org.junit.Assert.assertTrue;
    1111
    1212import java.util.Arrays;
  • test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java

     
    2323import java.util.logging.Handler;
    2424
    2525import org.awaitility.Awaitility;
     26import org.junit.jupiter.api.extension.AfterEachCallback;
     27import org.junit.jupiter.api.extension.BeforeEachCallback;
     28import org.junit.jupiter.api.extension.ExtensionContext;
    2629import org.junit.rules.TemporaryFolder;
    2730import org.junit.rules.TestRule;
    2831import org.junit.runner.Description;
     
    7881 *
    7982 * @author Michael Zangl
    8083 */
    81 public class JOSMTestRules implements TestRule {
     84public class JOSMTestRules implements TestRule, AfterEachCallback, BeforeEachCallback {
    8285    private int timeout = isDebugMode() ? -1 : 10 * 1000;
    8386    private TemporaryFolder josmHome;
    8487    private boolean usePreferences = false;
     
    432435        return statement;
    433436    }
    434437
     438    @Override
     439    public void beforeEach(ExtensionContext context) throws Exception {
     440        Statement temporaryStatement = new Statement() {
     441            @Override
     442            public void evaluate() throws Throwable {
     443                // do nothing
     444            }
     445        };
     446        try {
     447            this.apply(temporaryStatement,
     448                    Description.createTestDescription(this.getClass(), "JOSMTestRules JUnit5 Compatibility"))
     449                    .evaluate();
     450        } catch (Throwable e) {
     451            throw new Exception(e);
     452        }
     453    }
     454
     455    @Override
     456    public void afterEach(ExtensionContext context) throws Exception {
     457        // do nothing for now
     458    }
     459
    435460    /**
    436461     * Set up before running a test
    437462     * @throws InitializationError If an error occurred while creating the required environment.
     
    548573        }
    549574
    550575        if (territories) {
    551             Territories.initializeInternalData();
     576            Territories.initialize();
    552577        }
    553578
    554579        if (this.edtAssertionMockingRunnable != null) {