Package hudson.model

Examples of hudson.model.ParametersDefinitionProperty$DescriptorImpl


    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()));
            }
            for (ParameterDefinition pd : pdp.getParameterDefinitions()) {
                if (parameters.get(pd.getName()) == null) {
                    values.add(pd.getDefaultParameterValue());
                }
            }
            a = new ParametersAction(values);
View Full Code Here


        CopyOnWriteListProjectProperty projectProperty = getCopyOnWriteListProjectProperty(job, key);
        CopyOnWriteList<ParametersDefinitionProperty> pdProperties
            = new CopyOnWriteList<ParametersDefinitionProperty>();
        //Create new instance for each parameter in order to set owner and use in cascading children.
        for (ParametersDefinitionProperty pdp : parameterDefinitionProperties) {
            ParametersDefinitionProperty copiedDefinitionProperty = new ParametersDefinitionProperty(
                new ArrayList<ParameterDefinition>(pdp.getParameterDefinitions()));
            copiedDefinitionProperty.setOwner((AbstractProject) job);
            pdProperties.add(copiedDefinitionProperty);
        }
        projectProperty.setValue(pdProperties);
        Set<String> cascadingChildrenNames = job.getCascadingChildrenNames();
        //Iterate through cascading children and recursively update property for each child.
View Full Code Here

    public void testScheduleWithDefaultParameters() {

        AbstractProject project = PowerMockito.mock(AbstractProject.class);
        when(project.getFullDisplayName()).thenReturn("MockedProject");
        when(project.getFullName()).thenReturn("MockedProject");
        ParametersDefinitionProperty parameters = mock(ParametersDefinitionProperty.class);
        List<ParameterDefinition> list = new LinkedList<ParameterDefinition>();
        list.add(new StringParameterDefinition("MOCK_PARAM", "mock_value"));
        when(parameters.getParameterDefinitions()).thenReturn(list);
        when(project.getProperty(ParametersDefinitionProperty.class)).thenReturn(parameters);

        PowerMockito.mockStatic(PluginImpl.class);
        PluginImpl plugin = PowerMockito.mock(PluginImpl.class);
        PowerMockito.when(PluginImpl.getInstance()).thenReturn(plugin);
View Full Code Here

    @Test
    public void testScheduleWithNoDefaultParameters() {
        AbstractProject project = PowerMockito.mock(AbstractProject.class);
        when(project.getFullDisplayName()).thenReturn("MockedProject");
        when(project.getFullName()).thenReturn("MockedProject");
        ParametersDefinitionProperty parameters = mock(ParametersDefinitionProperty.class);
        when(parameters.getParameterDefinitions()).thenReturn(Collections.EMPTY_LIST);
        when(project.getProperty(ParametersDefinitionProperty.class)).thenReturn(parameters);

        PowerMockito.mockStatic(PluginImpl.class);
        PluginImpl plugin = PowerMockito.mock(PluginImpl.class);
        PowerMockito.when(PluginImpl.getInstance()).thenReturn(plugin);
View Full Code Here

    @Test
    public void testScheduleWithOwnerAndUploader() {
        AbstractProject project = PowerMockito.mock(AbstractProject.class);
        when(project.getFullDisplayName()).thenReturn("MockedProject");
        when(project.getFullName()).thenReturn("MockedProject");
        ParametersDefinitionProperty parameters = mock(ParametersDefinitionProperty.class);
        when(parameters.getParameterDefinitions()).thenReturn(Collections.EMPTY_LIST);
        when(project.getProperty(ParametersDefinitionProperty.class)).thenReturn(parameters);

        Account owner = new Account("Bobby", "bobby@somewhere.com");
        Account uploader = new Account("Nisse", "nisse@acme.org");
View Full Code Here

    @Test
    public void testScheduleWithOwnerAndOneUploaderNull() {
        AbstractProject project = PowerMockito.mock(AbstractProject.class);
        when(project.getFullDisplayName()).thenReturn("MockedProject");
        when(project.getFullName()).thenReturn("MockedProject");
        ParametersDefinitionProperty parameters = mock(ParametersDefinitionProperty.class);
        when(parameters.getParameterDefinitions()).thenReturn(Collections.EMPTY_LIST);
        when(project.getProperty(ParametersDefinitionProperty.class)).thenReturn(parameters);

        Account owner = new Account("Bobby", "bobby@somewhere.com");
        Account uploader = new Account("Nisse", "nisse@acme.org");
View Full Code Here

    @Test
    public void testScheduleWithOwnerAndOtherUploaderNull() {
        AbstractProject project = PowerMockito.mock(AbstractProject.class);
        when(project.getFullDisplayName()).thenReturn("MockedProject");
        when(project.getFullName()).thenReturn("MockedProject");
        ParametersDefinitionProperty parameters = mock(ParametersDefinitionProperty.class);
        when(parameters.getParameterDefinitions()).thenReturn(Collections.EMPTY_LIST);
        when(project.getProperty(ParametersDefinitionProperty.class)).thenReturn(parameters);

        Account owner = new Account("Bobby", "bobby@somewhere.com");
        Account uploader = new Account("Nisse", "nisse@acme.org");
View Full Code Here

    @Test
    public void testScheduleWithOwnerAndBothUploadersNull() {
        AbstractProject project = PowerMockito.mock(AbstractProject.class);
        when(project.getFullDisplayName()).thenReturn("MockedProject");
        when(project.getFullName()).thenReturn("MockedProject");
        ParametersDefinitionProperty parameters = mock(ParametersDefinitionProperty.class);
        when(parameters.getParameterDefinitions()).thenReturn(Collections.EMPTY_LIST);
        when(project.getProperty(ParametersDefinitionProperty.class)).thenReturn(parameters);

        Account owner = new Account("Bobby", "bobby@somewhere.com");

        PowerMockito.mockStatic(PluginImpl.class);
View Full Code Here

    @Test
    public void testScheduleWithOwnerAndPartOfUploadersNull() {
        AbstractProject project = PowerMockito.mock(AbstractProject.class);
        when(project.getFullDisplayName()).thenReturn("MockedProject");
        when(project.getFullName()).thenReturn("MockedProject");
        ParametersDefinitionProperty parameters = mock(ParametersDefinitionProperty.class);
        when(parameters.getParameterDefinitions()).thenReturn(Collections.EMPTY_LIST);
        when(project.getProperty(ParametersDefinitionProperty.class)).thenReturn(parameters);

        Account owner = new Account("Bobby", "bobby@somewhere.com");
        Account uploader = new Account("Bobby", null);
View Full Code Here

        String stringWithQuotesEscaped = "Fixed \\\" the thing to make \\\" some thing fun";
        String stringWithoutQuotes = "Fixed  the thing to make  some thing fun";

        //prepare AbstractProject object
        AbstractProject project = PowerMockito.mock(AbstractProject.class);
        ParametersDefinitionProperty parameters = mock(ParametersDefinitionProperty.class);
        when(parameters.getParameterDefinitions()).thenReturn(Collections.EMPTY_LIST);
        when(project.getProperty(ParametersDefinitionProperty.class)).thenReturn(parameters);

        //prepare  PatchsetCreated object
        JSONObject patch = new JSONObject();
        patch.put(NUMBER, "2");
View Full Code Here

TOP

Related Classes of hudson.model.ParametersDefinitionProperty$DescriptorImpl

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.