Search in sources :

Example 11 with ProjectInfo

use of com.google.gerrit.extensions.common.ProjectInfo in project gerrit by GerritCodeReview.

the class AbstractQueryProjectsTest method withStart.

@Test
public void withStart() throws Exception {
    ProjectInfo project1 = createProject(name("project1"));
    ProjectInfo project2 = createProject(name("project2"));
    ProjectInfo project3 = createProject(name("project3"));
    String query = "name:" + project1.name + " OR name:" + project2.name + " OR name:" + project3.name;
    List<ProjectInfo> result = assertQuery(query, project1, project2, project3);
    assertQuery(newQuery(query).withStart(1), result.subList(1, 3));
}
Also used : ProjectInfo(com.google.gerrit.extensions.common.ProjectInfo) Test(org.junit.Test)

Example 12 with ProjectInfo

use of com.google.gerrit.extensions.common.ProjectInfo in project gerrit by GerritCodeReview.

the class AbstractQueryProjectsTest method byName.

@Test
public void byName() throws Exception {
    assertQuery("name:project");
    assertQuery("name:non-existing");
    ProjectInfo project = createProject(name("project"));
    assertQuery("name:" + project.name, project);
    // only exact match
    ProjectInfo projectWithHyphen = createProject(name("project-with-hyphen"));
    createProject(name("project-no-match-with-hyphen"));
    assertQuery("name:" + projectWithHyphen.name, projectWithHyphen);
}
Also used : ProjectInfo(com.google.gerrit.extensions.common.ProjectInfo) Test(org.junit.Test)

Example 13 with ProjectInfo

use of com.google.gerrit.extensions.common.ProjectInfo in project gerrit by GerritCodeReview.

the class AbstractQueryProjectsTest method withLimit.

@Test
public void withLimit() throws Exception {
    ProjectInfo project1 = createProject(name("project1"));
    ProjectInfo project2 = createProject(name("project2"));
    ProjectInfo project3 = createProject(name("project3"));
    String query = "name:" + project1.name + " OR name:" + project2.name + " OR name:" + project3.name;
    List<ProjectInfo> result = assertQuery(query, project1, project2, project3);
    assertQuery(newQuery(query).withLimit(2), result.subList(0, 2));
}
Also used : ProjectInfo(com.google.gerrit.extensions.common.ProjectInfo) Test(org.junit.Test)

Example 14 with ProjectInfo

use of com.google.gerrit.extensions.common.ProjectInfo in project gerrit by GerritCodeReview.

the class AbstractQueryProjectsTest method sortedByName.

@Test
public void sortedByName() throws Exception {
    ProjectInfo projectFoo = createProject("foo-" + name("project1"));
    ProjectInfo projectBar = createProject("bar-" + name("project2"));
    ProjectInfo projectBaz = createProject("baz-" + name("project3"));
    String query = "name:" + projectFoo.name + " OR name:" + projectBar.name + " OR name:" + projectBaz.name;
    assertQuery(newQuery(query), projectBar, projectBaz, projectFoo);
}
Also used : ProjectInfo(com.google.gerrit.extensions.common.ProjectInfo) Test(org.junit.Test)

Example 15 with ProjectInfo

use of com.google.gerrit.extensions.common.ProjectInfo in project gerrit by GerritCodeReview.

the class AbstractQueryProjectsTest method byState.

@Test
public void byState() throws Exception {
    assume().that(getSchemaVersion() >= 2).isTrue();
    ProjectInfo project1 = createProjectWithState(name("project1"), ProjectState.ACTIVE);
    ProjectInfo project2 = createProjectWithState(name("project2"), ProjectState.READ_ONLY);
    assertQuery("state:active", project1);
    assertQuery("state:read-only", project2);
}
Also used : ProjectInfo(com.google.gerrit.extensions.common.ProjectInfo) Test(org.junit.Test)

Aggregations

ProjectInfo (com.google.gerrit.extensions.common.ProjectInfo)38 Test (org.junit.Test)25 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)15 ProjectAssert.assertProjectInfo (com.google.gerrit.acceptance.rest.project.ProjectAssert.assertProjectInfo)10 ProjectState (com.google.gerrit.server.project.ProjectState)10 Project (com.google.gerrit.entities.Project)8 ProjectInput (com.google.gerrit.extensions.api.projects.ProjectInput)5 ImmutableList (com.google.common.collect.ImmutableList)3 BadRequestException (com.google.gerrit.extensions.restapi.BadRequestException)3 Project (com.google.gerrit.reviewdb.client.Project)3 ProjectResource (com.google.gerrit.server.project.ProjectResource)3 ArrayList (java.util.ArrayList)3 Truth.assertThat (com.google.common.truth.Truth.assertThat)2 RestResponse (com.google.gerrit.acceptance.RestResponse)2 AccountGroup (com.google.gerrit.entities.AccountGroup)2 ConfigInput (com.google.gerrit.extensions.api.projects.ConfigInput)2 LabelTypeInfo (com.google.gerrit.extensions.common.LabelTypeInfo)2 WebLinkInfo (com.google.gerrit.extensions.common.WebLinkInfo)2 PermissionBackend (com.google.gerrit.server.permissions.PermissionBackend)2 PermissionBackendException (com.google.gerrit.server.permissions.PermissionBackendException)2