Build with 3.0.0 API
- OrmException is replaced with StorageException which is unchecked,
so we don't need to explicitly declare it as thrown.
- Adjust to factory methods for account class.
- Adjust standalone build to fix transient loads with bazel 0.25.
Change-Id: I764e2adc747f408232e065d5a2823717ccd18d01
diff --git a/WORKSPACE b/WORKSPACE
index 34d98a8..4825cd4 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "c2227415d5044f8439bd47edffb0f052f8da2ac5",
+ commit = "51049da0140c58ee26f8285bca4393c5e43ce4a1",
#local_path = "/home/<user>/projects/bazlets",
)
diff --git a/src/main/java/com/criteo/gerrit/plugins/automerge/AtomicityHelper.java b/src/main/java/com/criteo/gerrit/plugins/automerge/AtomicityHelper.java
index 620f515..32b409c 100644
--- a/src/main/java/com/criteo/gerrit/plugins/automerge/AtomicityHelper.java
+++ b/src/main/java/com/criteo/gerrit/plugins/automerge/AtomicityHelper.java
@@ -17,6 +17,7 @@
import static com.google.gerrit.server.permissions.ChangePermission.READ;
import com.google.gerrit.common.data.SubmitRecord;
+import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.changes.RelatedChangeAndCommitInfo;
import com.google.gerrit.extensions.api.changes.RelatedChangesInfo;
import com.google.gerrit.extensions.api.changes.SubmitInput;
@@ -39,7 +40,6 @@
import com.google.gerrit.server.restapi.change.GetRelated;
import com.google.gerrit.server.restapi.change.PostReview;
import com.google.gerrit.server.restapi.change.Submit;
-import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;
import java.io.IOException;
import java.util.List;
@@ -80,11 +80,10 @@
* @throws IOException
* @throws NoSuchChangeException
* @throws NoSuchProjectException
- * @throws OrmException
* @throws PermissionBackendException
*/
public boolean hasDependentReview(String project, int number)
- throws IOException, NoSuchChangeException, NoSuchProjectException, OrmException,
+ throws IOException, NoSuchChangeException, NoSuchProjectException,
PermissionBackendException {
RevisionResource r = getRevisionResource(project, number);
RelatedChangesInfo related = getRelated.apply(r);
@@ -140,9 +139,8 @@
* @param project a change project
* @param change a change number
* @return true or false
- * @throws OrmException
*/
- public boolean isSubmittable(String project, int change) throws OrmException {
+ public boolean isSubmittable(String project, int change) {
ChangeData changeData =
changeDataFactory.create(
new Project.NameKey(project), new com.google.gerrit.reviewdb.client.Change.Id(change));
@@ -165,8 +163,7 @@
submitter.apply(getRevisionResource(project, number), new SubmitInput());
}
- public RevisionResource getRevisionResource(String project, int changeNumber)
- throws OrmException {
+ public RevisionResource getRevisionResource(String project, int changeNumber) {
com.google.gerrit.reviewdb.client.Change.Id changeId =
new com.google.gerrit.reviewdb.client.Change.Id(changeNumber);
ChangeNotes notes = changeNotesFactory.createChecked(changeId);
@@ -191,7 +188,7 @@
throw new RuntimeException("No user found with email: " + config.getBotEmail());
}
return factory.create(ids.iterator().next());
- } catch (IOException | OrmException e) {
+ } catch (IOException | StorageException e) {
throw new RuntimeException("Unable to get account with email: " + config.getBotEmail(), e);
}
}
diff --git a/src/test/java/com/criteo/gerrit/plugins/automerge/AutomaticMergerTest.java b/src/test/java/com/criteo/gerrit/plugins/automerge/AutomaticMergerTest.java
index 5e866ba..ed84b29 100644
--- a/src/test/java/com/criteo/gerrit/plugins/automerge/AutomaticMergerTest.java
+++ b/src/test/java/com/criteo/gerrit/plugins/automerge/AutomaticMergerTest.java
@@ -77,15 +77,15 @@
@Test
@GerritConfig(name = "automerge.botEmail", value = "botuser@mycompany.com")
public void changeShouldBeAutomaticallyMergedByBotUser() throws Exception {
- requestScopeOperations.setApiUser(regularUser.id);
+ requestScopeOperations.setApiUser(regularUser.id());
String changeId = createChange(user);
ChangeApi changeApi = changesApi().id(changeId);
changeApi.current().review(ReviewInput.approve());
ChangeInfo changeInfo = gApi.changes().id(changeId).get();
assertThat(changeInfo.submitter).isNotNull();
- assertThat(changeInfo.submitter._accountId).isEqualTo(new Integer(botUser.id.get()));
- assertThat(changeInfo.submitter.email).isEqualTo(botUser.email);
+ assertThat(changeInfo.submitter._accountId).isEqualTo(new Integer(botUser.id().get()));
+ assertThat(changeInfo.submitter.email).isEqualTo(botUser.email());
}
private AccountGroup.UUID groupUUID(String name) {
@@ -101,7 +101,7 @@
}
protected PushOneCommit.Result createChangeAsUser(String ref, TestAccount user) throws Exception {
- PushOneCommit.Result result = pushFactory.create(user.getIdent(), testRepo).to(ref);
+ PushOneCommit.Result result = pushFactory.create(user.newIdent(), testRepo).to(ref);
result.assertOkStatus();
return result;
}
diff --git a/tools/bzl/classpath.bzl b/tools/bzl/classpath.bzl
index d5764f7..c921d01 100644
--- a/tools/bzl/classpath.bzl
+++ b/tools/bzl/classpath.bzl
@@ -1,4 +1,6 @@
load(
"@com_googlesource_gerrit_bazlets//tools:classpath.bzl",
- "classpath_collector",
+ _classpath_collector = "classpath_collector",
)
+
+classpath_collector = _classpath_collector
diff --git a/tools/bzl/junit.bzl b/tools/bzl/junit.bzl
index 3af7e58..97307bd 100644
--- a/tools/bzl/junit.bzl
+++ b/tools/bzl/junit.bzl
@@ -1,4 +1,6 @@
load(
"@com_googlesource_gerrit_bazlets//tools:junit.bzl",
- "junit_tests",
+ _junit_tests = "junit_tests",
)
+
+junit_tests = _junit_tests
diff --git a/tools/bzl/plugin.bzl b/tools/bzl/plugin.bzl
index 0b25d23..4d2dbdd 100644
--- a/tools/bzl/plugin.bzl
+++ b/tools/bzl/plugin.bzl
@@ -1,6 +1,10 @@
load(
"@com_googlesource_gerrit_bazlets//:gerrit_plugin.bzl",
- "PLUGIN_DEPS",
- "PLUGIN_TEST_DEPS",
- "gerrit_plugin",
+ _gerrit_plugin = "gerrit_plugin",
+ _plugin_deps = "PLUGIN_DEPS",
+ _plugin_test_deps = "PLUGIN_TEST_DEPS",
)
+
+gerrit_plugin = _gerrit_plugin
+PLUGIN_DEPS = _plugin_deps
+PLUGIN_TEST_DEPS = _plugin_test_deps