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


Java Action类代码示例

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


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

示例1: retrieveActions

import hudson.model.Action; //导入依赖的package包/类
@NonNull
@Override
protected List<Action> retrieveActions(SCMSourceEvent 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<>();
    result.add(new ObjectMetadataAction(null, giteaRepository.getDescription(), giteaRepository.getWebsite()));
    result.add(new GiteaLink("icon-gitea-repo", UriTemplate.buildFromTemplate(serverUrl)
            .path(UriTemplateBuilder.var("owner"))
            .path(UriTemplateBuilder.var("repository"))
            .build()
            .set("owner", repoOwner)
            .set("repository", repository)
            .expand()
    ));
    return result;
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:23,代码来源:GiteaSCMSource.java

示例2: getEnVars

import hudson.model.Action; //导入依赖的package包/类
@Nonnull
public static Map<String, String> getEnVars(@Nonnull Run<?, ?> run) throws EnvInjectException {
    Action envInjectAction = EnvInjectActionRetriever.getEnvInjectAction(run);
    if (envInjectAction != null) {
        try {
            Method method = envInjectAction.getClass().getMethod("getEnvMap");
            return (Map<String, String>) method.invoke(envInjectAction);
        } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException | ClassCastException e) {
            throw new EnvInjectException(e);
        }
    }

    // Retrieve node used for this build
    Node builtOn = (run instanceof AbstractBuild) ? ((AbstractBuild)run).getBuiltOn() : null;
    
    // Check if node is always on. Otherwise, gather master env vars
    if (builtOn == null) {
        return getFallBackMasterNode(run.getParent());
    }
    if (builtOn.getRootPath() == null) {
        return getFallBackMasterNode(run.getParent());
    }

    // Get envVars from the node of the last build
    return getDefaultEnvVarsJob(run.getParent(), builtOn);
}
 
开发者ID:jenkinsci,项目名称:envinject-api-plugin,代码行数:27,代码来源:EnvVarsResolver.java

示例3: retrieveActions

import hudson.model.Action; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@NonNull
@Override
protected List<Action> retrieveActions(@NonNull SCMNavigatorOwner owner, SCMNavigatorEvent event,
                                       @NonNull TaskListener listener) throws IOException, InterruptedException {
    List<Action> result = new ArrayList<>(super.retrieveActions(owner, event, listener));
    ASFGitSCMNavigatorContext context = new ASFGitSCMNavigatorContext().withTraits(traits);
    String avatarUrl = context.avatarUrl();
    if (avatarUrl != null) {
        String avatarDescription = context.avatarDescription();
        result.add(new ASFAvatarMetadataAction(avatarUrl, avatarDescription));
    }
    String objectUrl = context.objectUrl();
    String objectDescription = context.objectDescription();
    String objectDisplayName = context.objectDisplayName();
    if (objectUrl != null || objectDescription != null || objectDisplayName != null) {
        result.add(new ObjectMetadataAction(objectDisplayName, objectDescription, objectUrl));
    }
    return result;
}
 
开发者ID:stephenc,项目名称:asf-gitpubsub-jenkins-plugin,代码行数:23,代码来源:ASFGitSCMNavigator.java

示例4: retrieve

import hudson.model.Action; //导入依赖的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

示例5: setJobRunParamsFromEnvAndUIParams

import hudson.model.Action; //导入依赖的package包/类
public static List<Action> setJobRunParamsFromEnvAndUIParams(WorkflowJob job, JenkinsPipelineBuildStrategy strat,
		List<Action> buildActions, ParametersAction params) {
	List<EnvVar> envs = strat.getEnv();
	List<ParameterValue> envVarList = new ArrayList<ParameterValue>();
	if (envs.size() > 0) {
		// build list of env var keys for compare with existing job params
		for (EnvVar env : envs) {
			envVarList.add(new StringParameterValue(env.getName(), env.getValue()));
		}
	}

	if (params != null)
		envVarList.addAll(params.getParameters());

	if (envVarList.size() > 0)
		buildActions.add(new ParametersAction(envVarList));

	return buildActions;
}
 
开发者ID:jenkinsci,项目名称:openshift-sync-plugin,代码行数:20,代码来源:JenkinsUtils.java

示例6: testGetProjectActionHavingLastBuildGivesStarWarsAction

import hudson.model.Action; //导入依赖的package包/类
public void testGetProjectActionHavingLastBuildGivesStarWarsAction() {
	AbstractProject mockProject = mock(AbstractProject.class);
	Build mockBuild = mock(Build.class);
	Quote expectedQuote = generateQuote(StarWarsResult.SUCCESS);

	when(mockProject.getLastBuild()).thenReturn(mockBuild);
	when(mockBuild.getResult()).thenReturn(Result.SUCCESS);
	
	when(mockQuotesGenerator.generate(StarWarsResult.SUCCESS)).thenReturn(expectedQuote);

	Action action = recorder.getProjectAction(mockProject);

	assertTrue(action instanceof StarWarsAction);
	assertEquals(StarWarsResult.SUCCESS, ((StarWarsAction) action).getResult());
	assertNotNull(((StarWarsAction) action).getQuote());
}
 
