Index: applications/editors/josm/plugins/graphview/.classpath
===================================================================
--- applications/editors/josm/plugins/graphview/.classpath	(revision 30532)
+++ applications/editors/josm/plugins/graphview/.classpath	(revision 30550)
@@ -2,5 +2,7 @@
 <classpath>
 	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="test/unit"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
 	<classpathentry kind="output" path="build"/>
Index: applications/editors/josm/plugins/graphview/build.xml
===================================================================
--- applications/editors/josm/plugins/graphview/build.xml	(revision 30532)
+++ applications/editors/josm/plugins/graphview/build.xml	(revision 30550)
@@ -3,198 +3,15 @@
     <property name="commit.message" value="option to change graph colors; closes ticket 5523 in JOSM Trac"/>
     <property name="plugin.main.version" value="7001"/>
-    <property name="josm" location="../../core/dist/josm-custom.jar"/>
-    <property name="plugin.build.dir" value="build"/>
-    <property name="plugin.src.dir" value="src"/>
-    <!-- this is the directory where the plugin jar is copied to -->
-    <property name="plugin.dist.dir" value="../../dist"/>
-    <property name="ant.build.javac.target" value="1.7"/>
-    <property name="plugin.dist.dir" value="../../dist"/>
-    <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
-    <!--
-    **********************************************************
-    ** init - initializes the build
-    **********************************************************
+
+    <!-- Configure these properties (replace "..." accordingly).
+         See http://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
     -->
-    <target name="init">
-        <mkdir dir="${plugin.build.dir}"/>
-    </target>
-    <!--
-    **********************************************************
-    ** compile - complies the source tree
-    **********************************************************
-    -->
-    <target name="compile" depends="init">
-        <echo message="compiling sources for  ${plugin.jar} ... "/>
-        <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}" includeantruntime="false">
-            <compilerarg value="-Xlint:deprecation"/>
-            <compilerarg value="-Xlint:unchecked"/>
-        </javac>
-    </target>
-    <!--
-    **********************************************************
-    ** dist - creates the plugin jar
-    **********************************************************
-    -->
-    <target name="dist" depends="compile,revision">
-        <echo message="creating ${plugin.jar} ... "/>
-        <copy todir="${plugin.build.dir}/images">
-            <fileset dir="images"/>
-        </copy>
-        <copy todir="${plugin.build.dir}/data">
-            <fileset dir="data"/>
-        </copy>
-        <copy todir="${plugin.build.dir}/files">
-            <fileset dir="files"/>
-        </copy>
-        <copy todir="${plugin.build.dir}">
-            <fileset dir=".">
-                <include name="LICENSE"/>
-            </fileset>
-        </copy>
-        <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
-            <manifest>
-                <attribute name="Author" value="Tobias Knerr"/>
-                <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.graphview.plugin.GraphViewPlugin"/>
-                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
-                <attribute name="Plugin-Description" value="Visualizes routing information as a routing graph."/>
-                <attribute name="Plugin-Icon" value="images/preferences/graphview.png"/>
-                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/Graphview"/>
-                <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
-                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
-            </manifest>
-        </jar>
-    </target>
-    <!--
-    **********************************************************
-    ** revision - extracts the current revision number for the
-    **    file build.number and stores it in the XML property
-    **    version.*
-    **********************************************************
-    -->
-    <target name="revision">
-        <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
-            <env key="LANG" value="C"/>
-            <arg value="info"/>
-            <arg value="--xml"/>
-            <arg value="."/>
-        </exec>
-        <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
-        <delete file="REVISION"/>
-    </target>
-    <!--
-    **********************************************************
-    ** clean - clean up the build environment
-    **********************************************************
-    -->
-    <target name="clean">
-        <delete dir="${plugin.build.dir}"/>
-        <delete file="${plugin.jar}"/>
-    </target>
-    <!--
-    **********************************************************
-    ** install - install the plugin in your local JOSM installation
-    **********************************************************
-    -->
-    <target name="install" depends="dist">
-        <property environment="env"/>
-        <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
-            <and>
-                <os family="windows"/>
-            </and>
-        </condition>
-        <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
-    </target>
-    <!--
-         ************************** Publishing the plugin ***********************************
-        -->
-    <!--
-        ** extracts the JOSM release for the JOSM version in ../core and saves it in the
-        ** property ${coreversion.info.entry.revision}
-        **
-        -->
-    <target name="core-info">
-        <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
-            <env key="LANG" value="C"/>
-            <arg value="info"/>
-            <arg value="--xml"/>
-            <arg value="../../core"/>
-        </exec>
-        <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
-        <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
-        <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
-        <delete file="core.info.xml"/>
-    </target>
-    <!--
-        ** commits the source tree for this plugin
-        -->
-    <target name="commit-current">
-        <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
-        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
-            <env key="LANG" value="C"/>
-            <arg value="commit"/>
-            <arg value="-m '${commit.message}'"/>
-            <arg value="."/>
-        </exec>
-    </target>
-    <!--
-        ** updates (svn up) the source tree for this plugin
-        -->
-    <target name="update-current">
-        <echo>Updating plugin source ...</echo>
-        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
-            <env key="LANG" value="C"/>
-            <arg value="up"/>
-            <arg value="."/>
-        </exec>
-        <echo>Updating ${plugin.jar} ...</echo>
-        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
-            <env key="LANG" value="C"/>
-            <arg value="up"/>
-            <arg value="../dist/${plugin.jar}"/>
-        </exec>
-    </target>
-    <!--
-        ** commits the plugin.jar
-        -->
-    <target name="commit-dist">
-        <echo>
-    ***** Properties of published ${plugin.jar} *****
-    Commit message    : '${commit.message}'
-    Plugin-Mainversion: ${plugin.main.version}
-    JOSM build version: ${coreversion.info.entry.revision}
-    Plugin-Version    : ${version.entry.commit.revision}
-    ***** / Properties of published ${plugin.jar} *****
+    <property name="plugin.author" value="Tobias Knerr"/>
+    <property name="plugin.class" value="org.openstreetmap.josm.plugins.graphview.plugin.GraphViewPlugin"/>
+    <property name="plugin.description" value="Visualizes routing information as a routing graph."/>
+    <property name="plugin.icon" value="images/preferences/graphview.png"/>
+    <property name="plugin.link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/Graphview"/>
 
