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


Java JiraRestClient类代码示例

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


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

示例1: getWithUriAndUsernameConfigFailsBecauseOfMissingConsole

import com.atlassian.jira.rest.client.api.JiraRestClient; //导入依赖的package包/类
@Test
public void getWithUriAndUsernameConfigFailsBecauseOfMissingConsole() throws Exception {
	when(mockConfig.getUri()).thenReturn(URI.create("https://jira.company.com:1234"));
	when(mockConfig.getUsername()).thenReturn("johndoe");
	when(mockConsole.readPassword(anyString())).thenReturn("monkey123".toCharArray());
	JiraRestClient client = provider.get(mockConfig);
	assertThat(client).isNotNull();
}
 
开发者ID:gustavkarlsson,项目名称:rocketchat-jira-trigger,代码行数:9,代码来源:RestClientProviderTest.java

示例2: getWithUriAndPasswordConfigIsOk

import com.atlassian.jira.rest.client.api.JiraRestClient; //导入依赖的package包/类
@Test
public void getWithUriAndPasswordConfigIsOk() throws Exception {
	when(mockConfig.getUri()).thenReturn(URI.create("https://jira.company.com:1234"));
	when(mockConfig.getPassword()).thenReturn("monkey123");
	JiraRestClient client = provider.get(mockConfig);
	assertThat(client).isNotNull();
}
 
开发者ID:gustavkarlsson,项目名称:rocketchat-jira-trigger,代码行数:8,代码来源:RestClientProviderTest.java

示例3: getWithFullConfigIsOk

import com.atlassian.jira.rest.client.api.JiraRestClient; //导入依赖的package包/类
@Test
public void getWithFullConfigIsOk() throws Exception {
	when(mockConfig.getUri()).thenReturn(URI.create("https://jira.company.com:1234"));
	when(mockConfig.getUsername()).thenReturn("johndoe");
	when(mockConfig.getPassword()).thenReturn("monkey123");
	JiraRestClient client = provider.get(mockConfig);
	assertThat(client).isNotNull();
}
 
开发者ID:gustavkarlsson,项目名称:rocketchat-jira-trigger,代码行数:9,代码来源:RestClientProviderTest.java

示例4: checkConnection

import com.atlassian.jira.rest.client.api.JiraRestClient; //导入依赖的package包/类
@Override
public boolean checkConnection(ExternalSystem details) {
    validateExternalSystemDetails(details);
    try (JiraRestClient restClient = getClient(details.getUrl(), details.getUsername(), details.getPassword())) {
        return restClient.getProjectClient().getProject(details.getProject()).claim() != null;
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
        return false;
    }
}
 
开发者ID:reportportal,项目名称:service-jira,代码行数:11,代码来源:JiraStrategy.java

示例5: getTicket

import com.atlassian.jira.rest.client.api.JiraRestClient; //导入依赖的package包/类
@Override
@Cacheable(value = CacheConfiguration.EXTERNAL_SYSTEM_TICKET_CACHE, key = "#system.url + #system.project + #id")
public Optional<Ticket> getTicket(final String id, ExternalSystem system) {
    try (JiraRestClient client = getClient(system.getUrl(), system.getUsername(),
            simpleEncryptor.decrypt(system.getPassword()))) {
        return getTicket(id, system, client);
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
        return Optional.empty();
    }
}
 
开发者ID:reportportal,项目名称:service-jira,代码行数:12,代码来源:JiraStrategy.java

示例6: getIssueTypes

import com.atlassian.jira.rest.client.api.JiraRestClient; //导入依赖的package包/类
@Override
public List<String> getIssueTypes(ExternalSystem system) {
    try (JiraRestClient client = getClient(system.getUrl(), system.getUsername(),
            simpleEncryptor.decrypt(system.getPassword()))) {
        Project jiraProject = getProject(client, system);
        return StreamSupport.stream(jiraProject.getIssueTypes().spliterator(), false)
                .map(IssueType::getName).collect(Collectors.toList());
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
        return Collections.emptyList();
    }
}
 
开发者ID:reportportal,项目名称:service-jira,代码行数:13,代码来源:JiraStrategy.java

示例7: get

