Package hudson.triggers

Examples of hudson.triggers.TimerTrigger


        req = createMock(StaplerRequest.class);
        json = new JSONObject();
        JSONObject refspec = new JSONObject();
        refspec.put("refspec", "* * * * *");
        json.put(propertyKey, refspec);
        expect(req.bindJSON(TimerTrigger.class, refspec)).andReturn(new TimerTrigger("* * * * *")).anyTimes();
        mockStatic(Hudson.class);
        Hudson hudson = createMock(Hudson.class);
        expect(hudson.getDescriptorOrDie(TimerTrigger.class)).andReturn(descriptor).anyTimes();
        expect(hudson.getItem("p2")).andReturn(p2).anyTimes();
        expect(hudson.getItem("p3")).andReturn(p3).anyTimes();
View Full Code Here


     * @throws Exception if any.
     */
    @Test
    public void testSetChildrenTriggerOverridden() throws Exception {
        CascadingUtil.setChildrenTrigger(p1, descriptor, propertyKey, req, json);
        CascadingUtil.getTriggerProjectProperty(p2, propertyKey).setValue(new TimerTrigger("*/2 * * * *"));
        CascadingUtil.setChildrenTrigger(p1, descriptor, propertyKey, req, json);
        assertTrue(CascadingUtil.getTriggerProjectProperty(p2, propertyKey).isOverridden());
        verifyAll();
    }
View Full Code Here

     * @throws Exception if any
     */
    @Test
    public void testSetChildrenTriggerOverridenFalse() throws Exception {
        CascadingUtil.setChildrenTrigger(p1, descriptor, propertyKey, req, json);
        CascadingUtil.getTriggerProjectProperty(p2, propertyKey).setValue(new TimerTrigger("*/2 * * * *"));
        CascadingUtil.setChildrenTrigger(p1, descriptor, propertyKey, req, json);
        assertTrue(CascadingUtil.getTriggerProjectProperty(p2, propertyKey).isOverridden());
        CascadingUtil.getTriggerProjectProperty(p2, propertyKey).setValue(new TimerTrigger("* * * * *"));
        CascadingUtil.setChildrenTrigger(p1, descriptor, propertyKey, req, json);
        assertFalse(CascadingUtil.getTriggerProjectProperty(p2, propertyKey).isOverridden());
        verifyAll();
    }
View Full Code Here

    @Test
    public void testClearOriginalValue() throws ANTLRException {
        //Overridden flag should be cleared to false. Pre-set true value
        property.setOverridden(true);
        assertTrue(property.isOverridden());
        Trigger trigger = new TimerTrigger("* * * * *");
        property.clearOriginalValue(trigger);
        //Original value should be set with overridden flag == false
        assertFalse(property.isOverridden());
        assertTrue(trigger == property.getOriginalValue());
    }
View Full Code Here

     *
     * @throws antlr.ANTLRException if any
     */
    @Test
    public void testUpdateOriginalValue() throws ANTLRException {
        Trigger originalTrigger = new TimerTrigger("* * * * *");
        Trigger cascadingTrigger = new TimerTrigger("* * * * *");
        property.updateOriginalValue(originalTrigger, cascadingTrigger);
        //Property isn't overridden because of values equal.
        assertFalse(property.isOverridden());
        //If trigger property value equals to cascading be sure that sets original value instead of cascading.
        assertEquals(property.getOriginalValue(), originalTrigger);

        cascadingTrigger = new TimerTrigger("*/2 * * * *");
        property.updateOriginalValue(originalTrigger, cascadingTrigger);
        assertTrue(property.isOverridden());
        assertEquals(property.getOriginalValue(), originalTrigger);
    }
View Full Code Here

     *
     * @throws antlr.ANTLRException if any
     */
    @Test
    public void testOnCascadingProjectRemoved() throws ANTLRException {
        Trigger trigger = new TimerTrigger("* * * * *");
        property.setOriginalValue(trigger, false);
        assertTrue(trigger == property.getOriginalValue());
        assertFalse(property.isOverridden());
        property.onCascadingProjectRemoved();
        assertFalse(property.isOverridden());
View Full Code Here

TOP

Related Classes of hudson.triggers.TimerTrigger

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.