ProjectApi: Add method to list project dashboards
In the initial implementation, support for the "inherit" flag is not included. Change-Id: I0c615236f395db36e8a35318b221c3127a2bd78d
This commit is contained in:
@@ -25,6 +25,7 @@ import com.google.gerrit.extensions.api.projects.DashboardInfo;
|
||||
import com.google.gerrit.extensions.restapi.BadRequestException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
import com.google.gerrit.server.project.DashboardsCollection;
|
||||
import java.util.List;
|
||||
import org.eclipse.jgit.junit.TestRepository;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
@@ -46,6 +47,7 @@ public class DashboardIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void getDashboard() throws Exception {
|
||||
assertThat(dashboards()).isEmpty();
|
||||
DashboardInfo info = createDashboard(DashboardsCollection.DEFAULT_DASHBOARD_NAME, "test");
|
||||
DashboardInfo result = gApi.projects().name(project.get()).dashboard(info.id).get();
|
||||
assertThat(result.id).isEqualTo(info.id);
|
||||
@@ -53,6 +55,7 @@ public class DashboardIT extends AbstractDaemonTest {
|
||||
assertThat(result.ref).isEqualTo(info.ref);
|
||||
assertThat(result.project).isEqualTo(project.get());
|
||||
assertThat(result.definingProject).isEqualTo(project.get());
|
||||
assertThat(dashboards()).hasSize(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -63,6 +66,10 @@ public class DashboardIT extends AbstractDaemonTest {
|
||||
gApi.projects().name(project.get()).dashboard(info.id).get(true);
|
||||
}
|
||||
|
||||
private List<DashboardInfo> dashboards() throws Exception {
|
||||
return gApi.projects().name(project.get()).dashboards().get();
|
||||
}
|
||||
|
||||
private DashboardInfo createDashboard(String ref, String path) throws Exception {
|
||||
DashboardInfo info = DashboardsCollection.newDashboardInfo(ref, path);
|
||||
String canonicalRef = DashboardsCollection.normalizeDashboardRef(info.ref);
|
||||
|
Reference in New Issue
Block a user