Java Code Examples for org.eclipse.egit.github.core.service.IssueService#createIssue()

The following examples show how to use org.eclipse.egit.github.core.service.IssueService#createIssue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GitHubExporterTest.java    From rtc2jira with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testExport_WithDBEntries_ExpectExport(@Mocked Repository repoMock, @Mocked IssueService issueServiceMock)
    throws Exception {
  new Expectations() {
    {
      settingsMock.hasGithubProperties();
      result = true;
      _service.getRepository(anyString, anyString);
      result = repoMock;
    }
  };
  engine.withDB(db -> {
    createWorkItem(123);
    createWorkItem(324);
  });
  ExportManager exportManager = new ExportManager();
  exportManager.addExporters(exporter);
  exportManager.export(settingsMock, engine);

  new Verifications() {
    {
      issueServiceMock.createIssue(null, withInstanceOf(Issue.class));
      times = 2;
    }
  };
}
 
Example 2
Source File: ExportManagerTest.java    From rtc2jira with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testExport_EmptyDB_ExpectNoExport(@Mocked IssueService issueServiceMock) throws Exception {
  new Expectations() {
    {
      exporter.isConfigured();
      result = true;
    }
  };
  ExportManager exportManager = new ExportManager();
  exportManager.addExporters(exporter);
  exportManager.export(settingsMock, engine);
  new Verifications() {
    {
      exporter.initialize(settingsMock, engine);
      times = 1;

      issueServiceMock.createIssue(withInstanceOf(IRepositoryIdProvider.class), withInstanceOf(Issue.class));
      times = 0;

      exporter.createOrUpdateItem(withInstanceOf(ODocument.class));
      times = 0;
    }
  };
}
 
Example 3
Source File: IssueReportFix.java    From CogniCrypt with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * sends the {@link Issue} to the eclipse-cognicrypt/CogniCrypt GitHub repository.
 * 
 * @param issue issue to send
 */
private void send(Issue issue) {
	GitHubClient client = new GitHubClient();
	client.setOAuth2Token(readToken());
	IssueService issueService = new IssueService(client);
	try {
		issueService.createIssue("eclipse-cognicrypt", "CogniCrypt", issue);
	}
	catch (IOException e) {
		Activator.getDefault().logError(e);
	}
}
 
Example 4
Source File: GitHubExporterTest.java    From rtc2jira with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testExport_WithoutEmptyDB_ExpectNoExport(@Mocked IssueService issueServiceMock) throws Exception {
  ExportManager exportManager = new ExportManager();
  exportManager.addExporters(exporter);
  exportManager.export(settingsMock, engine);
  new Verifications() {
    {
      issueServiceMock.createIssue(withInstanceOf(IRepositoryIdProvider.class), withInstanceOf(Issue.class));
      times = 0;
    }
  };
}
 
Example 5
Source File: GenerateRoadmapIssuesTest.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
@Test
public void createIssuesStepB() throws Exception {

    String accessToken = System.getenv("GitHubAccessToken");
    Assume.assumeNotNull("GitHubAccessToken not null", accessToken);

    GitHubClient client = new GitHubClient();
    client.setOAuth2Token(accessToken);

    String githubUser = "wildfly-extras";
    String githubRepo = "wildfly-camel";

    Milestone milestone = null;
    MilestoneService milestoneService = new MilestoneService(client);
    for (Milestone aux : milestoneService.getMilestones(githubUser, githubRepo, IssueService.STATE_OPEN)) {
        if  (aux.getTitle().equals(MILESTONE)) {
            milestone = aux;
            break;
        }
    }
    Assert.assertNotNull("Milestone not null", milestone);

    IssueService issueService = new IssueService(client);
    try (BufferedReader br = new BufferedReader(new FileReader(auxfile.toFile()))) {
        String line = br.readLine();
        while (line != null) {
            String title = "Add support for " + line;
            System.out.println(title);
            Issue issue = new Issue();
            issue.setTitle(title);
            issue.setLabels(Collections.singletonList(LABEL));
            issue.setMilestone(milestone);
            issueService.createIssue(githubUser, githubRepo, issue);
            line = br.readLine();
            Thread.sleep(3 * 1000);
        }
    }
}