summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.http.test/tst/org/eclipse
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.http.test/tst/org/eclipse')
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/GitServletInitTest.java31
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java8
2 files changed, 27 insertions, 12 deletions
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/GitServletInitTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/GitServletInitTest.java
index 78db5747f7..9dfb199425 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/GitServletInitTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/GitServletInitTest.java
@@ -43,7 +43,6 @@
package org.eclipse.jgit.http.test;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -53,6 +52,7 @@ import javax.servlet.ServletException;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.util.MultiException;
import org.eclipse.jgit.http.server.GitServlet;
import org.eclipse.jgit.junit.http.AppServer;
import org.eclipse.jgit.junit.http.MockServletConfig;
@@ -100,15 +100,28 @@ public class GitServletInitTest {
ServletContextHandler app = server.addContext("/");
ServletHolder s = app.addServlet(GitServlet.class, "/git");
s.setInitOrder(1);
+ s.getServletHandler().setStartWithUnavailable(false);
- server.setUp();
-
- List<RecordingLogger.Warning> events = RecordingLogger.getWarnings();
- assertFalse("Servlet started without base-path", events.isEmpty());
-
- Throwable why = events.get(0).getCause();
- assertTrue("Caught ServletException", why instanceof ServletException);
- assertTrue("Wanted base-path", why.getMessage().contains("base-path"));
+ try {
+ server.setUp();
+ } catch (Exception e) {
+ Throwable why = null;
+ if (e instanceof MultiException) {
+ MultiException multi = (MultiException) e;
+ List<Throwable> reasons = multi.getThrowables();
+ why = reasons.get(0);
+ assertTrue("Expected ServletException",
+ why instanceof ServletException);
+ } else if (e instanceof ServletException)
+ why = e;
+
+ if (why != null) {
+ assertTrue("Wanted base-path",
+ why.getMessage().contains("base-path"));
+ return;
+ }
+ }
+ fail("Expected ServletException complaining about unset base-path");
}
@Test
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
index 2a39c9f39c..4db7430ba9 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
@@ -57,9 +57,11 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.net.URISyntaxException;
import java.util.Collections;
+import java.util.EnumSet;
import java.util.List;
import java.util.Map;
+import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
@@ -70,7 +72,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.servlet.FilterMapping;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jgit.errors.RemoteRepositoryException;
@@ -89,9 +90,9 @@ import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevBlob;
import org.eclipse.jgit.revwalk.RevCommit;
-import org.eclipse.jgit.storage.file.ReflogEntry;
import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.ReflogEntry;
import org.eclipse.jgit.storage.file.ReflogReader;
import org.eclipse.jgit.transport.FetchConnection;
import org.eclipse.jgit.transport.HttpTransport;
@@ -160,7 +161,8 @@ public class SmartClientSmartServerTest extends HttpTestCase {
public void destroy() {
//
}
- }), "/" + srcName + "/git-upload-pack", FilterMapping.DEFAULT);
+ }), "/" + srcName + "/git-upload-pack", EnumSet
+ .of(DispatcherType.REQUEST));
broken.addServlet(new ServletHolder(gs), "/*");
server.setUp();