Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Jetty 9.2.15 → 9.4.5 #63

Merged
merged 2 commits into from
Jun 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci</groupId>
<artifactId>jenkins</artifactId>
<version>1.36</version>
<version>1.37</version>
</parent>

<groupId>org.jenkins-ci.main</groupId>
Expand All @@ -47,7 +47,10 @@ THE SOFTWARE.

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jetty.version>9.2.15.v20160210</jetty.version>
<jetty.version>9.4.5.v20170502</jetty.version>
<maven-surefire-plugin.version>2.20</maven-surefire-plugin.version>
<maven-compiler-plugin.version>3.6.1</maven-compiler-plugin.version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would you need the explicit versions here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also curious about this. The parent POM defines these versions IIUC.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well it's really to use more up2date versions :-)

<java.level>8</java.level>
</properties>

<licenses>
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
import org.eclipse.jetty.http.MimeTypes;
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.security.LoginService;
import org.eclipse.jetty.security.UserStore;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.Server;
Expand Down Expand Up @@ -551,9 +552,11 @@ public Thread newThread(Runnable r) {
protected LoginService configureUserRealm() {
HashLoginService realm = new HashLoginService();
realm.setName("default"); // this is the magic realm name to make it effective on everywhere
realm.update("alice", new Password("alice"), new String[]{"user","female"});
realm.update("bob", new Password("bob"), new String[]{"user","male"});
realm.update("charlie", new Password("charlie"), new String[]{"user","male"});
UserStore userStore = new UserStore();
realm.setUserStore( userStore );
userStore.addUser("alice", new Password("alice"), new String[]{"user","female"});
userStore.addUser("bob", new Password("bob"), new String[]{"user","male"});
userStore.addUser("charlie", new Password("charlie"), new String[]{"user","male"});

return realm;
}
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/org/jvnet/hudson/test/JenkinsRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
import org.eclipse.jetty.http.MimeTypes;
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.security.LoginService;
import org.eclipse.jetty.security.UserStore;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.Server;
Expand Down Expand Up @@ -685,9 +686,11 @@ public Thread newThread(Runnable r) {
protected LoginService configureUserRealm() {
HashLoginService realm = new HashLoginService();
realm.setName("default"); // this is the magic realm name to make it effective on everywhere
realm.update("alice", new Password("alice"), new String[]{"user","female"});
realm.update("bob", new Password("bob"), new String[]{"user","male"});
realm.update("charlie", new Password("charlie"), new String[]{"user","male"});
UserStore userStore = new UserStore();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forced by Jetty changes as detailed in jetty/jetty.project#1488 (comment). This makes it awkward to switch Jetty versions in a plugin back to 9.2.x, which @vivek says is currently necessary for Wiremock compatibility: you must use

@Rule
public JenkinsRule r = new JenkinsRule() {
    @Override
    protected LoginService configureUserRealm() {
        HashLoginService realm = new HashLoginService();
        realm.setName("default");
        return realm;
    }
};

We cannot simply delete the UserStore part from the default implementation; it works for most tests, but not those calling WebClient.login while using LegacySecurityRealm (perhaps indirectly via @PresetData(DataSet.NO_ANONYMOUS_READACCESS)), of which there are a few in core and some plugins. (For example, JnlpAccessWithSecuredHudsonTest, using HudsonTestCase.)

realm.setUserStore( userStore );
userStore.addUser("alice", new Password("alice"), new String[]{"user","female"});
userStore.addUser("bob", new Password("bob"), new String[]{"user","male"});
userStore.addUser("charlie", new Password("charlie"), new String[]{"user","male"});

return realm;
}
Expand Down