• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java SCMHeadEvent类的典型用法和代码示例

java 9次浏览

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

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

示例1: handle

点赞 3

import jenkins.scm.api.SCMHeadEvent; //导入依赖的package包/类
private void handle(String id, GitLabHookEventType eventType, HttpServletRequest request) throws IOException {
    switch (eventType) {
        case PUSH:
            SCMHeadEvent.fireNow(new GitLabSCMPushEvent(id, readHook(PushHook.class, request), originOf(request)));
            break;
        case TAG_PUSH:
            SCMHeadEvent.fireNow(new GitLabSCMTagPushEvent(id, readHook(PushHook.class, request), originOf(request)));
            break;
        case MERGE_REQUEST:
            SCMHeadEvent.fireNow(GitLabSCMMergeRequestEvent.create(id, readHook(MergeRequestHook.class, request), originOf(request)));
            break;
        case SYSTEM_HOOK:
            handleSystemHook(id, request);
            break;
        default:
            throw new IllegalArgumentException("cannot handle hook-event of type " + eventType);
    }
}
 

开发者ID:Argelbargel,
项目名称:gitlab-branch-source-plugin,
代码行数:19,
代码来源:HookHandler.java

示例2: retrieve

点赞 3

import jenkins.scm.api.SCMHeadEvent; //导入依赖的package包/类
@Nonnull
private List<Action> retrieve(@Nonnull GitLabSCMHead head, @CheckForNull SCMHeadEvent event, @Nonnull TaskListener listener) throws IOException, InterruptedException {
    List<Action> actions = new ArrayList<>();

    actions.add(new GitLabSCMPublishAction(head, source.getSourceSettings()));

    Action linkAction;

    if (head instanceof ChangeRequestSCMHead) {
        GitLabMergeRequest mr = retrieveMergeRequest((ChangeRequestSCMHead) head, listener);
        linkAction = GitLabLinkAction.toMergeRequest(mr.getWebUrl());
        if (acceptMergeRequest(head)) {
            boolean removeSourceBranch = mr.getRemoveSourceBranch() || removeSourceBranch(head);
            actions.add(new GitLabSCMAcceptMergeRequestAction(mr.getProjectId(), mr.getId(), mr.getIid(), source.getSourceSettings().getMergeCommitMessage(), removeSourceBranch));
        }
    } else {
        linkAction = (head instanceof TagSCMHead) ? GitLabLinkAction.toTag(source.getProject(), head.getName()) : GitLabLinkAction.toBranch(source.getProject(), head.getName());
        if (head instanceof GitLabSCMBranchHead && StringUtils.equals(source.getProject().getDefaultBranch(), head.getName())) {
            actions.add(new PrimaryInstanceMetadataAction());
        }
    }

    actions.add(linkAction);
    return actions;
}
 

开发者ID:Argelbargel,
项目名称:gitlab-branch-source-plugin,
代码行数:26,
代码来源:SourceActions.java

示例3: retrieve

点赞 2

import jenkins.scm.api.SCMHeadEvent; //导入依赖的package包/类
void retrieve(@CheckForNull SCMSourceCriteria criteria, @Nonnull SCMHeadObserver observer, @CheckForNull SCMHeadEvent<?> event, @Nonnull TaskListener listener) throws IOException, InterruptedException {
    if (event instanceof GitLabSCMMergeRequestEvent) {
        retrieveMergeRequest(criteria, observer, (GitLabSCMMergeRequestEvent) event, listener);
    } else if (event instanceof GitLabSCMTagPushEvent) {
        retrieveTag(criteria, observer, (GitLabSCMTagPushEvent) event, listener);
    } else if (event instanceof GitLabSCMPushEvent) {
        retrieveBranch(criteria, observer, (GitLabSCMPushEvent) event, listener);
    } else {
        retrieveAll(criteria, observer, listener);
    }
}
 

开发者ID:Argelbargel,
项目名称:gitlab-branch-source-plugin,
代码行数:12,
代码来源:SourceHeads.java

示例4: process

点赞 2

import jenkins.scm.api.SCMHeadEvent; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void process(GiteaPushSCMEvent event) {
    SCMHeadEvent.fireNow(event);
}
 

开发者ID:jenkinsci,
项目名称:gitea-plugin,
代码行数:8,
代码来源:GiteaPushSCMEvent.java

示例5: process

点赞 2

import jenkins.scm.api.SCMHeadEvent; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void process(GiteaCreateSCMEvent event) {
    SCMHeadEvent.fireNow(event);
}
 

开发者ID:jenkinsci,
项目名称:gitea-plugin,
代码行数:8,
代码来源:GiteaCreateSCMEvent.java

示例6: process

点赞 2

