Merge "GetServerInfo: Return archive format names as lower case"
This commit is contained in:
@@ -94,10 +94,10 @@ As result a link:#server-info[ServerInfo] entity is returned.
|
||||
}
|
||||
],
|
||||
"archives": [
|
||||
"TGZ",
|
||||
"TAR",
|
||||
"TBZ2",
|
||||
"TXZ"
|
||||
"tgz",
|
||||
"tar",
|
||||
"tbz2",
|
||||
"txz"
|
||||
]
|
||||
},
|
||||
"gerrit": {
|
||||
@@ -1001,8 +1001,8 @@ options.
|
||||
The supported download schemes as a map which maps the scheme name to a
|
||||
of link:#download-scheme-info[DownloadSchemeInfo] entity.
|
||||
|`archives` |
|
||||
List of supported archive formats. Possible values are `TGZ`, `TAR`,
|
||||
`TBZ2` and `TXZ`.
|
||||
List of supported archive formats. Possible values are `tgz`, `tar`,
|
||||
`tbz2` and `txz`.
|
||||
|=======================
|
||||
|
||||
[[download-scheme-info]]
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
package com.google.gerrit.server.config;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gerrit.extensions.config.DownloadCommand;
|
||||
import com.google.gerrit.extensions.config.DownloadScheme;
|
||||
import com.google.gerrit.extensions.registration.DynamicMap;
|
||||
@@ -30,6 +32,7 @@ import java.net.MalformedURLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public class GetServerInfo implements RestReadView<ConfigResource> {
|
||||
@@ -113,7 +116,7 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
|
||||
|
||||
public static class DownloadInfo {
|
||||
public Map<String, DownloadSchemeInfo> schemes;
|
||||
public List<ArchiveFormat> archives;
|
||||
public List<String> archives;
|
||||
|
||||
public DownloadInfo(DownloadConfig downloadConfig,
|
||||
DynamicMap<DownloadScheme> downloadSchemes,
|
||||
@@ -126,7 +129,14 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
|
||||
new DownloadSchemeInfo(scheme, downloadCommands));
|
||||
}
|
||||
}
|
||||
archives = new ArrayList<>(downloadConfig.getArchiveFormats());
|
||||
archives =
|
||||
Lists.transform(new ArrayList<>(downloadConfig.getArchiveFormats()),
|
||||
new Function<ArchiveFormat, String>() {
|
||||
@Override
|
||||
public String apply(ArchiveFormat archiveFormat) {
|
||||
return archiveFormat.name().toLowerCase(Locale.US);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user