use of jakarta.ws.rs.core.GenericType in project OpenGrok by OpenGrok.
the class ProjectsControllerTest method testGetRepos.
@Test
void testGetRepos() throws Exception {
GenericType<List<String>> type = new GenericType<>() {
};
// Create subrepository.
File mercurialRoot = new File(repository.getSourceRoot() + File.separator + "mercurial");
MercurialRepositoryTest.runHgCommand(mercurialRoot, "clone", mercurialRoot.getAbsolutePath(), mercurialRoot.getAbsolutePath() + File.separator + "closed");
addProject("mercurial");
// Get repositories of the project.
List<String> repos = target("projects").path("mercurial").path("repositories").request().get(type);
// Perform cleanup of the subrepository in order not to interfere
// with other tests.
removeRecursive(new File(mercurialRoot.getAbsolutePath() + File.separator + "closed").toPath());
// test
assertEquals(new ArrayList<>(Arrays.asList(Paths.get("/mercurial").toString(), Paths.get("/mercurial/closed").toString())), repos);
// Test the types. There should be only one type for project with
// multiple nested Mercurial repositories.
List<String> types = target("projects").path("mercurial").path("repositories/type").request().get(type);
assertEquals(Collections.singletonList("Mercurial"), types);
}
Aggregations