You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2017/05/24 13:49:40 UTC

incubator-juneau git commit: Tests for UriContext class.

Repository: incubator-juneau
Updated Branches:
  refs/heads/master 953f1d9e3 -> cdebb74d7


Tests for UriContext class.

Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau/commit/cdebb74d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau/tree/cdebb74d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau/diff/cdebb74d

Branch: refs/heads/master
Commit: cdebb74d7a5d8a48be9eacf8e21802dad179d780
Parents: 953f1d9
Author: JamesBognar <ja...@apache.org>
Authored: Wed May 24 09:49:37 2017 -0400
Committer: JamesBognar <ja...@apache.org>
Committed: Wed May 24 09:49:37 2017 -0400

----------------------------------------------------------------------
 .../test/java/org/apache/juneau/TestUtils.java  |    2 +
 .../utils/UriContextResolutionComboTest.java    | 1632 +++++++++++-------
 .../juneau/utils/UriContextUriComboTest.java    |  445 ++---
 .../main/java/org/apache/juneau/UriContext.java |   21 +-
 .../org/apache/juneau/internal/StringUtils.java |   14 +-
 5 files changed, 1301 insertions(+), 813 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cdebb74d/juneau-core-test/src/test/java/org/apache/juneau/TestUtils.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/TestUtils.java b/juneau-core-test/src/test/java/org/apache/juneau/TestUtils.java
