提交 ee9c3e96 编写于 作者: S Stephen Connolly 提交者: GitHub

Merge pull request #2475 from stephenc/jenkins-36923

[JENKINS-36923] Give ownership of bcpkix dependency to bouncycastle-apl plugin
......@@ -417,7 +417,8 @@ public class ClassicPluginStrategy implements PluginStrategy {
new DetachedPlugin("windows-slaves", "1.547.*", "1.0"),
new DetachedPlugin("antisamy-markup-formatter", "1.553.*", "1.0"),
new DetachedPlugin("matrix-project", "1.561.*", "1.0"),
new DetachedPlugin("junit", "1.577.*", "1.0")
new DetachedPlugin("junit", "1.577.*", "1.0"),
new DetachedPlugin("bouncycastle-api", "2.16.*", "2.16.0")
));
/** Implicit dependencies that are known to be unnecessary and which must be cut out to prevent a dependency cycle among bundled plugins. */
......
......@@ -25,9 +25,12 @@ package hudson.model;
import com.google.common.io.Resources;
import com.trilead.ssh2.crypto.Base64;
import hudson.ClassicPluginStrategy;
import hudson.Util;
import hudson.model.UsageStatistics.CombinedCipherInputStream;
import hudson.node_monitors.ArchitectureMonitor;
import hudson.util.VersionNumber;
import java.util.Set;
import jenkins.model.Jenkins;
import net.sf.json.JSONObject;
import org.apache.commons.io.IOUtils;
......@@ -50,7 +53,10 @@ import java.util.SortedSet;
import java.util.TreeSet;
import java.util.zip.GZIPInputStream;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
/**
......@@ -95,8 +101,28 @@ public class UsageStatisticsTest {
assertTrue(o.has("jobs"));
assertTrue(o.has("nodes"));
// Validate the plugins format
List<JSONObject> plugins = sortPlugins((List<JSONObject>) o.get("plugins"));
Set<String> detached = new TreeSet<>();
for (ClassicPluginStrategy.DetachedPlugin p: ClassicPluginStrategy.getDetachedPlugins()) {
detached.add(p.getShortName());
}
Set<String> keys = new TreeSet<>();
keys.add("name");
keys.add("version");
Set<String> reported = new TreeSet<>();
for (JSONObject plugin: plugins) {
assertThat(plugin.keySet(), is((Set)keys));
assertThat(plugin.get("name"), instanceOf(String.class));
assertThat(plugin.get("version"), instanceOf(String.class));
String name = plugin.getString("name");
assertThat("No duplicates", reported.contains(name), is(false));
reported.add(name);
}
reported.retainAll(detached); // ignore the dependencies of the detached plugins
assertThat(reported, is(detached));
// Compare content to watch out for backwards compatibility
compareWithFile("plugins.json", sortPlugins((List<JSONObject>) o.get("plugins")));
compareWithFile("jobs.json", sortJobTypes((JSONObject) o.get("jobs")));
compareWithFile("nodes.json", o.get("nodes"));
}
......@@ -123,7 +149,7 @@ public class UsageStatisticsTest {
}
// Plugins can be retrieved in any order, so sorting them so that the test is stable
private Object sortPlugins(List<JSONObject> list) {
private List<JSONObject> sortPlugins(List<JSONObject> list) {
List<JSONObject> sorted = new ArrayList<>(list);
Collections.sort(sorted, new Comparator<JSONObject>() {
public int compare(JSONObject j1, JSONObject j2) {
......
[{"name":"ant","version":"1.2"}, {"name":"antisamy-markup-formatter","version":"1.1"}, {"name":"credentials","version":"1.18"}, {"name":"cvs","version":"2.11"}, {"name":"external-monitor-job","version":"1.4"}, {"name":"javadoc","version":"1.1"}, {"name":"junit","version":"1.2-beta-4"}, {"name":"ldap","version":"1.11"}, {"name":"mailer","version":"1.11"}, {"name":"matrix-auth","version":"1.1"}, {"name":"matrix-project","version":"1.4.1"}, {"name":"maven-plugin","version":"2.7.1"}, {"name":"pam-auth","version":"1.1"}, {"name":"script-security","version":"1.13"}, {"name":"ssh-credentials","version":"1.10"}, {"name":"ssh-slaves","version":"1.9"}, {"name":"subversion","version":"1.54"}, {"name":"translation","version":"1.10"}, {"name":"windows-slaves","version":"1.0"}]
\ No newline at end of file
......@@ -101,12 +101,6 @@ THE SOFTWARE.
<artifactId>instance-identity</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<!-- TODO remove once bouncycastle-api plugin bundles bouncycastle -->
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.54</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>ssh-cli-auth</artifactId>
......@@ -411,6 +405,12 @@ THE SOFTWARE.
<version>1.2-beta-4</version>
<type>hpi</type>
</artifactItem>
<artifactItem>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>bouncycastle-api</artifactId>
<version>2.16.0</version>
<type>hpi</type>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/detached-plugins</outputDirectory>
<stripVersion>true</stripVersion>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册