本文整理汇总了Java中org.eclipse.egit.github.core.PullRequestMarker类的典型用法代码示例。如果您正苦于以下问题:Java PullRequestMarker类的具体用法?Java PullRequestMarker怎么用?Java PullRequestMarker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PullRequestMarker类属于org.eclipse.egit.github.core包,在下文中一共展示了PullRequestMarker类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testUpdateCommitRetargeted
点赞 3
import org.eclipse.egit.github.core.PullRequestMarker; //导入依赖的package包/类
@Test
public void testUpdateCommitRetargeted() throws IOException
{
final PullRequestMarker destination = mockRef("destinationBranch2");
when(pullRequest.getBase()).thenReturn(destination);
RepositoryCommitMapping commitMapping = mock(RepositoryCommitMapping.class);
when(commitMapping.getNode()).thenReturn("original");
when(pullRequestMapping.getCommits()).thenReturn(new RepositoryCommitMapping[] { commitMapping });
target.setCommits(new RepositoryCommitMapping[] { commitMapping });
RepositoryCommit repositoryCommit = mockCommit("aaa");
when(gitHubPullRequestService.getCommits(any(IRepositoryIdProvider.class), anyInt())).thenReturn(Arrays.asList(repositoryCommit));
testedClass.processPullRequest(repository, pullRequest);
verify(repositoryPullRequestDao).saveCommit(eq(repository), saveCommitCaptor.capture());
assertEquals(saveCommitCaptor.getValue().get(RepositoryCommitMapping.NODE), "aaa");
verify(repositoryPullRequestDao).unlinkCommits(eq(repository), eq(target), argThat(IsIterableContainingInAnyOrder.containsInAnyOrder(commitMapping)));
verify(repositoryPullRequestDao).removeCommits(argThat(IsIterableContainingInAnyOrder.containsInAnyOrder(commitMapping)));
}
开发者ID:edgehosting,
项目名称:jira-dvcs-connector,
代码行数:22,
代码来源:GitHubPullRequestProcessorTest.java
示例2: createPrMap
点赞 3
import org.eclipse.egit.github.core.PullRequestMarker; //导入依赖的package包/类
private Map<String, String> createPrMap(PullRequest request) {
Map<String, String> params = new HashMap<String, String>();
if (request != null) {
String title = request.getTitle();
if (title != null)
params.put(PR_TITLE, title);
String body = request.getBody();
if (body != null)
params.put(PR_BODY, body);
PullRequestMarker baseMarker = request.getBase();
if (baseMarker != null) {
String base = baseMarker.getLabel();
if (base != null)
params.put(PR_BASE, base);
}
PullRequestMarker headMarker = request.getHead();
if (headMarker != null) {
String head = headMarker.getLabel();
if (head != null)
params.put(PR_HEAD, head);
}
}
return params;
}
开发者ID:tsangiotis,
项目名称:JekyllForAndroid,
代码行数:25,
代码来源:PullRequestService.java
示例3: setBase
点赞 2
import org.eclipse.egit.github.core.PullRequestMarker; //导入依赖的package包/类
private void setBase(final String newBase) {
ExtendedPullRequest edit = new ExtendedPullRequest();
edit.setNumber(pullRequest.getNumber());
edit.setBase(new PullRequestMarker().setRef(newBase));
try {
pullRequest = pullRequestService.editPullRequest(base, edit);
} catch (final IOException e) {
throw new UncheckedIOException(e);
}
}
开发者ID:aaronjwhiteside,
项目名称:pipeline-github,
代码行数:11,
代码来源:PullRequestGroovyObject.java
示例4: openPullRequest
点赞 2
import org.eclipse.egit.github.core.PullRequestMarker; //导入依赖的package包/类
/**
* Open pull request over provided repository, head and base information.
*
* @param owner of repository
* @param repositoryName on which repository
* @param title title of Pull request
* @param description description of Pull request
* @param head from which head e.g.: master or organization:master
* @param base to which base
* @return created EGit pull request
*/
public PullRequest openPullRequest(String owner, String repositoryName, String title, String description, String head, String base)
{
final EGitPullRequestServiceWrapper pullRequestService = buildPullRequestServiceWrapper(owner, repositoryName);
PullRequest request = new PullRequest();
request.setTitle(title);
request.setBody(description);
request.setHead(new PullRequestMarker().setLabel(head));
request.setBase(new PullRequestMarker().setLabel(base));
PullRequest result = null;
try
{
result = pullRequestService.create(request);
}
catch (RuntimeException e)
{
// let's try once more after while
sleep(5000);
result = pullRequestService.create(request);
}
// pull request creation is asynchronous process - it is necessary to wait a little bit
// otherwise unexpected behavior can happened - like next push will be part as open pull request
final int pullrequestId = result.getNumber();
waitUntil(new PullRequestCallBackPredicate(pullRequestService, pullrequestId, new PullRequestCallBackFunction()
{
@Override
public boolean testPullRequest(final PullRequest pullRequest)
{
return true;
}
}));
return result;
}
开发者ID:edgehosting,
项目名称:jira-dvcs-connector,
代码行数:48,
代码来源:GitHubTestSupport.java
示例5: getBranchName
点赞 2
import org.eclipse.egit.github.core.PullRequestMarker; //导入依赖的package包/类
private String getBranchName(PullRequestMarker ref, String oldBranchName)
{
if (ref == null || ref.getRef() == null)
{
return oldBranchName;
}
return ref.getRef();
}
开发者ID:edgehosting,
项目名称:jira-dvcs-connector,
代码行数:10,
代码来源:GitHubPullRequestProcessor.java
示例6: getRepositoryFullName
点赞 2
import org.eclipse.egit.github.core.PullRequestMarker; //导入依赖的package包/类
private String getRepositoryFullName(PullRequestMarker pullRequestMarker)
{
if (pullRequestMarker == null)
{
return null;
}
final org.eclipse.egit.github.core.Repository gitHubRepository = pullRequestMarker.getRepo();
if (gitHubRepository == null || gitHubRepository.getOwner() == null)
{
return null;
}
return gitHubRepository.getOwner().getLogin() + "/" + gitHubRepository.getName();
}
开发者ID:edgehosting,
项目名称:jira-dvcs-connector,
代码行数:16,
代码来源:GitHubPullRequestProcessor.java
示例7: init
点赞 2
import org.eclipse.egit.github.core.PullRequestMarker; //导入依赖的package包/类
@BeforeMethod
private void init() throws IOException
{
MockitoAnnotations.initMocks(this);
when(pullRequest.getId()).thenReturn(1L);
when(pullRequest.getUpdatedAt()).thenReturn(new Date());
final PullRequestMarker source = mockRef("sourceBranch", "sourceRepo");
when(pullRequest.getHead()).thenReturn(source);
final PullRequestMarker destination = mockRef("destinationBranch");
when(pullRequest.getBase()).thenReturn(destination);
when(pullRequest.getState()).thenReturn("open");
when(repository.getOrgName()).thenReturn("org");
when(repository.getSlug()).thenReturn("repo");
when(gitHubClientProvider.getPullRequestService(repository)).thenReturn(gitHubPullRequestService);
when(gitHubClientProvider.getIssueService(repository)).thenReturn(issueService);
when(gitHubPullRequestService.getPullRequest(any(IRepositoryIdProvider.class), anyInt())).thenReturn(pullRequest);
Date updatedOn = pullRequest.getUpdatedAt();
long remoteId = pullRequest.getId();
when(pullRequestMapping.getUpdatedOn()).thenReturn(updatedOn);
when(pullRequestMapping.getRemoteId()).thenReturn(remoteId);
when(pullRequestMapping.getCommits()).thenReturn(new RepositoryCommitMapping[] { });
when(pullRequestMapping.getLastStatus()).thenReturn("OPEN");
when(pullRequestMapping.getSourceBranch()).thenReturn("sourceBranch");
when(pullRequestMapping.getSourceRepo()).thenReturn("owner/sourceRepo");
when(pullRequestMapping.getDestinationBranch()).thenReturn("destinationBranch");
when(repositoryPullRequestDao.findRequestByRemoteId(eq(repository), anyLong())).thenReturn(pullRequestMapping);
when(pullRequestService.createPullRequest(savePullRequestCaptor.capture())).thenAnswer(returnsFirstArg());
when(pullRequestService.updatePullRequest(eq(pullRequestMapping.getID()), savePullRequestCaptor.capture())).thenAnswer(returnsSecondArg());
target = new RepositoryPullRequestMappingMock();
when(repositoryPullRequestDao.createPullRequest()).thenReturn(target);
}
开发者ID:edgehosting,
项目名称:jira-dvcs-connector,
代码行数:40,
代码来源:GitHubPullRequestProcessorTest.java
示例8: testSourceBranchDeleted
点赞 2
import org.eclipse.egit.github.core.PullRequestMarker; //导入依赖的package包/类
@Test
public void testSourceBranchDeleted()
{
PullRequestMarker sourceRef = mock(PullRequestMarker.class);
when(sourceRef.getRepo()).thenReturn(mock(org.eclipse.egit.github.core.Repository.class));
when(sourceRef.getRef()).thenReturn(null);
when(pullRequest.getHead()).thenReturn(sourceRef);
when(repositoryPullRequestDao.findRequestByRemoteId(eq(repository), anyLong())).thenReturn(null);
testedClass.processPullRequest(repository, pullRequest);
verify(repositoryPullRequestDao, never()).updatePullRequestInfo(anyInt(), any(RepositoryPullRequestMapping.class));
verify(repositoryPullRequestDao, never()).savePullRequest(eq(repository), anyMap());
}
开发者ID:edgehosting,
项目名称:jira-dvcs-connector,
代码行数:16,
代码来源:GitHubPullRequestProcessorTest.java
示例9: testSourceRepositoryDeleted
点赞 2
import org.eclipse.egit.github.core.PullRequestMarker; //导入依赖的package包/类
@Test
public void testSourceRepositoryDeleted()
{
PullRequestMarker source = mockRef(null, null);
when(pullRequest.getHead()).thenReturn(source);
when(repositoryPullRequestDao.findRequestByRemoteId(eq(repository), anyLong())).thenReturn(null);
testedClass.processPullRequest(repository, pullRequest);
verify(repositoryPullRequestDao, never()).updatePullRequestInfo(anyInt(), any(RepositoryPullRequestMapping.class));
verify(repositoryPullRequestDao, never()).savePullRequest(eq(repository), any(Map.class));
}
开发者ID:edgehosting,
项目名称:jira-dvcs-connector,
代码行数:14,
代码来源:GitHubPullRequestProcessorTest.java
示例10: mockRef
点赞 2
import org.eclipse.egit.github.core.PullRequestMarker; //导入依赖的package包/类
private PullRequestMarker mockRef(String branchName, String repositoryName)
{
PullRequestMarker ref = mock(PullRequestMarker.class);
when(ref.getRef()).thenReturn(branchName);
if (repositoryName != null)
{
org.eclipse.egit.github.core.Repository gitHubRepository = mock(org.eclipse.egit.github.core.Repository.class);
when(gitHubRepository.getName()).thenReturn(repositoryName);
User owner = mock(User.class);
when(owner.getLogin()).thenReturn("owner");
when(gitHubRepository.getOwner()).thenReturn(owner);
when(ref.getRepo()).thenReturn(gitHubRepository);
}
return ref;
}
开发者ID:edgehosting,
项目名称:jira-dvcs-connector,
代码行数:16,
代码来源:GitHubPullRequestProcessorTest.java
示例11: buildParamList
点赞 2
import org.eclipse.egit.github.core.PullRequestMarker; //导入依赖的package包/类
private List<String> buildParamList(PullRequest pr, List<String> params) {
final PullRequestMarker head = pr.getHead();
final Repository headRepo = head.getRepo();
final List<String> parsedParams = newArrayList();
parsedParams.addAll(asList(headRepo.getOwner().getLogin(),
headRepo.getName(),
head.getRef(),
"" + pr.getNumber()));
parsedParams.addAll(params);
return parsedParams;
}
开发者ID:caarlos0-graveyard,
项目名称:github-integrator,
代码行数:12,
代码来源:MainIntegrator.java
示例12: mockPR
点赞 2
import org.eclipse.egit.github.core.PullRequestMarker; //导入依赖的package包/类
private PullRequest mockPR() {
final PullRequest pr = new PullRequest();
final PullRequestMarker head = new PullRequestMarker();
final User owner = new User();
owner.setLogin("user");
final Repository repo = new Repository();
repo.setName("repo");
repo.setOwner(owner);
head.setRepo(repo);
pr.setHead(head);
head.setRef("feature/my-branch");
pr.setNumber(1);
return pr;
}
开发者ID:caarlos0-graveyard,
项目名称:github-integrator,
代码行数:15,
代码来源:MainIntegratorTest.java
示例13: createPullRequest
点赞 2
import org.eclipse.egit.github.core.PullRequestMarker; //导入依赖的package包/类
/**
* @return the HTML link of the Pull Request
* @throws InterruptedException
*/
private static String createPullRequest(User user, int count) throws IOException, InterruptedException {
GitHubClient client = createClient(user.getGitHubAccessToken());
PullRequestService pulls = new PullRequestService(client);
RestTemplate rest = new RestTemplate();
// get sha for master
DataService references = new DataService(client);
RepositoryId forkRepositoryId = RepositoryId.create(user.getGitHubUsername(), "cla-test");
Reference forked = references.getReference(forkRepositoryId, "heads/master");
// create a branch for our Pull Request
Reference createPullRequestBranch = new Reference();
createPullRequestBranch.setRef("refs/heads/pull-" + count);
createPullRequestBranch.setObject(forked.getObject());
references.createReference(forkRepositoryId, createPullRequestBranch);
// create a file for our Pull Request
Map<String,String> content = new HashMap<>();
content.put("message", "We added some content for "+ count);
content.put("content", "bXkgbmV3IGZpbGUgY29udGVudHM=");
content.put("branch", "pull-"+count);
rest.put("https://api.github.com/repos/{owner}/{repo}/contents/forPullRequest?access_token={token}", content, user.getGitHubUsername(), "cla-test", user.getGitHubAccessToken());
PullRequest request = new PullRequest();
request.setTitle("Please merge");
request.setBody("Please merge");
PullRequestMarker head = new PullRequestMarker();
head.setLabel(signUser.getGitHubUsername() + ":pull-" + count);
request.setHead(head);
PullRequestMarker base = new PullRequestMarker();
base.setLabel("master");
request.setBase(base);
Thread.sleep(TimeUnit.SECONDS.toMillis(1));
PullRequest newPull = pulls.createPullRequest(RepositoryId.createFromId(linkUser.getGitHubUsername() + "/" + "cla-test"), request );
Thread.sleep(TimeUnit.SECONDS.toMillis(1));
return newPull.getHtmlUrl();
}
开发者ID:pivotalsoftware,
项目名称:pivotal-cla,
代码行数:45,
代码来源:SmokeTests.java