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


Java Milestone类代码示例

本文整理汇总了Java中org.eclipse.egit.github.core.Milestone的典型用法代码示例。如果您正苦于以下问题:Java Milestone类的具体用法?Java Milestone怎么用?Java Milestone使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setMilestone

import org.eclipse.egit.github.core.Milestone; //导入依赖的package包/类
@Override
public Optional<Integer> setMilestone(String repoId, int issueId, String issueTitle,
                                      Optional<Integer> issueMilestone) throws IOException {
    // github api requires at least id and title
    Issue createdIssue = new Issue();
    createdIssue.setNumber(issueId);
    createdIssue.setTitle(issueTitle);

    Milestone gitHubMilestone = new Milestone();
    // set milestone number to the desired milestone id
    // simply don't set a number to demilestone
    issueMilestone.ifPresent(gitHubMilestone::setNumber);
    createdIssue.setMilestone(gitHubMilestone);

    Issue returnedIssue = issueService.editIssue(RepositoryId.createFromId(repoId), createdIssue);

    return Optional.ofNullable(returnedIssue.getMilestone())
            .map(Milestone::getNumber);
}
 
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:20,代码来源:GitHubRepo.java

示例2: turboMilestoneTest

import org.eclipse.egit.github.core.Milestone; //导入依赖的package包/类
@Test
public void turboMilestoneTest() {
    Milestone milestone = new Milestone();
    milestone.setNumber(1);
    milestone.setState("open");
    TurboMilestone turboMilestone = new TurboMilestone("dummy/dummy", milestone);
    assertEquals(1, turboMilestone.getId());
    assertEquals("dummy/dummy", turboMilestone.getRepoId());
    turboMilestone.setDueDate(Optional.<LocalDate>empty());
    assertEquals(Optional.empty(), turboMilestone.getDueDate());
    turboMilestone.setDescription("test description");
    assertEquals("test description", turboMilestone.getDescription());
    turboMilestone.setOpen(false);
    assertEquals(false, turboMilestone.isOpen());
    turboMilestone.setOpenIssues(0);
    assertEquals(0, turboMilestone.getOpenIssues());
    turboMilestone.setClosedIssues(0);
    assertEquals(0, turboMilestone.getClosedIssues());
}
 
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:20,代码来源:TurboMilestoneTest.java

示例3: testHeaderIteratorInvalidRepo

import org.eclipse.egit.github.core.Milestone; //导入依赖的package包/类
/**
 * Tests that PageHeaderIterator throws a NoSuchElement exception when its next
 * method is called with a initial request to an non-existent repository
 *
 * @throws NoSuchElementException
 */
@Test(expected = NoSuchElementException.class)
public void testHeaderIteratorInvalidRepo() throws NoSuchElementException {
    GitHubClientEx client = new GitHubClientEx();

    Map<String, String> params = new HashMap<>();
    params.put("state", "all");

    PagedRequest<Milestone> request = new PagedRequest<>();
    String path = SEGMENT_REPOS + "/nonexistentrepo";
    request.setUri(path);
    request.setResponseContentType(CONTENT_TYPE_JSON);
    request.setParams(params);

    PageHeaderIterator iter = new PageHeaderIterator(request, client, "ETag");
    if (iter.hasNext()) {
        iter.next();
    }
}
 
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:25,代码来源:PageHeaderIteratorTests.java

示例4: testInvalidHeadRequest

import org.eclipse.egit.github.core.Milestone; //导入依赖的package包/类
/**
 * Tests that head request to nonexistent repo throws an exception
 *
 * @throws IOException
 */
@Test(expected = IOException.class)
public void testInvalidHeadRequest() throws IOException {
    GitHubClientEx client = new GitHubClientEx();

    PagedRequest<Milestone> request = new PagedRequest<>();
    Map<String, String> params = new HashMap<>();
    params.put("state", "all");

    String path = SEGMENT_REPOS + "/nonexistentrepo";
    request.setUri(path);
    request.setResponseContentType(CONTENT_TYPE_JSON);
    request.setParams(params);

    client.head(request);
}
 
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:21,代码来源:GitHubClientExTests.java

示例5: show

import org.eclipse.egit.github.core.Milestone; //导入依赖的package包/类
/**
 * Show dialog with given milestone selected
 *
 * @param selectedMilestone
 */