index 4405efd..c53e3bf 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/TestUtils.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/TestUtils.java
@@ -497,6 +497,8 @@ public class TestUtils {
 	 * Same as {@link Assert#assertEquals(String,String,String) except takes in a MessageFormat-style message.
 	 */
 	public static void assertEquals(Object expected, Object actual, String msg, Object...args) {
+		if ("xxx".equals(expected))
+			System.err.println("actual=["+actual+"]");
 		if (! isEquals(expected, actual))
 			throw new ComparisonFailure(MessageFormat.format(msg, args), toString(expected), toString(actual));			
 	}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cdebb74d/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextResolutionComboTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextResolutionComboTest.java b/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextResolutionComboTest.java
index e6bf460..2995cf6 100644
--- a/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextResolutionComboTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextResolutionComboTest.java
@@ -12,6 +12,13 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.utils;
 
+import static org.apache.juneau.TestUtils.*;
+import static org.apache.juneau.UriRelativity.*;
+import static org.apache.juneau.UriResolution.*;
+
+import java.util.*;
+
+import org.apache.juneau.*;
 import org.junit.*;
 import org.junit.runner.*;
 import org.junit.runners.*;
@@ -21,607 +28,1028 @@ import org.junit.runners.*;
  */
 @RunWith(Parameterized.class)
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
-@Ignore
 public class UriContextResolutionComboTest {
-//
-//	@Parameterized.Parameters
-//	public static Collection<Object[]> getInput() {
-//		return Arrays.asList(new Object[][] {
-//
-//			// Happy cases - All URL parts known.
-//			{
-//				input(
-//					"Happy-1",
-//					"http://host:port","/context","/resource","/path",
-//					"http://foo.com:123/foobar",
-//					"http://foo.com:123/foobar",
-//					"http://foo.com:123/foobar"
-//				)
-//			},
-//			{
-//				input(
-//					"Happy-2",
-//					"http://host:port","/context","/resource","/path",
-//					"http://foo.com:123",
-//					"http://foo.com:123",
-//					"http://foo.com:123"
-//				)
-//			},
-//			{
-//				input(
-//					"Happy-3",
-//					"http://host:port","/context","/resource","/path",
-//					"/foobar",
-//					"http://host:port/foobar",
-//					"/foobar"
-//				)
-//			},
-//			{
-//				input(
-//					"Happy-4",
-//					"http://host:port","/context","/resource","/path",
-//					"/",
-//					"http://host:port",
-//					"/"
-//				)
-//			},
-//			{
-//				input(
-//					"Happy-5",
-//					"http://host:port","/context","/resource","/path",
-//					"foobar",
-//					"http://host:port/context/resource/foobar",
-//					"/context/resource/foobar"
-//				)
-//			},
-//			{
-//				input(
-//					"Happy-6",
-//					"http://host:port","/context","/resource","/path",
-//					"",
-//					"http://host:port/context/resource/path",
-//					"/context/resource/path"
-//				)
-//			},
-//			{
-//				input(
-//					"Happy-7",
-//					"http://host:port","/context","/resource","/path",
-//					"context:/foo",
-//					"http://host:port/context/foo",
-//					"/context/foo"
-//				)
-//			},
-//			{
-//				input(
-//					"Happy-8",
-//					"http://host:port","/context","/resource","/path",
-//					"context:/",
-//					"http://host:port/context",
-//					"/context"
-//				)
-//			},
-//			{
-//				input(
-//					"Happy-9",
-//					"http://host:port","/context","/resource","/path",
-//					"servlet:/foo",
-//					"http://host:port/context/resource/foo",
-//					"/context/resource/foo"
-//				)
-//			},
-//			{
-//				input(
-//					"Happy-10",
-//					"http://host:port","/context","/resource","/path",
-//					"servlet:/",
-//					"http://host:port/context/resource",
-//					"/context/resource"
-//				)
-//			},
-//			
-//			// Multiple context and resource parts
-//			{
-//				input(
-//					"MultiContextResource-1",
-//					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
-//					"http://foo.com:123/foobar",
-//					"http://foo.com:123/foobar",
-//					"http://foo.com:123/foobar"
-//				)
-//			},
-//			{
-//				input(
-//					"MultiContextResource-2",
-//					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
-//					"http://foo.com:123",
-//					"http://foo.com:123",
-//					"http://foo.com:123"
-//				)
-//			},
-//			{
-//				input(
-//					"MultiContextResource-3",
-//					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
-//					"/foobar",
-//					"http://host:port/foobar",
-//					"/foobar"
-//				)
-//			},
-//			{
-//				input(
-//					"MultiContextResource-4",
-//					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
-//					"/",
-//					"http://host:port",
-//					"/"
-//				)
-//			},
-//			{
-//				input(
-//					"MultiContextResource-5",
-//					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
-//					"foobar",
-//					"http://host:port/c1/c2/r1/r2/p1/foobar",
-//					"/c1/c2/r1/r2/p1/foobar"
-//				)
-//			},
-//			{
-//				input(
-//					"MultiContextResource-6",
-//					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
-//					"",
-//					"http://host:port/c1/c2/r1/r2/p1/p2",
-//					"/c1/c2/r1/r2/p1/p2"
-//				)
-//			},
-//			{
-//				input(
-//					"MultiContextResource-7",
-//					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
-//					"context:/foo",
-//					"http://host:port/c1/c2/foo",
-//					"/c1/c2/foo"
-//				)
-//			},
-//			{
-//				input(
-//					"MultiContextResource-8",
-//					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
-//					"context:/",
-//					"http://host:port/c1/c2",
-//					"/c1/c2"
-//				)
-//			},
-//			{
-//				input(
-//					"MultiContextResource-9",
-//					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
-//					"servlet:/foo",
-//					"http://host:port/c1/c2/r1/r2/foo",
-//					"/c1/c2/r1/r2/foo"
-//				)
-//			},
-//			{
-//				input(
-//					"MultiContextResource-10",
-//					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
-//					"servlet:/",
-//					"http://host:port/c1/c2/r1/r2",
-//					"/c1/c2/r1/r2"
-//				)
-//			},
-//			
-//			// No authority given
-//			{
-//				input(
-//					"NoAuthority-1",
-//					"","/context","/resource","/path",
-//					"http://foo.com:123/foobar",
-//					"http://foo.com:123/foobar",
-//					"http://foo.com:123/foobar"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthority-2",
-//					"","/context","/resource","/path",
-//					"http://foo.com:123",
-//					"http://foo.com:123",
-//					"http://foo.com:123"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthority-3",
-//					"","/context","/resource","/path",
-//					"/foobar",
-//					"/foobar",
-//					"/foobar"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthority-4",
-//					"","/context","/resource","/path",
-//					"/",
-//					"/",
-//					"/"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthority-5",
-//					"","/context","/resource","/path",
-//					"foobar",
-//					"/context/resource/foobar",
-//					"/context/resource/foobar"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthority-6",
-//					"","/context","/resource","/path",
-//					"",
-//					"/context/resource/path",
-//					"/context/resource/path"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthority-7",
-//					"","/context","/resource","/path",
-//					"context:/foo",
-//					"/context/foo",
-//					"/context/foo"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthority-8",
-//					"","/context","/resource","/path",
-//					"context:/",
-//					"/context",
-//					"/context"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthority-9",
-//					"","/context","/resource","/path",
-//					"servlet:/foo",
-//					"/context/resource/foo",
-//					"/context/resource/foo"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthority-10",
-//					"","/context","/resource","/path",
-//					"servlet:/",
-//					"/context/resource",
-//					"/context/resource"
-//				)
-//			},
-//			
-//			// No authority or context given
-//			{
-//				input(
-//					"NoAuthorityOrContext-1",
-//					"","","/resource","/path",
-//					"http://foo.com:123/foobar",
-//					"http://foo.com:123/foobar",
-//					"http://foo.com:123/foobar"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityOrContext-2",
-//					"","","/resource","/path",
-//					"http://foo.com:123",
-//					"http://foo.com:123",
-//					"http://foo.com:123"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityOrContext-3",
-//					"","","/resource","/path",
-//					"/foobar",
-//					"/foobar",
-//					"/foobar"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityOrContext-4",
-//					"","","/resource","/path",
-//					"/",
-//					"/",
-//					"/"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityOrContext-5",
-//					"","","/resource","/path",
-//					"foobar",
-//					"/resource/foobar",
-//					"/resource/foobar"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityOrContext-6",
-//					"","","/resource","/path",
-//					"",
-//					"/resource/path",
-//					"/resource/path"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityOrContext-7",
-//					"","","/resource","/path",
-//					"context:/foo",
-//					"/foo",
-//					"/foo"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityOrContext-8",
-//					"","","/resource","/path",
-//					"context:/",
-//					"/",
-//					"/"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityOrContext-9",
-//					"","","/resource","/path",
-//					"servlet:/foo",
-//					"/resource/foo",
-//					"/resource/foo"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityOrContext-10",
-//					"","","/resource","/path",
-//					"servlet:/",
-//					"/resource",
-//					"/resource"
-//				)
-//			},
-//
-//			// No authority or context or resource given
-//			{
-//				input(
-//					"NoAuthorityOrContextOrResource-1",
-//					"","","","/path",
-//					"http://foo.com:123/foobar",
-//					"http://foo.com:123/foobar",
-//					"http://foo.com:123/foobar"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityOrContextOrResource-2",
-//					"","","","/path",
-//					"http://foo.com:123",
-//					"http://foo.com:123",
-//					"http://foo.com:123"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityOrContextOrResource-3",
-//					"","","","/path",
-//					"/foobar",
-//					"/foobar",
-//					"/foobar"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityOrContextOrResource-4",
-//					"","","","/path",
-//					"/",
-//					"/",
-//					"/"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityOrContextOrResource-5",
-//					"","","","/path",
-//					"foobar",
-//					"/foobar",
-//					"/foobar"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityOrContextOrResource-6",
-//					"","","","/path",
-//					"",
-//					"/path",
-//					"/path"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityOrContextOrResource-7",
-//					"","","","/path",
-//					"context:/foo",
-//					"/foo",
-//					"/foo"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityOrContextOrResource-8",
-//					"","","","/path",
-//					"context:/",
-//					"/",
-//					"/"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityOrContextOrResource-9",
-//					"","","","/path",
-//					"servlet:/foo",
-//					"/foo",
-//					"/foo"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityOrContextOrResource-10",
-//					"","","","/path",
-//					"servlet:/",
-//					"/",
-//					"/"
-//				)
-//			},
-//			
-//			// No context or resource given.
-//			{
-//				input(
-//					"NoContextOrResource-1",
-//					"http://host:port","","","/path",
-//					"http://foo.com:123/foobar",
-//					"http://foo.com:123/foobar",
-//					"http://foo.com:123/foobar"
-//				)
-//			},
-//			{
-//				input(
-//					"NoContextOrResource-2",
-//					"http://host:port","","","/path",
-//					"http://foo.com:123",
-//					"http://foo.com:123",
-//					"http://foo.com:123"
-//				)
-//			},
-//			{
-//				input(
-//					"NoContextOrResource-3",
-//					"http://host:port","","","/path",
-//					"/foobar",
-//					"http://host:port/foobar",
-//					"/foobar"
-//				)
-//			},
-//			{
-//				input(
-//					"NoContextOrResource-4",
-//					"http://host:port","","","/path",
-//					"/",
-//					"http://host:port",
-//					"/"
-//				)
-//			},
-//			{
-//				input(
-//					"NoContextOrResource-5",
-//					"http://host:port","","","/path",
-//					"foobar",
-//					"http://host:port/foobar",
-//					"/foobar"
-//				)
-//			},
-//			{
-//				input(
-//					"NoContextOrResource-6",
-//					"http://host:port","","","/path",
-//					"",
-//					"http://host:port/path",
-//					"/path"
-//				)
-//			},
-//			{
-//				input(
-//					"NoContextOrResource-7",
-//					"http://host:port","","","/path",
-//					"context:/foo",
-//					"http://host:port/foo",
-//					"/foo"
-//				)
-//			},
-//			{
-//				input(
-//					"NoContextOrResource-8",
-//					"http://host:port","","","/path",
-//					"context:/",
-//					"http://host:port",
-//					"/"
-//				)
-//			},
-//			{
-//				input(
-//					"NoContextOrResource-9",
-//					"http://host:port","","","/path",
-//					"servlet:/foo",
-//					"http://host:port/foo",
-//					"/foo"
-//				)
-//			},
-//			{
-//				input(
-//					"NoContextOrResource-10",
-//					"http://host:port","","","/path",
-//					"servlet:/",
-//					"http://host:port",
-//					"/"
-//				)
-//			},
-//		});		
-//	}
-//	
-//	public static Input input(String label, String authority, String context, String resource, String path, String uri, String expectedAbsolute, String expectedRootRelative) {
-//		return new Input(label, authority, context, resource, path, uri, expectedAbsolute, expectedRootRelative);
-//	}
-//	
-//	public static class Input {
-//		private final UriContext uriContext;
-//		private final String label, uri, expectedAbsolute, expectedRootRelative;
-//		
-//		public Input(String label, String authority, String context, String resource, String path, String uri, String expectedAbsolute, String expectedRootRelative) {
-//			this.label = label;
-//			this.uriContext = new UriContext(authority, context, resource, path);
-//			this.uri = uri;
-//			this.expectedAbsolute = expectedAbsolute;
-//			this.expectedRootRelative = expectedRootRelative;
-//		}
-//	}
-//	
-//	private Input in;
-//	
-//	public UriContextResolutionComboTest(Input in) throws Exception {
-//		this.in = in;
-//	}
-//	
-//	@Test
-//	public void testAbsolute() {
-//		assertEquals(in.expectedAbsolute, in.uriContext.resolve(in.uri), "{0}: testAbsolute() failed", in.label);
-//	}
-//		
-//	@Test
-//	public void testRootRelative() {
-//		assertEquals(in.expectedRootRelative, in.uriContext.resolveRootRelative(in.uri), "{0}: testRootRelative() failed", in.label);
-//	}
-//
-//	@Test
-//	public void testAbsoluteAppend() {
-//		assertEquals(in.expectedAbsolute, in.uriContext.append(new StringBuilder(), in.uri).toString(), "{0}: testAbsolute() failed", in.label);
-//	}
-//		
-//	@Test
-//	public void testRootRelativeAppend() {
-//		assertEquals(in.expectedRootRelative, in.uriContext.appendRootRelative(new StringBuilder(), in.uri).toString(), "{0}: testRootRelative() failed", in.label);
-//	}
+
+	@Parameterized.Parameters
+	public static Collection<Object[]> getInput() {
+		return Arrays.asList(new Object[][] {
+
+			// Happy cases - All URL parts known.
+			{
+				"Happy-1a",
+				input(
+					"http://host:port","/context","/resource","/path",
+					"http://foo.com:123/foobar"
+				),
+				results(
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar"
+				)
+			},
+			{
+				"Happy-2",
+				input(
+					"http://host:port","/context","/resource","/path",
+					"http://foo.com:123"
+				),
+				results(
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123"
+				)
+			},
+			{
+				"Happy-3",
+				input(
+					"http://host:port","/context","/resource","/path",
+					"/foobar"
+				),
+				results(
+					"http://host:port/foobar",
+					"http://host:port/foobar",
+					"/foobar",
+					"/foobar",
+					"/foobar",
+					"/foobar"
+				)
+			},
+			{
+				"Happy-4",
+				input(
+					"http://host:port","/context","/resource","/path", 
+					"/"
+				),
+				results(
+					"http://host:port",
+					"http://host:port",
+					"/",
+					"/",
+					"/",
+					"/"
+				)
+			},
+			{
+				"Happy-5",
+				input(
+					"http://host:port","/context","/resource","/path", 
+					"foobar"
+				),
+				results(
+					"http://host:port/context/resource/foobar",
+					"http://host:port/context/resource/foobar",
+					"/context/resource/foobar",
+					"/context/resource/foobar",
+					"foobar",
+					"foobar"
+				)
+			},
+			{
+				"Happy-6",
+				input(
+					"http://host:port","/context","/resource","/path", 
+					""
+				),
+				results(
+					"http://host:port/context/resource",
+					"http://host:port/context/resource/path",
+					"/context/resource",
+					"/context/resource/path",
+					"",
+					""
+				)
+			},
+			{
+				"Happy-7",
+				input(
+					"http://host:port","/context","/resource","/path", 
+					"context:/foo"
+				),
+				results(
+					"http://host:port/context/foo",
+					"http://host:port/context/foo",
+					"/context/foo",
+					"/context/foo",
+					"/context/foo",
+					"/context/foo"
+				)
+			},
+			{
+				"Happy-8",
+				input(
+					"http://host:port","/context","/resource","/path", 
+					"context:/"
+				),
+				results(
+					"http://host:port/context",
+					"http://host:port/context",
+					"/context",
+					"/context",
+					"/context",
+					"/context"
+				)
+			},
+			{
+				"Happy-9",
+				input(
+					"http://host:port","/context","/resource","/path", 
+					"servlet:/foo"
+				),
+				results(
+					"http://host:port/context/resource/foo",
+					"http://host:port/context/resource/foo",
+					"/context/resource/foo",
+					"/context/resource/foo",
+					"/context/resource/foo",
+					"/context/resource/foo"
+				)
+			},
+			{
+				"Happy-10",
+				input(
+					"http://host:port","/context","/resource","/path", 
+					"servlet:/"
+				),
+				results(
+					"http://host:port/context/resource",
+					"http://host:port/context/resource",
+					"/context/resource",
+					"/context/resource",
+					"/context/resource",
+					"/context/resource"
+				)
+			},
+			
+			// Multiple context and resource parts
+			{
+				"MultiContextResource-1",
+				input(
+					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
+					"http://foo.com:123/foobar"
+				),
+				results(
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar"
+				)
+			},
+			{
+				"MultiContextResource-2",
+				input(
+					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
+					"http://foo.com:123"
+				),
+				results(
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123"
+				)
+			},
+			{
+				"MultiContextResource-3",
+				input(
+					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
+					"/foobar"
+				),
+				results(
+					"http://host:port/foobar",
+					"http://host:port/foobar",
+					"/foobar",
+					"/foobar",
+					"/foobar",
+					"/foobar"
+				)
+			},
+			{
+				"MultiContextResource-4",
+				input(
+					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
+					"/"
+				),
+				results(
+					"http://host:port",
+					"http://host:port",
+					"/",
+					"/",
+					"/",
+					"/"
+				)
+			},
+			{
+				"MultiContextResource-5",
+				input(
+					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
+					"foobar"
+				),
+				results(
+					"http://host:port/c1/c2/r1/r2/foobar",
+					"http://host:port/c1/c2/r1/r2/p1/foobar",
+					"/c1/c2/r1/r2/foobar",
+					"/c1/c2/r1/r2/p1/foobar",
+					"foobar",
+					"foobar"
+				)
+			},
+			{
+				"MultiContextResource-6",
+				input(
+					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
+					""
+				),
+				results(
+					"http://host:port/c1/c2/r1/r2",
+					"http://host:port/c1/c2/r1/r2/p1/p2",
+					"/c1/c2/r1/r2",
+					"/c1/c2/r1/r2/p1/p2",
+					"",
+					""
+				)
+			},
+			{
+				"MultiContextResource-7",
+				input(
+					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
+					"context:/foo"
+				),
+				results(
+					"http://host:port/c1/c2/foo",
+					"http://host:port/c1/c2/foo",
+					"/c1/c2/foo",
+					"/c1/c2/foo",
+					"/c1/c2/foo",
+					"/c1/c2/foo"
+				)
+			},
+			{
+				"MultiContextResource-8",
+				input(
+					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
+					"context:/"
+				),
+				results(
+					"http://host:port/c1/c2",
+					"http://host:port/c1/c2",
+					"/c1/c2",
+					"/c1/c2",
+					"/c1/c2",
+					"/c1/c2"
+				)
+			},
+			{
+				"MultiContextResource-9",
+				input(
+					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
+					"servlet:/foo"
+				),
+				results(
+					"http://host:port/c1/c2/r1/r2/foo",
+					"http://host:port/c1/c2/r1/r2/foo",
+					"/c1/c2/r1/r2/foo",
+					"/c1/c2/r1/r2/foo",
+					"/c1/c2/r1/r2/foo",
+					"/c1/c2/r1/r2/foo"
+				)
+			},
+			{
+				"MultiContextResource-10",
+				input(
+					"http://host:port","/c1/c2","/r1/r2","/p1/p2",
+					"servlet:/"
+				),
+				results(
+					"http://host:port/c1/c2/r1/r2",
+					"http://host:port/c1/c2/r1/r2",
+					"/c1/c2/r1/r2",
+					"/c1/c2/r1/r2",
+					"/c1/c2/r1/r2",
+					"/c1/c2/r1/r2"
+				)
+			},
+			
+			// No authority given
+			{
+				"NoAuthority-1",
+				input(
+					"","/context","/resource","/path",
+					"http://foo.com:123/foobar"
+				),
+				results(
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar"
+				)
+			},
+			{
+				"NoAuthority-2",
+				input(
+					"","/context","/resource","/path",
+					"http://foo.com:123"
+				),
+				results(
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123"
+				)
+			},
+			{
+				"NoAuthority-3",
+				input(
+					"","/context","/resource","/path",
+					"/foobar"
+				),
+				results(
+					"/foobar",
+					"/foobar",
+					"/foobar",
+					"/foobar",
+					"/foobar",
+					"/foobar"
+				)
+			},
+			{
+				"NoAuthority-4",
+				input(
+					"","/context","/resource","/path",
+					"/"
+				),
+				results(
+					"/",
+					"/",
+					"/",
+					"/",
+					"/",
+					"/"
+				)
+			},
+			{
+				"NoAuthority-5",
+				input(
+					"","/context","/resource","/path",
+					"foobar"
+				),
+				results(
+					"/context/resource/foobar",
+					"/context/resource/foobar",
+					"/context/resource/foobar",
+					"/context/resource/foobar",
+					"foobar",
+					"foobar"
+				)
+			},
+			{
+				"NoAuthority-6",
+				input(
+					"","/context","/resource","/path",
+					""
+				),
+				results(
+					"/context/resource",
+					"/context/resource/path",
+					"/context/resource",
+					"/context/resource/path",
+					"",
+					""
+				)
+			},
+			{
+				"NoAuthority-7",
+				input(
+					"","/context","/resource","/path",
+					"context:/foo"
+				),
+				results(
+					"/context/foo",
+					"/context/foo",
+					"/context/foo",
+					"/context/foo",
+					"/context/foo",
+					"/context/foo"
+				)
+			},
+			{
+				"NoAuthority-8",
+				input(
+					"","/context","/resource","/path",
+					"context:/"
+				),
+				results(
+					"/context",
+					"/context",
+					"/context",
+					"/context",
+					"/context",
+					"/context"
+				)
+			},
+			{
+				"NoAuthority-9",
+				input(
+					"","/context","/resource","/path",
+					"servlet:/foo"
+				),
+				results(
+					"/context/resource/foo",
+					"/context/resource/foo",
+					"/context/resource/foo",
+					"/context/resource/foo",
+					"/context/resource/foo",
+					"/context/resource/foo"
+				)
+			},
+			{
+				"NoAuthority-10",
+				input(
+					"","/context","/resource","/path",
+					"servlet:/"
+				),
+				results(
+					"/context/resource",
+					"/context/resource",
+					"/context/resource",
+					"/context/resource",
+					"/context/resource",
+					"/context/resource"
+				)
+			},
+			
+			// No authority or context given
+			{
+				"NoAuthorityOrContext-1",
+				input(
+					"","","/resource","/path",
+					"http://foo.com:123/foobar"
+				),
+				results(
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar"
+				)
+			},
+			{
+				"NoAuthorityOrContext-2",
+				input(
+					"","","/resource","/path",
+					"http://foo.com:123"
+				),
+				results(
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123"
+				)
+			},
+			{
+				"NoAuthorityOrContext-3",
+				input(
+					"","","/resource","/path",
+					"/foobar"
+				),
+				results(
+					"/foobar",
+					"/foobar",
+					"/foobar",
+					"/foobar",
+					"/foobar",
+					"/foobar"
+				)
+			},
+			{
+				"NoAuthorityOrContext-4",
+				input(
+					"","","/resource","/path",
+					"/"
+				),
+				results(
+					"/",
+					"/",
+					"/",
+					"/",
+					"/",
+					"/"
+				)
+			},
+			{
+				"NoAuthorityOrContext-5",
+				input(
+					"","","/resource","/path",
+					"foobar"
+				),
+				results(
+					"/resource/foobar",
+					"/resource/foobar",
+					"/resource/foobar",
+					"/resource/foobar",
+					"foobar",
+					"foobar"
+				)
+			},
+			{
+				"NoAuthorityOrContext-6",
+				input(
+					"","","/resource","/path",
+					""
+				),
+				results(
+					"/resource",
+					"/resource/path",
+					"/resource",
+					"/resource/path",
+					"",
+					""
+				)
+			},
+			{
+				"NoAuthorityOrContext-7",
+				input(
+					"","","/resource","/path",
+					"context:/foo"
+				),
+				results(
+					"/foo",
+					"/foo",
+					"/foo",
+					"/foo",
+					"/foo",
+					"/foo"
+				)
+			},
+			{
+				"NoAuthorityOrContext-8",
+				input(
+					"","","/resource","/path",
+					"context:/"
+				),
+				results(
+					"/",
+					"/",
+					"/",
+					"/",
+					"/",
+					"/"
+				)
+			},
+			{
+				"NoAuthorityOrContext-9",
+				input(
+					"","","/resource","/path",
+					"servlet:/foo"
+				),
+				results(
+					"/resource/foo",
+					"/resource/foo",
+					"/resource/foo",
+					"/resource/foo",
+					"/resource/foo",
+					"/resource/foo"
+				)
+			},
+			{
+				"NoAuthorityOrContext-10",
+				input(
+					"","","/resource","/path",
+					"servlet:/"
+				),
+				results(
+					"/resource",
+					"/resource",
+					"/resource",
+					"/resource",
+					"/resource",
+					"/resource"
+				)
+			},
+
+			// No authority or context or resource given
+			{
+				"NoAuthorityOrContextOrResource-1",
+				input(
+					"","","","/path",
+					"http://foo.com:123/foobar"
+				),
+				results(
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar"
+				)
+			},
+			{
+				"NoAuthorityOrContextOrResource-2",
+				input(
+					"","","","/path",
+					"http://foo.com:123"
+				),
+				results(
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123"
+				)
+			},
+			{
+				"NoAuthorityOrContextOrResource-3",
+				input(
+					"","","","/path",
+					"/foobar"
+				),
+				results(
+					"/foobar",
+					"/foobar",
+					"/foobar",
+					"/foobar",
+					"/foobar",
+					"/foobar"
+				)
+			},
+			{
+				"NoAuthorityOrContextOrResource-4",
+				input(
+					"","","","/path",
+					"/"
+				),
+				results(
+					"/",
+					"/",
+					"/",
+					"/",
+					"/",
+					"/"
+				)
+			},
+			{
+				"NoAuthorityOrContextOrResource-5",
+				input(
+					"","","","/path",
+					"foobar"
+				),
+				results(
+					"/foobar",
+					"/foobar",
+					"/foobar",
+					"/foobar",
+					"foobar",
+					"foobar"
+				)
+			},
+//			return new Results(eAbsResource, eAbsPathInfo, eRrResource, eRrPathInfo, eNoneResource, eNonePathInfo);
+			{
+				"NoAuthorityOrContextOrResource-6",
+				input(
+					"","","","/path",
+					""
+				),
+				results(
+					"/",
+					"/path",
+					"/",
+					"/path",
+					"",
+					""
+				)
+			},
+			{
+				"NoAuthorityOrContextOrResource-7",
+				input(
+					"","","","/path",
+					"context:/foo"
+				),
+				results(
+					"/foo",
+					"/foo",
+					"/foo",
+					"/foo",
+					"/foo",
+					"/foo"
+				)
+			},
+			{
+				"NoAuthorityOrContextOrResource-8",
+				input(
+					"","","","/path",
+					"context:/"
+				),
+				results(
+					"/",
+					"/",
+					"/",
+					"/",
+					"/",
+					"/"
+				)
+			},
+			{
+				"NoAuthorityOrContextOrResource-9",
+				input(
+					"","","","/path",
+					"servlet:/foo"
+				),
+				results(
+					"/foo",
+					"/foo",
+					"/foo",
+					"/foo",
+					"/foo",
+					"/foo"
+				)
+			},
+			{
+				"NoAuthorityOrContextOrResource-10",
+				input(
+					"","","","/path",
+					"servlet:/"
+				),
+				results(
+					"/",
+					"/",
+					"/",
+					"/",
+					"/",
+					"/"
+				)
+			},
+			
+			// No context or resource given.
+			{
+				"NoContextOrResource-1",
+				input(
+					"http://host:port","","","/path",
+					"http://foo.com:123/foobar"
+				),
+				results(
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar",
+					"http://foo.com:123/foobar"
+				)
+			},
+			{
+				"NoContextOrResource-2",
+				input(
+					"http://host:port","","","/path",
+					"http://foo.com:123"
+				),
+				results(
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123"
+				)
+			},
+			{
+				"NoContextOrResource-3",
+				input(
+					"http://host:port","","","/path",
+					"/foobar"
+				),
+				results(
+					"http://host:port/foobar",
+					"http://host:port/foobar",
+					"/foobar",
+					"/foobar",
+					"/foobar",
+					"/foobar"
+				)
+			},
+			{
+				"NoContextOrResource-4",
+				input(
+					"http://host:port","","","/path",
+					"/"
+				),
+				results(
+					"http://host:port",
+					"http://host:port",
+					"/",
+					"/",
+					"/",
+					"/"
+				)
+			},
+			{
+				"NoContextOrResource-5",
+				input(
+					"http://host:port","","","/path",
+					"foobar"
+				),
+				results(
+					"http://host:port/foobar",
+					"http://host:port/foobar",
+					"/foobar",
+					"/foobar",
+					"foobar",
+					"foobar"
+				)
+			},
+			{
+				"NoContextOrResource-6",
+				input(
+					"http://host:port","","","/path",
+					""
+				),
+				results(
+					"http://host:port",
+					"http://host:port/path",
+					"/",
+					"/path",
+					"",
+					""
+				)
+			},
+			{
+				"NoContextOrResource-7",
+				input(
+					"http://host:port","","","/path",
+					"context:/foo"
+				),
+				results(
+					"http://host:port/foo",
+					"http://host:port/foo",
+					"/foo",
+					"/foo",
+					"/foo",
+					"/foo"
+				)
+			},
+			{
+				"NoContextOrResource-8",
+				input(
+					"http://host:port","","","/path",
+					"context:/"
+				),
+				results(
+					"http://host:port",
+					"http://host:port",
+					"/",
+					"/",
+					"/",
+					"/"
+				)
+			},
+			{
+				"NoContextOrResource-9",
+				input(
+					"http://host:port","","","/path",
+					"servlet:/foo"
+				),
+				results(
+					"http://host:port/foo",
+					"http://host:port/foo",
+					"/foo",
+					"/foo",
+					"/foo",
+					"/foo"
+				)
+			},
+			{
+				"NoContextOrResource-10",
+				input(
+					"http://host:port","","","/path",
+					"servlet:/"
+				),
+				results(
+					"http://host:port",
+					"http://host:port",
+					"/",
+					"/",
+					"/",
+					"/"
+				)
+			},
+		});		
+	}
+	
+	public static Input input(String authority, String context, String resource, String path, String uri) {
+		return new Input(authority, context, resource, path, uri);
+	}
+	
+	public static Results results(String eAbsResource, String eAbsPathInfo, String eRrResource, String eRrPathInfo, String eNoneResource, String eNonePathInfo) {
+		return new Results(eAbsResource, eAbsPathInfo, eRrResource, eRrPathInfo, eNoneResource, eNonePathInfo);
+	}
+
+	public static class Input {
+		private final String uri;
+		private final String authority, context, resource, path;
+		
+		public Input(String authority, String context, String resource, String path, String uri) {
+			this.authority = authority;
+			this.context = context;
+			this.resource = resource;
+			this.path = path;
+			this.uri = uri;
+		}
+	}
+	
+	public static class Results {
+		private final String aResource, aPathInfo, rrResource, rrPathInfo, nResource, nPathInfo;
+		
+		public Results(String aResource, String aPathInfo, String rrResource, String rrPathInfo, String nResource, String nPathInfo) {
+			this.aResource = aResource;
+			this.aPathInfo = aPathInfo;
+			this.rrResource = rrResource;
+			this.rrPathInfo = rrPathInfo;
+			this.nResource = nResource;
+			this.nPathInfo = nPathInfo;
+		}
+	}
+	
+	private String label;
+	private Input in;
+	private Results r;
+	
+	public UriContextResolutionComboTest(String label, Input in, Results r) throws Exception {
+		this.label = label;
+		this.in = in;
+		this.r = r;
+	}
+	
+	@Test
+	public void a01_testAbsoluteResource() {
+		assertEquals(r.aResource, new UriContext(ABSOLUTE, RESOURCE, in.authority, in.context, in.resource, in.path).resolve(in.uri), "{0}: testAbsolute() failed", label);
+	}	
+		
+	@Test
+	public void a02_testAppendAbsoluteResource() {
+		assertEquals(r.aResource, new UriContext(ABSOLUTE, RESOURCE, in.authority, in.context, in.resource, in.path).append(new StringBuilder(), in.uri).toString(), "{0}: testAbsolute() failed", label);
+	}
+	
+	@Test
+	public void a03_testAbsolutePathInfo() {
+		assertEquals(r.aPathInfo, new UriContext(ABSOLUTE, PATH_INFO, in.authority, in.context, in.resource, in.path).resolve(in.uri), "{0}: testAbsolute() failed", label);
+	}	
+		
+	@Test
+	public void a04_testAppendAbsolutePathInfo() {
+		assertEquals(r.aPathInfo, new UriContext(ABSOLUTE, PATH_INFO, in.authority, in.context, in.resource, in.path).append(new StringBuilder(), in.uri).toString(), "{0}: testAbsolute() failed", label);
+	}
+
+	@Test
+	public void a05_testRootRelativeResource() {
+		assertEquals(r.rrResource, new UriContext(ROOT_RELATIVE, RESOURCE, in.authority, in.context, in.resource, in.path).resolve(in.uri), "{0}: testAbsolute() failed", label);
+	}	
+		
+	@Test
+	public void a06_testAppendRootRelativeResource() {
+		assertEquals(r.rrResource, new UriContext(ROOT_RELATIVE, RESOURCE, in.authority, in.context, in.resource, in.path).append(new StringBuilder(), in.uri).toString(), "{0}: testAbsolute() failed", label);
+	}
+
+	@Test
+	public void a07_testRootRelativePathInfo() {
+		assertEquals(r.rrPathInfo, new UriContext(ROOT_RELATIVE, PATH_INFO, in.authority, in.context, in.resource, in.path).resolve(in.uri), "{0}: testAbsolute() failed", label);
+	}	
+		
+	@Test
+	public void a08_testAppendRootRelativePathInfo() {
+		assertEquals(r.rrPathInfo, new UriContext(ROOT_RELATIVE, PATH_INFO, in.authority, in.context, in.resource, in.path).append(new StringBuilder(), in.uri).toString(), "{0}: testAbsolute() failed", label);
+	}
+
+	@Test
+	public void a09_testNoneResource() {
+		assertEquals(r.nResource, new UriContext(NONE, RESOURCE, in.authority, in.context, in.resource, in.path).resolve(in.uri), "{0}: testAbsolute() failed", label);
+	}	
+		
+	@Test
+	public void a10_testAppendNoneResource() {
+		assertEquals(r.nResource, new UriContext(NONE, RESOURCE, in.authority, in.context, in.resource, in.path).append(new StringBuilder(), in.uri).toString(), "{0}: testAbsolute() failed", label);
+	}
+
+	@Test
+	public void a11_testNonePathInfo() {
+		assertEquals(r.nPathInfo, new UriContext(NONE, PATH_INFO, in.authority, in.context, in.resource, in.path).resolve(in.uri), "{0}: testAbsolute() failed", label);
+	}	
+		
+	@Test
+	public void a12_testAppendNonePathInfo() {
+		assertEquals(r.nPathInfo, new UriContext(NONE, PATH_INFO, in.authority, in.context, in.resource, in.path).append(new StringBuilder(), in.uri).toString(), "{0}: testAbsolute() failed", label);
+	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cdebb74d/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextUriComboTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextUriComboTest.java b/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextUriComboTest.java
index 7d9eda7..e63f87f 100644
--- a/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextUriComboTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextUriComboTest.java
@@ -12,6 +12,11 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.utils;
 
+import static org.apache.juneau.TestUtils.*;
+
+import java.util.*;
+
+import org.apache.juneau.*;
 import org.junit.*;
 import org.junit.runner.*;
 import org.junit.runners.*;
@@ -21,210 +26,240 @@ import org.junit.runners.*;
  */
 @RunWith(Parameterized.class)
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
-@Ignore
 public class UriContextUriComboTest {
-//
-//	@Parameterized.Parameters
-//	public static Collection<Object[]> getInput() {
-//		return Arrays.asList(new Object[][] {
-//
-//			// Happy cases - All URL parts known.
-//			{
-//				input(
-//					"Happy-1",
-//					"http://foo.com:123","/context","/resource","/path",
-//					"http://foo.com:123",
-//					"http://foo.com:123/context",
-//					"http://foo.com:123/context/resource",
-//					"http://foo.com:123/context/resource/path",
-//					"/context",
-//					"/context/resource",
-//					"/context/resource/path"
-//				)
-//			},
-//			{
-//				input(
-//					"Happy-2",
-//					"http://foo.com:123","/c1/c2","/r1/r2","/p1/p2",
-//					"http://foo.com:123",
-//					"http://foo.com:123/c1/c2",
-//					"http://foo.com:123/c1/c2/r1/r2",
-//					"http://foo.com:123/c1/c2/r1/r2/p1/p2",
-//					"/c1/c2",
-//					"/c1/c2/r1/r2",
-//					"/c1/c2/r1/r2/p1/p2"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthority-1",
-//					"","/context","/resource","/path",
-//					"/",
-//					"/context",
-//					"/context/resource",
-//					"/context/resource/path",
-//					"/context",
-//					"/context/resource",
-//					"/context/resource/path"
-//				)
-//			},
-//			{
-//				input(
-//					"NoContext-1",
-//					"http://foo.com:123","","/resource","/path",
-//					"http://foo.com:123",
-//					"http://foo.com:123",
-//					"http://foo.com:123/resource",
-//					"http://foo.com:123/resource/path",
-//					"/",
-//					"/resource",
-//					"/resource/path"
-//				)
-//			},
-//			{
-//				input(
-//					"NoResource-1",
-//					"http://foo.com:123","/context","","/path",
-//					"http://foo.com:123",
-//					"http://foo.com:123/context",
-//					"http://foo.com:123/context",
-//					"http://foo.com:123/context/path",
-//					"/context",
-//					"/context",
-//					"/context/path"
-//				)
-//			},
-//			{
-//				input(
-//					"NoPath-1",
-//					"http://foo.com:123","/context","/resource","",
-//					"http://foo.com:123",
-//					"http://foo.com:123/context",
-//					"http://foo.com:123/context/resource",
-//					"http://foo.com:123/context/resource",
-//					"/context",
-//					"/context/resource",
-//					"/context/resource"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityNoContext-1",
-//					"","","/resource","/path",
-//					"/",
-//					"/",
-//					"/resource",
-//					"/resource/path",
-//					"/",
-//					"/resource",
-//					"/resource/path"
-//				)
-//			},
-//			{
-//				input(
-//					"NoContextNoResource-1",
-//					"http://foo.com:123","","","/path",
-//					"http://foo.com:123",
-//					"http://foo.com:123",
-//					"http://foo.com:123",
-//					"http://foo.com:123/path",
-//					"/",
-//					"/",
-//					"/path"
-//				)
-//			},
-//			{
-//				input(
-//					"NoAuthorityNoContextNoResource-1",
-//					"","","","/path",
-//					"/",
-//					"/",
-//					"/",
-//					"/path",
-//					"/",
-//					"/",
-//					"/path"
-//				)
-//			},
-//			{
-//				input(
-//					"Nothing-1",
-//					"","","","",
-//					"/",
-//					"/",
-//					"/",
-//					"/",
-//					"/",
-//					"/",
-//					"/"
-//				)
-//			},
-//		});		
-//	}
-//	
-//	public static Input input(String label, String authority, String context, String resource, String path, 
-//			String eAbsoluteAuthority, String eAbsoluteContext, String eAbsoluteResource, String eAbsolutePath, 
-//			String eRootRelativeContext, String eRootRelativeResource, String eRootRelativePath) {
-//		return new Input(label, authority, context, resource, path, eAbsoluteAuthority, eAbsoluteContext, eAbsoluteResource, eAbsolutePath, eRootRelativeContext, eRootRelativeResource, eRootRelativePath);
-//	}
-//	
-//	public static class Input {
-//		private final UriContext uriContext;
-//		private final String label, eAbsoluteAuthority, eAbsoluteContext, eAbsoluteResource, eAbsolutePath, eRootRelativeContext, eRootRelativeResource, eRootRelativePath;
-//		
-//		public Input(String label, String authority, String context, String resource, String path, 
-//					String eAbsoluteAuthority, String eAbsoluteContext, String eAbsoluteResource, String eAbsolutePath, 
-//					String eRootRelativeContext, String eRootRelativeResource, String eRootRelativePath) {
-//			this.label = label;
-//			this.uriContext = new UriContext(authority, context, resource, path);
-//			this.eAbsoluteAuthority = eAbsoluteAuthority;
-//			this.eAbsoluteContext = eAbsoluteContext;
-//			this.eAbsoluteResource = eAbsoluteResource;
-//			this.eAbsolutePath = eAbsolutePath;
-//			this.eRootRelativeContext = eRootRelativeContext;
-//			this.eRootRelativeResource = eRootRelativeResource;
-//			this.eRootRelativePath = eRootRelativePath;
-//		}
-//	}
-//	
-//	private Input in;
-//	
-//	public UriContextUriComboTest(Input in) throws Exception {
-//		this.in = in;
-//	}
-//	
-//	@Test
-//	public void a1_testAbsoluteAuthority() {
-//		assertEquals(in.eAbsoluteAuthority, in.uriContext.getAbsoluteAuthority(), "{0}: testAbsoluteAuthority() failed", in.label);
-//	}
-//
-//	@Test
-//	public void a2_testAbsoluteContext() {
-//		assertEquals(in.eAbsoluteContext, in.uriContext.getAbsoluteContextRoot(), "{0}: testAbsoluteContext() failed", in.label);
-//	}
-//	
-//	@Test
-//	public void a3_testAbsoluteResource() {
-//		assertEquals(in.eAbsoluteResource, in.uriContext.getAbsoluteServletPath(), "{0}: testAbsoluteResource() failed", in.label);
-//	}
-//	
-//	@Test
-//	public void a4_testAbsolutePath() {
-//		assertEquals(in.eAbsolutePath, in.uriContext.getAbsolutePathInfo(), "{0}: testAbsolutePath() failed", in.label);
-//	}
-//	
-//	@Test
-//	public void a5_testRootRelativeContext() {
-//		assertEquals(in.eRootRelativeContext, in.uriContext.getRootRelativeContextRoot(), "{0}: testRootRelativeContext() failed", in.label);
-//	}
-//	
-//	@Test
-//	public void a6_testRootRelativeResource() {
-//		assertEquals(in.eRootRelativeResource, in.uriContext.getRootRelativeServletPath(), "{0}: testRootRelativeResource() failed", in.label);
-//	}
-//	
-//	@Test
-//	public void a7_testRootRelativePath() {
-//		assertEquals(in.eRootRelativePath, in.uriContext.getRootRelativePathInfo(), "{0}: testRootRelativePath() failed", in.label);
-//	}
+
+	@Parameterized.Parameters
+	public static Collection<Object[]> getInput() {
+		return Arrays.asList(new Object[][] {
+
+			// Happy cases - All URL parts known.
+			{
+				"Happy-1",
+				input(
+					"http://foo.com:123","/context","/resource","/path"
+				),
+				results(
+					"http://foo.com:123",
+					"http://foo.com:123/context",
+					"http://foo.com:123/context/resource",
+					"http://foo.com:123/context/resource/path",
+					"/context",
+					"/context/resource",
+					"/context/resource/path"
+				)
+			},
+			{
+				"Happy-2",
+				input(
+					"http://foo.com:123","/c1/c2","/r1/r2","/p1/p2"
+				),
+				results(
+					"http://foo.com:123",
+					"http://foo.com:123/c1/c2",
+					"http://foo.com:123/c1/c2/r1/r2",
+					"http://foo.com:123/c1/c2/r1/r2/p1/p2",
+					"/c1/c2",
+					"/c1/c2/r1/r2",
+					"/c1/c2/r1/r2/p1/p2"
+				)
+			},
+			{
+				"NoAuthority-1",
+				input(
+					"","/context","/resource","/path"
+				),
+				results(
+					"/",
+					"/context",
+					"/context/resource",
+					"/context/resource/path",
+					"/context",
+					"/context/resource",
+					"/context/resource/path"
+				)
+			},
+			{
+				"NoContext-1",
+				input(
+					"http://foo.com:123","","/resource","/path"
+				),
+				results(
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123/resource",
+					"http://foo.com:123/resource/path",
+					"/",
+					"/resource",
+					"/resource/path"
+				)
+			},
+			{
+				"NoResource-1",
+				input(
+					"http://foo.com:123","/context","","/path"
+				),
+				results(
+					"http://foo.com:123",
+					"http://foo.com:123/context",
+					"http://foo.com:123/context",
+					"http://foo.com:123/context/path",
+					"/context",
+					"/context",
+					"/context/path"
+				)
+			},
+			{
+				"NoPath-1",
+				input(
+					"http://foo.com:123","/context","/resource",""
+				),
+				results(
+					"http://foo.com:123",
+					"http://foo.com:123/context",
+					"http://foo.com:123/context/resource",
+					"http://foo.com:123/context/resource",
+					"/context",
+					"/context/resource",
+					"/context/resource"
+				)
+			},
+			{
+				"NoAuthorityNoContext-1",
+				input(
+					"","","/resource","/path"
+				),
+				results(
+					"/",
+					"/",
+					"/resource",
+					"/resource/path",
+					"/",
+					"/resource",
+					"/resource/path"
+				)
+			},
+			{
+				"NoContextNoResource-1",
+				input(
+					"http://foo.com:123","","","/path"
+				),
+				results(
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123",
+					"http://foo.com:123/path",
+					"/",
+					"/",
+					"/path"
+				)
+			},
+			{
+				"NoAuthorityNoContextNoResource-1",
+				input(
+					"","","","/path"
+				),
+				results(
+					"/",
+					"/",
+					"/",
+					"/path",
+					"/",
+					"/",
+					"/path"
+				)
+			},
+			{
+				"Nothing-1",
+				input(
+					"","","",""
+				),
+				results(
+					"/",
+					"/",
+					"/",
+					"/",
+					"/",
+					"/",
+					"/"
+				)
+			},
+		});		
+	}
+	
+	public static Input input(String authority, String context, String resource, String path) {
+		return new Input(authority, context, resource, path);
+	}
+	
+	public static Results results(String eAbsoluteAuthority, String eAbsoluteContext, String eAbsoluteResource, String eAbsolutePath, 
+			String eRootRelativeContext, String eRootRelativeResource, String eRootRelativePath) {
+		return new Results(eAbsoluteAuthority, eAbsoluteContext, eAbsoluteResource, eAbsolutePath, eRootRelativeContext, eRootRelativeResource, eRootRelativePath);
+	}
+
+	public static class Input {
+		private final UriContext uriContext;
+		
+		public Input(String authority, String context, String resource, String path) {
+			this.uriContext = new UriContext(UriResolution.ABSOLUTE, UriRelativity.RESOURCE, authority, context, resource, path);
+		}
+	}
+	
+	public static class Results {
+		private final String eAbsoluteAuthority, eAbsoluteContext, eAbsoluteResource, eAbsolutePath, eRootRelativeContext, eRootRelativeResource, eRootRelativePath;
+		
+		public Results(String eAbsoluteAuthority, String eAbsoluteContext, String eAbsoluteResource, String eAbsolutePath, 
+					String eRootRelativeContext, String eRootRelativeResource, String eRootRelativePath) {
+			this.eAbsoluteAuthority = eAbsoluteAuthority;
+			this.eAbsoluteContext = eAbsoluteContext;
+			this.eAbsoluteResource = eAbsoluteResource;
+			this.eAbsolutePath = eAbsolutePath;
+			this.eRootRelativeContext = eRootRelativeContext;
+			this.eRootRelativeResource = eRootRelativeResource;
+			this.eRootRelativePath = eRootRelativePath;
+		}
+	}
+
+	private String label;
+	private Input in;
+	private Results r;
+	
+	public UriContextUriComboTest(String label, Input in, Results r) throws Exception {
+		this.label = label;
+		this.in = in;
+		this.r = r;
+	}
+	
+	@Test
+	public void a1_testAbsoluteAuthority() {
+		assertEquals(r.eAbsoluteAuthority, in.uriContext.getAbsoluteAuthority(), "{0}: testAbsoluteAuthority() failed", label);
+	}
+
+	@Test
+	public void a2_testAbsoluteContext() {
+		assertEquals(r.eAbsoluteContext, in.uriContext.getAbsoluteContextRoot(), "{0}: testAbsoluteContext() failed", label);
+	}
+	
+	@Test
+	public void a3_testAbsoluteResource() {
+		assertEquals(r.eAbsoluteResource, in.uriContext.getAbsoluteServletPath(), "{0}: testAbsoluteResource() failed", label);
+	}
+	
+	@Test
+	public void a4_testAbsolutePath() {
+		assertEquals(r.eAbsolutePath, in.uriContext.getAbsolutePathInfo(), "{0}: testAbsolutePath() failed", label);
+	}
+	
+	@Test
+	public void a5_testRootRelativeContext() {
+		assertEquals(r.eRootRelativeContext, in.uriContext.getRootRelativeContextRoot(), "{0}: testRootRelativeContext() failed", label);
+	}
+	
+	@Test
+	public void a6_testRootRelativeResource() {
+		assertEquals(r.eRootRelativeResource, in.uriContext.getRootRelativeServletPath(), "{0}: testRootRelativeResource() failed", label);
+	}
+	
+	@Test
+	public void a7_testRootRelativePath() {
+		assertEquals(r.eRootRelativePath, in.uriContext.getRootRelativePathInfo(), "{0}: testRootRelativePath() failed", label);
+	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cdebb74d/juneau-core/src/main/java/org/apache/juneau/UriContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/UriContext.java b/juneau-core/src/main/java/org/apache/juneau/UriContext.java
index 6f531bf..35e7678 100644
--- a/juneau-core/src/main/java/org/apache/juneau/UriContext.java
+++ b/juneau-core/src/main/java/org/apache/juneau/UriContext.java
@@ -278,7 +278,7 @@ public class UriContext {
 			return uri;
 		if (resolution == ROOT_RELATIVE && startsWith(uri, '/'))
 			return uri;
-		if (resolution == NONE)
+		if (resolution == NONE && ! isSpecialUri(uri))
 			return uri;
 		return append(new StringBuilder(), uri).toString();
 	}
@@ -298,8 +298,8 @@ public class UriContext {
 			// Absolute paths are not changed.
 			if (isAbsoluteUri(uri))
 				return a.append(uri);
-			if (resolution == NONE)
-				return a.append(uri);
+			if (resolution == NONE && ! isSpecialUri(uri))
+				return a.append(emptyIfNull(uri));
 			if (resolution == ROOT_RELATIVE && startsWith(uri, '/'))
 				return a.append(uri);
 
@@ -321,7 +321,7 @@ public class UriContext {
 					a.append('/').append(contextRoot);
 				if (uri.length() > 9)
 					a.append('/').append(uri.substring(9));
-				else if (contextRoot == null && (authority == null || resolution == ROOT_RELATIVE))
+				else if (contextRoot == null && (authority == null || resolution != ABSOLUTE))
 					a.append('/');
 				return a;
 			}
@@ -336,7 +336,7 @@ public class UriContext {
 					a.append('/').append(servletPath);
 				if (uri.length() > 9)
 					a.append('/').append(uri.substring(9));
-				else if (servletPath == null && contextRoot == null && (authority == null || resolution == ROOT_RELATIVE))
+				else if (servletPath == null && contextRoot == null && (authority == null || resolution != ABSOLUTE))
 					a.append('/');
 				return a;
 			}
@@ -360,6 +360,8 @@ public class UriContext {
 					a.append('/').append(uri);
 				}
 			}
+			else if (uri == null && contextRoot == null && servletPath == null && (authority == null || resolution != ABSOLUTE))
+				a.append('/');
 
 			return a;
 		} catch (IOException e) {
@@ -373,4 +375,13 @@ public class UriContext {
 			return "/";
 		return uri.substring(0, i);
 	}
+
+	private static boolean isSpecialUri(String s) {
+		if (s == null || s.length() == 0)
+			return false;
+		char c = s.charAt(0);
+		if (c != 's' && c != 'c')
+			return false;
+		return s.startsWith("servlet:/") || s.startsWith("context:/");
+	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cdebb74d/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java b/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java
index ac232a3..c4bf1db 100644
--- a/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java
+++ b/juneau-core/src/main/java/org/apache/juneau/internal/StringUtils.java
@@ -633,6 +633,18 @@ public final class StringUtils {
 	}
 
 	/**
+	 * Returns an empty string if the specified string is <jk>null</jk>.
+	 *
+	 * @param s The string to check.
+	 * @return An empty string if the specified string is <jk>null</jk>, or the same string otherwise.
+	 */
+	public static String emptyIfNull(String s) {
+		if (s == null)
+			return "";
+		return s;
+	}
+
+	/**
 	 * Removes escape characters (\) from the specified characters.
 	 *
 	 * @param s The string to remove escape characters from.
@@ -1345,7 +1357,7 @@ public final class StringUtils {
 			return false;
 
 		// Use a state machine for maximum performance.
-		
+
 		int S1 = 1;  // Looking for http
 		int S2 = 2;  // Found http, looking for :
 		int S3 = 3;  // Found :, looking for /