Package hudson.model

Examples of hudson.model.ParametersDefinitionProperty


            this.mavenHome = mavenHome;
            this.rootPOM = project.getRootPOM(envVars); // JENKINS-13822
            this.profiles = project.getProfiles();
            this.properties = project.getMavenProperties();
            this.updateSnapshots = isUpdateSnapshots(project.getGoals());
            ParametersDefinitionProperty parametersDefinitionProperty = project.getProperty( ParametersDefinitionProperty.class );
            if (parametersDefinitionProperty != null && parametersDefinitionProperty.getParameterDefinitions() != null) {
                for (ParameterDefinition parameterDefinition : parametersDefinitionProperty.getParameterDefinitions()) {
                    // those must used as env var
                    if (parameterDefinition instanceof StringParameterDefinition) {
                        this.properties.put( "env." + parameterDefinition.getName(), ((StringParameterDefinition)parameterDefinition).getDefaultValue() );
                    }
                }
View Full Code Here


   * Priority: parameters > slave > master
   * @throws Exception
   */
  public void testSlaveAndMasterPropertyAndParameterOnSlave()
      throws Exception {
    ParametersDefinitionProperty pdp = new ParametersDefinitionProperty(
        new StringParameterDefinition("KEY", "parameterValue"));
    project.addProperty(pdp);

    setVariables(hudson, new Entry("KEY", "masterValue"));
    setVariables(slave, new Entry("KEY", "slaveValue"));
View Full Code Here

    @Email("https://groups.google.com/d/msg/hudson-users/Xhw00UopVN0/FA9YqDAIsSYJ")
    public void testMavenWithDependencyVersionInEnvVar() throws Exception {
       
        MavenModuleSet m = createMavenProject();
        MavenInstallation mavenInstallation = configureDefaultMaven();
        ParametersDefinitionProperty parametersDefinitionProperty =
            new ParametersDefinitionProperty(new StringParameterDefinition( "JUNITVERSION", "3.8.2" ));
       
        m.addProperty( parametersDefinitionProperty );
        m.setMaven( mavenInstallation.getName() );
        m.getReporters().add(new TestReporter());
        m.setScm(new ExtractResourceSCM(getClass().getResource("envars-maven-project.zip")));
View Full Code Here

        String javaVar = javaHome.substring(0, 3);
        JDK varJDK = new JDK("varJDK", javaHomeVar);
        hudson.getJDKs().add(varJDK);

        FreeStyleProject project = createFreeStyleProject();
        project.addProperty(new ParametersDefinitionProperty(
                new StringParameterDefinition("VAR_MAVEN", "XXX"),
                new StringParameterDefinition("VAR_JAVA", "XXX")));
        project.getBuildersList().add(new Maven("--help", varMaven.getName()));
        project.setJDK(varJDK);
View Full Code Here

        assertNotNull(isp.installers.get(MavenInstaller.class));
    }

    public void testSensitiveParameters() throws Exception {
        FreeStyleProject project = createFreeStyleProject();
        ParametersDefinitionProperty pdb = new ParametersDefinitionProperty(
                new StringParameterDefinition("string", "defaultValue", "string description"),
                new PasswordParameterDefinition("password", "12345", "password description"),
                new StringParameterDefinition("string2", "Value2", "string description")
        );
        project.addProperty(pdb);
View Full Code Here

    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);
        }
View Full Code Here

                    .fromDBObject(ParameterDefinition.class, dbObject, getMapper().createEntityCache());

            parameterDefinitions.add(definition);
        }

        return new ParametersDefinitionProperty(parameterDefinitions);
    }
View Full Code Here

    @Override
    public Object encode(Object value, MappedField optionalExtraInfo) {
        if (value == null) return null;

        ParametersDefinitionProperty parametersDefinitionProperty = (ParametersDefinitionProperty) value;

        BasicDBList parameters = new BasicDBList();
        for(ParameterDefinition definition : parametersDefinitionProperty.getParameterDefinitions()) {
            parameters.add(getMapper().toDBObject(definition));
        }

        return parameters;
    }
View Full Code Here

            project.setDescription(format("<a href=\"%s\">%s</a>", githubRepository.getUrl(), githubRepository.getUrl()));
            project.setConcurrentBuild(true);
            if (StringUtils.isNotEmpty(SetupConfig.get().getLabel())) {
                project.setAssignedLabel(Jenkins.getInstance().getLabel(SetupConfig.get().getLabel()));
            }
            project.addProperty(new ParametersDefinitionProperty(new GithubBranchParameterDefinition("BRANCH", "master",githubRepository.getUrl())));
            project.addProperty(new GithubRepoProperty(githubRepository.getUrl()));
            project.addProperty(new BuildTypeProperty(SetupConfig.get().getDefaultBuildType()));

            project.save();
            folder.addItem(project);
View Full Code Here

        return this.job.scheduleBuild2(0, cause, new ParametersAction(listValues));
    }

    private Map<String, ParameterValue> getDefaultParameters() {
        Map<String, ParameterValue> values = new HashMap<String, ParameterValue>();
        ParametersDefinitionProperty definitionProperty = this.job.getProperty(ParametersDefinitionProperty.class);

        if (definitionProperty != null) {
            for (ParameterDefinition definition : definitionProperty.getParameterDefinitions()) {
                values.put(definition.getName(), definition.getDefaultParameterValue());
            }
        }

        return values;
View Full Code Here

TOP

Related Classes of hudson.model.ParametersDefinitionProperty

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.