You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by je...@apache.org on 2002/08/23 06:32:12 UTC
cvs commit: jakarta-slide/src/tests/uri RelativeURITest.java URITestSuite.java
jericho 2002/08/22 21:32:12
Modified: src/tests/uri URITestSuite.java
Added: src/tests/uri RelativeURITest.java
Log:
- Add relative uri cases
Revision Changes Path
1.2 +2 -1 jakarta-slide/src/tests/uri/URITestSuite.java
Index: URITestSuite.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/tests/uri/URITestSuite.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- URITestSuite.java 17 Aug 2002 23:31:04 -0000 1.1
+++ URITestSuite.java 23 Aug 2002 04:32:12 -0000 1.2
@@ -99,6 +99,7 @@
TestSuite suite = new TestSuite(URITestSuite.class);
suite.setName("All URI tests");
suite.addTest(BasicURITest.suite());
+ suite.addTest(RelativeURITest.suite());
suite.addTest(KoreanURITest.suite());
// TODO: add other all URI suites
return suite;
1.1 jakarta-slide/src/tests/uri/RelativeURITest.java
Index: RelativeURITest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Slide", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package uri;
import org.apache.util.URI;
import org.apache.util.URIException;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
/**
* The normal testcases for URI {@link org.apache.util.URI}.
*
* @author <a href="mailto:jericho at apache.org">Sung-Gu</a>
* @version $Id: RelativeURITest.java,v 1.1 2002/08/23 04:32:12 jericho Exp $
*/
public class RelativeURITest extends URITestBase {
// ----------------------------------------------------------- constructors
/**
* The constructor.
*
* @param name the name
*/
public RelativeURITest(String name) {
super(name);
}
// ------------------------------------------------------------- properties
/**
* The URI base example 1.
*/
protected String base1;
/**
* The URI relative example 1.
*/
protected String uri01;
/**
* The URI relative example 2.
*/
protected String uri02;
/**
* The URI relative example 3.
*/
protected String uri03;
/**
* The URI relative example 4.
*/
protected String uri04;
/**
* The URI relative example 5.
*/
protected String uri05;
/**
* The URI relative example 6.
*/
protected String uri06;
/**
* The URI relative example 7.
*/
protected String uri07;
/**
* The URI relative example 8.
*/
protected String uri08;
/**
* The URI relative example 9.
*/
protected String uri09;
/**
* The URI relative example 10.
*/
protected String uri10;
/**
* The URI relative example 11.
*/
protected String uri11;
/**
* The URI relative example 12.
*/
protected String uri12;
/**
* The URI relative example 13.
*/
protected String uri13;
/**
* The URI relative example 14.
*/
protected String uri14;
/**
* The URI relative example 15.
*/
protected String uri15;
/**
* The URI relative example 16.
*/
protected String uri16;
/**
* The URI relative example 17.
*/
protected String uri17;
/**
* The URI relative example 18.
*/
protected String uri18;
/**
* The URI relative example 19.
*/
protected String uri19;
/**
* The URI relative example 20.
*/
protected String uri20;
/**
* The URI relative example 21.
*/
protected String uri21;
/**
* The URI relative example 22.
*/
protected String uri22;
/**
* The URI relative example 23.
*/
protected String uri23;
// ------------------------------------------------------------------- main
/**
* The command line interface with java compiler.
*
* @param args arguments
*/
public static void main(String[] args) {
TestRunner.run(suite());
}
// ---------------------------------------------------------- suite methods
/**
* Return the suite.
*
* @return Test
*/
public static Test suite() {
TestSuite suite = new TestSuite(RelativeURITest.class);
suite.setName("Relative characters URI tests");
return suite;
}
/**
* Set up.
*/
protected void setUp() throws Exception {
base1 = "http://a/b/c/d;p?q";
uri01 = "g:h";
uri02 = "g";
uri03 = "./g";
uri04 = "g/";
uri05 = "/g";
uri06 = "//g";
uri07 = "?y";
uri08 = "g?y";
uri09 = "#s";
uri10 = "g#s";
uri11 = "g?y#s";
uri12 = ";x";
uri13 = "g;x";
uri14 = "g;x?y#s";
uri15 = ".";
uri16 = "./";
uri17 = "..";
uri18 = "../";
uri19 = "../g";
uri20 = "../..";
uri21 = "../../";
uri22 = "../../g";
}
/**
* Tear down.
*/
protected void tearDown() throws Exception {
super.tearDown();
}
// ----------------------------------------------------------- test methods
/**
* Test the relative URI example 01 with the base URI example 1.
*/
public void testBase1Relative01() throws URIException {
URI result = new URI("g:h");
URI uri = new URI(new URI(this.base1), new URI(this.uri01));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 02 with the base URI example 1.
*/
public void testBase1Relative02() throws URIException {
URI result = new URI("http://a/b/c/g");
URI uri = new URI(new URI(this.base1), new URI(this.uri02));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 03 with the base URI example 1.
*/
public void testBase1Relative03() throws URIException {
URI result = new URI("http://a/b/c/g");
URI uri = new URI(new URI(this.base1), new URI(this.uri03));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 04 with the base URI example 1.
*/
public void testBase1Relative04() throws URIException {
URI result = new URI("http://a/b/c/g/");
URI uri = new URI(new URI(this.base1), new URI(this.uri04));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 05 with the base URI example 1.
*/
public void testBase1Relative05() throws URIException {
URI result = new URI("http://a/g");
URI uri = new URI(new URI(this.base1), new URI(this.uri05));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 06 with the base URI example 1.
*/
public void testBase1Relative06() throws URIException {
URI result = new URI("http://g");
URI uri = new URI(new URI(this.base1), new URI(this.uri06));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 07 with the base URI example 1.
*/
public void testBase1Relative07() throws URIException {
URI result = new URI("http://a/b/c/?y");
URI uri = new URI(new URI(this.base1), new URI(this.uri07));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 08 with the base URI example 1.
*/
public void testBase1Relative08() throws URIException {
URI result = new URI("http://a/b/c/g?y");
URI uri = new URI(new URI(this.base1), new URI(this.uri08));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 09 with the base URI example 1.
*/
public void testBase1Relative09() throws URIException {
// FIXME: support the _is_only_fragment of URI class?
URI result = new URI("#s");
// Or just use the way, URI result = new URI("http://a/b/c/#s");
URI uri = new URI(new URI(this.base1), new URI(this.uri09));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 10 with the base URI example 1.
*/
public void testBase1Relative10() throws URIException {
URI result = new URI("http://a/b/c/g#s");
URI uri = new URI(new URI(this.base1), new URI(this.uri10));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 11 with the base URI example 1.
*/
public void testBase1Relative11() throws URIException {
URI result = new URI("http://a/b/c/g?y#s");
URI uri = new URI(new URI(this.base1), new URI(this.uri11));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 12 with the base URI example 1.
*/
public void testBase1Relative12() throws URIException {
URI result = new URI("http://a/b/c/;x");
URI uri = new URI(new URI(this.base1), new URI(this.uri12));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 13 with the base URI example 1.
*/
public void testBase1Relative13() throws URIException {
URI result = new URI("http://a/b/c/g;x");
URI uri = new URI(new URI(this.base1), new URI(this.uri13));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 14 with the base URI example 1.
*/
public void testBase1Relative14() throws URIException {
URI result = new URI("http://a/b/c/g;x?y#s");
URI uri = new URI(new URI(this.base1), new URI(this.uri14));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 15 with the base URI example 1.
*/
public void testBase1Relative15() throws URIException {
URI result = new URI("http://a/b/c/");
URI uri = new URI(new URI(this.base1), new URI(this.uri15));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 16 with the base URI example 1.
*/
public void testBase1Relative16() throws URIException {
URI result = new URI("http://a/b/c/");
URI uri = new URI(new URI(this.base1), new URI(this.uri16));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 17 with the base URI example 1.
*/
public void testBase1Relative17() throws URIException {
URI result = new URI("http://a/b/");
URI uri = new URI(new URI(this.base1), new URI(this.uri17));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 18 with the base URI example 1.
*/
public void testBase1Relative18() throws URIException {
URI result = new URI("http://a/b/");
URI uri = new URI(new URI(this.base1), new URI(this.uri18));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 19 with the base URI example 1.
*/
public void testBase1Relative19() throws URIException {
URI result = new URI("http://a/b/g");
URI uri = new URI(new URI(this.base1), new URI(this.uri19));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 20 with the base URI example 1.
*/
public void testBase1Relative20() throws URIException {
URI result = new URI("http://a/");
URI uri = new URI(new URI(this.base1), new URI(this.uri20));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 21 with the base URI example 1.
*/
public void testBase1Relative21() throws URIException {
URI result = new URI("http://a/");
URI uri = new URI(new URI(this.base1), new URI(this.uri21));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
/**
* Test the relative URI example 22 with the base URI example 1.
*/
public void testBase1Relative22() throws URIException {
URI result = new URI("http://a/g");
URI uri = new URI(new URI(this.base1), new URI(this.uri22));
assertEquals(result.getURI(), uri.getURI());
assertEquals(true, result.equals(uri));
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs commit: jakarta-slide/src/tests/uri RelativeURITest.java URITestSuite.java
Posted by Sung-Gu <je...@apache.org>.
----- Original Message -----
From: <je...@apache.org>
Subject: cvs commit: jakarta-slide/src/tests/uri RelativeURITest.java
> public void testBase1Relative09() throws URIException {
> // FIXME: support the _is_only_fragment of URI class?
> URI result = new URI("#s");
#s = (current document)#s
It's RFC2396.C.1.
I think this expression is conceptional in the document...
> // Or just use the way, URI result = new URI("http://a/b/c/#s");
So, probably I will support the above form.
And rename '_is_only_fragment' to '_is_fragment' in URI.
Sung-Gu
P.S.: Because of my lack of time, I'll add URI-applied HttpURL &
HttpsURL test cases next week probably...
If there is someone to add other complicated test cases,
please let us try and share it. :)
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>