开发者ID:pedrolopesme,项目名称:starwars-plugin,代码行数:17,代码来源:StarWarsRecorderTest.java

示例7: testPerformWithFailureResultAddsStarWarsActionWithFailResultAndExpectedQuote

import hudson.model.Action; //导入依赖的package包/类
public void testPerformWithFailureResultAddsStarWarsActionWithFailResultAndExpectedQuote() throws Exception {
	List<Action> actions = new ArrayList<Action>();
	Quote expectedQuote = generateQuote(StarWarsResult.FAIL);
	
	AbstractBuild mockBuild = mock(AbstractBuild.class);
	when(mockBuild.getResult()).thenReturn(Result.FAILURE);
	when(mockBuild.getActions()).thenReturn(actions);

	mockQuotesGenerator.add(expectedQuote);
	when(mockQuotesGenerator.generate(StarWarsResult.FAIL)).thenReturn(expectedQuote);
	assertEquals(0, actions.size());

	Launcher mockLauncher = mock(Launcher.class); 
	BuildListener mockBuildListener = mock(BuildListener.class);
	recorder.perform(mockBuild, mockLauncher, mockBuildListener);

	assertEquals(1, actions.size());
	assertTrue(actions.get(0) instanceof StarWarsAction);

	StarWarsAction action = (StarWarsAction) actions.get(0);
	assertEquals(StarWarsResult.FAIL, action.getResult());
	assertEquals(expectedQuote, action.getQuote());
}
 
开发者ID:pedrolopesme,项目名称:starwars-plugin,代码行数:24,代码来源:StarWarsRecorderTest.java

示例8: getInstance

import hudson.model.Action; //导入依赖的package包/类
/**
 * Gets the {@link DockerTraceabilityRootAction} of Jenkins instance.
 * @return Instance or null if it is not available
 */
public static @CheckForNull DockerTraceabilityRootAction getInstance() {
    Jenkins j = Jenkins.getInstance();
    if (j == null) {
        return null;
    }
    
    @CheckForNull DockerTraceabilityRootAction action = null;
    for (Action rootAction : j.getActions()) {
        if (rootAction instanceof DockerTraceabilityRootAction) {
            action = (DockerTraceabilityRootAction) rootAction;
            break;
        }
    } 
    return action;
}
 
开发者ID:jenkinsci,项目名称:docker-traceability-plugin,代码行数:20,代码来源:DockerTraceabilityRootAction.java

示例9: getProjectAction

import hudson.model.Action; //导入依赖的package包/类
@Override
public Action getProjectAction(final AbstractProject<?, ?> project) {
	log.info("Gebe Projektaktion aus, Klasse: " + project.getClass() + " Instanz von Projekt: " + (project instanceof Project));
	if (project instanceof AbstractProject)
	{
		lastProject = project;
		VisualizeAction va = new VisualizeAction(project, this);
		lastVisulizeAction = va;
		log.info("Visualizer: " + va.getVisualizer().size());

		collectorNames = va.getCollectorNames();
		testNames = va.getTestNames();

		testcases = new LinkedList<GraphVisualizer>();
		for (GraphVisualizer gv : va.getVisualizer()) {
			log.info("Füge Testcase hinzu: " + gv.getName());
			testcases.add(gv);
		}
		log.info("Aktion: " + va);
		return va;
	}
	else {
		log.log(Level.ALL, "Unexpected Class: " + project.getClass());
	}
	return null;
}
 
开发者ID:DaGeRe,项目名称:KoPeMe,代码行数:27,代码来源:KoPeMePublisher.java

示例10: mergeParameters

import hudson.model.Action; //导入依赖的package包/类
public static final void mergeParameters(List<Action> actions) {
	List<ParameterValue> pv = new LinkedList<ParameterValue>();
	Iterator<Action> iter = actions.iterator();
	while (iter.hasNext()) {
		Action a = iter.next();
		if (!(a instanceof ParametersAction)) {
			continue;
		}
		ParametersAction pa = (ParametersAction) a;
		pv.addAll(pa.getParameters());
		iter.remove();
	}
	if (!pv.isEmpty()) {
		actions.add(new ParametersAction(pv));
	}
}
 
开发者ID:i-m-c,项目名称:jenkins-inheritance-plugin,代码行数:17,代码来源:BuildViewExtension.java

示例11: createFor

import hudson.model.Action; //导入依赖的package包/类
/**
    * Creates and returns one single <code>{@link
    * InheritanceListAction}</code> that will be added to the
    * given job.
 *
 * <p>The returned <code>{@link InheritanceListAction}</code>
 * will be added by Jenkins to the given job as a transient
 * action. Transient actions are not persisted.</p>
 *
 * The purpose of the returned <code>{@link
 * InheritanceListAction}</code> is to add a section to the job
 * detail page with an inheritance diagram in case the job is of
 * type inheritance project.</p>
 *
 * <p>This method is automatically called by Jenkins during the
 * initialisation of a job object.</p>
 *
 * @param target The job for which we are to create our action.
 *
 * @return A collection with one single <code>{@link
 * InheritanceListAction}</code> instance.
    */
   @Override
   public Collection<? extends Action> createFor(
		@SuppressWarnings("rawtypes") final AbstractProject target
) {
	Collection<Action> result;
	
	if (target instanceof InheritanceProject) {
		InheritanceProject job = (InheritanceProject) target;
		InheritanceListService service = getService();
		Action action = new InheritanceListAction(job, service);
		result = Collections.singleton(action);

		log.fine(String.format(
				"Added %s to job '%s'",
				InheritanceListAction.class.getSimpleName(),
				job.getFullName()
		));
	} else {
		result = Collections.emptyList();
	}
       return result;
   }
 
