AbstractDaemonTest: Create projects using API instead of SSH
Move the methods from GitUtil into AbstractDaemonTest, as all callers are subclasses anyway so they're passing in the same gApi instance. We can't just replace createProject(name) with gApi.projects().create(name) as the value for createEmptyCommit differs from the default; Change-Id: I525b0a6ffb7ef5d4c3e0324915519325960214fd
This commit is contained in:
committed by
David Pursehouse
parent
4ff91616a1
commit
e6992e76f6
@@ -203,7 +203,7 @@ public abstract class AbstractDaemonTest {
|
|||||||
|
|
||||||
ProjectInput projectInput = projectInput(description);
|
ProjectInput projectInput = projectInput(description);
|
||||||
project = new Project.NameKey(projectInput.name);
|
project = new Project.NameKey(projectInput.name);
|
||||||
gApi.projects().create(projectInput);
|
createProject(projectInput);
|
||||||
|
|
||||||
git = cloneProject(sshSession.getUrl() + "/" + project.get());
|
git = cloneProject(sshSession.getUrl() + "/" + project.get());
|
||||||
}
|
}
|
||||||
@@ -231,6 +231,29 @@ public abstract class AbstractDaemonTest {
|
|||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void createProject(String name) throws RestApiException {
|
||||||
|
createProject(name, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void createProject(String name, Project.NameKey parent)
|
||||||
|
throws RestApiException {
|
||||||
|
// Default for createEmptyCommit should match TestProjectConfig.
|
||||||
|
createProject(name, parent, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void createProject(String name, Project.NameKey parent,
|
||||||
|
boolean createEmptyCommit) throws RestApiException {
|
||||||
|
ProjectInput in = new ProjectInput();
|
||||||
|
in.name = name;
|
||||||
|
in.parent = parent != null ? parent.get() : null;
|
||||||
|
in.createEmptyCommit = createEmptyCommit;
|
||||||
|
createProject(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void createProject(ProjectInput in) throws RestApiException {
|
||||||
|
gApi.projects().create(in);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modify a project input before creating the initial test project.
|
* Modify a project input before creating the initial test project.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import static com.google.common.base.Preconditions.checkState;
|
|||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.gerrit.common.FooterConstants;
|
import com.google.gerrit.common.FooterConstants;
|
||||||
import com.google.gerrit.reviewdb.client.Project;
|
|
||||||
import com.google.gerrit.testutil.TempFileUtil;
|
import com.google.gerrit.testutil.TempFileUtil;
|
||||||
|
|
||||||
import com.jcraft.jsch.JSch;
|
import com.jcraft.jsch.JSch;
|
||||||
@@ -75,39 +74,6 @@ public class GitUtil {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createProject(SshSession s, String name)
|
|
||||||
throws JSchException, IOException {
|
|
||||||
createProject(s, name, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void createProject(SshSession s, String name, Project.NameKey parent)
|
|
||||||
throws JSchException, IOException {
|
|
||||||
createProject(s, name, parent, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void createProject(SshSession s, String name,
|
|
||||||
Project.NameKey parent, boolean emptyCommit)
|
|
||||||
throws JSchException, IOException {
|
|
||||||
StringBuilder b = new StringBuilder();
|
|
||||||
b.append("gerrit create-project");
|
|
||||||
if (emptyCommit) {
|
|
||||||
b.append(" --empty-commit");
|
|
||||||
}
|
|
||||||
b.append(" --name \"");
|
|
||||||
b.append(name);
|
|
||||||
b.append("\"");
|
|
||||||
if (parent != null) {
|
|
||||||
b.append(" --parent \"");
|
|
||||||
b.append(parent.get());
|
|
||||||
b.append("\"");
|
|
||||||
}
|
|
||||||
s.exec(b.toString());
|
|
||||||
if (s.hasError()) {
|
|
||||||
throw new IllegalStateException(
|
|
||||||
"gerrit create-project returned error: " + s.getError());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Git cloneProject(String url) throws GitAPIException, IOException {
|
public static Git cloneProject(String url) throws GitAPIException, IOException {
|
||||||
return cloneProject(url, true);
|
return cloneProject(url, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
package com.google.gerrit.acceptance.rest.project;
|
package com.google.gerrit.acceptance.rest.project;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.gerrit.acceptance.GitUtil.createProject;
|
|
||||||
|
|
||||||
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
||||||
import com.google.gerrit.acceptance.GcAssert;
|
import com.google.gerrit.acceptance.GcAssert;
|
||||||
@@ -40,7 +39,7 @@ public class GarbageCollectionIT extends AbstractDaemonTest {
|
|||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
project2 = new Project.NameKey("p2");
|
project2 = new Project.NameKey("p2");
|
||||||
createProject(sshSession, project2.get());
|
createProject(project2.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
package com.google.gerrit.acceptance.rest.project;
|
package com.google.gerrit.acceptance.rest.project;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.gerrit.acceptance.GitUtil.createProject;
|
|
||||||
import static com.google.gerrit.acceptance.rest.project.ProjectAssert.assertProjectInfo;
|
import static com.google.gerrit.acceptance.rest.project.ProjectAssert.assertProjectInfo;
|
||||||
|
|
||||||
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
||||||
@@ -39,9 +38,9 @@ public class GetChildProjectIT extends AbstractDaemonTest {
|
|||||||
public void getNonChildProject_NotFound() throws Exception {
|
public void getNonChildProject_NotFound() throws Exception {
|
||||||
SshSession sshSession = new SshSession(server, admin);
|
SshSession sshSession = new SshSession(server, admin);
|
||||||
Project.NameKey p1 = new Project.NameKey("p1");
|
Project.NameKey p1 = new Project.NameKey("p1");
|
||||||
createProject(sshSession, p1.get());
|
createProject(p1.get());
|
||||||
Project.NameKey p2 = new Project.NameKey("p2");
|
Project.NameKey p2 = new Project.NameKey("p2");
|
||||||
createProject(sshSession, p2.get());
|
createProject(p2.get());
|
||||||
sshSession.close();
|
sshSession.close();
|
||||||
|
|
||||||
assertChildNotFound(p1, p2.get());
|
assertChildNotFound(p1, p2.get());
|
||||||
@@ -51,7 +50,7 @@ public class GetChildProjectIT extends AbstractDaemonTest {
|
|||||||
public void getChildProject() throws Exception {
|
public void getChildProject() throws Exception {
|
||||||
SshSession sshSession = new SshSession(server, admin);
|
SshSession sshSession = new SshSession(server, admin);
|
||||||
Project.NameKey child = new Project.NameKey("p1");
|
Project.NameKey child = new Project.NameKey("p1");
|
||||||
createProject(sshSession, child.get());
|
createProject(child.get());
|
||||||
sshSession.close();
|
sshSession.close();
|
||||||
|
|
||||||
ProjectInfo childInfo = gApi.projects().name(allProjects.get())
|
ProjectInfo childInfo = gApi.projects().name(allProjects.get())
|
||||||
@@ -63,9 +62,9 @@ public class GetChildProjectIT extends AbstractDaemonTest {
|
|||||||
public void getGrandChildProject_NotFound() throws Exception {
|
public void getGrandChildProject_NotFound() throws Exception {
|
||||||
SshSession sshSession = new SshSession(server, admin);
|
SshSession sshSession = new SshSession(server, admin);
|
||||||
Project.NameKey child = new Project.NameKey("p1");
|
Project.NameKey child = new Project.NameKey("p1");
|
||||||
createProject(sshSession, child.get());
|
createProject(child.get());
|
||||||
Project.NameKey grandChild = new Project.NameKey("p1.1");
|
Project.NameKey grandChild = new Project.NameKey("p1.1");
|
||||||
createProject(sshSession, grandChild.get(), child);
|
createProject(grandChild.get(), child);
|
||||||
sshSession.close();
|
sshSession.close();
|
||||||
|
|
||||||
assertChildNotFound(allProjects, grandChild.get());
|
assertChildNotFound(allProjects, grandChild.get());
|
||||||
@@ -75,9 +74,9 @@ public class GetChildProjectIT extends AbstractDaemonTest {
|
|||||||
public void getGrandChildProjectWithRecursiveFlag() throws Exception {
|
public void getGrandChildProjectWithRecursiveFlag() throws Exception {
|
||||||
SshSession sshSession = new SshSession(server, admin);
|
SshSession sshSession = new SshSession(server, admin);
|
||||||
Project.NameKey child = new Project.NameKey("p1");
|
Project.NameKey child = new Project.NameKey("p1");
|
||||||
createProject(sshSession, child.get());
|
createProject(child.get());
|
||||||
Project.NameKey grandChild = new Project.NameKey("p1.1");
|
Project.NameKey grandChild = new Project.NameKey("p1.1");
|
||||||
createProject(sshSession, grandChild.get(), child);
|
createProject(grandChild.get(), child);
|
||||||
sshSession.close();
|
sshSession.close();
|
||||||
|
|
||||||
ProjectInfo grandChildInfo = gApi.projects().name(allProjects.get())
|
ProjectInfo grandChildInfo = gApi.projects().name(allProjects.get())
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
package com.google.gerrit.acceptance.rest.project;
|
package com.google.gerrit.acceptance.rest.project;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.gerrit.acceptance.GitUtil.createProject;
|
|
||||||
import static com.google.gerrit.acceptance.rest.project.ProjectAssert.assertThatNameList;
|
import static com.google.gerrit.acceptance.rest.project.ProjectAssert.assertThatNameList;
|
||||||
|
|
||||||
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
||||||
@@ -51,11 +50,11 @@ public class ListChildProjectsIT extends AbstractDaemonTest {
|
|||||||
@Test
|
@Test
|
||||||
public void listChildren() throws Exception {
|
public void listChildren() throws Exception {
|
||||||
Project.NameKey child1 = new Project.NameKey("p1");
|
Project.NameKey child1 = new Project.NameKey("p1");
|
||||||
createProject(sshSession, child1.get());
|
createProject(child1.get());
|
||||||
Project.NameKey child2 = new Project.NameKey("p2");
|
Project.NameKey child2 = new Project.NameKey("p2");
|
||||||
createProject(sshSession, child2.get());
|
createProject(child2.get());
|
||||||
Project.NameKey child1_1 = new Project.NameKey("p1.1");
|
Project.NameKey child1_1 = new Project.NameKey("p1.1");
|
||||||
createProject(sshSession, child1_1.get(), child1);
|
createProject(child1_1.get(), child1);
|
||||||
|
|
||||||
assertThatNameList(gApi.projects().name(allProjects.get()).children())
|
assertThatNameList(gApi.projects().name(allProjects.get()).children())
|
||||||
.containsExactly(allUsers, project, child1, child2).inOrder();
|
.containsExactly(allUsers, project, child1, child2).inOrder();
|
||||||
@@ -66,16 +65,16 @@ public class ListChildProjectsIT extends AbstractDaemonTest {
|
|||||||
@Test
|
@Test
|
||||||
public void listChildrenRecursively() throws Exception {
|
public void listChildrenRecursively() throws Exception {
|
||||||
Project.NameKey child1 = new Project.NameKey("p1");
|
Project.NameKey child1 = new Project.NameKey("p1");
|
||||||
createProject(sshSession, child1.get());
|
createProject(child1.get());
|
||||||
createProject(sshSession, "p2");
|
createProject("p2");
|
||||||
Project.NameKey child1_1 = new Project.NameKey("p1.1");
|
Project.NameKey child1_1 = new Project.NameKey("p1.1");
|
||||||
createProject(sshSession, child1_1.get(), child1);
|
createProject(child1_1.get(), child1);
|
||||||
Project.NameKey child1_2 = new Project.NameKey("p1.2");
|
Project.NameKey child1_2 = new Project.NameKey("p1.2");
|
||||||
createProject(sshSession, child1_2.get(), child1);
|
createProject(child1_2.get(), child1);
|
||||||
Project.NameKey child1_1_1 = new Project.NameKey("p1.1.1");
|
Project.NameKey child1_1_1 = new Project.NameKey("p1.1.1");
|
||||||
createProject(sshSession, child1_1_1.get(), child1_1);
|
createProject(child1_1_1.get(), child1_1);
|
||||||
Project.NameKey child1_1_1_1 = new Project.NameKey("p1.1.1.1");
|
Project.NameKey child1_1_1_1 = new Project.NameKey("p1.1.1.1");
|
||||||
createProject(sshSession, child1_1_1_1.get(), child1_1_1);
|
createProject(child1_1_1_1.get(), child1_1_1);
|
||||||
|
|
||||||
assertThatNameList(gApi.projects().name(child1.get()).children(true))
|
assertThatNameList(gApi.projects().name(child1.get()).children(true))
|
||||||
.containsExactly(child1_1, child1_1_1, child1_1_1_1, child1_2)
|
.containsExactly(child1_1, child1_1_1, child1_1_1_1, child1_2)
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
package com.google.gerrit.acceptance.rest.project;
|
package com.google.gerrit.acceptance.rest.project;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.gerrit.acceptance.GitUtil.createProject;
|
|
||||||
import static com.google.gerrit.acceptance.rest.project.ProjectAssert.assertThatNameList;
|
import static com.google.gerrit.acceptance.rest.project.ProjectAssert.assertThatNameList;
|
||||||
import static com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS;
|
import static com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS;
|
||||||
|
|
||||||
@@ -48,7 +47,7 @@ public class ListProjectsIT extends AbstractDaemonTest {
|
|||||||
@Test
|
@Test
|
||||||
public void listProjects() throws Exception {
|
public void listProjects() throws Exception {
|
||||||
Project.NameKey someProject = new Project.NameKey("some-project");
|
Project.NameKey someProject = new Project.NameKey("some-project");
|
||||||
createProject(sshSession, someProject.get());
|
createProject(someProject.get());
|
||||||
assertThatNameList(gApi.projects().list().get())
|
assertThatNameList(gApi.projects().list().get())
|
||||||
.containsExactly(allProjects, allUsers, project, someProject).inOrder();
|
.containsExactly(allProjects, allUsers, project, someProject).inOrder();
|
||||||
}
|
}
|
||||||
@@ -97,7 +96,7 @@ public class ListProjectsIT extends AbstractDaemonTest {
|
|||||||
@Test
|
@Test
|
||||||
public void listProjectsWithLimit() throws Exception {
|
public void listProjectsWithLimit() throws Exception {
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
createProject(sshSession, new Project.NameKey("someProject" + i).get());
|
createProject(new Project.NameKey("someProject" + i).get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5 plus All-Projects, All-Users, and p.
|
// 5 plus All-Projects, All-Users, and p.
|
||||||
@@ -111,12 +110,12 @@ public class ListProjectsIT extends AbstractDaemonTest {
|
|||||||
@Test
|
@Test
|
||||||
public void listProjectsWithPrefix() throws Exception {
|
public void listProjectsWithPrefix() throws Exception {
|
||||||
Project.NameKey someProject = new Project.NameKey("some-project");
|
Project.NameKey someProject = new Project.NameKey("some-project");
|
||||||
createProject(sshSession, someProject.get());
|
createProject(someProject.get());
|
||||||
Project.NameKey someOtherProject =
|
Project.NameKey someOtherProject =
|
||||||
new Project.NameKey("some-other-project");
|
new Project.NameKey("some-other-project");
|
||||||
createProject(sshSession, someOtherProject.get());
|
createProject(someOtherProject.get());
|
||||||
Project.NameKey projectAwesome = new Project.NameKey("project-awesome");
|
Project.NameKey projectAwesome = new Project.NameKey("project-awesome");
|
||||||
createProject(sshSession, projectAwesome.get());
|
createProject(projectAwesome.get());
|
||||||
|
|
||||||
assertBadRequest(gApi.projects().list().withPrefix("some").withRegex(".*"));
|
assertBadRequest(gApi.projects().list().withPrefix("some").withRegex(".*"));
|
||||||
assertBadRequest(gApi.projects().list().withPrefix("some")
|
assertBadRequest(gApi.projects().list().withPrefix("some")
|
||||||
@@ -128,12 +127,12 @@ public class ListProjectsIT extends AbstractDaemonTest {
|
|||||||
@Test
|
@Test
|
||||||
public void listProjectsWithRegex() throws Exception {
|
public void listProjectsWithRegex() throws Exception {
|
||||||
Project.NameKey someProject = new Project.NameKey("some-project");
|
Project.NameKey someProject = new Project.NameKey("some-project");
|
||||||
createProject(sshSession, someProject.get());
|
createProject(someProject.get());
|
||||||
Project.NameKey someOtherProject =
|
Project.NameKey someOtherProject =
|
||||||
new Project.NameKey("some-other-project");
|
new Project.NameKey("some-other-project");
|
||||||
createProject(sshSession, someOtherProject.get());
|
createProject(someOtherProject.get());
|
||||||
Project.NameKey projectAwesome = new Project.NameKey("project-awesome");
|
Project.NameKey projectAwesome = new Project.NameKey("project-awesome");
|
||||||
createProject(sshSession, projectAwesome.get());
|
createProject(projectAwesome.get());
|
||||||
|
|
||||||
assertBadRequest(gApi.projects().list().withRegex("[.*"));
|
assertBadRequest(gApi.projects().list().withRegex("[.*"));
|
||||||
assertBadRequest(gApi.projects().list().withRegex(".*").withPrefix("p"));
|
assertBadRequest(gApi.projects().list().withRegex(".*").withPrefix("p"));
|
||||||
@@ -152,7 +151,7 @@ public class ListProjectsIT extends AbstractDaemonTest {
|
|||||||
@Test
|
@Test
|
||||||
public void listProjectsWithStart() throws Exception {
|
public void listProjectsWithStart() throws Exception {
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
createProject(sshSession, new Project.NameKey("someProject" + i).get());
|
createProject(new Project.NameKey("someProject" + i).get());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ProjectInfo> all = gApi.projects().list().get();
|
List<ProjectInfo> all = gApi.projects().list().get();
|
||||||
@@ -166,12 +165,12 @@ public class ListProjectsIT extends AbstractDaemonTest {
|
|||||||
@Test
|
@Test
|
||||||
public void listProjectsWithSubstring() throws Exception {
|
public void listProjectsWithSubstring() throws Exception {
|
||||||
Project.NameKey someProject = new Project.NameKey("some-project");
|
Project.NameKey someProject = new Project.NameKey("some-project");
|
||||||
createProject(sshSession, someProject.get());
|
createProject(someProject.get());
|
||||||
Project.NameKey someOtherProject =
|
Project.NameKey someOtherProject =
|
||||||
new Project.NameKey("some-other-project");
|
new Project.NameKey("some-other-project");
|
||||||
createProject(sshSession, someOtherProject.get());
|
createProject(someOtherProject.get());
|
||||||
Project.NameKey projectAwesome = new Project.NameKey("project-awesome");
|
Project.NameKey projectAwesome = new Project.NameKey("project-awesome");
|
||||||
createProject(sshSession, projectAwesome.get());
|
createProject(projectAwesome.get());
|
||||||
|
|
||||||
assertBadRequest(gApi.projects().list().withSubstring("some")
|
assertBadRequest(gApi.projects().list().withSubstring("some")
|
||||||
.withRegex(".*"));
|
.withRegex(".*"));
|
||||||
@@ -186,10 +185,10 @@ public class ListProjectsIT extends AbstractDaemonTest {
|
|||||||
public void listProjectsWithTree() throws Exception {
|
public void listProjectsWithTree() throws Exception {
|
||||||
Project.NameKey someParentProject =
|
Project.NameKey someParentProject =
|
||||||
new Project.NameKey("some-parent-project");
|
new Project.NameKey("some-parent-project");
|
||||||
createProject(sshSession, someParentProject.get());
|
createProject(someParentProject.get());
|
||||||
Project.NameKey someChildProject =
|
Project.NameKey someChildProject =
|
||||||
new Project.NameKey("some-child-project");
|
new Project.NameKey("some-child-project");
|
||||||
createProject(sshSession, someChildProject.get(), someParentProject);
|
createProject(someChildProject.get(), someParentProject);
|
||||||
|
|
||||||
Map<String, ProjectInfo> result = gApi.projects().list().withTree(true)
|
Map<String, ProjectInfo> result = gApi.projects().list().withTree(true)
|
||||||
.getAsMap();
|
.getAsMap();
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
package com.google.gerrit.acceptance.rest.project;
|
package com.google.gerrit.acceptance.rest.project;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.gerrit.acceptance.GitUtil.createProject;
|
|
||||||
|
|
||||||
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
||||||
import com.google.gerrit.acceptance.RestResponse;
|
import com.google.gerrit.acceptance.RestResponse;
|
||||||
@@ -29,7 +28,7 @@ public class SetParentIT extends AbstractDaemonTest {
|
|||||||
@Test
|
@Test
|
||||||
public void setParent_Forbidden() throws Exception {
|
public void setParent_Forbidden() throws Exception {
|
||||||
String parent = "parent";
|
String parent = "parent";
|
||||||
createProject(sshSession, parent, null, true);
|
createProject(parent, null, true);
|
||||||
RestResponse r =
|
RestResponse r =
|
||||||
userSession.put("/projects/" + project.get() + "/parent",
|
userSession.put("/projects/" + project.get() + "/parent",
|
||||||
newParentInput(parent));
|
newParentInput(parent));
|
||||||
@@ -40,7 +39,7 @@ public class SetParentIT extends AbstractDaemonTest {
|
|||||||
@Test
|
@Test
|
||||||
public void setParent() throws Exception {
|
public void setParent() throws Exception {
|
||||||
String parent = "parent";
|
String parent = "parent";
|
||||||
createProject(sshSession, parent, null, true);
|
createProject(parent, null, true);
|
||||||
RestResponse r =
|
RestResponse r =
|
||||||
adminSession.put("/projects/" + project.get() + "/parent",
|
adminSession.put("/projects/" + project.get() + "/parent",
|
||||||
newParentInput(parent));
|
newParentInput(parent));
|
||||||
@@ -73,14 +72,14 @@ public class SetParentIT extends AbstractDaemonTest {
|
|||||||
r.consume();
|
r.consume();
|
||||||
|
|
||||||
String child = "child";
|
String child = "child";
|
||||||
createProject(sshSession, child, project, true);
|
createProject(child, project, true);
|
||||||
r = adminSession.put("/projects/" + project.get() + "/parent",
|
r = adminSession.put("/projects/" + project.get() + "/parent",
|
||||||
newParentInput(child));
|
newParentInput(child));
|
||||||
assertThat(r.getStatusCode()).isEqualTo(HttpStatus.SC_CONFLICT);
|
assertThat(r.getStatusCode()).isEqualTo(HttpStatus.SC_CONFLICT);
|
||||||
r.consume();
|
r.consume();
|
||||||
|
|
||||||
String grandchild = "grandchild";
|
String grandchild = "grandchild";
|
||||||
createProject(sshSession, grandchild, new Project.NameKey(child), true);
|
createProject(grandchild, new Project.NameKey(child), true);
|
||||||
r = adminSession.put("/projects/" + project.get() + "/parent",
|
r = adminSession.put("/projects/" + project.get() + "/parent",
|
||||||
newParentInput(grandchild));
|
newParentInput(grandchild));
|
||||||
assertThat(r.getStatusCode()).isEqualTo(HttpStatus.SC_CONFLICT);
|
assertThat(r.getStatusCode()).isEqualTo(HttpStatus.SC_CONFLICT);
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ package com.google.gerrit.acceptance.ssh;
|
|||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.common.truth.Truth.assert_;
|
import static com.google.common.truth.Truth.assert_;
|
||||||
import static com.google.gerrit.acceptance.GitUtil.createProject;
|
|
||||||
|
|
||||||
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
||||||
import com.google.gerrit.acceptance.GcAssert;
|
import com.google.gerrit.acceptance.GcAssert;
|
||||||
@@ -53,10 +52,10 @@ public class GarbageCollectionIT extends AbstractDaemonTest {
|
|||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
project2 = new Project.NameKey("p2");
|
project2 = new Project.NameKey("p2");
|
||||||
createProject(sshSession, project2.get());
|
createProject(project2.get());
|
||||||
|
|
||||||
project3 = new Project.NameKey("p3");
|
project3 = new Project.NameKey("p3");
|
||||||
createProject(sshSession, project3.get());
|
createProject(project3.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ package com.google.gerrit.acceptance.ssh;
|
|||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.gerrit.acceptance.GitUtil.cloneProject;
|
import static com.google.gerrit.acceptance.GitUtil.cloneProject;
|
||||||
import static com.google.gerrit.acceptance.GitUtil.createProject;
|
|
||||||
|
|
||||||
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
||||||
import com.google.gerrit.acceptance.NoHttpd;
|
import com.google.gerrit.acceptance.NoHttpd;
|
||||||
@@ -50,7 +49,7 @@ public class JschVerifyFalseBugIT extends AbstractDaemonTest {
|
|||||||
public Void call() throws Exception {
|
public Void call() throws Exception {
|
||||||
for (int i = 1; i < 100; i++) {
|
for (int i = 1; i < 100; i++) {
|
||||||
String p = "p" + i;
|
String p = "p" + i;
|
||||||
createProject(sshSession, p);
|
createProject(p);
|
||||||
cloneProject(sshSession.getUrl() + "/" + p);
|
cloneProject(sshSession.getUrl() + "/" + p);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user