Search in sources :

Example 1 with IssueManagement

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;
}
Also used : MavenProject(org.apache.maven.project.MavenProject) HashMap(java.util.HashMap) IssueManagement(org.apache.maven.model.IssueManagement)

Example 2 with IssueManagement

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());
}
Also used : Expectations(mockit.Expectations) MavenProject(org.apache.maven.project.MavenProject) IssueManagement(org.apache.maven.model.IssueManagement) Test(org.junit.Test)

Example 3 with IssueManagement

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());
}
Also used : Issue(org.apache.maven.plugins.issues.Issue) User(org.eclipse.egit.github.core.User) IssueManagement(org.apache.maven.model.IssueManagement)

Example 4 with IssueManagement

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.");
}
Also used : Server(org.apache.maven.settings.Server) SettingsDecrypter(org.apache.maven.settings.crypto.SettingsDecrypter) Log(org.apache.maven.plugin.logging.Log) DefaultSettingsDecryptionRequest(org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest) SettingsDecryptionResult(org.apache.maven.settings.crypto.SettingsDecryptionResult) IssueManagement(org.apache.maven.model.IssueManagement) Settings(org.apache.maven.settings.Settings)

Example 5 with IssueManagement

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;
}
Also used : MavenPomIssueManagement(org.gradle.api.publish.maven.MavenPomIssueManagement) IssueManagement(org.apache.maven.model.IssueManagement)

Aggregations

IssueManagement (org.apache.maven.model.IssueManagement)10 MavenProject (org.apache.maven.project.MavenProject)4 Expectations (mockit.Expectations)3 Test (org.junit.Test)3 Log (org.apache.maven.plugin.logging.Log)2 Server (org.apache.maven.settings.Server)2 Settings (org.apache.maven.settings.Settings)2 DefaultSettingsDecryptionRequest (org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest)2 SettingsDecrypter (org.apache.maven.settings.crypto.SettingsDecrypter)2 SettingsDecryptionResult (org.apache.maven.settings.crypto.SettingsDecryptionResult)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Properties (java.util.Properties)1 Build (org.apache.maven.model.Build)1 CiManagement (org.apache.maven.model.CiManagement)1 Contributor (org.apache.maven.model.Contributor)1 Dependency (org.apache.maven.model.Dependency)1 DependencyManagement (org.apache.maven.model.DependencyManagement)1