Merge branch 'stable-3.1' into stable-3.2
* stable-3.1:
Upgrade bazlets to latest stable-3.1 to build with 3.1.8 API
Upgrade bazlets to latest stable-3.0 to build with 3.0.12 API
Upgrade bazlets to latest stable-2.16 to build with 2.16.22 API
Change-Id: Ia85c95a20f415274a51ae4a13816affef1e6be4e
diff --git a/WORKSPACE b/WORKSPACE
index 0abed59..33950a2 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "3f9dadc615dc4053369a42d9ada37dafd8d4763c",
+ commit = "74f9d8e76d5014d218ae6fe55127a5288c9a32c3",
#local_path = "/home/<user>/projects/bazlets",
)
diff --git a/src/main/java/com/googlesource/gerrit/plugins/renameproject/RenameCommand.java b/src/main/java/com/googlesource/gerrit/plugins/renameproject/RenameCommand.java
index 3625e9a..ef251db 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/renameproject/RenameCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/renameproject/RenameCommand.java
@@ -32,6 +32,7 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
+import java.util.NoSuchElementException;
import org.kohsuke.args4j.Argument;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -66,7 +67,7 @@
input.name = newProjectName;
ProjectResource rsrc =
new ProjectResource(
- projectCacheProvider.get().get(Project.nameKey(projectControl)), self.get());
+ projectCacheProvider.get().get(Project.nameKey(projectControl)).get(), self.get());
try (CommandProgressMonitor monitor = new CommandProgressMonitor(stdout)) {
renameProject.assertCanRename(rsrc, input, monitor);
List<Change.Id> changeIds = renameProject.getChanges(rsrc, monitor);
@@ -79,7 +80,7 @@
stdout.flush();
}
}
- } catch (RestApiException | IOException e) {
+ } catch (NoSuchElementException | RestApiException | IOException e) {
throw die(e);
}
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/renameproject/conditions/RenamePreconditions.java b/src/main/java/com/googlesource/gerrit/plugins/renameproject/conditions/RenamePreconditions.java
index 204c564..cab2957 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/renameproject/conditions/RenamePreconditions.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/renameproject/conditions/RenamePreconditions.java
@@ -25,7 +25,7 @@
import com.google.gerrit.server.project.ProjectResource;
import com.google.gerrit.server.restapi.project.ListChildProjects;
import com.google.gerrit.server.submit.MergeOpRepoManager;
-import com.google.gerrit.server.submit.SubmoduleException;
+import com.google.gerrit.server.submit.SubmoduleConflictException;
import com.google.gerrit.server.submit.SubmoduleOp;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -121,7 +121,7 @@
throw new CannotRenameProjectException(message);
}
}
- } catch (IOException | SubmoduleException e) {
+ } catch (IOException | SubmoduleConflictException e) {
throw new CannotRenameProjectException(e);
}
}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/renameproject/LockUnlockProjectTest.java b/src/test/java/com/googlesource/gerrit/plugins/renameproject/LockUnlockProjectTest.java
index aa3776f..02c47c5 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/renameproject/LockUnlockProjectTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/renameproject/LockUnlockProjectTest.java
@@ -34,10 +34,13 @@
@Test
public void testLockUnlockSucceeds() throws IOException, ConfigInvalidException {
- assertThat(projectCache.get(project).getProject().getState()).isEqualTo(ProjectState.ACTIVE);
+ assertThat(projectCache.get(project).get().getProject().getState())
+ .isEqualTo(ProjectState.ACTIVE);
lockUnlockInstance.lock(project);
- assertThat(projectCache.get(project).getProject().getState()).isEqualTo(ProjectState.READ_ONLY);
+ assertThat(projectCache.get(project).get().getProject().getState())
+ .isEqualTo(ProjectState.READ_ONLY);
lockUnlockInstance.unlock(project);
- assertThat(projectCache.get(project).getProject().getState()).isEqualTo(ProjectState.ACTIVE);
+ assertThat(projectCache.get(project).get().getProject().getState())
+ .isEqualTo(ProjectState.ACTIVE);
}
}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/renameproject/RenameIT.java b/src/test/java/com/googlesource/gerrit/plugins/renameproject/RenameIT.java
index 41bd819..6a450e9 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/renameproject/RenameIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/renameproject/RenameIT.java
@@ -29,6 +29,7 @@
import com.google.gerrit.server.project.ProjectState;
import com.google.inject.Inject;
import java.util.List;
+import java.util.Optional;
import javax.inject.Named;
import org.eclipse.jgit.junit.TestRepository;
import org.junit.Test;
@@ -55,8 +56,8 @@
adminSshSession.exec(PLUGIN_NAME + " " + project.get() + " " + NEW_PROJECT_NAME);
adminSshSession.assertSuccess();
- ProjectState projectState = projectCache.get(Project.nameKey(NEW_PROJECT_NAME));
- assertThat(projectState).isNotNull();
+ Optional<ProjectState> projectState = projectCache.get(Project.nameKey(NEW_PROJECT_NAME));
+ assertThat(projectState.isPresent()).isTrue();
assertThat(queryProvider.get().byProject(project)).isEmpty();
assertThat(queryProvider.get().byProject(Project.nameKey(NEW_PROJECT_NAME))).isNotEmpty();
}
@@ -69,8 +70,8 @@
adminSshSession.exec(PLUGIN_NAME + " " + project.get() + " " + newProjectName);
adminSshSession.assertFailure();
- ProjectState projectState = projectCache.get(Project.nameKey(newProjectName));
- assertThat(projectState).isNull();
+ Optional<ProjectState> projectState = projectCache.get(Project.nameKey(newProjectName));
+ assertThat(projectState.isPresent()).isFalse();
}
@Test
@@ -80,8 +81,8 @@
adminSshSession.exec(PLUGIN_NAME + " " + allProjects.get() + " " + NEW_PROJECT_NAME);
adminSshSession.assertFailure();
- ProjectState projectState = projectCache.get(Project.nameKey(NEW_PROJECT_NAME));
- assertThat(projectState).isNull();
+ Optional<ProjectState> projectState = projectCache.get(Project.nameKey(NEW_PROJECT_NAME));
+ assertThat(projectState.isPresent()).isFalse();
}
@Test
diff --git a/src/test/java/com/googlesource/gerrit/plugins/renameproject/RevertRenameProjectTest.java b/src/test/java/com/googlesource/gerrit/plugins/renameproject/RevertRenameProjectTest.java
index c13f2e6..b895bfa 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/renameproject/RevertRenameProjectTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/renameproject/RevertRenameProjectTest.java
@@ -30,6 +30,7 @@
import com.googlesource.gerrit.plugins.renameproject.RenameProject.Step;
import com.googlesource.gerrit.plugins.renameproject.monitor.ProgressMonitor;
import java.util.List;
+import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -125,22 +126,22 @@
}
private void assertReverted() throws Exception {
- ProjectState oldProjectState = projectCache.get(oldProjectKey);
- assertThat(oldProjectState).isNotNull();
+ Optional<ProjectState> oldProjectState = projectCache.get(oldProjectKey);
+ assertThat(oldProjectState.isPresent()).isTrue();
- ProjectState newProjectState = projectCache.get(newProjectKey);
- assertThat(newProjectState).isNull();
+ Optional<ProjectState> newProjectState = projectCache.get(newProjectKey);
+ assertThat(newProjectState.isPresent()).isFalse();
assertThat(queryProvider.get().byProject(oldProjectKey)).isNotEmpty();
assertThat(queryProvider.get().byProject(newProjectKey)).isEmpty();
}
private void assertRenamed(Result result) throws Exception {
- ProjectState oldProjectState = projectCache.get(oldProjectKey);
- assertThat(oldProjectState).isNull();
+ Optional<ProjectState> oldProjectState = projectCache.get(oldProjectKey);
+ assertThat(oldProjectState.isPresent()).isFalse();
- ProjectState newProjectState = projectCache.get(newProjectKey);
- assertThat(newProjectState).isNotNull();
+ Optional<ProjectState> newProjectState = projectCache.get(newProjectKey);
+ assertThat(newProjectState.isPresent()).isTrue();
if (renameProject.getStepsPerformed().contains(Step.DATABASE)) {
ChangeApi changeApi = gApi.changes().id(NEW_PROJECT_NAME, result.getChange().getId().get());