Skip to content

Commit

Permalink
fix(nexus): change Nexus config (#513)
Browse files Browse the repository at this point in the history
Originally I used “repos” to list Nexus repos. Artifactory uses “searches”. I used “repo” instead at first because Nexus actually pushes rather than the polling search that Artifactory does.  But it seems like it is best to stay consistent with Artifactory config naming, and the underlying implementation doesn’t really matter. Though they will function a bit differently. Also, there is a lot of Hal code that could be shared if the naming was consistent. This change makes the naming consistent.
  • Loading branch information
claymccoy authored and cfieber committed Sep 20, 2019
1 parent e9ec638 commit 355e95c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
@Data
@ConfigurationProperties(prefix = "nexus")
public class NexusProperties {
private List<NexusRepo> repos;
private List<NexusRepo> searches;
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ public NexusController(

@GetMapping("/names")
List<String> getNexusNames() {
return nexusProperties.getRepos().stream().map(NexusRepo::getName).collect(Collectors.toList());
return nexusProperties.getSearches().stream()
.map(NexusRepo::getName)
.collect(Collectors.toList());
}

@PostMapping(path = "/webhook", consumes = "application/json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ public void postEvent(NexusAssetWebhookPayload payload) {

private Optional<NexusRepo> findNexusRepo(NexusAssetWebhookPayload payload) {
if (payload.getNodeId() != null) {
return nexusProperties.getRepos().stream()
return nexusProperties.getSearches().stream()
.filter(
repo -> {
return payload.getNodeId().equals(repo.getNodeId());
})
.findFirst();
} else {
return nexusProperties.getRepos().stream()
return nexusProperties.getSearches().stream()
.filter(
repo -> {
return payload.getRepositoryName().equals(repo.getRepo());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class NexusEventPosterTest {
nexusRepo.setRepo("maven-snapshots");
nexusRepo.setBaseUrl("http://localhost:8082/repository/");
nexusRepo.setNodeId("123");
nexusProperties.setRepos(Collections.singletonList(nexusRepo));
nexusProperties.setSearches(Collections.singletonList(nexusRepo));
}

private NexusEventPoster nexusEventPoster = new NexusEventPoster(nexusProperties, echoService);
Expand Down

0 comments on commit 355e95c

Please sign in to comment.