-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhancement: Replace Sonarqube server URL with installation name
- Loading branch information
1 parent
0bd9880
commit 33583c8
Showing
43 changed files
with
1,538 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/org/jenkinsci/plugins/sonargerrit/config/SonarQubeInstallations.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.jenkinsci.plugins.sonargerrit.config; | ||
|
||
import hudson.plugins.sonar.SonarGlobalConfiguration; | ||
import hudson.plugins.sonar.SonarInstallation; | ||
import java.util.Optional; | ||
import java.util.UUID; | ||
import java.util.stream.Stream; | ||
import org.apache.commons.lang3.ArrayUtils; | ||
|
||
/** @author Réda Housni Alaoui */ | ||
class SonarQubeInstallations { | ||
|
||
private SonarQubeInstallations() {} | ||
|
||
public static SonarQubeInstallations get() { | ||
return new SonarQubeInstallations(); | ||
} | ||
|
||
public SonarInstallation findOrCreate(String serverUrl) { | ||
return Stream.of(SonarGlobalConfiguration.get().getInstallations()) | ||
.filter(installation -> serverUrl.equals(installation.getServerUrl())) | ||
.findFirst() | ||
.orElseGet(() -> create(serverUrl)); | ||
} | ||
|
||
public Optional<SonarInstallation> byName(String name) { | ||
return Stream.of(SonarGlobalConfiguration.get().getInstallations()) | ||
.filter(installation -> name.equals(installation.getName())) | ||
.findFirst(); | ||
} | ||
|
||
public SonarInstallation create(String serverUrl) { | ||
SonarInstallation sonarInstallation = | ||
new SonarInstallation( | ||
UUID.randomUUID().toString(), serverUrl, null, null, null, null, null, null, null); | ||
|
||
SonarGlobalConfiguration.get() | ||
.setInstallations( | ||
ArrayUtils.add(SonarGlobalConfiguration.get().getInstallations(), sonarInstallation)); | ||
return sonarInstallation; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ain/resources/org/jenkinsci/plugins/sonargerrit/config/InspectionConfig/config.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
jenkins.plugin.settings.inspection.server.url=Server URL | ||
jenkins.plugin.settings.inspection.sonar-qube.installation=SonarQube installation | ||
jenkins.plugin.settings.inspection.base.config=Project configuration | ||
jenkins.plugin.settings.inspection.base.config.allow.auto.match=Allow auto match | ||
jenkins.plugin.settings.inspection.list.configs=Sub-project configurations |
3 changes: 0 additions & 3 deletions
3
...n/resources/org/jenkinsci/plugins/sonargerrit/config/InspectionConfig/help-serverURL.html
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.