import com.atlassian.jira.rest.client.api.JiraRestClient; //导入依赖的package包/类
JiraRestClient get(JiraConfiguration jiraConfig) {
	URI uri = checkNotNull(jiraConfig.getUri(), "No JIRA URI provided");
	AuthenticationHandler authHandler = getAuthHandler(jiraConfig);
	AsynchronousJiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();
	return factory.create(uri, authHandler);
}
 
开发者ID:gustavkarlsson,项目名称:rocketchat-jira-trigger,代码行数:7,代码来源:RestClientProvider.java

示例8: getWithEmptyConfigThrowsNPE

import com.atlassian.jira.rest.client.api.JiraRestClient; //导入依赖的package包/类
@Test(expected = NullPointerException.class)
public void getWithEmptyConfigThrowsNPE() throws Exception {
	JiraRestClient client = provider.get(mockConfig);
	assertThat(client).isNotNull();
}
 
开发者ID:gustavkarlsson,项目名称:rocketchat-jira-trigger,代码行数:6,代码来源:RestClientProviderTest.java

示例9: findIssue

import com.atlassian.jira.rest.client.api.JiraRestClient; //导入依赖的package包/类
private SearchResult findIssue(String id, JiraRestClient jiraRestClient) {
    return jiraRestClient.getSearchClient().searchJql("issue = " + id).claim();
}
 
开发者ID:reportportal,项目名称:service-jira,代码行数:4,代码来源:JiraStrategy.java

示例10: getClient

import com.atlassian.jira.rest.client.api.JiraRestClient; //导入依赖的package包/类
public JiraRestClient getClient(String uri, String providedUsername, String providePassword) {
    return new AsynchronousJiraRestClientFactory()
            .create(URI.create(uri), new BasicHttpAuthenticationHandler(providedUsername, providePassword));
}
 
开发者ID:reportportal,项目名称:service-jira,代码行数:5,代码来源:JiraStrategy.java

示例11: fetchIssues

import com.atlassian.jira.rest.client.api.JiraRestClient; //导入依赖的package包/类
private Collection<Issue> fetchIssues(IssueTracker issueTracker) throws IOException {
	Collection<Issue> issues = new HashSet<Issue>();

	JiraURLParser.ParseResult parseResult = new JiraURLParser().parse(issueTracker.getUri());

	final JiraRestClient restClient = factory.create(parseResult.getBaseURI(),
			new AnonymousAuthenticationHandler());
	final String jqlSearchString = "project=" + parseResult.getProjectKey();
	int exceptionsOccurred = 0;

	Promise<SearchResult> issuePromise = null;
       int sizeBefore;

	do {
           if (exceptionsOccurred > 0) {
               logger.debug("Restarted after " + exceptionsOccurred + " exceptions");
           }

           sizeBefore = issues.size();

		try {
			issuePromise = restClient.getSearchClient().searchJql(jqlSearchString,
                       numberOfIssuesFetchedAtOnce, issues.size(), null);

               logger.debug("About to fetch issues");
			Iterables.addAll(issues, issuePromise.claim().getIssues());
               logger.debug("Sucessfully fetched " + issues.size() + " issues in total");

		} catch (Exception e) {
			if (exceptionsOccurred > maximumNumberOfExceptionsBeforeTermination) {
                   logger.debug("Exception occurred multiple times");
				throw e;
			} else {
                   logger.debug("Exception occurred for the " + (exceptionsOccurred + 1) + " time");
				exceptionsOccurred++;
				continue;
			}
		}

		exceptionsOccurred = 0;

	} while (issues.size() > sizeBefore || exceptionsOccurred > 0);

	restClient.close();

	return issues;
}
 
开发者ID:bugminer,项目名称:bugminer,代码行数:48,代码来源:JiraIssueTrackerStrategy.java

示例12: testFetch