import jenkins.scm.api.SCMHeadEvent; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void process(GiteaPullSCMEvent event) {
    SCMHeadEvent.fireNow(event);
}
 

开发者ID:jenkinsci,
项目名称:gitea-plugin,
代码行数:8,
代码来源:GiteaPullSCMEvent.java

示例7: retrieveActions

点赞 2

import jenkins.scm.api.SCMHeadEvent; //导入依赖的package包/类
@NonNull
@Override
protected List<Action> retrieveActions(@NonNull SCMHead head, SCMHeadEvent event, @NonNull TaskListener listener)
        throws IOException, InterruptedException {
    if (giteaRepository == null) {
        try (GiteaConnection c = gitea().open()) {
            listener.getLogger().format("Looking up repository %s/%s%n", repoOwner, repository);
            giteaRepository = c.fetchRepository(repoOwner, repository);
        }
    }
    List<Action> result = new ArrayList<>();
    if (head instanceof BranchSCMHead) {
        String branchUrl = UriTemplate.buildFromTemplate(serverUrl)
                .path(UriTemplateBuilder.var("owner"))
                .path(UriTemplateBuilder.var("repository"))
                .path("src")
                .path(UriTemplateBuilder.var("branch"))
                .build()
                .set("owner", repoOwner)
                .set("repository", repository)
                .set("branch", head.getName())
                .expand();
        result.add(new ObjectMetadataAction(
                null,
                null,
                branchUrl
        ));
        result.add(new GiteaLink("icon-gitea-branch", branchUrl));
        if (head.getName().equals(giteaRepository.getDefaultBranch())) {
            result.add(new PrimaryInstanceMetadataAction());
        }
    } else if (head instanceof PullRequestSCMHead) {
        String pullUrl = UriTemplate.buildFromTemplate(serverUrl)
                .path(UriTemplateBuilder.var("owner"))
                .path(UriTemplateBuilder.var("repository"))
                .path("pulls")
                .path(UriTemplateBuilder.var("id"))
                .build()
                .set("owner", repoOwner)
                .set("repository", repository)
                .set("id", ((PullRequestSCMHead) head).getId())
                .expand();
        result.add(new ObjectMetadataAction(
                null,
                null,
                pullUrl
        ));
        result.add(new GiteaLink("icon-gitea-branch", pullUrl));
    }
    return result;
}
 

开发者ID:jenkinsci,
项目名称:gitea-plugin,
代码行数:52,
代码来源:GiteaSCMSource.java

示例8: visitSources

点赞 2

import jenkins.scm.api.SCMHeadEvent; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void visitSources(@NonNull SCMSourceObserver observer, @NonNull SCMHeadEvent<?> event)
        throws IOException, InterruptedException {
    visitSource(event.getSourceName(), observer);
}
 

开发者ID:stephenc,
项目名称:asf-gitpubsub-jenkins-plugin,
代码行数:9,
代码来源:ASFGitSCMNavigator.java

示例9: retrieve

点赞 2

import jenkins.scm.api.SCMHeadEvent; //导入依赖的package包/类
@Override
protected void retrieve(@CheckForNull SCMSourceCriteria criteria, @Nonnull SCMHeadObserver observer, @CheckForNull SCMHeadEvent<?> event, @Nonnull TaskListener listener) throws IOException, InterruptedException {
    listener.getLogger().format(Messages.GitLabSCMSource_retrievingHeadsForProject(project.getPathWithNamespace()) + "\n");
    heads.retrieve(criteria, observer, event, listener);
}
 

开发者ID:Argelbargel,
项目名称:gitlab-branch-source-plugin,
代码行数:6,
代码来源:GitLabSCMSource.java

示例10: retrieveActions

点赞 2

import jenkins.scm.api.SCMHeadEvent; //导入依赖的package包/类
@Nonnull
@Override
protected List<Action> retrieveActions(@Nonnull SCMHead head, @CheckForNull SCMHeadEvent event, @Nonnull TaskListener listener) throws IOException, InterruptedException {
    return actions.retrieve(head, event, listener);
}
 

开发者ID:Argelbargel,
项目名称:gitlab-branch-source-plugin,
代码行数:6,
代码来源:GitLabSCMSource.java

示例11: fire

点赞 2

import jenkins.scm.api.SCMHeadEvent; //导入依赖的package包/类
private void fire(MockSCMHeadEvent event) throws Exception {
    long watermark = SCMEvents.getWatermark();
    SCMHeadEvent.fireNow(event);
    SCMEvents.awaitAll(watermark);
    r.waitUntilNoActivity();
}
 

开发者ID:jenkinsci,
项目名称:multi-branch-project-plugin,
代码行数:7,
代码来源:FreeStyleMultiBranchProjectTest.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)