diff options
author | Mat Booth <mat.booth@redhat.com> | 2017-05-11 15:46:50 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2017-05-11 22:04:41 +0200 |
commit | 33bbbc3c77eeee37a7b3d233f3c7be904948c5e7 (patch) | |
tree | de1272197469b806baf6e24f2f8671ea30039c80 /org.eclipse.jgit.junit.http | |
parent | 2244078e87d4b81b7cff78b307ff757dcb6ac285 (diff) | |
download | jgit-33bbbc3c77eeee37a7b3d233f3c7be904948c5e7.tar.gz jgit-33bbbc3c77eeee37a7b3d233f3c7be904948c5e7.zip |
Update jetty to 9.4.5
* Adapt to API removals in jetty 9.4+
* Manifests changed to restrict jetty to [9.4.5,10.0.0)
Bug: 514336
Bug: 516514
Change-Id: Ifcfd968084dfa6db0ae07cf541d33a6cdedc1ee2
Signed-off-by: Mat Booth <mat.booth@redhat.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.junit.http')
3 files changed, 35 insertions, 26 deletions
diff --git a/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF b/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF index c611b31b21..bf000aa31a 100644 --- a/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF @@ -10,16 +10,16 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Import-Package: javax.servlet;version="[2.5.0,3.2.0)", javax.servlet.http;version="[2.5.0,3.2.0)", org.apache.commons.logging;version="[1.1.1,2.0.0)", - org.eclipse.jetty.http;version="[9.0.0,9.4.0)", - org.eclipse.jetty.security;version="[9.0.0,9.4.0)", - org.eclipse.jetty.security.authentication;version="[9.0.0,9.4.0)", - org.eclipse.jetty.server;version="[9.0.0,9.4.0)", - org.eclipse.jetty.server.handler;version="[9.0.0,9.4.0)", - org.eclipse.jetty.server.nio;version="[9.0.0,9.4.0)", - org.eclipse.jetty.servlet;version="[9.0.0,9.4.0)", - org.eclipse.jetty.util.component;version="[9.0.0,9.4.0)", - org.eclipse.jetty.util.log;version="[9.0.0,9.4.0)", - org.eclipse.jetty.util.security;version="[9.0.0,9.4.0)", + org.eclipse.jetty.http;version="[9.4.5,10.0.0)", + org.eclipse.jetty.security;version="[9.4.5,10.0.0)", + org.eclipse.jetty.security.authentication;version="[9.4.5,10.0.0)", + org.eclipse.jetty.server;version="[9.4.5,10.0.0)", + org.eclipse.jetty.server.handler;version="[9.4.5,10.0.0)", + org.eclipse.jetty.server.nio;version="[9.4.5,10.0.0)", + org.eclipse.jetty.servlet;version="[9.4.5,10.0.0)", + org.eclipse.jetty.util.component;version="[9.4.5,10.0.0)", + org.eclipse.jetty.util.log;version="[9.4.5,10.0.0)", + org.eclipse.jetty.util.security;version="[9.4.5,10.0.0)", org.eclipse.jgit.errors;version="[4.8.0,4.9.0)", org.eclipse.jgit.http.server;version="[4.8.0,4.9.0)", org.eclipse.jgit.internal.storage.file;version="[4.8.0,4.9.0)", diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java index 9ef4068cc4..28c0f21111 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java @@ -46,25 +46,25 @@ package org.eclipse.jgit.junit.http; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import java.io.IOException; import java.net.InetAddress; import java.net.URI; import java.net.URISyntaxException; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import org.eclipse.jetty.security.AbstractLoginService; import org.eclipse.jetty.security.Authenticator; import org.eclipse.jetty.security.ConstraintMapping; import org.eclipse.jetty.security.ConstraintSecurityHandler; -import org.eclipse.jetty.security.MappedLoginService; import org.eclipse.jetty.security.authentication.BasicAuthenticator; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; -import org.eclipse.jetty.server.UserIdentity; import org.eclipse.jetty.server.handler.ContextHandlerCollection; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.util.security.Constraint; @@ -168,38 +168,41 @@ public class AppServer { return ctx; } - static class TestMappedLoginService extends MappedLoginService { + static class TestMappedLoginService extends AbstractLoginService { private String role; + protected final ConcurrentMap<String, UserPrincipal> users = new ConcurrentHashMap<>(); + TestMappedLoginService(String role) { this.role = role; } @Override - protected UserIdentity loadUser(String who) { - return null; - } - - @Override - protected void loadUsers() throws IOException { - putUser(username, new Password(password), new String[] { role }); + protected void doStart() throws Exception { + UserPrincipal p = new UserPrincipal(username, + new Password(password)); + users.put(username, p); + super.doStart(); } @Override - protected String[] loadRoleInfo(KnownUser user) { - return null; + protected String[] loadRoleInfo(UserPrincipal user) { + if (users.get(user.getName()) == null) + return null; + else + return new String[] { role }; } @Override - protected KnownUser loadUserInfo(String usrname) { - return null; + protected UserPrincipal loadUserInfo(String user) { + return users.get(user); } } private void auth(ServletContextHandler ctx, Authenticator authType) { final String role = "can-access"; - MappedLoginService users = new TestMappedLoginService(role); + AbstractLoginService users = new TestMappedLoginService(role); ConstraintMapping cm = new ConstraintMapping(); cm.setConstraint(new Constraint()); cm.getConstraint().setAuthenticate(true); diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java index 415398da26..4e35ff6422 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java @@ -161,6 +161,12 @@ public class RecordingLogger implements Logger { @Override public void warn(String msg, Object... args) { synchronized (warnings) { + int i = 0; + int index = msg.indexOf("{}"); + while (index >= 0) { + msg = msg.replaceFirst("\\{\\}", "{" + i++ + "}"); + index = msg.indexOf("{}"); + } warnings.add(new Warning(MessageFormat.format(msg, args))); } } |