import com.atlassian.jira.rest.client.api.JiraRestClient; //导入依赖的package包/类
@Test
public void testFetch() throws IOException {

	JiraRestClient client = mock(JiraRestClient.class);
	SearchRestClient searchClient = mock(SearchRestClient.class);
	SearchResult searchResult = mock(SearchResult.class);

	when(factory.create(eq(URI.create(API_URL)),
			org.mockito.Matchers.isA(AnonymousAuthenticationHandler.class)))
			.thenReturn(client);
	when(client.getSearchClient()).thenReturn(searchClient);
	when(searchClient.searchJql(eq("project=" + issueTracker.getProject().getName()),
			org.mockito.Matchers.isA(Integer.class),
			org.mockito.Matchers.isA(Integer.class),
			anySetOf(String.class))).thenReturn(promise);
	when(promise.claim()).thenReturn(searchResult);
	when(searchResult.getIssues()).thenReturn(issues).thenReturn(new HashSet<Issue>());

	IssueType type = mock(IssueType.class);
	when(issue1.getIssueType()).thenReturn(type);
	when(type.getName()).thenReturn("Bug");

	Status status = mock(Status.class);
	when(issue1.getStatus()).thenReturn(status);
	when(status.getName()).thenReturn("Closed");

	when(issue1.getSummary()).thenReturn("Bug #1337");

	IssueField resolutionDate = mock(IssueField.class);
	when(issue1.getField(eq("resolutiondate"))).thenReturn(resolutionDate);
	when(resolutionDate.getValue()).thenReturn(BUG_RESOLUTION_DATE);

	when(issue1.getCreationDate()).thenReturn(BUG_REPORT_TIME);
	when(issue1.getLabels()).thenReturn(new HashSet<String>()); // TODO
	when(issue1.getDescription()).thenReturn(BUG_DESCRIPTION);

	Resolution resolution = mock(Resolution.class);
	when(issue1.getResolution()).thenReturn(resolution);
	when(resolution.getName()).thenReturn("Done");

	Collection<Bug> result = strategy.fetch(issueTracker);

	assertThat(result.size(), is(1));

	Bug bug = result.iterator().next();

	assertThat(bug.getTitle(), is("Bug #1337"));
	assertThat(bug.getReportTime(), is(Instant.ofEpochMilli(BUG_REPORT_TIME.getMillis())));
	assertThat(bug.isFixed(), is(true));
	assertThat(bug.getDescription(), is(BUG_DESCRIPTION));
	assertThat(bug.getProject().getName(), is(issueTracker.getProject().getName()));
	assertThat(bug.getIssueTracker().getUri(), is(issueTracker.getUri()));
}
 
开发者ID:bugminer,项目名称:bugminer,代码行数:54,代码来源:JiraIssueTrackerStrategyTest.java

示例13: extractGeneralMeasures

import com.atlassian.jira.rest.client.api.JiraRestClient; //导入依赖的package包/类
/**
	 * @param correctExecution
	 * @param restClient
	 * @param searchClient
	 * @param stats
	 * @return
	 */
	private void extractGeneralMeasures(JiraRestClient restClient, SearchRestClient searchClient, JiraLogStatistics stats) {
//		double numberOfClosedFeatureRequestsPerUpdate;
//		double numberOfClosedBugsPerUpdate;
		String jql;
		SearchResult results;
		// Number of Versions
		ProjectRestClient projectClient = restClient.getProjectClient();
		Project project;
		int countOfVersions = 0;

		Iterable<BasicProject> basicProjects = projectClient.getAllProjects().claim();
		for (BasicProject basicP : basicProjects) {

			project = projectClient.getProject(basicP.getKey()).claim();
			for (Version ver : project.getVersions()) {
				countOfVersions++;
			}
		}

		jql = "issuetype = Bug AND status in (Closed, Resolved)";
		results = searchClient.searchJql(jql).claim();
		stats.numberOfClosedBugsPerUpdate = (double) results.getTotal() / (double) countOfVersions;

		jql = "issuetype = \"New Feature\" AND status in (Closed, Resolved)";
		results = searchClient.searchJql(jql).claim();
		stats.numberOfClosedFeatureRequestsPerUpdate = (double) results.getTotal() / (double) countOfVersions;

//		stats.openBugs = numberOfOpenBugs;
		stats.timeToResolveABug = stats.totalBugFixTime / stats.counterCloseBugs;
		stats.timeToResolveABlockingOrCriticalBug = stats.totalCriticalBugFixTime / stats.counterCriticalBugs;
		stats.numberOfFeatureRequests = stats.numberOfFeatureRequests;
		stats.numberOfOpenFeatureRequests = stats.numberOfOpenFeatureRequests;

		stats.numberOfSecurityBugs = (int) (stats.totalBugs * security_factor);
		if (stats.counterCloseBugs > 0) { //TODO: check why this should express security bugs!
			stats.presenceOfBugsCorrected = true; //TODO: check: was presenceOfSecurityBugsCorrected before!??
		}
		if (stats.counterSecurityBugs > 0) {
			stats.timeToResolveASecurityBug = stats.totalSecurityBugFixTime / stats.counterSecurityBugs;
		}
			
//		return stats;
	}
 