public void show(Milestone selectedMilestone) {
    if (repositoryMilestones == null) {
        load(selectedMilestone);
        return;
    }

    int checked = -1;
    if (selectedMilestone != null)
        for (int i = 0; i < repositoryMilestones.size(); i++)
            if (selectedMilestone.getNumber() == repositoryMilestones
                    .get(i).getNumber()) {
                checked = i;
                break;
            }
    MilestoneDialogFragment.show(activity, requestCode,
            activity.getString(string.select_milestone), null,
            repositoryMilestones, checked);
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:24,代码来源:MilestoneDialog.java

示例6: merge

import org.eclipse.egit.github.core.Milestone; //导入依赖的package包/类
private static Map<String, Object> merge(final Milestone milestone,
                                         final String org,
                                         final String repo,
                                         final Map<Integer, Set<Map<String, String>>> assignees) {
    return ImmutableMap.<String, Object>builder()
            .put("organisation", org)
            .put("repository", repo)
            .put("id", UUID.randomUUID().toString())
            .put("url", milestone.getUrl())
            .put("title", milestone.getTitle())
            .put("number", milestone.getNumber())
            .put("openIssues", milestone.getOpenIssues())
            .put("closedIssues", milestone.getClosedIssues())
            .put("description", Strings.nullToEmpty(milestone.getDescription()))
            .put("slug", String.format("%s/%s/%d", org, repo, milestone.getNumber()))
            .put("assignees", Optional.ofNullable(assignees.get(milestone.getNumber())).orElse(emptySet()))
            .build();
}
 
开发者ID:plan3,项目名称:stoneboard,代码行数:19,代码来源:Milestones.java

示例7: getIssuesByMilestone

import org.eclipse.egit.github.core.Milestone; //导入依赖的package包/类
public ArrayList<Issue> getIssuesByMilestone(Repository repository, Milestone milestone){		
	try {
		Map<String, String> filterData = new HashMap<String, String>();
		filterData.put(IssueService.FILTER_MILESTONE, Integer.toString(milestone.getNumber()));
		filterData.put(IssueService.FILTER_STATE, IssueService.STATE_CLOSED);
		

		ArrayList<Issue> issues = new ArrayList<Issue>(issueService.getIssues(repository, filterData));
		filterData.put(IssueService.FILTER_STATE, IssueService.STATE_OPEN);
		issues.addAll(issueService.getIssues(repository, filterData));
		
		return issues;
	} catch (IOException e) {
		mainApp.writeNotification("Failed getting the issues.");
	}
	return null;
}
 
开发者ID:ThibaudL,项目名称:GitHubProjectManagement,代码行数:18,代码来源:GitHubModel.java

示例8: saveMilestone

import org.eclipse.egit.github.core.Milestone; //导入依赖的package包/类
public Milestone saveMilestone(Repository repository, Milestone milestone,
		String oldmilestoneName) {
	try {
		System.out.println(oldmilestoneName);
		System.out.println(milestone.getTitle());

		if(oldmilestoneName.compareTo(milestone.getTitle()) == 0){
			return milestoneService.editMilestone(repository, milestone);
		}else{
			labelService.deleteLabel(repository, oldmilestoneName);
			return milestoneService.createMilestone(repository, milestone);
		}
	} catch (IOException e) {
		mainApp.writeNotification("Failed saving the milestone.\n"+e.getMessage());
		return null;
	}
}
 
开发者ID:ThibaudL,项目名称:GitHubProjectManagement,代码行数:18,代码来源:GitHubModel.java

示例9: createUpdatedRequest

import org.eclipse.egit.github.core.Milestone; //导入依赖的package包/类
@Override
protected PagedRequest<Milestone> createUpdatedRequest(IRepositoryIdProvider repoId) {
    PagedRequest<Milestone> request = super.createUpdatedRequest(repoId);
    request.setParams(createUpdatedMilestonesParams());
    request.setType(new TypeToken<Milestone>() {
    }.getType());
    request.setArrayType(new TypeToken<ArrayList<Milestone>>() {
    }.getType());
    return request;
}
 
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:11,代码来源:MilestoneUpdateService.java

示例10: TurboMilestone

import org.eclipse.egit.github.core.Milestone; //导入依赖的package包/类
public TurboMilestone(String repoId, Milestone milestone) {
    this.id = milestone.getNumber();
    this.title = milestone.getTitle();
    this.dueDate = milestone.getDueOn() == null
            ? Optional.empty()
            : Optional.of(Utility.dateToLocalDateTime(milestone.getDueOn()).toLocalDate());
    this.description = milestone.getDescription() == null ? "" : milestone.getDescription();
    this.isOpen = milestone.getState().equals(STATE_OPEN);
    this.openIssues = milestone.getOpenIssues();
    this.closedIssues = milestone.getClosedIssues();
    this.repoId = repoId;
}
 
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:13,代码来源:TurboMilestone.java

示例11: testGetUpdatedMilestonesNoChanges

import org.eclipse.egit.github.core.Milestone; //导入依赖的package包/类
/**
 * Tests that getUpdatedItems returns empty result if the combination of ETags
 * from all pages returned by a MockServer is equal to the ETags passed into the constructor. The updated
 * ETags should then remain the same and the update check time should reflect first page' Date header
 */
@Test
public void testGetUpdatedMilestonesNoChanges() {
    GitHubClientEx client = new GitHubClientEx("localhost", 8888, "http");
    String previousETags = "4c0ad3c08dc706b76d8277a88a4c037e#4b56f029e953e9983344b9e0b60d9a71";
    MilestoneUpdateService service = new MilestoneUpdateService(client, previousETags);

    List<Milestone> milestones = service.getUpdatedItems(RepositoryId.createFromId("teammates/repo"));

    assertTrue(milestones.isEmpty());
    assertEquals(previousETags, service.getUpdatedETags());
    assertEquals(Utility.parseHTTPLastModifiedDate("Sun, 27 Dec 2015 15:28:46 GMT"),
                 service.getUpdatedCheckTime());
}
 
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:19,代码来源:MilestoneUpdateServiceTests.java

示例12: testGetUpdatedMilestonesSample

import org.eclipse.egit.github.core.Milestone; //导入依赖的package包/类
/**
 * Tests that getUpdatedItems returns all milestones recorded in resources/tests/PagedMilestonesSample
 * if last ETag of 2nd page is different from 2nd page' ETag in the responses. The updated ETags should
 * then be modified accordingly and the update check time should reflect the first page Date header
 */
@Test
public void testGetUpdatedMilestonesSample() {
    GitHubClientEx client = new GitHubClientEx("localhost", 8888, "http");
    String previousETags = "4c0ad3c08dc706b76d8277a88a4c037e#ffffff";
    String expectedETags = "4c0ad3c08dc706b76d8277a88a4c037e#4b56f029e953e9983344b9e0b60d9a71";
    MilestoneUpdateService service = new MilestoneUpdateService(client, previousETags);

    List<Milestone> milestones = service.getUpdatedItems(RepositoryId.createFromId("teammates/repo"));

    assertEquals(188, milestones.size());
    assertEquals(expectedETags, service.getUpdatedETags());
    assertEquals(Utility.parseHTTPLastModifiedDate("Sun, 27 Dec 2015 15:28:46 GMT"),
                 service.getUpdatedCheckTime());
}
 
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:20,代码来源:MilestoneUpdateServiceTests.java

示例13: MilestoneListAdapter

import org.eclipse.egit.github.core.Milestone; //导入依赖的package包/类
public MilestoneListAdapter(LayoutInflater inflater,
        Milestone[] milestones, int selected) {
    super(inflater, R.layout.milestone_item);

    this.selected = selected;
    setItems(milestones);
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:8,代码来源:MilestoneDialogFragment.java

示例14: update

import org.eclipse.egit.github.core.Milestone; //导入依赖的package包/类
@Override
protected void update(int position, Milestone item) {
    setText(1, item.getTitle());

    String description = item.getDescription();
    if (!TextUtils.isEmpty(description))
        ViewUtils.setGone(setText(2, description), false);
    else
        setGone(2, true);

    setChecked(0, selected == position);
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:13,代码来源:MilestoneDialogFragment.java

示例15: getMilestoneNumber

import org.eclipse.egit.github.core.Milestone; //导入依赖的package包/类
/**
 * Get milestone number for title
 *
 * @param title
 * @return number of -1 if not found
 */
public int getMilestoneNumber(String title) {
    if (repositoryMilestones == null)
        return -1;
    for (Milestone milestone : repositoryMilestones)
        if (title.equals(milestone.getTitle()))
            return milestone.getNumber();
    return -1;
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:15,代码来源:MilestoneDialog.java


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