From 5e8e2179b218ede7d14b69dc5149b0691b5859cf Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 26 Jan 2017 01:03:16 +0100 Subject: [PATCH] Update Jetty to 9.4.1.v20170120 MappedLoginService is no longer available in Jetty 9.4 therefore base TestLoginService on AbstractLoginService. Apparently Jetty now uses slf4j hence adapt RecordingLogger accordingly so we can log error messages containing slf4j style formatting anchors "{}". Change-Id: Ibb36aba8782882936849b6102001a88b699bb65c Signed-off-by: Matthias Sohn --- .../http/test/DumbClientSmartServerTest.java | 4 +-- .../http/test/SmartClientSmartServerTest.java | 4 +-- .../META-INF/MANIFEST.MF | 3 +- org.eclipse.jgit.junit.http/pom.xml | 5 +++ .../eclipse/jgit/junit/http/AppServer.java | 32 +++++++---------- .../jgit/junit/http/RecordingLogger.java | 4 ++- .../org.eclipse.jgit.target/jgit-4.5.target | 36 +++++++++---------- .../org.eclipse.jgit.target/jgit-4.5.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.6.target | 36 +++++++++---------- .../org.eclipse.jgit.target/jgit-4.6.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.7.target | 36 +++++++++---------- .../org.eclipse.jgit.target/jgit-4.7.tpd | 2 +- .../projects/jetty-9.2.13.tpd | 20 ----------- .../projects/jetty-9.4.1.tpd | 20 +++++++++++ pom.xml | 14 +++++++- 15 files changed, 117 insertions(+), 103 deletions(-) delete mode 100644 org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.2.13.tpd create mode 100644 org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.1.tpd diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java index da3a09809..bce44f9bf 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java @@ -199,7 +199,7 @@ public class DumbClientSmartServerTest extends HttpTestCase { .startsWith("JGit/")); assertEquals("*/*", info.getRequestHeader(HDR_ACCEPT)); assertEquals(200, info.getStatus()); - assertEquals("text/plain; charset=UTF-8", + assertEquals("text/plain;charset=utf-8", info .getResponseHeader(HDR_CONTENT_TYPE)); @@ -269,7 +269,7 @@ public class DumbClientSmartServerTest extends HttpTestCase { assertEquals("GET", req.get(0).getMethod()); assertEquals(0, req.get(0).getParameters().size()); assertEquals(200, req.get(0).getStatus()); - assertEquals("text/plain; charset=UTF-8", + assertEquals("text/plain;charset=utf-8", req.get(0).getResponseHeader( HDR_CONTENT_TYPE)); } 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 a58db3e6d..fd3fef4be 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 @@ -558,7 +558,7 @@ public class SmartClientSmartServerTest extends HttpTestCase { } catch (TransportException err) { String exp = brokenURI + ": expected" + " Content-Type application/x-git-upload-pack-result;" - + " received Content-Type text/plain; charset=UTF-8"; + + " received Content-Type text/plain;charset=utf-8"; assertEquals(exp, err.getMessage()); } } @@ -580,7 +580,7 @@ public class SmartClientSmartServerTest extends HttpTestCase { assertEquals(join(brokenURI, "git-upload-pack"), service.getPath()); assertEquals(0, service.getParameters().size()); assertEquals(200, service.getStatus()); - assertEquals("text/plain; charset=UTF-8", + assertEquals("text/plain;charset=utf-8", service.getResponseHeader(HDR_CONTENT_TYPE)); } diff --git a/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF b/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF index 9a0a6c8dd..09ecf91a8 100644 --- a/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF @@ -28,7 +28,8 @@ Import-Package: javax.servlet;version="[2.5.0,3.2.0)", org.eclipse.jgit.revwalk;version="[4.7.0,4.8.0)", org.eclipse.jgit.transport;version="[4.7.0,4.8.0)", org.eclipse.jgit.transport.resolver;version="[4.7.0,4.8.0)", - org.junit;version="[4.0.0,5.0.0)" + org.junit;version="[4.0.0,5.0.0)", + org.slf4j.helpers;version="[1.7.2,2.0.0)" Export-Package: org.eclipse.jgit.junit.http;version="4.7.0"; uses:="org.eclipse.jgit.transport, org.eclipse.jgit.junit, diff --git a/org.eclipse.jgit.junit.http/pom.xml b/org.eclipse.jgit.junit.http/pom.xml index 6a9464498..abfe04380 100644 --- a/org.eclipse.jgit.junit.http/pom.xml +++ b/org.eclipse.jgit.junit.http/pom.xml @@ -93,6 +93,11 @@ org.eclipse.jetty jetty-servlet + + + org.eclipse.jetty + jetty-security + 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 44c197717..09754317e 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,7 +46,6 @@ 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; @@ -54,21 +53,21 @@ import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; +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; -import org.eclipse.jetty.util.security.Password; +import org.eclipse.jetty.util.security.Credential; +import org.eclipse.jetty.util.security.Credential.Crypt; import org.eclipse.jgit.transport.URIish; /** @@ -168,36 +167,30 @@ public class AppServer { return ctx; } - static class TestMappedLoginService extends MappedLoginService { + static class TestLoginService extends AbstractLoginService { + private String role; - TestMappedLoginService(String role) { + TestLoginService(String role) { this.role = role; } - @Override - protected UserIdentity loadUser(String who) { - return null; + protected String[] loadRoleInfo(UserPrincipal user) { + return new String[] { role }; } @Override - protected void loadUsers() throws IOException { - putUser(username, new Password(password), new String[] { role }); + protected UserPrincipal loadUserInfo(String name) { + return new UserPrincipal(username, + Credential.getCredential(Crypt.crypt(username, password))); } - protected String[] loadRoleInfo(KnownUser user) { - return null; - } - - protected KnownUser loadUserInfo(String usrname) { - return null; - } } private void auth(ServletContextHandler ctx, Authenticator authType) { final String role = "can-access"; - MappedLoginService users = new TestMappedLoginService(role); + TestLoginService users = new TestLoginService(role); ConstraintMapping cm = new ConstraintMapping(); cm.setConstraint(new Constraint()); cm.getConstraint().setAuthenticate(true); @@ -237,6 +230,7 @@ public class AppServer { public void tearDown() throws Exception { RecordingLogger.clear(); log.clear(); + server.setStopTimeout(0); server.stop(); } 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 7600843d2..c7545a94b 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 @@ -49,6 +49,7 @@ import java.util.Collections; import java.util.List; import org.eclipse.jetty.util.log.Logger; +import org.slf4j.helpers.MessageFormatter; /** Logs warnings into an array for later inspection. */ public class RecordingLogger implements Logger { @@ -154,7 +155,8 @@ public class RecordingLogger implements Logger { public void warn(String msg, Object... args) { synchronized (warnings) { - warnings.add(new Warning(MessageFormat.format(msg, args))); + warnings.add(new Warning( + MessageFormatter.format(msg, args).getMessage())); } } diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target index f30bc2fa7..040b638ed 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target @@ -1,26 +1,26 @@ - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.tpd index ba7a694b4..61b720308 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.tpd @@ -1,6 +1,6 @@ target "jgit-4.5" with source configurePhase -include "projects/jetty-9.2.13.tpd" +include "projects/jetty-9.4.1.tpd" include "orbit/R20160221192158-Mars.tpd" include "orbit/S20170120205402-Oxygen.tpd" diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target index 163ab2c26..9582bf3fe 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target @@ -1,26 +1,26 @@ - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd index d07687815..4ffadff5f 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd @@ -1,6 +1,6 @@ target "jgit-4.6" with source configurePhase -include "projects/jetty-9.2.13.tpd" +include "projects/jetty-9.4.1.tpd" include "orbit/S20170120205402-Oxygen.tpd" location "http://download.eclipse.org/releases/neon/" { diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target index fa173e7b2..55a816245 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target @@ -1,26 +1,26 @@ - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd index 4cd9e2b74..426f935b5 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd @@ -1,6 +1,6 @@ target "jgit-4.7" with source configurePhase -include "projects/jetty-9.2.13.tpd" +include "projects/jetty-9.4.1.tpd" include "orbit/S20170120205402-Oxygen.tpd" location "http://download.eclipse.org/releases/oxygen/" { diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.2.13.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.2.13.tpd deleted file mode 100644 index 289a73d2a..000000000 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.2.13.tpd +++ /dev/null @@ -1,20 +0,0 @@ -target "jetty-9.2.13" with source configurePhase - -location jetty-9.2.13 "http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.2.13.v20150730/" { - org.eclipse.jetty.client [9.2.13.v20150730,9.2.13.v20150730] - org.eclipse.jetty.client.source [9.2.13.v20150730,9.2.13.v20150730] - org.eclipse.jetty.continuation [9.2.13.v20150730,9.2.13.v20150730] - org.eclipse.jetty.continuation.source [9.2.13.v20150730,9.2.13.v20150730] - org.eclipse.jetty.http [9.2.13.v20150730,9.2.13.v20150730] - org.eclipse.jetty.http.source [9.2.13.v20150730,9.2.13.v20150730] - org.eclipse.jetty.io [9.2.13.v20150730,9.2.13.v20150730] - org.eclipse.jetty.io.source [9.2.13.v20150730,9.2.13.v20150730] - org.eclipse.jetty.security [9.2.13.v20150730,9.2.13.v20150730] - org.eclipse.jetty.security.source [9.2.13.v20150730,9.2.13.v20150730] - org.eclipse.jetty.server [9.2.13.v20150730,9.2.13.v20150730] - org.eclipse.jetty.server.source [9.2.13.v20150730,9.2.13.v20150730] - org.eclipse.jetty.servlet [9.2.13.v20150730,9.2.13.v20150730] - org.eclipse.jetty.servlet.source [9.2.13.v20150730,9.2.13.v20150730] - org.eclipse.jetty.util [9.2.13.v20150730,9.2.13.v20150730] - org.eclipse.jetty.util.source [9.2.13.v20150730,9.2.13.v20150730] -} diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.1.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.1.tpd new file mode 100644 index 000000000..33ff29dd4 --- /dev/null +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.1.tpd @@ -0,0 +1,20 @@ +target "jetty-9.4.1" with source configurePhase + +location jetty-9.4.1 "http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.1.v20170120/" { + org.eclipse.jetty.client [9.4.1.v20170120,9.4.1.v20170120] + org.eclipse.jetty.client.source [9.4.1.v20170120,9.4.1.v20170120] + org.eclipse.jetty.continuation [9.4.1.v20170120,9.4.1.v20170120] + org.eclipse.jetty.continuation.source [9.4.1.v20170120,9.4.1.v20170120] + org.eclipse.jetty.http [9.4.1.v20170120,9.4.1.v20170120] + org.eclipse.jetty.http.source [9.4.1.v20170120,9.4.1.v20170120] + org.eclipse.jetty.io [9.4.1.v20170120,9.4.1.v20170120] + org.eclipse.jetty.io.source [9.4.1.v20170120,9.4.1.v20170120] + org.eclipse.jetty.security [9.4.1.v20170120,9.4.1.v20170120] + org.eclipse.jetty.security.source [9.4.1.v20170120,9.4.1.v20170120] + org.eclipse.jetty.server [9.4.1.v20170120,9.4.1.v20170120] + org.eclipse.jetty.server.source [9.4.1.v20170120,9.4.1.v20170120] + org.eclipse.jetty.servlet [9.4.1.v20170120,9.4.1.v20170120] + org.eclipse.jetty.servlet.source [9.4.1.v20170120,9.4.1.v20170120] + org.eclipse.jetty.util [9.4.1.v20170120,9.4.1.v20170120] + org.eclipse.jetty.util.source [9.4.1.v20170120,9.4.1.v20170120] +} diff --git a/pom.xml b/pom.xml index 5927f9534..ebaa6f122 100644 --- a/pom.xml +++ b/pom.xml @@ -200,7 +200,7 @@ 1.6 4.3.1 3.1.0 - 9.2.13.v20150730 + 9.4.1.v20170120 0.5.3 4.3.6 1.7.2 @@ -634,6 +634,18 @@ ${jetty-version} + + org.eclipse.jetty + jetty-security + ${jetty-version} + + + + org.eclipse.jetty + jetty-util + ${jetty-version} + + org.osgi org.osgi.core