Search in sources :

Example 6 with GithubIssue

use of org.jetbrains.plugins.github.api.data.GithubIssue in project intellij-community by JetBrains.

the class GithubIssuesTest method testAssigneeIssues3.

public void testAssigneeIssues3() throws Exception {
    List<GithubIssue> result = GithubApiUtil.getIssuesAssigned(new GithubConnection(myAuth), myLogin2, REPO_NAME, "", 100, false);
    List<Long> issues = ContainerUtil.map(result, new Function<GithubIssue, Long>() {

        @Override
        public Long fun(GithubIssue githubIssue) {
            return githubIssue.getNumber();
        }
    });
    List<Long> expected = Arrays.asList(1L, 2L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 13L, 14L);
    assertTrue(Comparing.haveEqualElements(issues, expected));
}
Also used : GithubConnection(org.jetbrains.plugins.github.api.GithubConnection) GithubIssue(org.jetbrains.plugins.github.api.data.GithubIssue)

Example 7 with GithubIssue

use of org.jetbrains.plugins.github.api.data.GithubIssue in project intellij-community by JetBrains.

the class GithubIssuesTest method testQueriedIssues2.

public void testQueriedIssues2() throws Exception {
    List<GithubIssue> result = GithubApiUtil.getIssuesQueried(new GithubConnection(myAuth), myLogin2, REPO_NAME, null, "commentary", true);
    List<Long> issues = ContainerUtil.map(result, new Function<GithubIssue, Long>() {

        @Override
        public Long fun(GithubIssue githubIssue) {
            return githubIssue.getNumber();
        }
    });
    List<Long> expected = Arrays.asList(11L);
    assertTrue(Comparing.haveEqualElements(issues, expected));
}
Also used : GithubConnection(org.jetbrains.plugins.github.api.GithubConnection) GithubIssue(org.jetbrains.plugins.github.api.data.GithubIssue)

Example 8 with GithubIssue

use of org.jetbrains.plugins.github.api.data.GithubIssue in project intellij-community by JetBrains.

the class GithubRepository method getIssues.

@NotNull
private Task[] getIssues(@Nullable String query, int max, boolean withClosed) throws Exception {
    GithubConnection connection = getConnection();
    try {
        String assigned = null;
        if (myAssignedIssuesOnly) {
            if (StringUtil.isEmptyOrSpaces(myUser)) {
                myUser = GithubApiUtil.getCurrentUser(connection).getLogin();
            }
            assigned = myUser;
        }
        List<GithubIssue> issues;
        if (StringUtil.isEmptyOrSpaces(query)) {
            // search queries have way smaller request number limit
            issues = GithubApiUtil.getIssuesAssigned(connection, getRepoAuthor(), getRepoName(), assigned, max, withClosed);
        } else {
            issues = GithubApiUtil.getIssuesQueried(connection, getRepoAuthor(), getRepoName(), assigned, query, withClosed);
        }
        return ContainerUtil.map2Array(issues, Task.class, issue -> createTask(issue));
    } finally {
        connection.close();
    }
}
Also used : GithubConnection(org.jetbrains.plugins.github.api.GithubConnection) GithubIssue(org.jetbrains.plugins.github.api.data.GithubIssue) NotNull(org.jetbrains.annotations.NotNull)

Example 9 with GithubIssue

use of org.jetbrains.plugins.github.api.data.GithubIssue in project intellij-community by JetBrains.

the class GithubIssuesTest method testQueriedIssues3.

public void testQueriedIssues3() throws Exception {
    List<GithubIssue> result = GithubApiUtil.getIssuesQueried(new GithubConnection(myAuth), myLogin2, REPO_NAME, null, "abracadabra", false);
    List<Long> issues = ContainerUtil.map(result, new Function<GithubIssue, Long>() {

        @Override
        public Long fun(GithubIssue githubIssue) {
            return githubIssue.getNumber();
        }
    });
    List<Long> expected = Arrays.asList(10L);
    assertTrue(Comparing.haveEqualElements(issues, expected));
}
Also used : GithubConnection(org.jetbrains.plugins.github.api.GithubConnection) GithubIssue(org.jetbrains.plugins.github.api.data.GithubIssue)

Example 10 with GithubIssue

use of org.jetbrains.plugins.github.api.data.GithubIssue in project intellij-community by JetBrains.

the class GithubIssuesTest method testAssigneeIssues1.

public void testAssigneeIssues1() throws Exception {
    List<GithubIssue> result = GithubApiUtil.getIssuesAssigned(new GithubConnection(myAuth), myLogin2, REPO_NAME, myLogin1, 100, false);
    List<Long> issues = ContainerUtil.map(result, new Function<GithubIssue, Long>() {

        @Override
        public Long fun(GithubIssue githubIssue) {
            return githubIssue.getNumber();
        }
    });
    List<Long> expected = Arrays.asList(6L, 7L, 8L);
    assertTrue(Comparing.haveEqualElements(issues, expected));
}
Also used : GithubConnection(org.jetbrains.plugins.github.api.GithubConnection) GithubIssue(org.jetbrains.plugins.github.api.data.GithubIssue)

Aggregations

GithubConnection (org.jetbrains.plugins.github.api.GithubConnection)10 GithubIssue (org.jetbrains.plugins.github.api.data.GithubIssue)10 NotNull (org.jetbrains.annotations.NotNull)1