use of org.apache.maven.model.IssueManagement in project fabric8-maven-plugin by fabric8io.
the class MavenIssueManagementEnricher method getAnnotations.
@Override
public Map<String, String> getAnnotations(Kind kind) {
Map<String, String> annotations = new HashMap<>();
if (kind.isController() || kind == Kind.SERVICE) {
MavenProject rootProject = getProject();
if (hasIssueManagement(rootProject)) {
IssueManagement issueManagement = rootProject.getIssueManagement();
String system = issueManagement.getSystem();
String url = issueManagement.getUrl();
if (StringUtils.isNotEmpty(system) && StringUtils.isNotEmpty(url)) {
annotations.put(ISSUE_MANAGEMENT_SYSTEM, system);
annotations.put(ISSUE_MANAGEMENT_URL, url);
return annotations;
}
}
}
return annotations;
}
use of org.apache.maven.model.IssueManagement in project fabric8-maven-plugin by fabric8io.
the class MavenIssueManagementEnricherTest method testMavenIssueManagementOnlySystem.
@Test
public void testMavenIssueManagementOnlySystem() {
final MavenProject project = new MavenProject();
final IssueManagement issueManagement = new IssueManagement();
issueManagement.setSystem("GitHub");
project.setIssueManagement(issueManagement);
// Setup mock behaviour
new Expectations() {
{
{
context.getProject();
result = project;
}
}
};
MavenIssueManagementEnricher enricher = new MavenIssueManagementEnricher(context);
Map<String, String> scmAnnotations = enricher.getAnnotations(Kind.DEPLOYMENT_CONFIG);
assertTrue(scmAnnotations.isEmpty());
}
use of org.apache.maven.model.IssueManagement in project maven-plugins by apache.
the class GitHubDownloaderTestCase method testCreateIssue.
public void testCreateIssue() throws IOException {
IssueManagement issueManagement = newGitHubIssueManagement();
GitHubDownloader gitHubDownloader = newGitHubDownloader(issueManagement);
org.eclipse.egit.github.core.Issue githubIssue = new org.eclipse.egit.github.core.Issue();
githubIssue.setNumber(1);
githubIssue.setBody("Body");
githubIssue.setTitle("Title");
User user = new User();
githubIssue.setUser(user);
Issue issue = gitHubDownloader.createIssue(githubIssue);
assertEquals(Integer.toString(githubIssue.getNumber()), issue.getId());
assertEquals(Integer.toString(githubIssue.getNumber()), issue.getKey());
assertEquals(githubIssue.getTitle(), issue.getTitle());
assertEquals(githubIssue.getTitle(), issue.getSummary());
assertEquals(issueManagement.getUrl() + githubIssue.getNumber(), issue.getLink());
}
use of org.apache.maven.model.IssueManagement in project maven-plugins by apache.
the class GitHubDownloaderTestCase method testConfigureAuthenticationWithNoServer.
public void testConfigureAuthenticationWithNoServer() throws Exception {
IssueManagement issueManagement = newGitHubIssueManagement();
GitHubDownloader gitHubDownloader = newGitHubDownloader(issueManagement);
Settings settings = new Settings();
Server server = newServer("not-the-right-one");
settings.addServer(server);
SettingsDecrypter decrypter = mock(SettingsDecrypter.class);
SettingsDecryptionResult result = mock(SettingsDecryptionResult.class);
Log log = mock(Log.class);
when(result.getProblems()).thenReturn(Collections.<SettingsProblem>emptyList());
when(result.getServer()).thenReturn(server);
when(decrypter.decrypt(new DefaultSettingsDecryptionRequest(server))).thenReturn(result);
gitHubDownloader.configureAuthentication(decrypter, "github-server", settings, log);
verify(log).warn("Can't find server id [github-server] configured in githubAPIServerId.");
}
use of org.apache.maven.model.IssueManagement in project gradle by gradle.
the class MavenPomFileGenerator method convertIssueManagement.
private IssueManagement convertIssueManagement(MavenPomIssueManagement source) {
IssueManagement target = new IssueManagement();
target.setSystem(source.getSystem().getOrNull());
target.setUrl(source.getUrl().getOrNull());
return target;
}
Aggregations