开发者ID:RISCOSS,项目名称:riscoss-data-collector,代码行数:51,代码来源:RDCJira.java

示例14: initializeRestClient

import com.atlassian.jira.rest.client.api.JiraRestClient; //导入依赖的package包/类
void initializeRestClient(final JiraRestClient restClient) throws Exception {
    Validate.notNull(restClient, "Jira REST client must be specified.");
    this.restClient = restClient;

    jiraBuildNumber = this.restClient.getMetadataClient().getServerInfo().claim().getBuildNumber();
}
 
开发者ID:arquillian,项目名称:arquillian-governor,代码行数:7,代码来源:JiraGovernorClient.java

示例15: extractGeneralMeasures

import com.atlassian.jira.rest.client.api.JiraRestClient; //导入依赖的package包/类
/**

     * @param restClient
     * @param searchClient
     * @param stats
     * @return
     */
    private void extractGeneralMeasures(JiraRestClient restClient, SearchRestClient searchClient,
            JiraLogStatistics stats)
    {
//	double numberOfClosedFeatureRequestsPerUpdate;
//	double numberOfClosedBugsPerUpdate;
        String jql;
        SearchResult results;
        // Number of Versions
        ProjectRestClient projectClient = restClient.getProjectClient();
        Project project;
        int countOfVersions = 0;
//	int totalBugs = 0;
//	int numberOfOpenBugs = 0;
//	double totalCriticalBugFixTime = 0;
//	int counterCriticalBugs = 0;
//	double totalBugFixTime = 0;
//	double totalSecurityBugFixTime = 0;
//	int counterSecurityBugs = 0;
//	int counterCloseBugs = 0;
//	int numberOfFeatureRequests = 0;
//	int numberOfOpenFeatureRequests = 0;
//	boolean presenceOfSecurityBugsCorrected = false;

        Iterable<BasicProject> basicProjects = projectClient.getAllProjects().claim();
        for (BasicProject basicP : basicProjects) {

            project = projectClient.getProject(basicP.getKey()).claim();
            for (Version ver : project.getVersions()) {
                countOfVersions++;
            }
        }

        jql = "issuetype = Bug AND status in (Closed, Resolved)";
        results = searchClient.searchJql(jql).claim();
        stats.numberOfClosedBugsPerUpdate = (double) results.getTotal() / (double) countOfVersions;

        jql = "issuetype = \"New Feature\" AND status in (Closed, Resolved)";
        results = searchClient.searchJql(jql).claim();
        stats.numberOfClosedFeatureRequestsPerUpdate = (double) results.getTotal() / (double) countOfVersions;

//	stats.openBugs = numberOfOpenBugs;
        stats.timeToResolveABug = stats.totalBugFixTime / stats.counterCloseBugs;
        stats.timeToResolveABlockingOrCriticalBug = stats.totalCriticalBugFixTime / stats.counterCriticalBugs;
        stats.numberOfFeatureRequests = stats.numberOfFeatureRequests;
        stats.numberOfOpenFeatureRequests = stats.numberOfOpenFeatureRequests;

        stats.numberOfSecurityBugs = (int) (stats.totalBugs * security_factor);
        if (stats.counterCloseBugs > 0) { //TODO: check why this should express security bugs!
            stats.presenceOfBugsCorrected = true; //TODO: check: was presenceOfSecurityBugsCorrected before!??
        }
        if (stats.counterSecurityBugs > 0) {
            stats.timeToResolveASecurityBug = stats.totalSecurityBugFixTime / stats.counterSecurityBugs;
        }

//	return stats;
    }
 
开发者ID:rbenjacob,项目名称:riscoss-platform,代码行数:64,代码来源:JiraRiskDataCollector.java


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