"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "httpclient/src/test/java/org/apache/http/client/utils/TestURIUtils.java" between
httpcomponents-client-4.5.8-src.tar.gz and httpcomponents-client-4.5.9-src.tar.gz

About: HttpComponents is an Apache project responsible for creating and maintaining a toolset of low level Java components focused on HTTP and associated protocols. Java sources.

TestURIUtils.java  (httpcomponents-client-4.5.8-src):TestURIUtils.java  (httpcomponents-client-4.5.9-src)
skipping to change at line 37 skipping to change at line 37
package org.apache.http.client.utils; package org.apache.http.client.utils;
import java.net.URI; import java.net.URI;
import java.util.Arrays; import java.util.Arrays;
import org.apache.http.HttpHost; import org.apache.http.HttpHost;
import org.apache.http.conn.routing.HttpRoute; import org.apache.http.conn.routing.HttpRoute;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import static org.apache.http.client.utils.URIUtils.DROP_FRAGMENT;
import static org.apache.http.client.utils.URIUtils.DROP_FRAGMENT_AND_NORMALIZE; import static org.apache.http.client.utils.URIUtils.DROP_FRAGMENT_AND_NORMALIZE;
import static org.apache.http.client.utils.URIUtils.NORMALIZE; import static org.apache.http.client.utils.URIUtils.NORMALIZE;
/** /**
* This TestCase contains test methods for URI resolving according to RFC 3986. * This TestCase contains test methods for URI resolving according to RFC 3986.
* The examples are listed in section "5.4 Reference Resolution Examples" * The examples are listed in section "5.4 Reference Resolution Examples"
*/ */
public class TestURIUtils { public class TestURIUtils {
private final URI baseURI = URI.create("http://a/b/c/d;p?q"); private final URI baseURI = URI.create("http://a/b/c/d;p?q");
skipping to change at line 87 skipping to change at line 88
Assert.assertEquals("http://thathost/", URIUtils.rewriteURI( Assert.assertEquals("http://thathost/", URIUtils.rewriteURI(
URI.create("http://ThatHost")).toString()); URI.create("http://ThatHost")).toString());
Assert.assertEquals("http://That_Host/", URIUtils.rewriteURI( Assert.assertEquals("http://That_Host/", URIUtils.rewriteURI(
URI.create("http://That_Host")).toString()); URI.create("http://That_Host")).toString());
Assert.assertEquals("http://thishost/Fragment_identifier%23Examples", Assert.assertEquals("http://thishost/Fragment_identifier%23Examples",
URIUtils.rewriteURI( URIUtils.rewriteURI(
URI.create("http://thishost/Fragment_identifier%23Exampl es")).toString()); URI.create("http://thishost/Fragment_identifier%23Exampl es")).toString());
} }
@Test @Test
public void testRewriteWithEmptyPath() throws Exception {
final HttpHost target = new HttpHost("thathost", -1);
Assert.assertEquals("http://thathost/", URIUtils.rewriteURI(
URI.create("http://thathost"), target, DROP_FRAGMENT_AND_NORMALIZE).
toString());
Assert.assertEquals("http://thathost/", URIUtils.rewriteURI(
URI.create("http://thathost"), target, DROP_FRAGMENT).toString());
}
@Test
public void testRewritePort() throws Exception { public void testRewritePort() throws Exception {
HttpHost target = new HttpHost("thathost", 8080); // port should be copi ed HttpHost target = new HttpHost("thathost", 8080); // port should be copi ed
Assert.assertEquals("http://thathost:8080/stuff", URIUtils.rewriteURI( Assert.assertEquals("http://thathost:8080/stuff", URIUtils.rewriteURI(
URI.create("http://thishost:80/stuff#crap"), target, DROP_FRAGME NT_AND_NORMALIZE).toString()); URI.create("http://thishost:80/stuff#crap"), target, DROP_FRAGME NT_AND_NORMALIZE).toString());
Assert.assertEquals("http://thathost:8080/stuff#crap", URIUtils.rewriteU RI( Assert.assertEquals("http://thathost:8080/stuff#crap", URIUtils.rewriteU RI(
URI.create("http://thishost:80/stuff#crap"), target, NORMALIZE). toString()); URI.create("http://thishost:80/stuff#crap"), target, NORMALIZE). toString());
target = new HttpHost("thathost", -1); // input port should be dropped target = new HttpHost("thathost", -1); // input port should be dropped
Assert.assertEquals("http://thathost/stuff", URIUtils.rewriteURI( Assert.assertEquals("http://thathost/stuff", URIUtils.rewriteURI(
URI.create("http://thishost:80/stuff#crap"), target, DROP_FRAGME NT_AND_NORMALIZE).toString()); URI.create("http://thishost:80/stuff#crap"), target, DROP_FRAGME NT_AND_NORMALIZE).toString());
Assert.assertEquals("http://thathost/stuff#crap", URIUtils.rewriteURI( Assert.assertEquals("http://thathost/stuff#crap", URIUtils.rewriteURI(
 End of changes. 2 change blocks. 
0 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)