Merge branch 'stable-2.16' into stable-3.0

* stable-2.16:
  ContentTypeUtil: Add singleton scope

Change-Id: I1eaae0a2bb52bc4256562151471655e6ca213b53
diff --git a/.bazelversion b/.bazelversion
index fd2a018..7c69a55 100644
--- a/.bazelversion
+++ b/.bazelversion
@@ -1 +1 @@
-3.1.0
+3.7.0
diff --git a/BUILD b/BUILD
index 6df464f..d74886f 100644
--- a/BUILD
+++ b/BUILD
@@ -7,9 +7,8 @@
     srcs = glob(["src/main/java/**/*.java"]),
     manifest_entries = [
         "Gerrit-PluginName: uploadvalidator",
-        "Gerrit-ApiVersion: 2.16",
+        "Gerrit-ApiVersion: 3.0-SNAPSHOT",
         "Gerrit-Module: com.googlesource.gerrit.plugins.uploadvalidator.Module",
-        "Gerrit-HttpModule: com.googlesource.gerrit.plugins.uploadvalidator.HttpModule",
     ],
     resources = glob(["src/main/resources/**/*"]),
     deps = [
diff --git a/WORKSPACE b/WORKSPACE
index 1917679..215e912 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,26 +3,15 @@
 load("//:bazlets.bzl", "load_bazlets")
 
 load_bazlets(
-    commit = "6c39deb06f58bb62162ccb6865964f531739f512",
+    commit = "a029d8e41d6211c8b23052aa0a0c2c7649577e85",
     #local_path = "/home/<user>/projects/bazlets",
 )
 
-# Snapshot Plugin API
-#load(
-#    "@com_googlesource_gerrit_bazlets//:gerrit_api_maven_local.bzl",
-#    "gerrit_api_maven_local",
-#)
-
-# Load snapshot Plugin API
-#gerrit_api_maven_local()
-
-# Release Plugin API
 load(
     "@com_googlesource_gerrit_bazlets//:gerrit_api.bzl",
     "gerrit_api",
 )
 
-# Load release Plugin API
 gerrit_api()
 
 load("//:external_plugin_deps.bzl", "external_plugin_deps")
diff --git a/src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/ChangeEmailValidator.java b/src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/ChangeEmailValidator.java
index 6deb42c..7ee8f95 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/ChangeEmailValidator.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/ChangeEmailValidator.java
@@ -23,7 +23,6 @@
 import com.google.gerrit.server.config.PluginConfigFactory;
 import com.google.gerrit.server.config.ProjectConfigEntry;
 import com.google.gerrit.server.events.CommitReceivedEvent;
-import com.google.gerrit.server.git.GitRepositoryManager;
 import com.google.gerrit.server.git.validators.CommitValidationException;
 import com.google.gerrit.server.git.validators.CommitValidationListener;
 import com.google.gerrit.server.git.validators.CommitValidationMessage;
@@ -69,18 +68,15 @@
   public static final String KEY_ALLOWED_COMMITTER_EMAIL_PATTERN = "allowedCommitterEmailPattern";
   private final String pluginName;
   private final PluginConfigFactory cfgFactory;
-  private final GitRepositoryManager repoManager;
   private final ValidatorConfig validatorConfig;
 
   @Inject
   ChangeEmailValidator(
       @PluginName String pluginName,
       PluginConfigFactory cfgFactory,
-      GitRepositoryManager repoManager,
       ValidatorConfig validatorConfig) {
     this.pluginName = pluginName;
     this.cfgFactory = cfgFactory;
-    this.repoManager = repoManager;
     this.validatorConfig = validatorConfig;
   }
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/HttpModule.java b/src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/HttpModule.java
deleted file mode 100644
index c5cc519..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/HttpModule.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2019 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.googlesource.gerrit.plugins.uploadvalidator;
-
-import com.google.gerrit.extensions.registration.DynamicSet;
-import com.google.gerrit.extensions.webui.JavaScriptPlugin;
-import com.google.gerrit.extensions.webui.WebUiPlugin;
-import com.google.gerrit.httpd.plugins.HttpPluginModule;
-
-public class HttpModule extends HttpPluginModule {
-
-  @Override
-  protected void configureServlets() {
-    DynamicSet.bind(binder(), WebUiPlugin.class)
-        .toInstance(new JavaScriptPlugin("gr-uploadvalidator.html"));
-  }
-}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/ValidatorConfig.java b/src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/ValidatorConfig.java
index c4ae334..9be7f75 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/ValidatorConfig.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/ValidatorConfig.java
@@ -15,7 +15,8 @@
 package com.googlesource.gerrit.plugins.uploadvalidator;
 
 import com.google.gerrit.common.Nullable;
-import com.google.gerrit.common.data.RefConfigSection;
+import com.google.gerrit.common.data.AccessSection;
+import com.google.gerrit.exceptions.StorageException;
 import com.google.gerrit.extensions.annotations.Exports;
 import com.google.gerrit.extensions.api.projects.ProjectConfigEntryType;
 import com.google.gerrit.reviewdb.client.AccountGroup;
@@ -26,7 +27,6 @@
 import com.google.gerrit.server.group.InternalGroup;
 import com.google.gerrit.server.project.RefPatternMatcher;
 import com.google.gerrit.server.query.group.InternalGroupQuery;
-import com.google.gwtorm.server.OrmException;
 import com.google.inject.AbstractModule;
 import com.google.inject.Inject;
 import com.google.inject.Provider;
@@ -103,7 +103,7 @@
       PluginConfig config, String refKey, Project.NameKey projectName) {
     boolean valid = true;
     for (String refPattern : config.getStringList(refKey)) {
-      if (!RefConfigSection.isValid(refPattern)) {
+      if (!AccessSection.isValidRefSectionName(refPattern)) {
         log.error(
             "Invalid {} name/pattern/regex '{}' in {} project's plugin config",
             refKey,
@@ -176,9 +176,8 @@
   }
 
   private AccountGroup.UUID groupUUID(String groupNameOrUUID) {
-    Optional<InternalGroup> group =
-        groupByNameFinder.get(new AccountGroup.NameKey(groupNameOrUUID));
-    return group.map(InternalGroup::getGroupUUID).orElse(new AccountGroup.UUID(groupNameOrUUID));
+    Optional<InternalGroup> group = groupByNameFinder.get(AccountGroup.nameKey(groupNameOrUUID));
+    return group.map(InternalGroup::getGroupUUID).orElse(AccountGroup.uuid(groupNameOrUUID));
   }
 
   interface GroupByNameFinder {
@@ -198,7 +197,7 @@
     public Optional<InternalGroup> get(AccountGroup.NameKey groupName) {
       try {
         return groupQueryProvider.get().byName(groupName);
-      } catch (OrmException e) {
+      } catch (StorageException e) {
         log.warn(String.format("Cannot lookup group %s by name", groupName.get()), e);
       }
       return Optional.empty();
diff --git a/src/main/resources/Documentation/config.md b/src/main/resources/Documentation/config.md
index eb47d6a..86f2015 100644
--- a/src/main/resources/Documentation/config.md
+++ b/src/main/resources/Documentation/config.md
@@ -308,7 +308,27 @@
     Multiple values are supported.
     Default: nobody is allowed to skip the rules (empty).
 
-    NOTE: When skipGroup isn't defined, all the other skip settings are ignored.
+NOTE: When skipGroup isn't defined, all the other skip settings are ignored.
+
+NOTE: For [system groups](../../../Documentation/access-control.html#system_groups)
+and external groups (e.g.
+[LDAP groups](../../../Documentation/access-control.html#ldap_groups)) the use
+of UUIDs is required. This is because group names are resolved through the
+group index and the group index only contains Gerrit internal groups.
+
+Example for system group:
+
+```
+   [plugin "@PLUGIN@"]
+     skipGroup = global:Registered-Users
+```
+
+Example for external group:
+
+```
+   [plugin "@PLUGIN@"]
+     skipGroup = ldap:Foo
+```
 
 plugin.@PLUGIN@.skipRef
 :    Ref name, pattern or regexp of the branch to skip.
diff --git a/src/main/resources/static/gr-uploadvalidator-config-table.html b/src/main/resources/static/gr-uploadvalidator-config-table.html
deleted file mode 100644
index c8ed87b..0000000
--- a/src/main/resources/static/gr-uploadvalidator-config-table.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<!--
-@license
-Copyright (C) 2019 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.
--->
-
-<dom-module id="gr-uploadvalidator-config-table">
-  <template>
-    <style include="shared-styles"></style>
-    <style include="gr-table-styles">
-      .genericList {
-        margin-bottom: 1em;
-      }
-
-      input#newEntry {
-        width: 100%;
-      }
-    </style>
-    <fieldset>
-      <section>
-        <table class="genericList">
-          <tbody>
-            <template id="list" is="dom-repeat" items="{{entries}}">
-              <tr>
-                <td class="nameColumn">{{item}}</td>
-                <td class="deleteColumn">
-                  <gr-button id="{{item}}"
-                             class="deleteEntryButton"
-                             on-click="_handleDeleteEntry"
-                             disabled="[[disabled]]">
-                    Delete
-                  </gr-button>
-                </td>
-              </tr>
-            </template>
-            <tr>
-              <td class="nameColumn">
-                <iron-input>
-                  <input id="newEntry" type="text" disabled$="[[disabled]]">
-                </iron-input>
-              </td>
-              <td class="deleteColumn">
-                <gr-button id="addEntry"
-                           on-click="_handleAddEntry"
-                           disabled="[[disabled]]">
-                  Add
-                </gr-button>
-              </td>
-            </tr>
-          </tbody>
-        </table>
-      </section>
-    </fieldset>
-  </template>
-  <script src="gr-uploadvalidator-config-table.js"></script>
-</dom-module>
diff --git a/src/main/resources/static/gr-uploadvalidator-config-table.js b/src/main/resources/static/gr-uploadvalidator-config-table.js
deleted file mode 100644
index 89d6bd9..0000000
--- a/src/main/resources/static/gr-uploadvalidator-config-table.js
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (C) 2019 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.
-
-(function () {
-  'use strict';
-
-  Polymer({
-    is: 'gr-uploadvalidator-config-table',
-
-    properties: {
-      disabled: {
-        type: Boolean,
-        reflectToAttribute: true,
-      },
-      entries: {
-        type: Array,
-        value(){ return []; },
-      },
-    },
-
-    _handleAddEntry() {
-      if (this.$.newEntry.value === '') {
-        return;
-      }
-
-      if (!this.entries.includes(this.$.newEntry.value)) {
-        this.push('entries', this.$.newEntry.value);
-        this.fire('listChanged', {
-          entry: this.$.newEntry.value,
-          allEntries: this.entries,
-        });
-      } else {
-        this.fire('show-alert', {message: 'Value already exists.'});
-      }
-      this.$.newEntry.value = '';
-    },
-
-    _handleDeleteEntry(event) {
-      this.splice('entries', this.entries.indexOf(event.path[1].id), 1);
-      this.fire('listChanged', {
-        entry: event.target.id,
-        allEntries: this.entries.slice(),
-      });
-    },
-  })
-})();
diff --git a/src/main/resources/static/gr-uploadvalidator-config.html b/src/main/resources/static/gr-uploadvalidator-config.html
deleted file mode 100644
index 7de6ea2..0000000
--- a/src/main/resources/static/gr-uploadvalidator-config.html
+++ /dev/null
@@ -1,200 +0,0 @@
-<!--
-@license
-Copyright (C) 2019 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.
--->
-
-<link rel="import" href="./gr-uploadvalidator-config-table.html">
-
-<dom-module id="gr-uploadvalidator-config">
-  <template>
-    <style include="shared-styles"></style>
-    <style include="gr-form-styles"></style>
-    <style>
-      .sectionTitle {
-        padding-top: 2em;
-      }
-    </style>
-    <fieldset class="gr-form-styles">
-      <h2 class="sectionTitle">Uploadvalidator Options</h2>
-      <section>
-        <section>
-          <h3>Author Email Pattern</h3>
-          <gr-uploadvalidator-config-table id="allowedAuthorEmailPattern"
-                                           entries=[[_changedConfig.allowedAuthorEmailPattern.values]]
-                                           disabled="[[readOnly]]">
-          </gr-uploadvalidator-config-table>
-        </section>
-        <section>
-          <h3>Committer Email Pattern</h3>
-          <gr-uploadvalidator-config-table id="allowedCommitterEmailPattern"
-                                           entries=[[_changedConfig.allowedCommitterEmailPattern.values]]
-                                           disabled="[[readOnly]]">
-          </gr-uploadvalidator-config-table>
-        </section>
-        <section>
-          <h3>Binary Types</h3>
-          <gr-uploadvalidator-config-table id="binaryTypes"
-                                           entries=[[_changedConfig.binaryTypes.values]]
-                                           disabled="[[readOnly]]">
-          </gr-uploadvalidator-config-table>
-        </section>
-        <section>
-          <h3>Blocked Content</h3>
-          <span class="title">List Type</span>
-          <span class="value">
-            <gr-select id="blockedContentTypeWhitelist"
-                       bind-value="{{_changedConfig.blockedContentTypeWhitelist.value}}"
-                       on-change="_handlePrefsChanged">
-              <select disabled$="[[readOnly]]">
-                <option value="true">Whitelist</option>
-                <option value="false">Blacklist</option>
-              </select>
-            </gr-select>
-          </span>
-          <gr-uploadvalidator-config-table id="blockedContentType"
-                                           entries=[[_changedConfig.blockedContentType.values]]
-                                           disabled="[[readOnly]]">
-          </gr-uploadvalidator-config-table>
-        </section>
-        <section>
-          <h3>Blocked File Extensions</h3>
-          <gr-uploadvalidator-config-table id="blockedFileExtension"
-                                           entries=[[_changedConfig.blockedFileExtension.values]]
-                                           disabled="[[readOnly]]">
-          </gr-uploadvalidator-config-table>
-        </section>
-        <section>
-          <h3>Blocked Keyword Pattern</h3>
-          <gr-uploadvalidator-config-table id="blockedKeywordPattern"
-                                           entries=[[_changedConfig.blockedKeywordPattern.values]]
-                                           disabled="[[readOnly]]">
-          </gr-uploadvalidator-config-table>
-        </section>
-        <section>
-          <h3>Invalid Filename Pattern</h3>
-          <gr-uploadvalidator-config-table id="invalidFilenamePattern"
-                                           entries=[[_changedConfig.invalidFilenamePattern.values]]
-                                           disabled="[[readOnly]]">
-          </gr-uploadvalidator-config-table>
-        </section>
-        <section>
-          <h3>Projects</h3>
-          <gr-uploadvalidator-config-table id="project"
-                                           entries=[[_changedConfig.project.values]]
-                                           disabled="[[readOnly]]">
-          </gr-uploadvalidator-config-table>
-        </section>
-        <section>
-          <h3>Refs</h3>
-          <gr-uploadvalidator-config-table id="ref"
-                                           entries=[[_changedConfig.ref.values]]
-                                           disabled="[[readOnly]]">
-          </gr-uploadvalidator-config-table>
-        </section>
-        <section>
-          <h3>Required Footers</h3>
-          <gr-uploadvalidator-config-table id="requiredFooter"
-                                           entries=[[_changedConfig.requiredFooter.values]]
-                                           disabled="[[readOnly]]">
-          </gr-uploadvalidator-config-table>
-        </section>
-        <section>
-          <span class="title">Max Path Length</span>
-          <span class="value">
-            <iron-input bind-value="{{_changedConfig.maxPathLength.value}}">
-              <input id="maxPathLength"
-                     value="{{_changedConfig.maxPathLength.value::input}}"
-                     prevent-invalid-input
-                     allowed-pattern="[0-9]"
-                     type="number"
-                     on-keypress="_handlePrefsChanged"
-                     on-change="_handlePrefsChanged"
-                     disabled$="[[readOnly]]">
-            </iron-input>
-          </span>
-        </section>
-        <section>
-          <span class="title">Reject Duplicate Pathnames Locale</span>
-          <span class="value">
-            <gr-select id="rejectDuplicatePathnamesLocale"
-                       bind-value="{{_changedConfig.rejectDuplicatePathnamesLocale.value}}"
-                       on-change="_handlePrefsChanged">
-              <select disabled$="[[readOnly]]">
-                <template is="dom-repeat"
-                          items="[[_changedConfig.rejectDuplicatePathnamesLocale.permitted_values]]">
-                  <option value="[[item]]">[[item]]</option>
-                </template>
-              </select>
-            </gr-select>
-          </span>
-        </section>
-        <section>
-          <span class="title">Reject Duplicate Pathnames</span>
-          <span class="value">
-            <gr-select id="rejectDuplicatePathnames"
-                       bind-value="{{_changedConfig.rejectDuplicatePathnames.value}}"
-                       on-change="_handlePrefsChanged">
-              <select disabled$="[[readOnly]]">
-                <option value="true">True</option>
-                <option value="false">False</option>
-              </select>
-            </gr-select>
-          </span>
-        </section>
-        <section>
-          <span class="title">Reject Submodules</span>
-          <span class="value">
-            <gr-select id="rejectSubmodule"
-                       bind-value="{{_changedConfig.rejectSubmodule.value}}"
-                       on-change="_handlePrefsChanged">
-              <select disabled$="[[readOnly]]">
-                <option value="true">True</option>
-                <option value="false">False</option>
-              </select>
-            </gr-select>
-          </span>
-        </section>
-        <section>
-          <span class="title">Reject Symbolic Links</span>
-          <span class="value">
-            <gr-select id="rejectSymlink"
-                       bind-value="{{_changedConfig.rejectSymlink.value}}"
-                       on-change="_handlePrefsChanged">
-              <select disabled$="[[readOnly]]">
-                <option value="true">True</option>
-                <option value="false">False</option>
-              </select>
-            </gr-select>
-          </span>
-        </section>
-        <section>
-          <span class="title">Reject Windows Line Endings</span>
-          <span class="value">
-            <gr-select id="rejectWindowsLineEndings"
-                       bind-value="{{_changedConfig.rejectWindowsLineEndings.value}}"
-                       on-change="_handlePrefsChanged">
-              <select disabled$="[[readOnly]]">
-                <option value="true">True</option>
-                <option value="false">False</option>
-              </select>
-            </gr-select>
-          </span>
-        </section>
-        <gr-button id="saveButton"
-                   on-click="_handlePrefsSave"
-                   disabled="[[!_prefsChanged]]">
-          Save Changes
-        </gr-button>
-    </fieldset>
-  </template>
-  <script src="gr-uploadvalidator-config.js"></script>
-</dom-module>
diff --git a/src/main/resources/static/gr-uploadvalidator-config.js b/src/main/resources/static/gr-uploadvalidator-config.js
deleted file mode 100644
index 69e24a2..0000000
--- a/src/main/resources/static/gr-uploadvalidator-config.js
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (C) 2019 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.
-
-(function () {
-  'use strict';
-
-  Polymer({
-    is: 'gr-uploadvalidator-config',
-
-    properties: {
-      repoName: String,
-      readOnly: {
-        type: Boolean,
-        value: true,
-      },
-      _config: Object,
-      _changedConfig: Object,
-      _prefsChanged: {
-        type: Boolean,
-        value: false,
-      },
-      _projectRestApi: Object,
-    },
-
-    listeners: {
-      listChanged: '_handleListDataChanged',
-    },
-
-    attached() {
-      this._projectRestApi = this.plugin.restApi('/projects/');
-
-      this._getPreferences().then(() => {
-        this._changedConfig = Object.assign({}, this._config);
-      });
-    },
-
-    _getPreferences() {
-      return this._projectRestApi.get(`${encodeURIComponent(this.repoName)}/config`)
-        .then(config => {
-          if (!config) {
-            return;
-          }
-
-          if (config.plugin_config && config.plugin_config.uploadvalidator) {
-            this._config = config.plugin_config.uploadvalidator;
-          }
-        })
-    },
-
-    _handleListDataChanged(event) {
-      this._changedConfig[event.target.id] = { values: event.detail.allEntries };
-      this._handlePrefsChanged();
-    },
-
-    _handlePrefsChanged() {
-      this._prefsChanged = true;
-    },
-
-    _handlePrefsSave() {
-      let body = { plugin_config_values: {} };
-      body.plugin_config_values.uploadvalidator = this._changedConfig;
-
-      this._projectRestApi.put(`${encodeURIComponent(this.repoName)}/config`, body)
-        .then(() => {
-          this._prefsChanged = false;
-        }).catch(response => {
-          this.fire('show-error', { message: response });
-        });
-    },
-
-  });
-})();
diff --git a/src/main/resources/static/gr-uploadvalidator.html b/src/main/resources/static/gr-uploadvalidator.html
deleted file mode 100644
index 767915a..0000000
--- a/src/main/resources/static/gr-uploadvalidator.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!--
-@license
-Copyright (C) 2019 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.
--->
-
-<link rel="import" href="./gr-uploadvalidator-config.html">
-
-<dom-module id="gr-uploadvalidator">
-  <script>
-    Gerrit.install(plugin => {
-      plugin.registerCustomComponent('repo-config', 'gr-uploadvalidator-config');
-    });
-  </script>
-</dom-module>
diff --git a/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/EmailAwareValidatorConfigTest.java b/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/EmailAwareValidatorConfigTest.java
index 8bdb16c..32966c8 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/EmailAwareValidatorConfigTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/EmailAwareValidatorConfigTest.java
@@ -22,7 +22,7 @@
 import org.junit.Test;
 
 public class EmailAwareValidatorConfigTest {
-  private Project.NameKey projectName = new Project.NameKey("testProject");
+  private Project.NameKey projectName = Project.nameKey("testProject");
   private IdentifiedUser anyUser = new FakeUserProvider().get();
 
   @Test
diff --git a/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/FakeGroupByNameFinder.java b/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/FakeGroupByNameFinder.java
index 69f1b74..72d31e4 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/FakeGroupByNameFinder.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/FakeGroupByNameFinder.java
@@ -17,6 +17,7 @@
 import com.google.common.collect.ImmutableSet;
 import com.google.gerrit.reviewdb.client.AccountGroup;
 import com.google.gerrit.server.group.InternalGroup;
+import java.sql.Timestamp;
 import java.util.Objects;
 import java.util.Optional;
 
@@ -28,9 +29,20 @@
     onlyGroup = Optional.empty();
   }
 
-  public FakeGroupByNameFinder(AccountGroup accountGroup) {
+  public FakeGroupByNameFinder(
+      AccountGroup.NameKey name, AccountGroup.Id id, AccountGroup.UUID uuid, Timestamp createdOn) {
     onlyGroup =
-        Optional.of(InternalGroup.create(accountGroup, ImmutableSet.of(), ImmutableSet.of()));
+        Optional.of(
+            InternalGroup.builder()
+                .setId(id)
+                .setNameKey(name)
+                .setGroupUUID(uuid)
+                .setOwnerGroupUUID(uuid)
+                .setVisibleToAll(false)
+                .setCreatedOn(createdOn)
+                .setMembers(ImmutableSet.of())
+                .setSubgroups(ImmutableSet.of())
+                .build());
   }
 
   @Override
diff --git a/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/FakeUserProvider.java b/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/FakeUserProvider.java
index 390eeee..ff79961 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/FakeUserProvider.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/FakeUserProvider.java
@@ -43,7 +43,7 @@
 
   private IdentifiedUser createNew(String email) {
     IdentifiedUser user = createMock(IdentifiedUser.class);
-    Account account = new Account(new Account.Id(1), TimeUtil.nowTs());
+    Account account = new Account(Account.id(1), TimeUtil.nowTs());
     account.setPreferredEmail(email);
     expect(user.isIdentifiedUser()).andReturn(true);
     expect(user.asIdentifiedUser()).andReturn(user);
diff --git a/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/ProjectAwareValidatorConfigTest.java b/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/ProjectAwareValidatorConfigTest.java
index e6e1be7..a5e01c9 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/ProjectAwareValidatorConfigTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/ProjectAwareValidatorConfigTest.java
@@ -22,7 +22,7 @@
 import org.junit.Test;
 
 public class ProjectAwareValidatorConfigTest {
-  private Project.NameKey projectName = new Project.NameKey("testProject");
+  private Project.NameKey projectName = Project.nameKey("testProject");
   private IdentifiedUser anyUser = new FakeUserProvider().get();
 
   @Test
@@ -66,7 +66,7 @@
         "[plugin \"uploadvalidator\"]\n"
             + "   project = test.*\n"
             + "   blockedFileExtension = jar";
-    Project.NameKey otherNameKey = new Project.NameKey("someOtherProject");
+    Project.NameKey otherNameKey = Project.nameKey("someOtherProject");
     ValidatorConfig config = getConfig(configString, projectName);
     ValidatorConfig config2 = getConfig(configString, otherNameKey);
 
@@ -83,8 +83,8 @@
             + "   project = testProject\n"
             + "   project = another.*\n"
             + "   blockedFileExtension = jar";
-    Project.NameKey anotherNameKey = new Project.NameKey("anotherProject");
-    Project.NameKey someOtherNameKey = new Project.NameKey("someOtherProject");
+    Project.NameKey anotherNameKey = Project.nameKey("anotherProject");
+    Project.NameKey someOtherNameKey = Project.nameKey("someOtherProject");
     ValidatorConfig config = getConfig(configString, projectName);
     ValidatorConfig config2 = getConfig(configString, anotherNameKey);
     ValidatorConfig config3 = getConfig(configString, someOtherNameKey);
diff --git a/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/RefAwareValidatorConfigTest.java b/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/RefAwareValidatorConfigTest.java
index acc2bdc..2e400e1 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/RefAwareValidatorConfigTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/RefAwareValidatorConfigTest.java
@@ -22,7 +22,7 @@
 import org.junit.Test;
 
 public class RefAwareValidatorConfigTest {
-  private final Project.NameKey projectName = new Project.NameKey("testProject");
+  private final Project.NameKey projectName = Project.nameKey("testProject");
   private final IdentifiedUser anyUser = new FakeUserProvider().get();
 
   @Test
diff --git a/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/SkipValidationTest.java b/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/SkipValidationTest.java
index 56bf317..3310361 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/SkipValidationTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/SkipValidationTest.java
@@ -23,7 +23,7 @@
 import org.junit.Test;
 
 public class SkipValidationTest {
-  private final Project.NameKey projectName = new Project.NameKey("testProject");
+  private final Project.NameKey projectName = Project.nameKey("testProject");
   private final IdentifiedUser anyUser = new FakeUserProvider().get();
 
   @Test
@@ -64,11 +64,10 @@
         new ValidatorConfig(
             new FakeConfigFactory(projectName, config),
             new FakeGroupByNameFinder(
-                new AccountGroup(
-                    new AccountGroup.NameKey("testGroupName"),
-                    new AccountGroup.Id(1),
-                    new AccountGroup.UUID("testGroupId"),
-                    TimeUtil.nowTs())));
+                AccountGroup.nameKey("testGroupName"),
+                AccountGroup.id(1),
+                AccountGroup.uuid("testGroupId"),
+                TimeUtil.nowTs()));
 
     assertThat(
             validatorConfig.isEnabledForRef(