use of org.apache.archiva.rest.api.services.BrowseService in project archiva by apache.
the class BrowseServiceTest method getProjectVersionMetadata.
@Test
public void getProjectVersionMetadata() throws Exception {
BrowseService browseService = getBrowseService(authorizationHeader, true);
ProjectVersionMetadata metadata = browseService.getProjectVersionMetadata("org.apache.karaf.features", "org.apache.karaf.features.core", TEST_REPO_ID);
assertThat(metadata).isNotNull();
}
use of org.apache.archiva.rest.api.services.BrowseService in project archiva by apache.
the class BrowseServiceTest method listUserRepositories.
@Test
public void listUserRepositories() throws Exception {
initSourceTargetRepo();
BrowseService browseService = getBrowseService(authorizationHeader, false);
List<ManagedRepository> browseResult = browseService.getUserRepositories();
assertThat(browseResult).isNotNull().isNotEmpty().hasSize(5);
List<String> repIds = new ArrayList<>();
for (ManagedRepository rep : browseResult) {
repIds.add(rep.getId());
}
assertThat(repIds).contains("internal", "snapshots", "test-repo", "test-copy-target", "test-origin-repo");
}
use of org.apache.archiva.rest.api.services.BrowseService in project archiva by apache.
the class BrowseServiceTest method metadatagetthenadd.
@Test
public void metadatagetthenadd() throws Exception {
scanRepo(TEST_REPO_ID);
waitForScanToComplete(TEST_REPO_ID);
BrowseService browseService = getBrowseService(authorizationHeader, false);
Map<String, String> metadatas = toMap(browseService.getMetadatas("commons-cli", "commons-cli", "1.0", TEST_REPO_ID));
assertThat(metadatas).isNotNull().isEmpty();
browseService.addMetadata("commons-cli", "commons-cli", "1.0", "wine", "bordeaux", TEST_REPO_ID);
metadatas = toMap(browseService.getMetadatas("commons-cli", "commons-cli", "1.0", TEST_REPO_ID));
assertThat(metadatas).isNotNull().isNotEmpty().contains(MapEntry.entry("wine", "bordeaux"));
}
use of org.apache.archiva.rest.api.services.BrowseService in project archiva by apache.
the class BrowseServiceTest method listUserManagableRepositories.
@Test
public void listUserManagableRepositories() throws Exception {
initSourceTargetRepo();
// Giving the guest user a manager role
String name = "Repository Manager - internal";
Role role = getRoleManagementService(authorizationHeader).getRole(name);
role.setUsers(Arrays.asList(getUserService(authorizationHeader).getUser("guest")));
getRoleManagementService(authorizationHeader).updateRoleUsers(role);
// browseService with guest user
BrowseService browseService = getBrowseService("", false);
List<ManagedRepository> browseResult = browseService.getUserManagableRepositories();
assertThat(browseResult).isNotNull().isNotEmpty().hasSize(1);
List<String> repIds = new ArrayList<>();
for (ManagedRepository rep : browseResult) {
repIds.add(rep.getId());
}
assertThat(repIds).contains("internal");
}
use of org.apache.archiva.rest.api.services.BrowseService in project archiva by apache.
the class BrowseServiceTest method readArtifactContentText.
@Test
public void readArtifactContentText() throws Exception {
BrowseService browseService = getBrowseService(authorizationHeader, true);
WebClient.client(browseService).accept(MediaType.TEXT_PLAIN);
String text = browseService.getArtifactContentText("commons-logging", "commons-logging", "1.1", "sources", null, "org/apache/commons/logging/LogSource.java", TEST_REPO_ID).getContent();
log.debug("text: {}", text);
assertThat(text).contains("package org.apache.commons.logging;").contains("public class LogSource {");
}
Aggregations