Package hudson.util

Examples of hudson.util.DescribableList


        //Return properties' originalValue if it was overridden
        property.setOverridden(true);
        assertTrue(property.returnOriginalValue());
        //If property has not empty value - return it (basically for non-cascadable projects)
        property.setOriginalValue(new DescribableList(project, Arrays.asList(new Object())), false);
        assertTrue(property.returnOriginalValue());
        //If property has not empty value and was overridden - return it
        property.setOriginalValue(new DescribableList(project, Arrays.asList(new Object())), true);
        assertTrue(property.returnOriginalValue());
    }
View Full Code Here


     */
    @Test
    public void testAllowOverrideValue() {
        //Don't need to override null values and equal lists
        assertFalse(property.allowOverrideValue(null, null));
        assertFalse(property.allowOverrideValue(new DescribableList(project), new DescribableList(project)));
        //Don't need to override Describable lists which has same Describable#data values, even if owners are not equal.
        assertFalse(property.allowOverrideValue(new DescribableList(project), new DescribableList(project)));
        assertFalse(property.allowOverrideValue(new DescribableList(project), new DescribableList(parent)));
        DescribableList describableList1 = new DescribableList(project,
            Arrays.asList(new Shell("echo 'test3'"), new Shell("echo 'test2'")));
        DescribableList describableList2 = new DescribableList(project,
            Arrays.asList(new Shell("echo 'test2'"), new Shell("echo 'test3'")));
        assertFalse(property.allowOverrideValue(describableList1, describableList2));

        DescribableList describableList3 = new DescribableList(parent, describableList2.toList());
        assertFalse(property.allowOverrideValue(describableList1, describableList3));

        describableList1 = new DescribableList(project, Arrays.asList(new Object()));
        describableList2 = new DescribableList(project, Arrays.asList(new Object()));
        assertFalse(property.allowOverrideValue(describableList1, describableList2));

        //Allow override if cascading or candidate are null
        assertTrue(property.allowOverrideValue(null, new DescribableList(project)));
        assertTrue(property.allowOverrideValue(new DescribableList(project), null));

        assertTrue(property.allowOverrideValue(new DescribableList(project),
            new DescribableList(project, Arrays.asList(new Shell("echo 'test1'")))));
        assertTrue(property.allowOverrideValue(new DescribableList(project, Arrays.asList(new Shell("echo 'test1'"))),
            new DescribableList(project)));
    }
View Full Code Here

        super(job);
    }

    @Override
    public DescribableList getDefaultValue() {
        DescribableList result = new DescribableList(getJob());
        setOriginalValue(result, false);
        return result;
    }
View Full Code Here

        return isOverridden() || !getOriginalValue().isEmpty();
    }

    @Override
    public DescribableList getOriginalValue() {
        DescribableList result = super.getOriginalValue();
        return null != result ? result : getDefaultValue();
    }
View Full Code Here

TOP

Related Classes of hudson.util.DescribableList

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.