Search in sources :

Example 1 with GenericType

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);
}
Also used : GenericType(jakarta.ws.rs.core.GenericType) List(java.util.List) ArrayList(java.util.ArrayList) File(java.io.File) MercurialRepositoryTest(org.opengrok.indexer.history.MercurialRepositoryTest) Test(org.junit.jupiter.api.Test)

Aggregations

GenericType (jakarta.ws.rs.core.GenericType)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Test (org.junit.jupiter.api.Test)1 MercurialRepositoryTest (org.opengrok.indexer.history.MercurialRepositoryTest)1