Ignore:
Timestamp:
2014-08-04T02:45:06+02:00 (10 years ago)
Author:
donvip
Message:

[josm_plugins] support for unit tests

Location:
applications/editors/josm/plugins/graphview
Files:
1 added
7 edited
3 moved

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/graphview/.classpath

    r30416 r30550  
    22<classpath>
    33        <classpathentry kind="src" path="src"/>
     4        <classpathentry kind="src" path="test/unit"/>
    45        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
     6        <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
    57        <classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
    68        <classpathentry kind="output" path="build"/>
  • applications/editors/josm/plugins/graphview/build.xml

    r30530 r30550  
    33    <property name="commit.message" value="option to change graph colors; closes ticket 5523 in JOSM Trac"/>
    44    <property name="plugin.main.version" value="7001"/>
    5     <property name="josm" location="../../core/dist/josm-custom.jar"/>
    6     <property name="plugin.build.dir" value="build"/>
    7     <property name="plugin.src.dir" value="src"/>
    8     <!-- this is the directory where the plugin jar is copied to -->
    9     <property name="plugin.dist.dir" value="../../dist"/>
    10     <property name="ant.build.javac.target" value="1.7"/>
    11     <property name="plugin.dist.dir" value="../../dist"/>
    12     <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
    13     <!--
    14     **********************************************************
    15     ** init - initializes the build
    16     **********************************************************
     5
     6    <!-- Configure these properties (replace "..." accordingly).
     7         See http://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
    178    -->
    18     <target name="init">
    19         <mkdir dir="${plugin.build.dir}"/>
    20     </target>
    21     <!--
    22     **********************************************************
    23     ** compile - complies the source tree
    24     **********************************************************
    25     -->
    26     <target name="compile" depends="init">
    27         <echo message="compiling sources for  ${plugin.jar} ... "/>
    28         <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}" includeantruntime="false">
    29             <compilerarg value="-Xlint:deprecation"/>
    30             <compilerarg value="-Xlint:unchecked"/>
    31         </javac>
    32     </target>
    33     <!--
    34     **********************************************************
    35     ** dist - creates the plugin jar
    36     **********************************************************
    37     -->
    38     <target name="dist" depends="compile,revision">
    39         <echo message="creating ${plugin.jar} ... "/>
    40         <copy todir="${plugin.build.dir}/images">
    41             <fileset dir="images"/>
    42         </copy>
    43         <copy todir="${plugin.build.dir}/data">
    44             <fileset dir="data"/>
    45         </copy>
    46         <copy todir="${plugin.build.dir}/files">
    47             <fileset dir="files"/>
    48         </copy>
    49         <copy todir="${plugin.build.dir}">
    50             <fileset dir=".">
    51                 <include name="LICENSE"/>
    52             </fileset>
    53         </copy>
    54         <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
    55             <manifest>
    56                 <attribute name="Author" value="Tobias Knerr"/>
    57                 <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.graphview.plugin.GraphViewPlugin"/>
    58                 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    59                 <attribute name="Plugin-Description" value="Visualizes routing information as a routing graph."/>
    60                 <attribute name="Plugin-Icon" value="images/preferences/graphview.png"/>
    61                 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/Graphview"/>
    62                 <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
    63                 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    64             </manifest>
    65         </jar>
    66     </target>
    67     <!--
    68     **********************************************************
    69     ** revision - extracts the current revision number for the
    70     **    file build.number and stores it in the XML property
    71     **    version.*
    72     **********************************************************
    73     -->
    74     <target name="revision">
    75         <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
    76             <env key="LANG" value="C"/>
    77             <arg value="info"/>
    78             <arg value="--xml"/>
    79             <arg value="."/>
    80         </exec>
    81         <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
    82         <delete file="REVISION"/>
    83     </target>
    84     <!--
    85     **********************************************************
    86     ** clean - clean up the build environment
    87     **********************************************************
    88     -->
    89     <target name="clean">
    90         <delete dir="${plugin.build.dir}"/>
    91         <delete file="${plugin.jar}"/>
    92     </target>
    93     <!--
    94     **********************************************************
    95     ** install - install the plugin in your local JOSM installation
    96     **********************************************************
    97     -->
    98     <target name="install" depends="dist">
    99         <property environment="env"/>
    100         <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
    101             <and>
    102                 <os family="windows"/>
    103             </and>
    104         </condition>
    105         <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
    106     </target>
    107     <!--
    108          ************************** Publishing the plugin ***********************************
    109         -->
    110     <!--
    111         ** extracts the JOSM release for the JOSM version in ../core and saves it in the
    112         ** property ${coreversion.info.entry.revision}
    113         **
    114         -->
    115     <target name="core-info">
    116         <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
    117             <env key="LANG" value="C"/>
    118             <arg value="info"/>
    119             <arg value="--xml"/>
    120             <arg value="../../core"/>
    121         </exec>
    122         <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
    123         <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
    124         <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
    125         <delete file="core.info.xml"/>
    126     </target>
    127     <!--
    128         ** commits the source tree for this plugin
    129         -->
    130     <target name="commit-current">
    131         <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
    132         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    133             <env key="LANG" value="C"/>
    134             <arg value="commit"/>
    135             <arg value="-m '${commit.message}'"/>
    136             <arg value="."/>
    137         </exec>
    138     </target>
    139     <!--
    140         ** updates (svn up) the source tree for this plugin
    141         -->
    142     <target name="update-current">
    143         <echo>Updating plugin source ...</echo>
    144         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    145             <env key="LANG" value="C"/>
    146             <arg value="up"/>
    147             <arg value="."/>
    148         </exec>
    149         <echo>Updating ${plugin.jar} ...</echo>
    150         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    151             <env key="LANG" value="C"/>
    152             <arg value="up"/>
    153             <arg value="../dist/${plugin.jar}"/>
    154         </exec>
    155     </target>
    156     <!--
    157         ** commits the plugin.jar
    158         -->
    159     <target name="commit-dist">
    160         <echo>
    161     ***** Properties of published ${plugin.jar} *****
    162     Commit message    : '${commit.message}'
    163     Plugin-Mainversion: ${plugin.main.version}
    164     JOSM build version: ${coreversion.info.entry.revision}
    165     Plugin-Version    : ${version.entry.commit.revision}
    166     ***** / Properties of published ${plugin.jar} *****
     9    <property name="plugin.author" value="Tobias Knerr"/>
     10    <property name="plugin.class" value="org.openstreetmap.josm.plugins.graphview.plugin.GraphViewPlugin"/>
     11    <property name="plugin.description" value="Visualizes routing information as a routing graph."/>
     12    <property name="plugin.icon" value="images/preferences/graphview.png"/>
     13    <property name="plugin.link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/Graphview"/>
    16714
    168     Now commiting ${plugin.jar} ...
    169     </echo>
    170         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    171             <env key="LANG" value="C"/>
    172             <arg value="-m '${commit.message}'"/>
    173             <arg value="commit"/>
    174             <arg value="${plugin.jar}"/>
    175         </exec>
    176     </target>
    177     <!-- ** make sure svn is present as a command line tool ** -->
    178     <target name="ensure-svn-present">
    179         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
    180             <env key="LANG" value="C"/>
    181             <arg value="--version"/>
    182         </exec>
    183         <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
    184             <!-- return code not set at all? Most likely svn isn't installed -->
    185             <condition>
    186                 <not>
    187                     <isset property="svn.exit.code"/>
    188                 </not>
    189             </condition>
    190         </fail>
    191         <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
    192             <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
    193             <condition>
    194                 <isfailure code="${svn.exit.code}"/>
    195             </condition>
    196         </fail>
    197     </target>
    198     <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
    199         </target>
     15    <!-- ** include targets that all plugins have in common ** -->
     16    <import file="../build-common.xml"/>
    20017</project>
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/preferences/InternalRuleset.java

    r23189 r30550  
    33public enum InternalRuleset {
    44
    5     DEFAULT("files/accessRuleset.xml"),
    6     GERMANY("files/accessRuleset_de.xml");
     5    DEFAULT("resources/accessRuleset.xml"),
     6    GERMANY("resources/accessRuleset_de.xml");
    77
    88    private String resourceName;
  • applications/editors/josm/plugins/graphview/test

    • Property svn:externals set to
    • Property svn:ignore set to
      build
      jacoco.exec
      report
  • applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/access/AccessRulesetReaderTest.java

    r23189 r30550  
    2525    public void testReadAccessRuleset_valid_classes() throws IOException {
    2626
    27         InputStream is = new FileInputStream("plugins/graphview/test/files/accessRuleset_valid.xml");
     27        InputStream is = new FileInputStream("plugins/graphview/test/data/accessRuleset_valid.xml");
    2828        AccessRuleset ruleset = AccessRulesetReader.readAccessRuleset(is);
    2929        assertNotNull(ruleset);
     
    5151    public void testReadAccessRuleset_valid_basetags() throws IOException {
    5252
    53         InputStream is = new FileInputStream("plugins/graphview/test/files/accessRuleset_valid.xml");
     53        InputStream is = new FileInputStream("plugins/graphview/test/data/accessRuleset_valid.xml");
    5454        AccessRuleset ruleset = AccessRulesetReader.readAccessRuleset(is);
    5555        assertNotNull(ruleset);
     
    6767    public void testReadAccessRuleset_valid_implications() throws IOException {
    6868
    69         InputStream is = new FileInputStream("plugins/graphview/test/files/accessRuleset_valid.xml");
     69        InputStream is = new FileInputStream("plugins/graphview/test/data/accessRuleset_valid.xml");
    7070        AccessRuleset ruleset = AccessRulesetReader.readAccessRuleset(is);
    7171        assertNotNull(ruleset);
     
    107107        return new MapBasedTagGroup(tagMap);
    108108    }
    109 
    110109}
  • applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/util/TagConditionLogicTest.java

    r23189 r30550  
    11package org.openstreetmap.josm.plugins.graphview.core.util;
    2 import static junit.framework.Assert.assertFalse;
    3 import static junit.framework.Assert.assertTrue;
     2import static org.junit.Assert.assertFalse;
     3import static org.junit.Assert.assertTrue;
    44
    55import java.util.Arrays;
  • applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/util/ValueStringParserTest.java

    r23189 r30550  
    11package org.openstreetmap.josm.plugins.graphview.core.util;
    22
    3 import static junit.framework.Assert.assertNull;
     3import static org.junit.Assert.assertNull;
    44import static org.openstreetmap.josm.plugins.graphview.core.util.ValueStringParser.parseMeasure;
    55import static org.openstreetmap.josm.plugins.graphview.core.util.ValueStringParser.parseSpeed;
Note: See TracChangeset for help on using the changeset viewer.