Search in sources :

Example 6 with BrowseResult

use of org.apache.archiva.rest.api.model.BrowseResult in project archiva by apache.

the class RepositoriesServiceTest method deleteGroupId.

@Test
public void deleteGroupId() throws Exception {
    initSourceTargetRepo();
    try {
        BrowseService browseService = getBrowseService(authorizationHeader, false);
        BrowseResult browseResult = browseService.browseGroupId("org.apache.karaf.features", SOURCE_REPO_ID);
        assertNotNull(browseResult);
        log.info("browseResult: {}", browseResult);
        assertThat(browseResult.getBrowseResultEntries()).isNotNull().isNotEmpty().contains(new BrowseResultEntry("org.apache.karaf.features.org.apache.karaf.features.command", true), new BrowseResultEntry("org.apache.karaf.features.org.apache.karaf.features.core", true));
        Path directory = Paths.get("target/test-origin-repo/org/apache/karaf/features/org.apache.karaf.features.command");
        assertTrue("directory not exists", Files.exists(directory));
        RepositoriesService repositoriesService = getRepositoriesService(authorizationHeader);
        repositoriesService.deleteGroupId("org.apache.karaf", SOURCE_REPO_ID);
        assertFalse("directory not exists", Files.exists(directory));
        browseResult = browseService.browseGroupId("org.apache.karaf.features", SOURCE_REPO_ID);
        assertNotNull(browseResult);
        assertThat(browseResult.getBrowseResultEntries()).isNotNull().isEmpty();
        browseResult = browseService.browseGroupId("org.apache.karaf", SOURCE_REPO_ID);
        assertNotNull(browseResult);
        assertThat(browseResult.getBrowseResultEntries()).isNotNull().isEmpty();
        log.info("browseResult empty: {}", browseResult);
    } finally {
        cleanRepos();
    }
}
Also used : Path(java.nio.file.Path) RepositoriesService(org.apache.archiva.rest.api.services.RepositoriesService) ManagedRepositoriesService(org.apache.archiva.rest.api.services.ManagedRepositoriesService) BrowseResultEntry(org.apache.archiva.rest.api.model.BrowseResultEntry) BrowseService(org.apache.archiva.rest.api.services.BrowseService) BrowseResult(org.apache.archiva.rest.api.model.BrowseResult) Test(org.junit.Test)

Aggregations

BrowseResult (org.apache.archiva.rest.api.model.BrowseResult)6 BrowseResultEntry (org.apache.archiva.rest.api.model.BrowseResultEntry)5 BrowseService (org.apache.archiva.rest.api.services.BrowseService)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)2 LinkedHashSet (java.util.LinkedHashSet)2 MetadataResolutionException (org.apache.archiva.metadata.repository.MetadataResolutionException)2 MetadataResolver (org.apache.archiva.metadata.repository.MetadataResolver)2 RepositorySession (org.apache.archiva.metadata.repository.RepositorySession)2 ArchivaRestServiceException (org.apache.archiva.rest.api.services.ArchivaRestServiceException)2 Path (java.nio.file.Path)1 ManagedRepositoriesService (org.apache.archiva.rest.api.services.ManagedRepositoriesService)1 RepositoriesService (org.apache.archiva.rest.api.services.RepositoriesService)1