Support retrieving of non-direct child projects via REST
To retrieve a non-direct child project the parameter 'recursive' must be specified: GET /projects/myParent/children/myGrandChild?recursive Without the 'recursive' flag being set only direct child projects can be retrieved. Change-Id: Ia702665efcd5a7ca59bfd9d9a0cc6eccc9ed1d9c Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
committed by
Gerrit Code Review
parent
c6b69e739a
commit
8a3fb5b120
@@ -103,6 +103,23 @@ public class GetChildProjectIT extends AbstractDaemonTest {
|
||||
.getStatusCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getGrandChildProjectWithRecursiveFlag() throws IOException,
|
||||
JSchException {
|
||||
SshSession sshSession = new SshSession(admin);
|
||||
Project.NameKey child = new Project.NameKey("p1");
|
||||
createProject(sshSession, child.get());
|
||||
Project.NameKey grandChild = new Project.NameKey("p1.1");
|
||||
createProject(sshSession, grandChild.get(), child);
|
||||
RestResponse r =
|
||||
GET("/projects/" + allProjects.get() + "/children/" + grandChild.get()
|
||||
+ "?recursive");
|
||||
assertEquals(HttpStatus.SC_OK, r.getStatusCode());
|
||||
ProjectInfo grandChildInfo =
|
||||
(new Gson()).fromJson(r.getReader(), new TypeToken<ProjectInfo>() {}.getType());
|
||||
assertProjectInfo(projectCache.get(grandChild).getProject(), grandChildInfo);
|
||||
}
|
||||
|
||||
private RestResponse GET(String endpoint) throws IOException {
|
||||
return session.get(endpoint);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user