<!--
   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                                             -->
<!-- @author vincent.hardy@sun.com                                          -->
<!-- @version $Id: unitTesting.xml 1733420 2016-03-03 07:41:59Z gadams $  -->
<!-- ====================================================================== -->
<testSuite id="util.unitTesting" name="org.apache.batik.util Unit Testing">

    <!-- ====================================================================== -->
    <!--                        Security Tests                                  -->
    <!-- ====================================================================== -->
    <test id="securityEnforcerTest" class="org.apache.batik.util.ApplicationSecurityEnforcerTest" />

    <!-- ====================================================================== -->
    <!--                         Base64 Tests                                   -->
    <!-- ====================================================================== -->

    <test id="B64.1" class="org.apache.batik.util.Base64Test">
        <arg class="java.lang.String" value="ENCODE" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/zeroByte" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/zeroByte.64" />
    </test>
   <test id="B64.2" class="org.apache.batik.util.Base64Test">
        <arg class="java.lang.String" value="DECODE" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/zeroByte.64" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/zeroByte" />
    </test>
   <test id="B64.3" class="org.apache.batik.util.Base64Test">
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/zeroByte" />
    </test>

   <test id="B64.4" class="org.apache.batik.util.Base64Test">
        <arg class="java.lang.String" value="ENCODE" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/oneByte" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/oneByte.64" />
    </test>
   <test id="B64.5" class="org.apache.batik.util.Base64Test">
        <arg class="java.lang.String" value="DECODE" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/oneByte.64" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/oneByte" />
    </test>
   <test id="B64.6" class="org.apache.batik.util.Base64Test">
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/oneByte" />
    </test>

   <test id="B64.7" class="org.apache.batik.util.Base64Test">
        <arg class="java.lang.String" value="ENCODE" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/twoByte" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/twoByte.64" />
    </test>
   <test id="B64.8" class="org.apache.batik.util.Base64Test">
        <arg class="java.lang.String" value="DECODE" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/twoByte.64" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/twoByte" />
    </test>
   <test id="B64.9" class="org.apache.batik.util.Base64Test">
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/twoByte" />
    </test>

   <test id="B64.10" class="org.apache.batik.util.Base64Test">
        <arg class="java.lang.String" value="ENCODE" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/threeByte" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/threeByte.64" />
    </test>
   <test id="B64.11" class="org.apache.batik.util.Base64Test">
        <arg class="java.lang.String" value="DECODE" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/threeByte.64" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/threeByte" />
    </test>
   <test id="B64.12" class="org.apache.batik.util.Base64Test">
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/threeByte" />
    </test>

   <test id="B64.13" class="org.apache.batik.util.Base64Test">
        <arg class="java.lang.String" value="ENCODE" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/fourByte" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/fourByte.64" />
    </test>
   <test id="B64.14" class="org.apache.batik.util.Base64Test">
        <arg class="java.lang.String" value="DECODE" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/fourByte.64" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/fourByte" />
    </test>
   <test id="B64.15" class="org.apache.batik.util.Base64Test">
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/fourByte" />
    </test>

   <test id="B64.16" class="org.apache.batik.util.Base64Test">
        <arg class="java.lang.String" value="ENCODE" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/tenByte" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/tenByte.64" />
    </test>
   <test id="B64.17" class="org.apache.batik.util.Base64Test">
        <arg class="java.lang.String" value="DECODE" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/tenByte.64" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/tenByte" />
    </test>
   <test id="B64.18" class="org.apache.batik.util.Base64Test">
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/tenByte" />
    </test>

   <test id="B64.19" class="org.apache.batik.util.Base64Test">
        <arg class="java.lang.String" value="ENCODE" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/small" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/small.64" />
    </test>
   <test id="B64.20" class="org.apache.batik.util.Base64Test">
        <arg class="java.lang.String" value="DECODE" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/small.64" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/small" />
    </test>
   <test id="B64.21" class="org.apache.batik.util.Base64Test">
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/small" />
    </test>

   <test id="B64.22" class="org.apache.batik.util.Base64Test">
        <arg class="java.lang.String" value="ENCODE" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/medium" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/medium.64" />
    </test>
   <test id="B64.23" class="org.apache.batik.util.Base64Test">
        <arg class="java.lang.String" value="DECODE" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/medium.64" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/medium" />
    </test>
   <test id="B64.24" class="org.apache.batik.util.Base64Test">
        <arg class="java.lang.String" value="DECODE" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/medium.pc.64" />
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/medium" />
    </test>
   <test id="B64.25" class="org.apache.batik.util.Base64Test">
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/medium" />
    </test>

   <test id="B64.26" class="org.apache.batik.util.Base64Test">
        <arg class="java.net.URL" value="file:test-references/org/apache/batik/util/large" />
    </test>


    <!-- ====================================================================== -->
    <!--                         ParsedURL Tests                                -->
    <!-- ====================================================================== -->
   <test id="ParsedURL.1" class="org.apache.batik.util.ParsedURLTest">
        <!-- Test simple parsing -->
        <arg class="java.lang.String" value="just.a.path" />
        <arg class="java.lang.String" value="file:just.a.path" />
    </test>
   <test id="ParsedURL.2" 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 id="ParsedURL.3" 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 id="ParsedURL.3" 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 id="ParsedURL.4" 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 id="ParsedURL.5" 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 id="ParsedURL.6" 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 id="ParsedURL.7" 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 id="ParsedURL.8" 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 id="ParsedURL.9" 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 id="ParsedURL.10" 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 id="ParsedURL.11" 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 id="ParsedURL.12" 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 id="ParsedURL.13" 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 id="ParsedURL.14" 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 id="ParsedURL.15" 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 id="ParsedURL.16" 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 id="ParsedURL.17" 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 id="ParsedURL.18" 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 id="ParsedURL.19" 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 id="ParsedURL.20" 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 id="ParsedURL.21" 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>
    <test id="ParsedURL.22" class="org.apache.batik.util.ParsedURLTest">
        <!-- Test absolute path, relative jar -->
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/h/init.svg" />
        <arg class="java.lang.String" 
             value="/b/a/t/i/k/new.svg" />
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/b/a/t/i/k/new.svg" />
    </test>
    <test id="ParsedURL.23" class="org.apache.batik.util.ParsedURLTest">
        <!-- Test absolute path, relative jar -->
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/h/init.svg" />
        <arg class="java.lang.String" 
             value="/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>
    <test id="ParsedURL.24" class="org.apache.batik.util.ParsedURLTest">
        <!-- Test relative path, relative jar -->
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/h/init.svg" />
        <arg class="java.lang.String" 
             value="t/o/new.svg" />
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/h/t/o/new.svg" />
    </test>
    <test id="ParsedURL.25" class="org.apache.batik.util.ParsedURLTest">
        <!-- Test relative path, relative jar -->
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/h/init.svg" />
        <arg class="java.lang.String" 
             value="t/o/new.svg#foo" />
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/h/t/o/new.svg#foo" />
    </test>
    <test id="ParsedURL.26" class="org.apache.batik.util.ParsedURLTest">
        <!-- Test relative path, relative jar -->
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/h/init.svg" />
        <arg class="java.lang.String" 
             value="../c/h/new.svg" />
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/c/h/new.svg" />
    </test>
    <test id="ParsedURL.27" class="org.apache.batik.util.ParsedURLTest">
        <!-- Test relative path, relative jar -->
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/h/init.svg" />
        <arg class="java.lang.String" 
             value="../c/h/new.svg#foo" />
        <arg class="java.lang.String" 
             value="jar:file:dir/file.jar!/p/a/t/c/h/new.svg#foo" />
    </test>

    <test id="ParsedURL.28" class="org.apache.batik.util.ParsedURLTest">
        <!-- Test relative path, relative jar -->
        <arg class="java.lang.String" 
             value="#data:1" />
        <arg class="java.lang.String" 
             value="#data:1" />
    </test>

    <test id="ParsedURL.29" class="org.apache.batik.util.ParsedURLTest">
        <!-- Test relative path, relative jar -->
        <arg class="java.lang.String" 
             value="http://foo.bar.com/path/test.svg" />
        <arg class="java.lang.String" 
             value="#data:1" />
        <arg class="java.lang.String" 
             value="http://foo.bar.com/path/test.svg#data:1" />
    </test>

    <test id="ParsedURLData.1" class="org.apache.batik.util.ParsedURLDataTest">
        <!-- Test basic image base 64 data -->
        <arg class="java.lang.String" 
             value="data:image/png;base64,R0lGODdhMAAw" />
        <arg class="java.lang.String" 
             value="CT: image/png CE: base64 DATA: 47 49 46 38 37 URL: data:image/png;base64,R0lGODdhMAAw" />
    </test>

    <test id="ParsedURLData.2" class="org.apache.batik.util.ParsedURLDataTest">
        <!-- Test text encoded as base 64 data -->
        <arg class="java.lang.String" 
             value="data:text/plain;charset=US-ASCII;base64,R0lGODdhMAAw" />
        <arg class="java.lang.String" 
             value="CT: text/plain;charset=US-ASCII CE: base64 DATA: 47 49 46 38 37 URL: data:text/plain;charset=US-ASCII;base64,R0lGODdhMAAw" />
    </test>

    <test id="ParsedURLData.3" class="org.apache.batik.util.ParsedURLDataTest">
        <!-- Test basic image base 64 data -->
        <arg class="java.lang.String" 
             value="data:image/gif;base64,R0lGODdhMAAw" />
        <arg class="java.lang.String" 
             value="CT: image/gif CE: base64 DATA: 47 49 46 38 37 URL: data:image/gif;base64,R0lGODdhMAAw" />
    </test>

    <test id="ParsedURLData.4" class="org.apache.batik.util.ParsedURLDataTest">
        <!-- Test text using octect encoding. -->
        <arg class="java.lang.String" 
             value="data:text/plain;charset=iso-8859-7,%be%fb%be" />
        <arg class="java.lang.String" 
             value="CT: text/plain;charset=iso-8859-7 CE: null DATA: be fb be URL: data:text/plain;charset=iso-8859-7,%be%fb%be" />
    </test>

    <test id="ParsedURLData.5" class="org.apache.batik.util.ParsedURLDataTest">
        <!-- Test Minimalest data url -->
        <arg class="java.lang.String" 
             value="data:,A%20brief%20note" />
        <arg class="java.lang.String" 
             value="CT: null CE: null DATA: 2c 41 20 62 72 URL: data:,,A%20brief%20note" />
    </test>

    <test id="ParsedURLData.6" class="org.apache.batik.util.ParsedURLDataTest">
        <!-- Test tricky data url -->
        <arg class="java.lang.String" 
             value="data:;=;,A%20brief%20note" />
        <arg class="java.lang.String" 
             value="CT: ;= CE:  DATA: 41 20 62 72 69 URL: data:;=;,A%20brief%20note" />
    </test>

</testSuite>
