Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2011-05-10 04:57:06 +0000
committerGreg Wilkins2011-05-10 04:57:06 +0000
commit866255f47418c6883502f0c1e5bd725ce7dd6a79 (patch)
tree665a81237fe81ecf3b9f5da3f99f2a00181950f0 /jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerCollectionTest.java
parentdedc2b648dabf9884cc3290ca244ac9106611795 (diff)
downloadorg.eclipse.jetty.project-866255f47418c6883502f0c1e5bd725ce7dd6a79.tar.gz
org.eclipse.jetty.project-866255f47418c6883502f0c1e5bd725ce7dd6a79.tar.xz
org.eclipse.jetty.project-866255f47418c6883502f0c1e5bd725ce7dd6a79.zip
332907 (work in progress) Added AbstractHandlerContainer.findContainerOf
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@3105 7e9141cc-0065-0410-87d8-b60c137991c4
Diffstat (limited to 'jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerCollectionTest.java')
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerCollectionTest.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerCollectionTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerCollectionTest.java
index 688e415175..e61ab3eca3 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerCollectionTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerCollectionTest.java
@@ -15,6 +15,7 @@ package org.eclipse.jetty.server.handler;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
import java.io.IOException;
@@ -153,6 +154,46 @@ public class ContextHandlerCollectionTest
}
+
+ @Test
+ public void testFindContainer() throws Exception
+ {
+ Server server = new Server();
+
+ ContextHandler contextA = new ContextHandler("/a");
+ IsHandledHandler handlerA = new IsHandledHandler();
+ contextA.setHandler(handlerA);
+
+ ContextHandler contextB = new ContextHandler("/b");
+ IsHandledHandler handlerB = new IsHandledHandler();
+ HandlerWrapper wrapperB = new HandlerWrapper();
+ wrapperB.setHandler(handlerB);
+ contextB.setHandler(wrapperB);
+
+ ContextHandler contextC = new ContextHandler("/c");
+ IsHandledHandler handlerC = new IsHandledHandler();
+ contextC.setHandler(handlerC);
+
+ ContextHandlerCollection collection = new ContextHandlerCollection();
+
+ collection.addHandler(contextA);
+ collection.addHandler(contextB);
+ collection.addHandler(contextC);
+
+ HandlerWrapper wrapper = new HandlerWrapper();
+ wrapper.setHandler(collection);
+ server.setHandler(wrapper);
+
+ assertEquals(wrapper,AbstractHandlerContainer.findContainerOf(server,HandlerWrapper.class,handlerA));
+ assertEquals(contextA,AbstractHandlerContainer.findContainerOf(server,ContextHandler.class,handlerA));
+ assertEquals(contextB,AbstractHandlerContainer.findContainerOf(server,ContextHandler.class,handlerB));
+ assertEquals(wrapper,AbstractHandlerContainer.findContainerOf(server,HandlerWrapper.class,handlerB));
+ assertEquals(contextB,AbstractHandlerContainer.findContainerOf(collection,HandlerWrapper.class,handlerB));
+ assertEquals(wrapperB,AbstractHandlerContainer.findContainerOf(contextB,HandlerWrapper.class,handlerB));
+
+ }
+
+
private static final class IsHandledHandler extends AbstractHandler
{
private boolean handled;
@@ -173,4 +214,7 @@ public class ContextHandlerCollectionTest
handled = false;
}
}
+
+
+
}

Back to the top