Package hudson.model

Examples of hudson.model.ParametersAction


                    // do builds here
                    try {
                        List<BuildWrapper> wrappers = new ArrayList<BuildWrapper>();
                        for (BuildWrapper w : project.getBuildWrappersList())
                            wrappers.add(w);
                        ParametersAction parameters = getAction(ParametersAction.class);
                        if (parameters != null)
                            parameters.createBuildWrappers(MavenModuleSetBuild.this,wrappers);

                        for( BuildWrapper w : wrappers) {
                            Environment e = w.setUp(MavenModuleSetBuild.this, launcher, listener);
                            if(e==null)
                                return (r = Result.FAILURE);
View Full Code Here


                new StringParameterDefinition("VAR_JAVA", "XXX")));
        project.getBuildersList().add(new Maven("--help", varMaven.getName()));
        project.setJDK(varJDK);

        FreeStyleBuild build = project.scheduleBuild2(0, new LegacyCodeCause(),
                new ParametersAction(
                        new StringParameterValue("VAR_MAVEN", mavenVar),
                        new StringParameterValue("VAR_JAVA", javaVar))).get();

        assertBuildStatusSuccess(build);
View Full Code Here

    public Map<String,String> parameters = new HashMap<String, String>();

    protected int run() throws Exception {
        job.checkPermission(Item.BUILD);

        ParametersAction a = null;
        if (!parameters.isEmpty()) {
            ParametersDefinitionProperty pdp = job.getProperty(ParametersDefinitionProperty.class);
            if (pdp==null)
                throw new AbortException(job.getFullDisplayName()+" is not parameterized but the -p option was specified");

            List<ParameterValue> values = new ArrayList<ParameterValue>();

            for (Entry<String, String> e : parameters.entrySet()) {
                String name = e.getKey();
                ParameterDefinition pd = pdp.getParameterDefinition(name);
                if (pd==null)
                    throw new AbortException(String.format("\'%s\' is not a valid parameter. Did you mean %s?",
                            name, EditDistance.findNearest(name, pdp.getParameterDefinitionNames())));
                values.add(pd.createValue(this,e.getValue()));
            }
           
            a = new ParametersAction(values);
        }

        if (checkSCM) {
            if (job.poll(new StreamTaskListener(stdout, getClientCharset())).change == Change.NONE) {
                return 0;
View Full Code Here

        return failed;
    }

    public boolean initialize() throws IOException, InterruptedException {
        List<BuildWrapper> wrappers = new ArrayList<BuildWrapper>(getProject().getBuildWrappers().values());
        ParametersAction parameters = getAction(ParametersAction.class);
        if (parameters != null) {
            parameters.createBuildWrappers(build, wrappers);
        }
        return setupWrappers(wrappers);

    }
View Full Code Here

        if (branchName.contains("*")) {
            return null;
        }

        // substitute build parameters if available
        ParametersAction parameters = build.getAction(ParametersAction.class);
        if (parameters != null) {
            branchName = parameters.substitute(build, branchName);
        }
        return branchName;
    }
View Full Code Here

    }

    public String getParamLocalBranch(AbstractBuild<?, ?> build) {
        String branch = getLocalBranch();
        // substitute build parameters if available
        ParametersAction parameters = build.getAction(ParametersAction.class);
        if (parameters != null) {
            branch = parameters.substitute(build, branch);
        }
        return branch;
    }
View Full Code Here

    }

    private String getRefSpec(RemoteConfig repo, AbstractBuild<?, ?> build) {
        String refSpec = repo.getFetchRefSpecs().get(0).toString();

        ParametersAction parameters = build.getAction(ParametersAction.class);
        if (parameters != null) {
            refSpec = parameters.substitute(build, refSpec);
        }

        return refSpec;
    }
View Full Code Here

        values.put("gitlabSourceRepository", new StringParameterValue("gitlabSourceRepository", cause.getSourceRepository()));
        values.put("gitlabSourceBranch", new StringParameterValue("gitlabSourceBranch", cause.getSourceBranch()));
        values.put("gitlabTargetBranch", new StringParameterValue("gitlabTargetBranch", cause.getTargetBranch()));

        List<ParameterValue> listValues = new ArrayList<ParameterValue>(values.values());
        return this.job.scheduleBuild2(0, cause, new ParametersAction(listValues));
    }
View Full Code Here

    Project projectB = createFreeStyleProject("projectB");
    projectB.getBuildersList().add(builder);
    projectB.setQuietPeriod(1);
    hudson.rebuildDependencyGraph();

    projectA.scheduleBuild2(0, new UserCause(), new ParametersAction(
      new StringParameterValue("KEY", "value"))).get();
    hudson.getQueue().getItem(projectB).getFuture().get();

    assertNotNull("builder should record environment", builder.getEnvVars());
    assertEquals("value", builder.getEnvVars().get("KEY"));
View Full Code Here

import junit.framework.TestCase;

public class ParameterizedTriggerUtilsTest extends TestCase {

    public void testMergeParameters() {
        ParametersAction base = new ParametersAction(
                new StringParameterValue("key1", "value1"),
                new StringParameterValue("key2", "value2")
                );

        ParametersAction overlay = new ParametersAction(
                new StringParameterValue("key2", "not-value2"),
                new StringParameterValue("key3", "value3")
                );

        ParametersAction result = ParameterizedTriggerUtils.mergeParameters(base, overlay);

        assertStringParameterValueEquals("value1", result.getParameter("key1"));
        assertStringParameterValueEquals("not-value2", result.getParameter("key2"));
        assertStringParameterValueEquals("value3", result.getParameter("key3"));
    }
View Full Code Here

TOP

Related Classes of hudson.model.ParametersAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.