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:
David Pursehouse
2016-08-22 21:17:27 +09:00
parent 49d9a46904
commit e9d0b55694
13 changed files with 272 additions and 85 deletions

View File

@@ -23,10 +23,10 @@ import com.google.gerrit.acceptance.GerritConfigs;
import com.google.gerrit.acceptance.RestResponse;
import com.google.gerrit.extensions.client.AccountFieldName;
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.AllUsersNameProvider;
import com.google.gerrit.server.config.AnonymousCowardNameProvider;
import com.google.gerrit.server.config.GetServerInfo.ServerInfo;
import org.junit.Test;

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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 {
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -20,8 +20,17 @@ import com.google.common.base.Optional;
import com.google.common.base.Strings;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.gerrit.extensions.client.AccountFieldName;
import com.google.gerrit.extensions.client.AuthType;
import com.google.gerrit.extensions.common.AuthInfo;
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.DownloadCommand;
import com.google.gerrit.extensions.config.DownloadScheme;
@@ -45,7 +54,6 @@ import org.eclipse.jgit.lib.Config;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@@ -322,85 +330,4 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
private static Boolean toBoolean(boolean v) {
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;
}
}