GetServerInfo: Move ServerInfo and nested classes to extension API
This will allow it to be used in the config API. Change-Id: Ia0116cd158a14c8a15bee59a38b1f4892a84c297
This commit is contained in:
@@ -23,10 +23,10 @@ import com.google.gerrit.acceptance.GerritConfigs;
|
|||||||
import com.google.gerrit.acceptance.RestResponse;
|
import com.google.gerrit.acceptance.RestResponse;
|
||||||
import com.google.gerrit.extensions.client.AccountFieldName;
|
import com.google.gerrit.extensions.client.AccountFieldName;
|
||||||
import com.google.gerrit.extensions.client.AuthType;
|
import com.google.gerrit.extensions.client.AuthType;
|
||||||
|
import com.google.gerrit.extensions.common.ServerInfo;
|
||||||
import com.google.gerrit.server.config.AllProjectsNameProvider;
|
import com.google.gerrit.server.config.AllProjectsNameProvider;
|
||||||
import com.google.gerrit.server.config.AllUsersNameProvider;
|
import com.google.gerrit.server.config.AllUsersNameProvider;
|
||||||
import com.google.gerrit.server.config.AnonymousCowardNameProvider;
|
import com.google.gerrit.server.config.AnonymousCowardNameProvider;
|
||||||
import com.google.gerrit.server.config.GetServerInfo.ServerInfo;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
// Copyright (C) 2016 The Android Open Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package com.google.gerrit.extensions.common;
|
||||||
|
|
||||||
|
import com.google.gerrit.extensions.client.AccountFieldName;
|
||||||
|
import com.google.gerrit.extensions.client.AuthType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AuthInfo {
|
||||||
|
public AuthType authType;
|
||||||
|
public Boolean useContributorAgreements;
|
||||||
|
public List<AccountFieldName> editableAccountFields;
|
||||||
|
public String loginUrl;
|
||||||
|
public String loginText;
|
||||||
|
public String switchAccountUrl;
|
||||||
|
public String registerUrl;
|
||||||
|
public String registerText;
|
||||||
|
public String editFullNameUrl;
|
||||||
|
public String httpPasswordUrl;
|
||||||
|
public Boolean isGitBasicAuth;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// Copyright (C) 2016 The Android Open Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package com.google.gerrit.extensions.common;
|
||||||
|
|
||||||
|
public class ChangeConfigInfo {
|
||||||
|
public Boolean allowBlame;
|
||||||
|
public Boolean allowDrafts;
|
||||||
|
public int largeChange;
|
||||||
|
public String replyLabel;
|
||||||
|
public String replyTooltip;
|
||||||
|
public int updateDelay;
|
||||||
|
public Boolean submitWholeTopic;
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// Copyright (C) 2016 The Android Open Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package com.google.gerrit.extensions.common;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class DownloadInfo {
|
||||||
|
public Map<String, DownloadSchemeInfo> schemes;
|
||||||
|
public List<String> archives;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// Copyright (C) 2016 The Android Open Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package com.google.gerrit.extensions.common;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class DownloadSchemeInfo {
|
||||||
|
public String url;
|
||||||
|
public Boolean isAuthRequired;
|
||||||
|
public Boolean isAuthSupported;
|
||||||
|
public Map<String, String> commands;
|
||||||
|
public Map<String, String> cloneCommands;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// Copyright (C) 2016 The Android Open Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package com.google.gerrit.extensions.common;
|
||||||
|
|
||||||
|
public class GerritInfo {
|
||||||
|
public String allProjects;
|
||||||
|
public String allUsers;
|
||||||
|
public Boolean docSearch;
|
||||||
|
public String docUrl;
|
||||||
|
public Boolean editGpgKeys;
|
||||||
|
public String reportBugUrl;
|
||||||
|
public String reportBugText;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// Copyright (C) 2016 The Android Open Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package com.google.gerrit.extensions.common;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PluginConfigInfo {
|
||||||
|
public Boolean hasAvatars;
|
||||||
|
public List<String> jsResourcePaths;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// Copyright (C) 2016 The Android Open Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package com.google.gerrit.extensions.common;
|
||||||
|
|
||||||
|
public class ReceiveInfo {
|
||||||
|
public Boolean enableSignedPush;
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
// Copyright (C) 2016 The Android Open Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package com.google.gerrit.extensions.common;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ServerInfo {
|
||||||
|
public AuthInfo auth;
|
||||||
|
public ChangeConfigInfo change;
|
||||||
|
public DownloadInfo download;
|
||||||
|
public GerritInfo gerrit;
|
||||||
|
public Boolean noteDbEnabled;
|
||||||
|
public PluginConfigInfo plugin;
|
||||||
|
public SshdInfo sshd;
|
||||||
|
public SuggestInfo suggest;
|
||||||
|
public Map<String, String> urlAliases;
|
||||||
|
public UserConfigInfo user;
|
||||||
|
public ReceiveInfo receive;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
// Copyright (C) 2016 The Android Open Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package com.google.gerrit.extensions.common;
|
||||||
|
|
||||||
|
public class SshdInfo {
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// Copyright (C) 2016 The Android Open Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package com.google.gerrit.extensions.common;
|
||||||
|
|
||||||
|
public class SuggestInfo {
|
||||||
|
public int from;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// Copyright (C) 2016 The Android Open Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package com.google.gerrit.extensions.common;
|
||||||
|
|
||||||
|
public class UserConfigInfo {
|
||||||
|
public String anonymousCowardName;
|
||||||
|
}
|
||||||
@@ -20,8 +20,17 @@ import com.google.common.base.Optional;
|
|||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.gerrit.extensions.client.AccountFieldName;
|
import com.google.gerrit.extensions.common.AuthInfo;
|
||||||
import com.google.gerrit.extensions.client.AuthType;
|
import com.google.gerrit.extensions.common.ChangeConfigInfo;
|
||||||
|
import com.google.gerrit.extensions.common.DownloadInfo;
|
||||||
|
import com.google.gerrit.extensions.common.DownloadSchemeInfo;
|
||||||
|
import com.google.gerrit.extensions.common.GerritInfo;
|
||||||
|
import com.google.gerrit.extensions.common.PluginConfigInfo;
|
||||||
|
import com.google.gerrit.extensions.common.ReceiveInfo;
|
||||||
|
import com.google.gerrit.extensions.common.ServerInfo;
|
||||||
|
import com.google.gerrit.extensions.common.SshdInfo;
|
||||||
|
import com.google.gerrit.extensions.common.SuggestInfo;
|
||||||
|
import com.google.gerrit.extensions.common.UserConfigInfo;
|
||||||
import com.google.gerrit.extensions.config.CloneCommand;
|
import com.google.gerrit.extensions.config.CloneCommand;
|
||||||
import com.google.gerrit.extensions.config.DownloadCommand;
|
import com.google.gerrit.extensions.config.DownloadCommand;
|
||||||
import com.google.gerrit.extensions.config.DownloadScheme;
|
import com.google.gerrit.extensions.config.DownloadScheme;
|
||||||
@@ -45,7 +54,6 @@ import org.eclipse.jgit.lib.Config;
|
|||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@@ -322,85 +330,4 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
|
|||||||
private static Boolean toBoolean(boolean v) {
|
private static Boolean toBoolean(boolean v) {
|
||||||
return v ? v : null;
|
return v ? v : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ServerInfo {
|
|
||||||
public AuthInfo auth;
|
|
||||||
public ChangeConfigInfo change;
|
|
||||||
public DownloadInfo download;
|
|
||||||
public GerritInfo gerrit;
|
|
||||||
public Boolean noteDbEnabled;
|
|
||||||
public PluginConfigInfo plugin;
|
|
||||||
public SshdInfo sshd;
|
|
||||||
public SuggestInfo suggest;
|
|
||||||
public Map<String, String> urlAliases;
|
|
||||||
public UserConfigInfo user;
|
|
||||||
public ReceiveInfo receive;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class AuthInfo {
|
|
||||||
public AuthType authType;
|
|
||||||
public Boolean useContributorAgreements;
|
|
||||||
public List<AccountFieldName> editableAccountFields;
|
|
||||||
public String loginUrl;
|
|
||||||
public String loginText;
|
|
||||||
public String switchAccountUrl;
|
|
||||||
public String registerUrl;
|
|
||||||
public String registerText;
|
|
||||||
public String editFullNameUrl;
|
|
||||||
public String httpPasswordUrl;
|
|
||||||
public Boolean isGitBasicAuth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ChangeConfigInfo {
|
|
||||||
public Boolean allowBlame;
|
|
||||||
public Boolean allowDrafts;
|
|
||||||
public int largeChange;
|
|
||||||
public String replyLabel;
|
|
||||||
public String replyTooltip;
|
|
||||||
public int updateDelay;
|
|
||||||
public Boolean submitWholeTopic;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class DownloadInfo {
|
|
||||||
public Map<String, DownloadSchemeInfo> schemes;
|
|
||||||
public List<String> archives;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class DownloadSchemeInfo {
|
|
||||||
public String url;
|
|
||||||
public Boolean isAuthRequired;
|
|
||||||
public Boolean isAuthSupported;
|
|
||||||
public Map<String, String> commands;
|
|
||||||
public Map<String, String> cloneCommands;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class GerritInfo {
|
|
||||||
public String allProjects;
|
|
||||||
public String allUsers;
|
|
||||||
public Boolean docSearch;
|
|
||||||
public String docUrl;
|
|
||||||
public Boolean editGpgKeys;
|
|
||||||
public String reportBugUrl;
|
|
||||||
public String reportBugText;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class PluginConfigInfo {
|
|
||||||
public Boolean hasAvatars;
|
|
||||||
public List<String> jsResourcePaths;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class SshdInfo {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class SuggestInfo {
|
|
||||||
public int from;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class UserConfigInfo {
|
|
||||||
public String anonymousCowardName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ReceiveInfo {
|
|
||||||
public Boolean enableSignedPush;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user