当前位置: 首页>>代码示例>>Java>>正文


Java ResponseException类代码示例

本文整理汇总了Java中com.atlassian.sal.api.net.ResponseException的典型用法代码示例。如果您正苦于以下问题:Java ResponseException类的具体用法?Java ResponseException怎么用?Java ResponseException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResponseException类属于com.atlassian.sal.api.net包,在下文中一共展示了ResponseException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: gettingDetailChangeset_ShouldSendGETRequestToGithub_AndParseJsonResult

import com.atlassian.sal.api.net.ResponseException; //导入依赖的package包/类
@Test
public void gettingDetailChangeset_ShouldSendGETRequestToGithub_AndParseJsonResult()
        throws ResponseException, IOException
{
    when(repository.getSlug()).thenReturn("SLUG");
    when(repository.getOrgName()).thenReturn("ORG");

    RepositoryCommit repositoryCommit = mock(RepositoryCommit.class);
    when(commitService.getCommit(Matchers.<IRepositoryIdProvider>anyObject(), anyString())).thenReturn(repositoryCommit);
    Commit commit = mock(Commit.class);
    when(repositoryCommit.getCommit()).thenReturn(commit);
    when(commit.getMessage()).thenReturn("ABC-123 fix");

    Changeset detailChangeset = communicator.getChangeset(repository, "abcde");

    verify(commitService).getCommit(Matchers.<IRepositoryIdProvider>anyObject(), anyString());

    assertThat(detailChangeset.getMessage()).isEqualTo("ABC-123 fix");
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:20,代码来源:GithubCommunicatorTest.java

示例2: shouldCheckIfCorrectJiraVersionExists

import com.atlassian.sal.api.net.ResponseException; //导入依赖的package包/类
@Test
public void shouldCheckIfCorrectJiraVersionExists() throws IOException, CredentialsRequiredException, ResponseException {

    givenJiraVersionGeneratorWithReleaseCommit(givenCommit(
            "1", "[maven-release-plugin] prepare release test-project-1.0.1", START_OF_2016));
    given(commitIterator.hasNext()).willReturn(true, true, true, false);
    given(commitIterator.next())
            .willReturn(givenCommit("2", "Merge pull request #276 in TEST/test-project from TEST-1", START_OF_2016),
                    givenCommit("3", "[maven-release-plugin] prepare for next development iteration", START_OF_2016),
                    givenCommit("4", "[maven-release-plugin] prepare release test-project-1.0.0", START_OF_2016));
    given(jiraService.findVersion(any(), any())).willReturn(Optional.empty());
    given(jiraService.createJiraVersion(any())).willReturn(new SerializedVersion(null, "1.0.1", "TEST", null, null));

    jiraVersionGenerator.generate("", new ProjectKey("TEST"));

    then(jiraService).should().findVersion(new ProjectKey("TEST"), "1.0.1");
}
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:18,代码来源:JiraVersionGeneratorTest.java

示例3: shouldCreateJiraVersion

import com.atlassian.sal.api.net.ResponseException; //导入依赖的package包/类
@Test
public void shouldCreateJiraVersion() throws IOException, CredentialsRequiredException, ResponseException {

    givenJiraVersionGeneratorWithReleaseCommit(givenCommit(
            "givenId", "[maven-release-plugin] prepare release test-project-1.0.1", START_OF_2016));
    given(commitIterator.hasNext()).willReturn(true, true, true, false);
    given(commitIterator.next())
            .willReturn(givenCommit("1", "Merge pull request #276 in TEST/test-project from TEST-1", START_OF_2016),
                    givenCommit("2", "[maven-release-plugin] prepare for next development iteration", START_OF_2016),
                    givenCommit("3", "[maven-release-plugin] prepare release test-project-1.0.0", START_OF_2016));
    given(jiraService.findVersion(any(), any())).willReturn(Optional.empty());
    given(jiraService.createJiraVersion(any())).willReturn(new SerializedVersion("1", "1.0.1", "TEST", null, null));

    jiraVersionGenerator.generate("", new ProjectKey("TEST"));

    then(jiraService).should().createJiraVersion(new SerializedVersion(null, "1.0.1", "TEST", null, false));
}
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:18,代码来源:JiraVersionGeneratorTest.java

示例4: shouldLinkIssuesToVersion

import com.atlassian.sal.api.net.ResponseException; //导入依赖的package包/类
@Test
public void shouldLinkIssuesToVersion() throws IOException, CredentialsRequiredException, ResponseException {

    givenJiraVersionGeneratorWithReleaseCommit(givenCommit(
            "1", "[maven-release-plugin] prepare release test-project-1.0.1", START_OF_2016));
    given(commitIterator.hasNext()).willReturn(true, true, true, false);
    given(commitIterator.next())
            .willReturn(givenCommit("2", "Merge pull request #276 in TEST/test-project from TEST-1", START_OF_2016),
                    givenCommit("3", "[maven-release-plugin] prepare for next development iteration", START_OF_2016),
                    givenCommit("4", "[maven-release-plugin] prepare release test-project-1.0.0", START_OF_2016));
    given(jiraService.findVersion(any(), any())).willReturn(Optional.empty());
    given(jiraService.createJiraVersion(any())).willReturn(new SerializedVersion(null, "1.0.1", "TEST", null, null));

    jiraVersionGenerator.generate("", new ProjectKey("TEST"));

    then(jiraService).should().addVersionToIssues("1.0.1",
            new ProjectKey("TEST"),
            ImmutableList.of(new IssueKey(new ProjectKey("TEST"), new IssueId("1"))));
}
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:20,代码来源:JiraVersionGeneratorTest.java

示例5: shouldReleaseVersion

import com.atlassian.sal.api.net.ResponseException; //导入依赖的package包/类
@Test
public void shouldReleaseVersion() throws IOException, CredentialsRequiredException, ResponseException, ParseException {

    givenJiraVersionGeneratorWithReleaseCommit(givenCommit("1", "[maven-release-plugin] prepare release test-project-1.0.1", START_OF_2016));
    given(commitIterator.hasNext()).willReturn(true, true, true, false);
    given(commitIterator.next())
            .willReturn(givenCommit("2", "Merge pull request #276 in TEST/test-project from TEST-1", START_OF_2016),
                    givenCommit("3", "[maven-release-plugin] prepare for next development iteration", START_OF_2016),
                    givenCommit("4", "[maven-release-plugin] prepare release test-project-1.0.0", START_OF_2016));
    given(jiraService.findVersion(any(), any())).willReturn(Optional.empty());
    given(jiraService.createJiraVersion(any())).willReturn(new SerializedVersion(null, "1.0.1", "TEST", null, null));

    jiraVersionGenerator.generate("", new ProjectKey("TEST"));

    then(jiraService).should().releaseVersion(new SerializedVersion(null, "1.0.1", "TEST", null, null), LocalDate.of(2016, 1, 1));
}
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:17,代码来源:JiraVersionGeneratorTest.java

示例6: shouldFindJiraVersion

import com.atlassian.sal.api.net.ResponseException; //导入依赖的package包/类
@Test
public void shouldFindJiraVersion() throws CredentialsRequiredException, ResponseException {

    givenReturnedJson("[\n" +
            "    {\n" +
            "        \"id\": \"11780\",\n" +
            "        \"name\": \"2.0.0\",\n" +
            "        \"released\": true,\n" +
            "        \"releaseDate\": \"2014-03-03\"\n" +
            "    }\n" +
            "]");

    SerializedVersion actual = jiraService.findVersion(new ProjectKey("TEST"), "2.0.0").orElse(null);

    String project = null;
    boolean released = true;
    then(actual).isEqualTo(new SerializedVersion("11780", "2.0.0", project, LocalDate.of(2014, 3, 3), released));
}
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:19,代码来源:JiraServiceTest.java

示例7: shouldReleaseVersion

import com.atlassian.sal.api.net.ResponseException; //导入依赖的package包/类
@Test
public void shouldReleaseVersion() throws ResponseException, CredentialsRequiredException {

    givenReturnedJson("[\n" +
            "    {\n" +
            "        \"self\": \"https://jira.infobip.com/rest/api/2/version/11780\",\n" +
            "        \"id\": \"11780\",\n" +
            "        \"description\": \"first release\",\n" +
            "        \"name\": \"2.0.0\",\n" +
            "        \"archived\": false,\n" +
            "        \"released\": false,\n" +
            "        \"releaseDate\": \"2014-03-03\",\n" +
            "        \"userReleaseDate\": \"03/Mar/14\",\n" +
            "        \"projectId\": 10901\n" +
            "    }\n" +
            "]");

    jiraService.releaseVersion(new SerializedVersion("11780", "2.0.0", "TEST", null, false), LocalDate.of(2016, 1, 1));

    thenShouldSendRequest(MethodType.PUT, "/rest/api/2/version/11780", "{\"released\":true,\"releaseDate\":\"2016-01-01\"}");
}
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:22,代码来源:JiraServiceTest.java

示例8: shouldGenerateVersionWithNoIssues

import com.atlassian.sal.api.net.ResponseException; //导入依赖的package包/类
@Test
public void shouldGenerateVersionWithNoIssues() throws IOException, CredentialsRequiredException, ResponseException {

    givenRepositoryName("test-project");
    givenSetting("jira-project-key", "TEST");
    Commit secondReleaseCommit = givenCommit("[maven-release-plugin] prepare release test-project-1.0.0", START_OF_2016);
    givenCommits(latestRefChange,
            givenCommit("[maven-release-plugin] prepare release test-project-1.0.1", START_OF_2016),
            secondReleaseCommit);
    givenCommits(olderRefChange, secondReleaseCommit);

    givenJiraVersionDoesNotExist();
    givenCreatedVersion("1", "1.0.1", "TEST");

    whenPostReceive(latestRefChange);
    whenPostReceive(olderRefChange);

    then(jiraService).should().findVersion(new ProjectKey("TEST"), "1.0.1");
}
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:20,代码来源:JiraVersionGeneratorHookTest.java

示例9: shouldGenerateJiraVersionWithAPrefix

import com.atlassian.sal.api.net.ResponseException; //导入依赖的package包/类
@Test
public void shouldGenerateJiraVersionWithAPrefix() throws IOException, CredentialsRequiredException, ResponseException {

    givenSetting("jira-version-prefix", "infobip-test-");
    givenSetting("jira-project-key", "TEST");
    givenRepositoryName("test-project");
    Commit firstReleaseCommit = givenCommit("[maven-release-plugin] prepare release test-project-1.0.1", START_OF_2016);
    Commit secondReleaseCommit = givenCommit("[maven-release-plugin] prepare release test-project-1.0.0", START_OF_2016);
    givenCommits(latestRefChange, firstReleaseCommit, secondReleaseCommit);
    givenCommits(olderRefChange, secondReleaseCommit);

    givenJiraVersionDoesNotExist();
    givenCreatedVersion("1", "infobip-test-1.0.1", "TEST");

    whenPostReceive(latestRefChange);
    whenPostReceive(olderRefChange);

    then(jiraService).should().findVersion(new ProjectKey("TEST"), "infobip-test-1.0.1");
    thenGetCommits(times(1), latestRefChange);
    thenGetCommits(times(1), olderRefChange);
}
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:22,代码来源:JiraVersionGeneratorHookTest.java

示例10: shouldGenerateJiraVersionWithACustomVersionPattern

import com.atlassian.sal.api.net.ResponseException; //导入依赖的package包/类
@Test
public void shouldGenerateJiraVersionWithACustomVersionPattern() throws IOException, CredentialsRequiredException, ResponseException {

    givenSetting("jira-project-key", "TEST");
    givenSetting("release-commit-version-pattern", "Release (?<version>.*)");
    givenRepositoryName("test-project");
    Commit secondCommit = givenCommit("Release test-project-1.0.0", START_OF_2016);
    givenCommits(latestRefChange, givenCommit("Release 1.0.1", START_OF_2016), secondCommit);
    givenCommits(olderRefChange, secondCommit);

    givenJiraVersionDoesNotExist();
    givenCreatedVersion("1", "1.0.1", "TEST");

    whenPostReceive(latestRefChange);
    whenPostReceive(olderRefChange);

    then(jiraService).should().findVersion(new ProjectKey("TEST"), "1.0.1");
    thenGetCommits(times(1), latestRefChange);
    thenGetCommits(times(1), olderRefChange);
}
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:21,代码来源:JiraVersionGeneratorHookTest.java

示例11: shouldGenerateJiraVersionAndLinkIssuesWhenHookEventOccursAfterAnotherCommit

import com.atlassian.sal.api.net.ResponseException; //导入依赖的package包/类
@Test
public void shouldGenerateJiraVersionAndLinkIssuesWhenHookEventOccursAfterAnotherCommit() throws IOException, CredentialsRequiredException, ResponseException {

    givenRepositoryName("test-project");
    givenSetting("jira-project-key", "TEST");
    Commit secondCommit = givenCommit("[maven-release-plugin] prepare release test-project-1.0.0", START_OF_2016);
    Commit thirdCommit = givenCommit("TEST-1", START_OF_2016);
    givenCommits(latestRefChange,
            givenCommit("[maven-release-plugin] prepare for next development iteration", START_OF_2016),
            secondCommit,
            thirdCommit);
    givenCommits(olderRefChange, secondCommit, thirdCommit);

    givenJiraVersionDoesNotExist();
    givenCreatedVersion("1", "1.0.0", "TEST");

    whenPostReceive(olderRefChange);
    whenPostReceive(latestRefChange);

    then(jiraService).should().findVersion(new ProjectKey("TEST"), "1.0.0");
    thenGetCommits(times(1), olderRefChange);
    thenGetCommits(times(1), latestRefChange);
}
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:24,代码来源:JiraVersionGeneratorHookTest.java

示例12: shouldGenerateJiraVersionAndLinkIssuesOnlyForLatestRefChange

import com.atlassian.sal.api.net.ResponseException; //导入依赖的package包/类
@Test
public void shouldGenerateJiraVersionAndLinkIssuesOnlyForLatestRefChange() throws IOException, CredentialsRequiredException, ResponseException {

    givenRepositoryName("test-project");
    givenSetting("jira-project-key", "TEST");
    Commit secondCommit = givenCommit("TEST-1", START_OF_2016);
    givenCommits(latestRefChange,
            givenCommit("[maven-release-plugin] prepare release test-project-1.0.0", START_OF_2016),
            secondCommit);
    givenCommits(olderRefChange, secondCommit);

    givenJiraVersionDoesNotExist();
    givenCreatedVersion("1", "1.0.0", "TEST");

    whenPostReceive(latestRefChange);
    whenPostReceive(olderRefChange);

    then(jiraService).should().findVersion(new ProjectKey("TEST"), "1.0.0");
    thenGetCommits(times(1), latestRefChange);
    thenGetCommits(times(1), olderRefChange);
}
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:22,代码来源:JiraVersionGeneratorHookTest.java

示例13: shouldGenerateJiraVersionAndLinkIssueWhenThereAreCommitsWithNoIssueKeyInMessage

import com.atlassian.sal.api.net.ResponseException; //导入依赖的package包/类
@Test
public void shouldGenerateJiraVersionAndLinkIssueWhenThereAreCommitsWithNoIssueKeyInMessage() throws IOException, CredentialsRequiredException, ResponseException {

    givenRepositoryName("test-project");
    givenSetting("jira-project-key", "TEST");
    givenCommits(latestRefChange,
            givenCommit("[maven-release-plugin] prepare release test-project-1.0.0", START_OF_2016),
            givenCommit("Merge pull request #3 in TEST/test-project from test to master", START_OF_2016),
            givenCommit("Merge pull request #2 in TEST/test-project from TEST-1", START_OF_2016),
            givenCommit("Merge pull request #1 in TEST/test-project from TEST-2", START_OF_2016));
    givenJiraVersionDoesNotExist();
    givenCreatedVersion("1", "1.0.0", "TEST");

    whenPostReceive(latestRefChange);

    then(jiraService).should().createJiraVersion(unreleasedSerializedVersion("1.0.0", "TEST"));

    then(jiraService).should().addVersionToIssues("1.0.0", new ProjectKey("TEST"), Arrays.asList(new IssueKey(new ProjectKey("TEST"), new IssueId("1")), new IssueKey(new ProjectKey("TEST"), new IssueId("2"))));
}
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:20,代码来源:JiraVersionGeneratorHookTest.java

示例14: shouldNotLinkIssuesThatAreNotPartOfVersionProject

import com.atlassian.sal.api.net.ResponseException; //导入依赖的package包/类
@Test
public void shouldNotLinkIssuesThatAreNotPartOfVersionProject() throws IOException, CredentialsRequiredException, ResponseException {

    givenRepositoryName("test-project");
    givenSetting("jira-project-key", "TEST");
    givenCommits(latestRefChange,
            givenCommit("[maven-release-plugin] prepare release test-project-1.0.0", START_OF_2016),
            givenCommit("Merge pull request #298 in TEST/test-project from test to master", START_OF_2016),
            givenCommit("Merge pull request #2 in TEST/test-project from TEST-1", START_OF_2016),
            givenCommit("Merge pull request #295 in TEST/test-project from ABCD-1", START_OF_2016),
            givenCommit("Merge pull request #1 in TEST/test-project from TEST-2", START_OF_2016));
    givenJiraVersionDoesNotExist();
    givenCreatedVersion("1", "1.0.0", "TEST");

    whenPostReceive(latestRefChange);

    then(jiraService).should().createJiraVersion(unreleasedSerializedVersion("1.0.0", "TEST"));

    then(jiraService).should().addVersionToIssues("1.0.0", new ProjectKey("TEST"), Arrays.asList(new IssueKey(new ProjectKey("TEST"), new IssueId("1")), new IssueKey(new ProjectKey("TEST"), new IssueId("2"))));
}
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:21,代码来源:JiraVersionGeneratorHookTest.java

示例15: shouldLinkAllRelatedIssuesPresentInACommitMessage

import com.atlassian.sal.api.net.ResponseException; //导入依赖的package包/类
@Test
public void shouldLinkAllRelatedIssuesPresentInACommitMessage() throws IOException, CredentialsRequiredException, ResponseException {

    givenRepositoryName("test-project");
    givenSetting("jira-project-key", "TEST");
    givenCommits(latestRefChange,
            givenCommit("[maven-release-plugin] prepare release test-project-1.0.0", START_OF_2016),
            givenCommit("Merge pull request #298 in TEST/test-project from test to master", START_OF_2016),
            givenCommit("Merge pull request #2 in TEST/test-project from TEST-1, TEST-2, TEST-3", START_OF_2016));
    givenJiraVersionDoesNotExist();
    givenCreatedVersion("1", "1.0.0", "TEST");

    whenPostReceive(latestRefChange);

    then(jiraService).should().createJiraVersion(unreleasedSerializedVersion("1.0.0", "TEST"));

    then(jiraService).should().addVersionToIssues("1.0.0", new ProjectKey("TEST"), Arrays.asList(new IssueKey(new ProjectKey("TEST"), new IssueId("1")), new IssueKey(new ProjectKey("TEST"), new IssueId("2")), new IssueKey(new ProjectKey("TEST"), new IssueId("3"))));
}
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:19,代码来源:JiraVersionGeneratorHookTest.java


注:本文中的com.atlassian.sal.api.net.ResponseException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。