开发者ID:i-m-c,项目名称:jenkins-inheritance-plugin,代码行数:45,代码来源:InheritanceListActionFactory.java

示例12: getResults

import hudson.model.Action; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public static List<StaticAnalysisResult> getResults(AbstractBuild<?, ?> build) {
    if (build != null) {
        if (JenkinsUtil.isPluginInstalled(ANALYSIS_CORE_PLUGIN)) {
            List<StaticAnalysisResult> result = new ArrayList<>();
            for (Action action : build.getActions()) {
                if (AbstractResultAction.class.isInstance(action) || MavenResultAction.class.isInstance(action)) {
                    @SuppressWarnings("rawtypes")
                    final BuildResult r = ((ResultAction) action).getResult();
                    result.add(new StaticAnalysisResult(
                            action.getDisplayName(),
                            build.getUrl() + action.getUrlName(),
                            r.getNumberOfHighPriorityWarnings(),
                            r.getNumberOfNormalPriorityWarnings(),
                            r.getNumberOfLowPriorityWarnings()));
                }
            }
            return result;
        }
    }
    return Collections.emptyList();
}
 
开发者ID:Diabol,项目名称:delivery-pipeline-plugin,代码行数:23,代码来源:StaticAnalysisResult.java

示例13: testAddActionIfNotExistsDontAdd

import hudson.model.Action; //导入依赖的package包/类
/**
 * Test method for {@see org.jenkinsci.plugins.neoload.integration.supporting.PluginUtils#addActionIfNotExists(hudson.model.AbstractBuild)}.
 */
@Test
public void testAddActionIfNotExistsDontAdd() {
	final List<Action> actions = new ArrayList<Action>();
	actions.add(mock(Action.class));
	actions.add(mock(Action.class));
	actions.add(mock(Action.class));
	actions.add(mock(NeoResultsAction.class));

	final AbstractBuild abstractBuild = mo.getAbstractBuild();
	when(abstractBuild.getActions()).thenReturn(actions);

	//NeoResultsAction.addActionIfNotExists(abstractBuild);

	Mockito.verify(abstractBuild, Mockito.never()).addAction((Action) Matchers.any());
}
 
开发者ID:jenkinsci,项目名称:neoload-plugin,代码行数:19,代码来源:NeoResultsActionTest.java

示例14: retrieveActions

import hudson.model.Action; //导入依赖的package包/类
@NonNull
@Override
protected List<Action> retrieveActions(@NonNull SCMNavigatorOwner owner, SCMNavigatorEvent event,
                                       @NonNull TaskListener listener) throws IOException, InterruptedException {
    if (this.giteaOwner == null) {
        try (GiteaConnection c = gitea(owner).open()) {
            this.giteaOwner = c.fetchUser(repoOwner);
            if (StringUtils.isBlank(giteaOwner.getEmail())) {
                this.giteaOwner = c.fetchOrganization(repoOwner);
            }
        }
    }
    List<Action> result = new ArrayList<>();
    String objectUrl = UriTemplate.buildFromTemplate(serverUrl)
            .path("owner")
            .build()
            .set("owner", repoOwner)
            .expand();
    result.add(new ObjectMetadataAction(
            Util.fixEmpty(giteaOwner.getFullName()),
            null,
            objectUrl)
    );
    if (StringUtils.isNotBlank(giteaOwner.getAvatarUrl())) {
        result.add(new GiteaAvatar(giteaOwner.getAvatarUrl()));
    }
    result.add(new GiteaLink("icon-gitea-org", objectUrl));
    if (giteaOwner instanceof GiteaOrganization) {
        String website = ((GiteaOrganization) giteaOwner).getWebsite();
        if (StringUtils.isBlank(website)) {
            listener.getLogger().println("Organization URL: unspecified");
            listener.getLogger().printf("Organization URL: %s%n",
                    HyperlinkNote.encodeTo(website, StringUtils.defaultIfBlank(giteaOwner.getFullName(), website)));
        }
    }
    return result;
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:38,代码来源:GiteaSCMNavigator.java

示例15: getProjectActions

import hudson.model.Action; //导入依赖的package包/类
public Collection<? extends Action> getProjectActions() {
    if (this.job != null && CollectionUtils.isEmpty(this.actions)) {
        this.actions = Collections.singletonList(new SQSActivityAction(this.job));
    }

    if (this.actions == null) {
        this.actions = Collections.emptyList();
    }
    return this.actions;
}
 
开发者ID:riboseinc,项目名称:aws-codecommit-trigger-plugin,代码行数:11,代码来源:SQSTrigger.java


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