-    Now commiting ${plugin.jar} ...
-    </echo>
-        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
-            <env key="LANG" value="C"/>
-            <arg value="-m '${commit.message}'"/>
-            <arg value="commit"/>
-            <arg value="${plugin.jar}"/>
-        </exec>
-    </target>
-    <!-- ** make sure svn is present as a command line tool ** -->
-    <target name="ensure-svn-present">
-        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
-            <env key="LANG" value="C"/>
-            <arg value="--version"/>
-        </exec>
-        <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
-            <!-- return code not set at all? Most likely svn isn't installed -->
-            <condition>
-                <not>
-                    <isset property="svn.exit.code"/>
-                </not>
-            </condition>
-        </fail>
-        <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
-            <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
-            <condition>
-                <isfailure code="${svn.exit.code}"/>
-            </condition>
-        </fail>
-    </target>
-    <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
-        </target>
+    <!-- ** include targets that all plugins have in common ** -->
+    <import file="../build-common.xml"/>
 </project>
Index: applications/editors/josm/plugins/graphview/resources/accessRuleset.xml
===================================================================
--- applications/editors/josm/plugins/graphview/resources/accessRuleset.xml	(revision 30550)
+++ applications/editors/josm/plugins/graphview/resources/accessRuleset.xml	(revision 30550)
@@ -0,0 +1,206 @@
+<accessRuleset>
+
+	<classes>
+		<class name="access">
+			<class name="foot"/>
+			<class name="horse"/>
+			<class name="vehicle">
+				<class name="bicycle" />
+				<class name="carriage" />
+				<class name="motor_vehicle">
+					<class name="motorcycle">
+						<class name="moped"/>
+					</class>
+					<class name="motorcar">
+						<class name="caravan"/>
+						<class name="goods"/>
+						<class name="hgv"/>
+						<class name="psv"/>
+						<class name="agricultural"/>
+						<class name="emergency"/>
+						<class name="hazmat"/>
+					</class>
+					<class name="motorboat"/>
+					<class name="boat"/>
+				</class>
+				<class name="bicycle" />
+			</class>
+		</class>
+	</classes>
+	
+	<basetags>
+		<tag k="highway" v="motorway"/>
+		<tag k="highway" v="motorway_link"/>
+		<tag k="highway" v="trunk"/>
+		<tag k="highway" v="trunk_link"/>
+		<tag k="highway" v="primary"/>
+		<tag k="highway" v="primary_link"/>
+		<tag k="highway" v="secondary"/>
+		<tag k="highway" v="secondary_link"/>
+		<tag k="highway" v="tertiary"/>
+        <tag k="highway" v="tertiary_link"/>
+		<tag k="highway" v="unclassified"/>
+		<tag k="highway" v="road"/>
+		<tag k="highway" v="residential"/>
+		<tag k="highway" v="living_street"/>
+		<tag k="highway" v="service"/>
+		<tag k="highway" v="track"/>
+		<tag k="highway" v="pedestrian"/>
+		<tag k="highway" v="path"/>
+		<tag k="highway" v="cycleway"/>
+		<tag k="highway" v="footway"/>
+		<tag k="highway" v="bridleway"/>
+		<tag k="highway" v="byway"/>
+		<tag k="highway" v="steps"/>
+		<tag k="highway" v="platform"/>
+		<tag k="railway" v="platform"/>
+	</basetags>
+		
+	<implications>
+			
+		<!-- implications based on 
+		     http://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Access-Restrictions
+		     section Default  -->
+	
+		<implication>
+			<condition>
+				<tag k="highway" v="motorway" />
+			</condition>
+			<implies>
+				<tag k="access"  v="designated"/>
+				<tag k="moped"   v="no"/>
+				<tag k="horse"   v="no"/>
+				<tag k="bicycle" v="no"/>
+				<tag k="foot"    v="no"/>
+			</implies>
+		</implication>
+		<implication>
+			<condition>
+				<or>
+					<tag k="highway" v="trunk" />
+					<tag k="highway" v="primary" />
+					<tag k="highway" v="secondary" />
+					<tag k="highway" v="tertiary" />
+					<tag k="highway" v="unclassified" />
+					<tag k="highway" v="residential" />
+					<tag k="highway" v="living_street" />
+					<tag k="highway" v="road" />
+				</or>
+			</condition>
+			<implies>
+				<tag k="access"  v="yes"/>
+			</implies>
+		</implication>
+		
+		<implication>
+			<condition>
+				<tag k="highway" v="pedestrian" />
+			</condition>
+			<implies>
+				<tag k="access" v="no"/>
+				<tag k="foot"   v="yes"/>
+			</implies>
+		</implication>		
+		<implication>
+			<condition>
+				<tag k="highway" v="path" />
+			</condition>
+			<implies>
+				<tag k="access"  v="no"/>
+				<tag k="horse"   v="yes"/>
+				<tag k="bicycle" v="yes"/>
+				<tag k="foot"    v="yes"/>
+			</implies>
+		</implication>
+		
+		<implication>
+			<condition>
+				<tag k="highway" v="bridleway" />
+			</condition>
+			<implies>
+				<tag k="access" v="no"/>
+				<tag k="horse"  v="designated"/>
+			</implies>
+		</implication>
+		<implication>
+			<condition>
+				<tag k="highway" v="cycleway" />
+			</condition>
+			<implies>
+				<tag k="access"  v="no"/>
+				<tag k="bicycle" v="designated"/>
+			</implies>
+		</implication>
+		<implication>
+			<condition>
+				<tag k="highway" v="footway" />
+			</condition>
+			<implies>
+				<tag k="access" v="no"/>
+				<tag k="foot"   v="designated"/>
+			</implies>
+		</implication>
+		
+		<!--  barriers -->
+		
+		<implication>
+			<condition>
+				<key k="barrier" />				
+			</condition>
+			<implies>
+				<tag k="access" v="no" />
+			</implies>
+		</implication>
+		
+		<implication>
+			<condition>
+				<tag k="barrier" v="bollard" />				
+			</condition>
+			<implies>
+				<tag k="foot" v="yes" />
+				<tag k="bicycle" v="yes" />
+			</implies>
+		</implication>
+			
+		<!--  direct implications -->
+		
+		<implication>
+			<condition>
+				<tag k="highway" v="motorway" />
+			</condition>
+			<implies>
+				<tag k="oneway" v="yes" />
+			</implies>
+		</implication>
+		
+		<implication>
+			<condition>
+				<tag k="highway" v="motorway_link" />
+			</condition>
+			<implies>
+				<tag k="oneway" v="yes" />
+			</implies>
+		</implication>
+		
+		<implication>
+			<condition>
+				<tag k="junction" v="roundabout" />
+			</condition>
+			<implies>
+				<tag k="oneway"  v="yes"/>
+			</implies>
+		</implication>
+		
+		<implication>
+			<condition>
+				<tag k="highway" v="steps" />
+			</condition>
+			<implies>
+				<tag k="access"  v="no"/>
+				<tag k="foot"  v="yes"/>
+			</implies>
+		</implication>
+						
+	</implications>
+	
+</accessRuleset>
Index: applications/editors/josm/plugins/graphview/resources/accessRuleset_de.xml
===================================================================
--- applications/editors/josm/plugins/graphview/resources/accessRuleset_de.xml	(revision 30550)
+++ applications/editors/josm/plugins/graphview/resources/accessRuleset_de.xml	(revision 30550)
@@ -0,0 +1,216 @@
+<accessRuleset>
+
+	<classes>
+		<class name="access">
+			<class name="foot"/>
+			<class name="horse"/>
+			<class name="vehicle">
+				<class name="bicycle" />
+				<class name="carriage" />
+				<class name="motor_vehicle">
+					<class name="motorcycle">
+						<class name="moped"/>
+					</class>
+					<class name="motorcar">
+						<class name="caravan"/>
+						<class name="goods"/>
+						<class name="hgv"/>
+						<class name="psv"/>
+						<class name="agricultural"/>
+						<class name="emergency"/>
+						<class name="hazmat"/>
+					</class>
+					<class name="motorboat"/>
+					<class name="boat"/>
+				</class>
+				<class name="bicycle" />
+			</class>
+		</class>
+	</classes>
+	
+	<basetags>
+		<tag k="highway" v="motorway"/>
+		<tag k="highway" v="motorway_link"/>
+		<tag k="highway" v="trunk"/>
+		<tag k="highway" v="trunk_link"/>
+		<tag k="highway" v="primary"/>
+		<tag k="highway" v="primary_link"/>
+		<tag k="highway" v="secondary"/>
+		<tag k="highway" v="secondary_link"/>
+		<tag k="highway" v="tertiary"/>
+        <tag k="highway" v="tertiary_link"/>
+		<tag k="highway" v="unclassified"/>
+		<tag k="highway" v="road"/>
+		<tag k="highway" v="residential"/>
+		<tag k="highway" v="living_street"/>
+		<tag k="highway" v="service"/>
+		<tag k="highway" v="track"/>
+		<tag k="highway" v="pedestrian"/>
+		<tag k="highway" v="path"/>
+		<tag k="highway" v="cycleway"/>
+		<tag k="highway" v="footway"/>
+		<tag k="highway" v="bridleway"/>
+		<tag k="highway" v="byway"/>
+		<tag k="highway" v="steps"/>
+		<tag k="highway" v="platform"/>
+		<tag k="railway" v="platform"/>
+	</basetags>
+		
+	<implications>
+			
+		<!-- implications based on 
+		     http://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Access-Restrictions
+		     section Germany  -->
+	
+		<implication>
+			<condition>
+				<tag k="highway" v="motorway" />
+			</condition>
+			<implies>
+				<tag k="access"  v="yes"/>
+				<tag k="moped"   v="no"/>
+				<tag k="horse"   v="no"/>
+				<tag k="bicycle" v="no"/>
+				<tag k="foot"    v="no"/>
+			</implies>
+		</implication>
+		<implication>
+			<condition>
+				<or>
+					<tag k="highway" v="trunk" />
+					<tag k="highway" v="primary" />
+					<tag k="highway" v="secondary" />
+					<tag k="highway" v="tertiary" />
+					<tag k="highway" v="unclassified" />
+					<tag k="highway" v="residential" />
+					<tag k="highway" v="living_street" />
+					<tag k="highway" v="road" />
+				</or>
+			</condition>
+			<implies>
+				<tag k="access"  v="yes"/>
+			</implies>
+		</implication>
+			
+		<implication>
+			<condition>
+				<tag k="highway" v="path" />
+			</condition>
+			<implies>
+				<tag k="access"  v="no"/>
+				<tag k="horse"   v="yes"/>
+				<tag k="bicycle" v="yes"/>
+				<tag k="foot"    v="yes"/>
+			</implies>
+		</implication>
+		
+		<implication>
+			<condition>
+				<tag k="highway" v="bridleway" />
+			</condition>
+			<implies>
+				<tag k="access" v="no"/>
+				<tag k="horse"  v="designated"/>
+			</implies>
+		</implication>
+		<implication>
+			<condition>
+				<tag k="highway" v="cycleway" />
+			</condition>
+			<implies>
+				<tag k="access"  v="no"/>
+				<tag k="bicycle" v="designated"/>
+			</implies>
+		</implication>
+		<implication>
+			<condition>
+				<or>
+					<tag k="highway" v="footway" />
+					<tag k="highway" v="pedestrian" />
+				</or>
+			</condition>
+			<implies>
+				<tag k="access" v="no"/>
+				<tag k="foot"   v="designated"/>
+			</implies>
+		</implication>
+		
+		<!--  local non-base-tags -->
+		
+		<implication>
+			<condition>
+				<tag k="motorroad" v="yes"/>
+			</condition>
+			<implies>
+				<tag k="minspeed"     v="60"/>
+				<tag k="foot"         v="no"/>
+				<tag k="bicycle"      v="no"/>				
+				<tag k="moped"        v="no"/>								
+				<tag k="horse"        v="no"/>								
+				<tag k="agricultural" v="no"/>
+			</implies>		
+		</implication>
+				
+		<!--  barriers -->
+		
+		<implication>
+			<condition>
+				<key k="barrier" />				
+			</condition>
+			<implies>
+				<tag k="access" v="no" />
+			</implies>
+		</implication>
+		
+		<implication>
+			<condition>
+				<tag k="barrier" v="bollard" />				
+			</condition>
+			<implies>
+				<tag k="foot" v="yes" />
+				<tag k="bicycle" v="yes" />
+			</implies>
+		</implication>
+			
+		<!--  direct implications -->
+		
+		<implication>
+			<condition>
+				<tag k="highway" v="motorway" />
+			</condition>
+			<implies>
+				<tag k="oneway" v="yes" />
+			</implies>
+		</implication>
+		
+		<implication>
+			<condition>
+				<tag k="highway" v="motorway_link" />
+			</condition>
+			<implies>
+				<tag k="oneway" v="yes" />
+			</implies>
+		</implication>
+		
+		<implication>
+			<condition>
+				<tag k="junction" v="roundabout" />
+			</condition>
+			<implies>
+				<tag k="oneway"  v="yes"/>
+			</implies>
+		</implication>
+		
+		<implication>
+			<condition>
+				<tag k="highway" v="steps" />
+			</condition>
+			<implies>
+				<tag k="access"  v="no"/>
+				<tag k="foot"  v="yes"/>
+			</implies>
+		</implication>
+		
+	</implications>
+	
+</accessRuleset>
Index: applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/preferences/InternalRuleset.java
===================================================================
--- applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/preferences/InternalRuleset.java	(revision 30532)
+++ applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/preferences/InternalRuleset.java	(revision 30550)
@@ -3,6 +3,6 @@
 public enum InternalRuleset {
 
-    DEFAULT("files/accessRuleset.xml"),
-    GERMANY("files/accessRuleset_de.xml");
+    DEFAULT("resources/accessRuleset.xml"),
+    GERMANY("resources/accessRuleset_de.xml");
 
     private String resourceName;
Index: applications/editors/josm/plugins/graphview/test/data/accessRuleset_valid.xml
===================================================================
--- applications/editors/josm/plugins/graphview/test/data/accessRuleset_valid.xml	(revision 30550)
+++ applications/editors/josm/plugins/graphview/test/data/accessRuleset_valid.xml	(revision 30550)
@@ -0,0 +1,54 @@
+<accessRuleset>
+	<unknown></unknown>
+	<classes>
+		<class name="vehicle">
+			<class name="motor_vehicle">
+				<class name="bus"></class>
+			</class>
+			<class name="bicycle" />
+		</class>
+	</classes>
+	<unknown />
+	
+	<basetags>
+		<tag k="highway" v="residential"/>
+		<tag k="highway" v="cycleway"/>		
+	</basetags>
+	
+	<implications>
+		<implication>
+			<condition>
+				<tag k="highway" v="cycleway"/>
+			</condition>
+			<implies>
+				<tag k="bicycle" v="designated"/>
+			</implies>
+		</implication>
+		<implication>
+			<condition>
+				<and>
+					<tag k="highway" v="steps"/>
+					<not>
+						<key k="escalator"/>
+					</not>
+				</and>
+			</condition>
+			<implies>
+				<tag k="normal_steps" v="yes"/>
+			</implies>
+		</implication>
+		<implication>
+			<condition>
+				<or>
+					<tag k="construction" v="yes"/>
+					<tag k="disused" v="yes"/>
+					<tag k="abandoned" v="yes"/>
+				</or>
+			</condition>
+			<implies>
+				<tag k="usable" v="no"/>
+			</implies>
+		</implication>
+	</implications>
+	
+</accessRuleset>
Index: applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/FullGraphCreationTest.java
===================================================================
--- applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/FullGraphCreationTest.java	(revision 30550)
+++ applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/FullGraphCreationTest.java	(revision 30550)
@@ -0,0 +1,181 @@
+package org.openstreetmap.josm.plugins.graphview.core;
+
+import static org.junit.Assert.assertSame;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
+
+import org.junit.Test;
+import org.openstreetmap.josm.plugins.graphview.core.TestDataSource.TestNode;
+import org.openstreetmap.josm.plugins.graphview.core.TestDataSource.TestRelation;
+import org.openstreetmap.josm.plugins.graphview.core.TestDataSource.TestRelationMember;
+import org.openstreetmap.josm.plugins.graphview.core.TestDataSource.TestWay;
+import org.openstreetmap.josm.plugins.graphview.core.access.AccessParameters;
+import org.openstreetmap.josm.plugins.graphview.core.access.AccessRuleset;
+import org.openstreetmap.josm.plugins.graphview.core.access.AccessType;
+import org.openstreetmap.josm.plugins.graphview.core.access.Implication;
+import org.openstreetmap.josm.plugins.graphview.core.data.Tag;
+import org.openstreetmap.josm.plugins.graphview.core.graph.TSBasedWayGraph;
+import org.openstreetmap.josm.plugins.graphview.core.graph.WayGraph;
+import org.openstreetmap.josm.plugins.graphview.core.property.RoadPropertyType;
+import org.openstreetmap.josm.plugins.graphview.core.property.RoadWidth;
+import org.openstreetmap.josm.plugins.graphview.core.property.VehiclePropertyType;
+import org.openstreetmap.josm.plugins.graphview.core.property.VehiclePropertyTypes;
+import org.openstreetmap.josm.plugins.graphview.core.transition.GenericTransitionStructure;
+import org.openstreetmap.josm.plugins.graphview.core.transition.TransitionStructure;
+import org.openstreetmap.josm.plugins.graphview.plugin.preferences.PreferenceAccessParameters;
+import org.openstreetmap.josm.plugins.graphview.plugin.preferences.VehiclePropertyStringParser.PropertyValueSyntaxException;
+
+public class FullGraphCreationTest {
+
+    private static final AccessParameters ACCESS_PARAMS;
+    static {
+        Map<VehiclePropertyType<?>, String> vehiclePropertyValues =
+            new HashMap<VehiclePropertyType<?>, String>();
+        vehiclePropertyValues.put(VehiclePropertyTypes.WIDTH, "3.0");
+
+        try {
+            ACCESS_PARAMS = new PreferenceAccessParameters(
+                    "test_vehicle",
+                    Arrays.asList(AccessType.UNDEFINED),
+                    vehiclePropertyValues);
+        } catch (PropertyValueSyntaxException e) {
+            throw new Error(e);
+        }
+    }
+
+    private static final AccessRuleset TEST_RULESET = new AccessRuleset() {
+        public java.util.List<String> getAccessHierarchyAncestors(String transportMode) {
+            return Arrays.asList(transportMode);
+        }
+        public java.util.Collection<Tag> getBaseTags() {
+            return Arrays.asList(new Tag("highway", "test"));
+        }
+        public java.util.List<Implication> getImplications() {
+            return new LinkedList<Implication>();
+        }
+    };
+
+    @Test
+    public void testTJunction() {
+
+        TestDataSource ds = new TestDataSource();
+
+        TestNode nodeN = new TestNode(2, 1);
+        TestNode nodeW = new TestNode(1, 0);
+        TestNode nodeS = new TestNode(0, 1);
+        TestNode nodeC = new TestNode(1, 1);
+
+        ds.nodes.addAll(Arrays.asList(nodeN, nodeW, nodeS, nodeC));
+
+        TestWay wayNC = new TestWay();
+        wayNC.tags.put("highway", "test");
+        wayNC.nodes.addAll(Arrays.asList(nodeN, nodeC));
+        TestWay wayCS = new TestWay();
+        wayCS.tags.put("highway", "test");
+        wayCS.nodes.addAll(Arrays.asList(nodeC, nodeS));
+        TestWay wayCW = new TestWay();
+        wayCW.tags.put("highway", "test");
+        wayCW.nodes.addAll(Arrays.asList(nodeC, nodeW));
+
+        ds.ways.add(wayNC);
+        ds.ways.add(wayCS);
+        ds.ways.add(wayCW);
+
+        /* variant 1: no restrictions */
+        {
+            TransitionStructure ts1 = createTestTransitionStructure(ds);
+
+            assertSame(4, size(ts1.getNodes()));
+            assertSame(6, size(ts1.getSegments()));
+            assertSame(0, size(ts1.getRestrictions()));
+
+            WayGraph graph1 = new TSBasedWayGraph(ts1);
+
+            assertSame(12, graph1.getNodes().size());
+            assertSame(24, graph1.getEdges().size());
+        }
+        /* variant 2: no left turn from S to W */
+        {
+            ds.relations.add(createTurnRestrictionRelation(wayCS, nodeC, wayCW, "no_left_turn"));
+            TransitionStructure ts2 = createTestTransitionStructure(ds);
+
+            assertSame(4, size(ts2.getNodes()));
+            assertSame(6, size(ts2.getSegments()));
+            assertSame(1, size(ts2.getRestrictions()));
+
+            WayGraph graph2 = new TSBasedWayGraph(ts2);
+
+            assertSame(12, graph2.getNodes().size());
+            assertSame(23, graph2.getEdges().size());
+        }
+
+    }
+
+    @Test
+    public void testBarrier() {
+
+        TestDataSource ds = new TestDataSource();
+
+        TestNode node1 = new TestNode(0, 1);
+        TestNode nodeB = new TestNode(0, 2);
+        nodeB.tags.put("width", "1");
+        TestNode node2 = new TestNode(0, 3);
+
+        ds.nodes.addAll(Arrays.asList(node1, nodeB, node2));
+
+        TestWay way = new TestWay();
+        way.tags.put("highway", "test");
+        way.tags.put("oneway", "yes");
+        way.nodes.addAll(Arrays.asList(node1, nodeB, node2));
+        ds.ways.add(way);
+
+        /* variant 1: no restrictions */
+
+        TransitionStructure ts = createTestTransitionStructure(ds);
+
+        assertSame(3, size(ts.getNodes()));
+        assertSame(2, size(ts.getSegments()));
+        assertSame(1, size(ts.getRestrictions()));
+
+        WayGraph graph = new TSBasedWayGraph(ts);
+
+        assertSame(4, graph.getNodes().size());
+        assertSame(2, graph.getEdges().size());
+
+    }
+
+    private TestRelation createTurnRestrictionRelation(
+            TestWay from, TestNode via, TestWay to, String restriction) {
+        TestRelation resultRelation = new TestRelation();
+        resultRelation.tags.put("type", "restriction");
+        resultRelation.tags.put("restriction", restriction);
+        resultRelation.members.add(new TestRelationMember("from", from));
+        resultRelation.members.add(new TestRelationMember("via", via));
+        resultRelation.members.add(new TestRelationMember("to", to));
+        return resultRelation;
+    }
+
+    private TransitionStructure createTestTransitionStructure(TestDataSource dataSource) {
+
+        LinkedList<RoadPropertyType<?>> properties = new LinkedList<RoadPropertyType<?>>();
+        properties.add(new RoadWidth());
+
+        return new GenericTransitionStructure<TestNode, TestWay, TestRelation, TestRelationMember>(
+                ACCESS_PARAMS, TEST_RULESET, dataSource, properties);
+    }
+
+    private static int size(Iterable<?> iterable) {
+        Iterator<?> iterator = iterable.iterator();
+        int size = 0;
+        while (iterator.hasNext()) {
+            iterator.next();
+            size ++;
+        }
+        return size;
+    }
+
+}
Index: applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/TestDataSource.java
===================================================================
--- applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/TestDataSource.java	(revision 30550)
+++ applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/TestDataSource.java	(revision 30550)
@@ -0,0 +1,144 @@
+package org.openstreetmap.josm.plugins.graphview.core;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.openstreetmap.josm.plugins.graphview.core.data.DataSource;
+import org.openstreetmap.josm.plugins.graphview.core.data.DataSourceObserver;
+import org.openstreetmap.josm.plugins.graphview.core.data.MapBasedTagGroup;
+import org.openstreetmap.josm.plugins.graphview.core.data.TagGroup;
+
+public class TestDataSource implements DataSource<TestDataSource.TestNode, TestDataSource.TestWay, TestDataSource.TestRelation, TestDataSource.TestRelationMember> {
+
+    public static class TestPrimitive {
+        public final Map<String, String> tags = new HashMap<String, String>();
+    };
+
+    public static class TestNode extends TestPrimitive {
+        public final double lat;
+        public final double lon;
+        public TestNode() {
+            this(0, 0);
+        }
+        public TestNode(double lat, double lon) {
+            this.lat = lat;
+            this.lon = lon;
+        }
+        @Override
+        public String toString() {
+            return "(" + lat + ", " + lon + "); " + tags;
+        }
+    }
+
+    public static class TestWay extends TestPrimitive {
+        public final List<TestNode> nodes = new LinkedList<TestNode>();
+        @Override
+        public String toString() {
+            return nodes + "; " + tags;
+        }
+    }
+
+    public static class TestRelation extends TestPrimitive {
+        public final Collection<TestRelationMember> members = new LinkedList<TestRelationMember>();
+        @Override
+        public String toString() {
+            return members + "; " + tags;
+        }
+    }
+
+    public static class TestRelationMember {
+        public final String role;
+        public final TestPrimitive member;
+        public TestRelationMember(String role, TestPrimitive member) {
+            this.role = role;
+            this.member = member;
+        }
+        public TestPrimitive getMember() {
+            return member;
+        }
+        public String getRole() {
+            return role;
+        }
+        @Override
+        public String toString() {
+            return role + "=" + member;
+        }
+    }
+
+
+    public final Collection<TestNode> nodes = new LinkedList<TestNode>();
+    public final Collection<TestWay> ways = new LinkedList<TestWay>();
+    public final Collection<TestRelation> relations = new LinkedList<TestRelation>();
+
+
+    public double getLat(TestNode node) {
+        return node.lat;
+    }
+    public double getLon(TestNode node) {
+        return node.lon;
+    }
+
+    public Iterable<TestRelationMember> getMembers(TestRelation relation) {
+        return relation.members;
+    }
+
+    public Iterable<TestNode> getNodes() {
+        return nodes;
+    }
+
+    public Iterable<TestNode> getNodes(TestWay way) {
+        return way.nodes;
+    }
+
+    public Iterable<TestWay> getWays() {
+        return ways;
+    }
+
+    public Iterable<TestRelation> getRelations() {
+        return relations;
+    }
+
+    public TagGroup getTagsN(TestNode node) {
+        return new MapBasedTagGroup(node.tags);
+    }
+
+    public TagGroup getTagsW(TestWay way) {
+        return new MapBasedTagGroup(way.tags);
+    }
+
+    public TagGroup getTagsR(TestRelation relation) {
+        return new MapBasedTagGroup(relation.tags);
+    }
+
+    public Object getMember(TestRelationMember member) {
+        return member.getMember();
+    }
+
+    public String getRole(TestRelationMember member) {
+        return member.getRole();
+    }
+
+    public boolean isNMember(TestRelationMember member) {
+        return member.getMember() instanceof TestNode;
+    }
+
+    public boolean isWMember(TestRelationMember member) {
+        return member.getMember() instanceof TestWay;
+    }
+
+    public boolean isRMember(TestRelationMember member) {
+        return member.getMember() instanceof TestRelation;
+    }
+
+    public void addObserver(DataSourceObserver observer) {
+        // not needed for test
+    }
+
+    public void deleteObserver(DataSourceObserver observer) {
+        // not needed for test
+    }
+
+}
Index: applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/access/AccessRulesetReaderTest.java
===================================================================
--- applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/access/AccessRulesetReaderTest.java	(revision 30550)
+++ applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/access/AccessRulesetReaderTest.java	(revision 30550)
@@ -0,0 +1,109 @@
+package org.openstreetmap.josm.plugins.graphview.core.access;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+import org.openstreetmap.josm.plugins.graphview.core.data.MapBasedTagGroup;
+import org.openstreetmap.josm.plugins.graphview.core.data.Tag;
+import org.openstreetmap.josm.plugins.graphview.core.data.TagGroup;
+
+
+public class AccessRulesetReaderTest {
+
+    @Test
+    public void testReadAccessRuleset_valid_classes() throws IOException {
+
+        InputStream is = new FileInputStream("plugins/graphview/test/data/accessRuleset_valid.xml");
+        AccessRuleset ruleset = AccessRulesetReader.readAccessRuleset(is);
+        assertNotNull(ruleset);
+
+
+        assertEquals("vehicle", ruleset.getAccessHierarchyAncestors("vehicle").get(0));
+
+        assertEquals("motor_vehicle", ruleset.getAccessHierarchyAncestors("motor_vehicle").get(0));
+        assertEquals("vehicle", ruleset.getAccessHierarchyAncestors("motor_vehicle").get(1));
+
+        assertEquals("bus", ruleset.getAccessHierarchyAncestors("bus").get(0));
+        assertEquals("motor_vehicle", ruleset.getAccessHierarchyAncestors("bus").get(1));
+        assertEquals("vehicle", ruleset.getAccessHierarchyAncestors("bus").get(2));
+
+        assertEquals("bicycle", ruleset.getAccessHierarchyAncestors("bicycle").get(0));
+        assertEquals("vehicle", ruleset.getAccessHierarchyAncestors("bicycle").get(1));
+
+        assertFalse(ruleset.getAccessHierarchyAncestors("bus").contains("bicycle"));
+
+        assertSame(ruleset.getAccessHierarchyAncestors("boat").size(), 0);
+
+    }
+
+    @Test
+    public void testReadAccessRuleset_valid_basetags() throws IOException {
+
+        InputStream is = new FileInputStream("plugins/graphview/test/data/accessRuleset_valid.xml");
+        AccessRuleset ruleset = AccessRulesetReader.readAccessRuleset(is);
+        assertNotNull(ruleset);
+
+        assertSame(2, ruleset.getBaseTags().size());
+
+        assertTrue(ruleset.getBaseTags().contains(new Tag("highway", "residential")));
+        assertTrue(ruleset.getBaseTags().contains(new Tag("highway", "cycleway")));
+        assertFalse(ruleset.getBaseTags().contains(new Tag("building", "residential")));
+        assertFalse(ruleset.getBaseTags().contains(new Tag("highway", "stop")));
+
+    }
+
+    @Test
+    public void testReadAccessRuleset_valid_implications() throws IOException {
+
+        InputStream is = new FileInputStream("plugins/graphview/test/data/accessRuleset_valid.xml");
+        AccessRuleset ruleset = AccessRulesetReader.readAccessRuleset(is);
+        assertNotNull(ruleset);
+
+        List<Implication> implications = ruleset.getImplications();
+
+        assertSame(3, implications.size());
+
+        TagGroup[] tagGroups = new TagGroup[4];
+        tagGroups[0] = createTagGroup(new Tag("highway", "cycleway"));
+        tagGroups[1] = createTagGroup(new Tag("highway", "steps"));
+        tagGroups[2] = createTagGroup(new Tag("highway", "steps"), new Tag("escalator", "yes"));
+        tagGroups[3] = createTagGroup(new Tag("disused", "yes"), new Tag("construction", "no"));
+
+        for (Implication implication : implications) {
+            for (int i = 0; i < tagGroups.length; i++) {
+                tagGroups[i] = implication.apply(tagGroups[i]);
+            }
+        }
+
+        assertSame(2, tagGroups[0].size());
+        assertTrue(tagGroups[0].contains(new Tag("bicycle", "designated")));
+
+        assertSame(2, tagGroups[1].size());
+        assertTrue(tagGroups[1].contains(new Tag("normal_steps", "yes")));
+
+        assertSame(2, tagGroups[2].size());
+        assertFalse(tagGroups[2].contains(new Tag("normal_steps", "yes")));
+
+        assertSame(3, tagGroups[3].size());
+        assertTrue(tagGroups[3].contains(new Tag("usable", "no")));
+    }
+
+    private static TagGroup createTagGroup(Tag... tags) {
+        Map<String, String> tagMap = new HashMap<String, String>();
+        for (Tag tag : tags) {
+            tagMap.put(tag.key, tag.value);
+        }
+        return new MapBasedTagGroup(tagMap);
+    }
+}
Index: applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/property/RoadInclineTest.java
===================================================================
--- applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/property/RoadInclineTest.java	(revision 30550)
+++ applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/property/RoadInclineTest.java	(revision 30550)
@@ -0,0 +1,24 @@
+package org.openstreetmap.josm.plugins.graphview.core.property;
+
+import org.junit.Test;
+import org.openstreetmap.josm.plugins.graphview.core.data.Tag;
+
+public class RoadInclineTest extends RoadPropertyTest {
+
+    private static void testIncline(Float expectedInclineForward, Float expectedInclineBackward,
+            String inclineString) {
+
+        testEvaluateW(new RoadIncline(),
+                expectedInclineForward, expectedInclineBackward,
+                new Tag("incline", inclineString));
+    }
+
+    @Test
+    public void testEvaluate() {
+        testIncline(5f, -5f, "5 %");
+        testIncline(9.5f, -9.5f, "9.5 %");
+        testIncline(-2.5f, 2.5f, "-2.5%");
+        testIncline(null, null, "steep");
+    }
+
+}
Index: applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/property/RoadMaxspeedTest.java
===================================================================
--- applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/property/RoadMaxspeedTest.java	(revision 30550)
+++ applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/property/RoadMaxspeedTest.java	(revision 30550)
@@ -0,0 +1,32 @@
+package org.openstreetmap.josm.plugins.graphview.core.property;
+
+import org.junit.Test;
+import org.openstreetmap.josm.plugins.graphview.core.data.Tag;
+
+public class RoadMaxspeedTest extends RoadPropertyTest {
+
+    private static void testMaxspeed(float expectedMaxspeed, String maxspeedString) {
+        testEvaluateBoth(new RoadMaxspeed(),    expectedMaxspeed, new Tag("maxspeed", maxspeedString));
+    }
+
+    @Test
+    public void testEvaluate_numeric() {
+        testMaxspeed(30, "30");
+        testMaxspeed(48.3f, "48.3");
+    }
+
+    @Test
+    public void testEvaluate_kmh() {
+        testMaxspeed(50, "50 km/h");
+        testMaxspeed(120, "120km/h");
+        testMaxspeed(30, "30    km/h");
+    }
+
+    @Test
+    public void testEvaluate_mph() {
+        testMaxspeed(72.42048f, "45 mph");
+        testMaxspeed(64.373764f, "40mph");
+        testMaxspeed(24.14016f, "15 mph");
+    }
+
+}
Index: applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/property/RoadPropertyTest.java
===================================================================
--- applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/property/RoadPropertyTest.java	(revision 30550)
+++ applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/property/RoadPropertyTest.java	(revision 30550)
@@ -0,0 +1,44 @@
+package org.openstreetmap.josm.plugins.graphview.core.property;
+
+import static org.junit.Assert.assertEquals;
+
+import org.openstreetmap.josm.plugins.graphview.core.TestDataSource;
+import org.openstreetmap.josm.plugins.graphview.core.data.Tag;
+
+abstract public class RoadPropertyTest {
+
+    protected static <P> void testEvaluateW(RoadPropertyType<P> property, P expectedForward, P expectedBackward, Tag... wayTags) {
+
+        TestDataSource ds = new TestDataSource();
+        TestDataSource.TestWay testWay = new TestDataSource.TestWay();
+        for (Tag tag : wayTags) {
+            testWay.tags.put(tag.key, tag.value);
+        }
+        ds.ways.add(testWay);
+
+        assertEquals(expectedForward, property.evaluateW(testWay, true, null, ds));
+        assertEquals(expectedBackward, property.evaluateW(testWay, false, null, ds));
+
+    }
+
+    protected static <P> void testEvaluateN(RoadPropertyType<P> property, P expected, Tag... nodeTags) {
+
+        TestDataSource ds = new TestDataSource();
+        TestDataSource.TestNode testNode = new TestDataSource.TestNode();
+        for (Tag tag : nodeTags) {
+            testNode.tags.put(tag.key, tag.value);
+        }
+        ds.nodes.add(testNode);
+
+        RoadMaxspeed m = new RoadMaxspeed();
+
+        assertEquals(expected, m.evaluateN(testNode, null, ds));
+
+    }
+
+    protected static <P> void testEvaluateBoth(RoadPropertyType<P> property, P expected, Tag... nodeTags) {
+        testEvaluateW(property, expected, expected, nodeTags);
+        testEvaluateN(property, expected, nodeTags);
+    }
+
+}
Index: applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/util/TagConditionLogicTest.java
===================================================================
--- applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/util/TagConditionLogicTest.java	(revision 30550)
+++ applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/util/TagConditionLogicTest.java	(revision 30550)
@@ -0,0 +1,115 @@
+package org.openstreetmap.josm.plugins.graphview.core.util;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openstreetmap.josm.plugins.graphview.core.data.MapBasedTagGroup;
+import org.openstreetmap.josm.plugins.graphview.core.data.Tag;
+import org.openstreetmap.josm.plugins.graphview.core.data.TagGroup;
+
+public class TagConditionLogicTest {
+
+    TagGroup groupA;
+    TagGroup groupB;
+
+    @Before
+    public void setUp() {
+        Map<String, String> mapA = new HashMap<String, String>();
+        mapA.put("key1", "value1");
+        mapA.put("key2", "value2");
+        mapA.put("key3", "value1");
+        groupA = new MapBasedTagGroup(mapA);
+
+        Map<String, String> mapB = new HashMap<String, String>();
+        mapB.put("key1", "value1");
+        mapB.put("key4", "value4");
+        groupB = new MapBasedTagGroup(mapB);
+    }
+
+    @Test
+    public void testTag() {
+        TagCondition condition = TagConditionLogic.tag(new Tag("key3", "value1"));
+        assertTrue(condition.matches(groupA));
+        assertFalse(condition.matches(groupB));
+    }
+
+    @Test
+    public void testKey() {
+        TagCondition condition = TagConditionLogic.key("key3");
+        assertTrue(condition.matches(groupA));
+        assertFalse(condition.matches(groupB));
+    }
+
+    @Test
+    public void testAnd() {
+        TagCondition condition1 = TagConditionLogic.tag(new Tag("key2", "value2"));
+        TagCondition conditionAnd1a = TagConditionLogic.and(condition1);
+        TagCondition conditionAnd1b = TagConditionLogic.and(Arrays.asList(condition1));
+
+        assertTrue(conditionAnd1a.matches(groupA));
+        assertTrue(conditionAnd1b.matches(groupA));
+        assertFalse(conditionAnd1a.matches(groupB));
+        assertFalse(conditionAnd1b.matches(groupB));
+
+        TagCondition condition2 = TagConditionLogic.tag(new Tag("key1", "value1"));
+        TagCondition conditionAnd2a = TagConditionLogic.and(condition1, condition2);
+        TagCondition conditionAnd2b = TagConditionLogic.and(Arrays.asList(condition1, condition2));
+
+        assertTrue(conditionAnd2a.matches(groupA));
+        assertTrue(conditionAnd2b.matches(groupA));
+        assertFalse(conditionAnd2a.matches(groupB));
+        assertFalse(conditionAnd2b.matches(groupB));
+
+        TagCondition condition3 = TagConditionLogic.tag(new Tag("key4", "value4"));
+        TagCondition conditionAnd3a = TagConditionLogic.and(condition1, condition2, condition3);
+        TagCondition conditionAnd3b = TagConditionLogic.and(Arrays.asList(condition1, condition2, condition3));
+
+        assertFalse(conditionAnd3a.matches(groupA));
+        assertFalse(conditionAnd3b.matches(groupA));
+        assertFalse(conditionAnd3a.matches(groupB));
+        assertFalse(conditionAnd3b.matches(groupB));
+    }
+
+    @Test
+    public void testOr() {
+        TagCondition condition1 = TagConditionLogic.tag(new Tag("key42", "value42"));
+        TagCondition conditionOr1a = TagConditionLogic.or(condition1);
+        TagCondition conditionOr1b = TagConditionLogic.or(Arrays.asList(condition1));
+
+        assertFalse(conditionOr1a.matches(groupA));
+        assertFalse(conditionOr1b.matches(groupA));
+        assertFalse(conditionOr1a.matches(groupB));
+        assertFalse(conditionOr1b.matches(groupB));
+
+        TagCondition condition2 = TagConditionLogic.tag(new Tag("key3", "value1"));
+        TagCondition conditionOr2a = TagConditionLogic.or(condition1, condition2);
+        TagCondition conditionOr2b = TagConditionLogic.or(Arrays.asList(condition1, condition2));
+
+        assertTrue(conditionOr2a.matches(groupA));
+        assertTrue(conditionOr2b.matches(groupA));
+        assertFalse(conditionOr2a.matches(groupB));
+        assertFalse(conditionOr2b.matches(groupB));
+
+        TagCondition condition3 = TagConditionLogic.tag(new Tag("key1", "value1"));
+        TagCondition conditionOr3a = TagConditionLogic.or(condition1, condition2, condition3);
+        TagCondition conditionOr3b = TagConditionLogic.or(Arrays.asList(condition1, condition2, condition3));
+
+        assertTrue(conditionOr3a.matches(groupA));
+        assertTrue(conditionOr3b.matches(groupA));
+        assertTrue(conditionOr3a.matches(groupB));
+        assertTrue(conditionOr3b.matches(groupB));
+    }
+
+    @Test
+    public void testNot() {
+        TagCondition condition = TagConditionLogic.not(TagConditionLogic.key("key3"));
+        assertFalse(condition.matches(groupA));
+        assertTrue(condition.matches(groupB));
+    }
+
+}
Index: applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/util/ValueStringParserTest.java
===================================================================
--- applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/util/ValueStringParserTest.java	(revision 30550)
+++ applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/util/ValueStringParserTest.java	(revision 30550)
@@ -0,0 +1,96 @@
+package org.openstreetmap.josm.plugins.graphview.core.util;
+
+import static org.junit.Assert.assertNull;
+import static org.openstreetmap.josm.plugins.graphview.core.util.ValueStringParser.parseMeasure;
+import static org.openstreetmap.josm.plugins.graphview.core.util.ValueStringParser.parseSpeed;
+import static org.openstreetmap.josm.plugins.graphview.core.util.ValueStringParser.parseWeight;
+
+import org.junit.Test;
+
+public class ValueStringParserTest {
+
+    /* speed */
+
+    @Test
+    public void testParseSpeedDefault() {
+        assertClose(50, parseSpeed("50"));
+    }
+
+    @Test
+    public void testParseSpeedKmh() {
+        assertClose(30, parseSpeed("30 km/h"));
+        assertClose(100, parseSpeed("100km/h"));
+    }
+
+    @Test
+    public void testParseSpeedMph() {
+        assertClose(40.234f, parseSpeed("25mph"));
+        assertClose(40.234f, parseSpeed("25 mph"));
+    }
+
+    @Test
+    public void testParseSpeedInvalid() {
+        assertNull(parseSpeed("lightspeed"));
+    }
+
+    /* measure */
+
+    @Test
+    public void testParseMeasureDefault() {
+        assertClose(3.5f, parseMeasure("3.5"));
+    }
+
+    @Test
+    public void testParseMeasureM() {
+        assertClose(2, parseMeasure("2m"));
+        assertClose(5.5f, parseMeasure("5.5 m"));
+    }
+
+    @Test
+    public void testParseMeasureKm() {
+        assertClose(1000, parseMeasure("1 km"));
+        assertClose(7200, parseMeasure("7.2km"));
+    }
+
+    @Test
+    public void testParseMeasureMi() {
+        assertClose(1609.344f, parseMeasure("1 mi"));
+    }
+
+    @Test
+    public void testParseMeasureFeetInches() {
+        assertClose(3.6576f, parseMeasure("12'0\""));
+        assertClose(1.9812f, parseMeasure("6' 6\""));
+    }
+
+    @Test
+    public void testParseMeasureInvalid() {
+        assertNull(parseMeasure("very long"));
+        assertNull(parseMeasure("6' 16\""));
+    }
+
+    /* weight */
+
+    @Test
+    public void testParseWeightDefault() {
+        assertClose(3.6f, parseWeight("3.6"));
+    }
+
+    @Test
+    public void testParseWeightT() {
+        assertClose(30, parseWeight("30t"));
+        assertClose(3.5f, parseWeight("3.5 t"));
+    }
+
+    @Test
+    public void testParseWeightInvalid() {
+        assertNull(parseWeight("heavy"));
+    }
+
+    private static final void assertClose(float expected, float actual) {
+        if (Math.abs(expected - actual) > 0.001) {
+            throw new AssertionError("expected " + expected + ", was " + actual);
+        }
+    }
+
+}
Index: applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/visualisation/FloatPropertyColorSchemeTest.java
===================================================================
--- applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/visualisation/FloatPropertyColorSchemeTest.java	(revision 30550)
+++ applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/visualisation/FloatPropertyColorSchemeTest.java	(revision 30550)
@@ -0,0 +1,49 @@
+package org.openstreetmap.josm.plugins.graphview.core.visualisation;
+
+import static org.junit.Assert.assertEquals;
+
+import java.awt.Color;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openstreetmap.josm.plugins.graphview.core.property.RoadMaxweight;
+
+public class FloatPropertyColorSchemeTest {
+
+    private FloatPropertyColorScheme subject;
+
+    @Before
+    public void setUp() {
+
+        Map<Float, Color> colorMap = new HashMap<Float, Color>();
+        colorMap.put( 5f, new Color( 42,  42,  42));
+        colorMap.put(10f, new Color(100, 100, 100));
+        colorMap.put(20f, new Color(200, 200, 200));
+
+        subject = new FloatPropertyColorScheme(RoadMaxweight.class, colorMap, Color.RED);
+    }
+
+    @Test
+    public void testGetColorForValue_below() {
+        assertEquals(new Color(42, 42, 42), subject.getColorForValue(1f));
+        assertEquals(new Color(42, 42, 42), subject.getColorForValue(5f));
+    }
+
+    @Test
+    public void testGetColorForValue_above() {
+        assertEquals(new Color(200, 200, 200), subject.getColorForValue(25f));
+    }
+
+    @Test
+    public void testGetColorForValue_value() {
+        assertEquals(new Color(100, 100, 100), subject.getColorForValue(10f));
+    }
+
+    @Test
+    public void testGetColorForValue_interpolate() {
+        assertEquals(new Color(150, 150, 150), subject.getColorForValue(15f));
+    }
+
+}
