<!--

   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

-->
<!-- ====================================================================== -->
<!-- @author deweese@apache.org                                             -->
<!-- @version $Id$     -->
<!-- ====================================================================== -->

<testSuite name="Parsed URL test Suite">
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test simple parsing -->
        <arg class="java.lang.String" value="xml.apache.org" />
        <arg class="java.lang.String" value="//xml.apache.org" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test simple parsing -->
        <arg class="java.lang.String" value="fooz:/home/deweese/.cshrc" />
        <arg class="java.lang.String" value="fooz:/home/deweese/.cshrc" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test simple parsing -->
        <arg class="java.lang.String" value="fazz:///home/deweese/.cshrc" />
        <arg class="java.lang.String" value="fazz:/home/deweese/.cshrc" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test simple parsing of single URL -->
        <arg class="java.lang.String" 
             value="fooz://www.com:1234/home/deweese/.cshrc#abcd" />
        <arg class="java.lang.String" 
             value="fooz://www.com:1234/home/deweese/.cshrc#abcd" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test relative url off root -->
        <arg class="java.lang.String" value="http://xml.apache.org/" />
        <arg class="java.lang.String" value="~deweese" />
        <arg class="java.lang.String" value="http://xml.apache.org/~deweese" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test relative url off file in root dir -->
        <arg class="java.lang.String" value="file:///xml.apache.org" />
        <arg class="java.lang.String" value="~deweese" />
        <arg class="java.lang.String" value="file:/~deweese" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test relative with partial path and fragement ident -->
        <arg class="java.lang.String" 
             value="fooz://www.com:1234/home/deweese/.cshrc#abcd" />
        <arg class="java.lang.String" 
             value="xyz.html#efgh" />
        <arg class="java.lang.String" 
             value="fooz://www.com:1234/home/deweese/xyz.html#efgh" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test relative with absolute path and fragement ident -->
        <arg class="java.lang.String" 
             value="fooz://www.com:1234/home/deweese/xyz.html#efgh" />
        <arg class="java.lang.String" 
             value="/xyz.svg#ijkl" />
        <arg class="java.lang.String" 
             value="fooz://www.com:1234/xyz.svg#ijkl" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test relative with matching protocol -->
        <arg class="java.lang.String" 
             value="file:/home/deweese/test.txt" />
        <arg class="java.lang.String" 
             value="file:junk.html" />
        <arg class="java.lang.String" 
             value="file:/home/deweese/junk.html" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test just keeping protocol -->
        <arg class="java.lang.String" value="http://xml.apache.org/batik/" />
        <arg class="java.lang.String" value="//jakarta.apache.org/ant/" />
        <arg class="java.lang.String" value="http://jakarta.apache.org/ant/" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test references to same document -->
        <arg class="java.lang.String" 
             value="http://xml.apache.org/batik/#test" />
        <arg class="java.lang.String" value="" />
        <arg class="java.lang.String" 
             value="http://xml.apache.org/batik/#test" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test relative with absolute path to root -->
        <arg class="java.lang.String" value="http://xml.apache.org/batik/" />
        <arg class="java.lang.String" value="/" />
        <arg class="java.lang.String" value="http://xml.apache.org/" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test relative with absolute path to item -->
        <arg class="java.lang.String" value="http://xml.apache.org/batik/" />
        <arg class="java.lang.String" value="/fop/" />
        <arg class="java.lang.String" value="http://xml.apache.org/fop/" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test relative with absolute path to item -->
        <arg class="java.lang.String" value="file:helloWorld.svg" />
        <arg class="java.lang.String" value="file:test.svg#Foo" />
        <arg class="java.lang.String" value="file:test.svg#Foo" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test relative with absolute path to item -->
        <arg class="java.lang.String" value="file:" />
        <arg class="java.lang.String" value="file:junk.svg#Bar" />
        <arg class="java.lang.String" value="file:junk.svg#Bar" />
    </test>

    <!-- Tests for the jar protocol... -->
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test basic parsing of jar URL -->
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/h/init.svg" />
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/h/init.svg" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- more basic parsing of jar URL -->
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/h/init.svg#foo" />
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/h/init.svg#foo" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test relative file from base jar URL -->
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/h/init.svg" />
        <arg class="java.lang.String" value="../base.svg" />
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/base.svg" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test fragment from base jar URL -->
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/h/init.svg" />
        <arg class="java.lang.String" value="#foo" />
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/h/init.svg#foo" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test fragment replacement in base jar URL -->
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/h/init.svg#bar" />
        <arg class="java.lang.String" value="#faz" />
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/h/init.svg#faz" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test simple absolute child jar URL -->
        <arg class="java.lang.String" 
             value="jar:file:/path1!/path2" />
        <arg class="java.lang.String" 
             value="jar:file:/path3!/path4" />
        <arg class="java.lang.String" 
             value="jar:file:/path3!/path4" />
    </test>
    <test class="org.apache.batik.util.ParsedURLTest">
        <!-- Test complex absolute child jar URL -->
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/h/init.svg" />
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/b/a/t/i/k/new.svg#bar" />
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/b/a/t/i/k/new.svg#bar" />
    </test>
</testSuite>
