use of org.sonatype.nexus.repository.Repository in project nexus-repository-r by sonatype-nexus-community.
the class PackagesGroupHandler method doGet.
@Override
protected Response doGet(@Nonnull final Context context, @Nonnull final GroupHandler.DispatchedRepositories dispatched) throws Exception {
GroupFacet groupFacet = context.getRepository().facet(GroupFacet.class);
Map<Repository, Response> responses = getAll(context, groupFacet.members(), dispatched);
List<Response> successfulResponses = responses.values().stream().filter(response -> response.getStatus().getCode() == HttpStatus.OK && response.getPayload() != null).collect(Collectors.toList());
if (successfulResponses.isEmpty()) {
return notFoundResponse(context);
}
if (successfulResponses.size() == 1) {
return successfulResponses.get(0);
}
List<List<Map<String, String>>> parts = successfulResponses.stream().map(this::parseResponse).collect(Collectors.toList());
List<Map<String, String>> merged = RPackagesUtils.merge(parts);
return HttpResponses.ok(RPackagesUtils.buildPackages(merged));
}
use of org.sonatype.nexus.repository.Repository in project nexus-repository-r by sonatype-nexus-community.
the class RResourceIT method createProxy.
@Test
public void createProxy() throws Exception {
AbstractRepositoryApiRequest request = createProxyRequest(true);
Response response = post(getCreateRepositoryPathUrl(ProxyType.NAME), request);
assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
Repository repository = repositoryManager.get(request.getName());
assertNotNull(repository);
assertEquals(RFormat.NAME, repository.getFormat().getValue());
assertEquals(ProxyType.NAME, repository.getType().getValue());
repositoryManager.delete(request.getName());
}
use of org.sonatype.nexus.repository.Repository in project nexus-repository-r by sonatype-nexus-community.
the class RResourceIT method updateHosted.
@Test
public void updateHosted() throws Exception {
repos.createRHosted(HOSTED_NAME);
AbstractRepositoryApiRequest request = createHostedRequest(false);
Response response = put(getUpdateRepositoryPathUrl(HostedType.NAME, HOSTED_NAME), request);
assertEquals(Status.NO_CONTENT.getStatusCode(), response.getStatus());
Repository repository = repositoryManager.get(request.getName());
assertNotNull(repository);
assertThat(repository.getConfiguration().attributes("storage").get("strictContentTypeValidation"), is(false));
repositoryManager.delete(HOSTED_NAME);
}
Aggregations