Package hudson.tasks

Examples of hudson.tasks.LogRotator


    /**
     * Perform log rotation.
     */
    public void logRotate() throws IOException, InterruptedException {
        LogRotator lr = getLogRotator();
        if (lr != null)
            lr.perform(this);
    }
View Full Code Here


        return getParent().getPublisher(descriptor);
    }

    @Override
    public LogRotator getLogRotator() {
        LogRotator lr = getParent().getLogRotator();
        return new LinkedLogRotator(lr != null ? lr.getArtifactDaysToKeep() : -1,
                                    lr != null ? lr.getArtifactNumToKeep() : -1);
    }
View Full Code Here

        return getParent().getAssignedLabel();
    }

    @Override
    public LogRotator getLogRotator() {
        LogRotator lr = getParent().getLogRotator();
        int artifactDaysToKeep = lr != null ? lr.getArtifactDaysToKeep() : -1;
        int artifactNumToKeep = lr != null ? lr.getArtifactNumToKeep() : -1;
        return new LinkedLogRotator(artifactDaysToKeep, artifactNumToKeep);
    }
View Full Code Here


    @Test
    public void testGetLogRotatorFromParent() {
        FreeStyleProject parentProject = new FreeStyleProjectMock("parent");
        parentProject.setLogRotator(new LogRotator(10, 11, 12, 13));

        FreeStyleProjectMock childProject1 = new FreeStyleProjectMock("child1");
        childProject1.setCascadingProject(parentProject);
        LogRotator result = childProject1.getLogRotator();
        assertNotNull(result);
        assertEquals(result.getDaysToKeep(), 10);
    }
View Full Code Here

    }

    @Test
    public void testGetLogRotatorFromChild() {
        FreeStyleProject parentProject = new FreeStyleProjectMock("parent");
        parentProject.setLogRotator(new LogRotator(10, 10, 10, 10));

        FreeStyleProjectMock childProject1 = new FreeStyleProjectMock("child1");
        childProject1.setLogRotator(new LogRotator(20, 20, 20, 20));
        childProject1.setCascadingProject(parentProject);
        LogRotator result = childProject1.getLogRotator();
        assertNotNull(result);
        assertEquals(result.getDaysToKeep(), 20);
    }
View Full Code Here

    }

    @Test
    public void testSetLogRotatorValueEqualsWithParent() {
        FreeStyleProject parentProject = new FreeStyleProjectMock("parent");
        parentProject.setLogRotator(new LogRotator(10, 11, 12, 13));

        FreeStyleProjectMock childProject1 = new FreeStyleProjectMock("child1");
        childProject1.setCascadingProject(parentProject);
        childProject1.setLogRotator(new LogRotator(10, 11, 12, 13));
        childProject1.setCascadingProject(null); // else log rotator will be taken from parent
        assertNull(childProject1.getLogRotator());
    }
View Full Code Here

    }

    @Test
    public void testSetLogRotatorParentNull() {
        FreeStyleProject childProject1 = new FreeStyleProjectMock("child1");
        childProject1.setLogRotator(new LogRotator(10, 11, 12, 13));
        assertNotNull(childProject1.getLogRotator());
        assertEquals(childProject1.getLogRotator().getDaysToKeep(), 10);
    }
View Full Code Here

            project.getProperty(MatrixProject.COMBINATION_FILTER_PROPERTY_NAME).getValue());
        assertEquals("label==\"unix\" && DB==\"mysql\"",
            project.getProperty(MatrixProject.TOUCH_STONE_COMBINATION_FILTER_PROPERTY_NAME).getValue());
        assertEquals(Result.SUCCESS,
            CascadingUtil.getResultProjectProperty(project, MatrixProject.TOUCH_STONE_RESULT_CONDITION_PROPERTY_NAME).getValue());
        assertEquals(new LogRotator(7, 7, 7, 7),
            CascadingUtil.getLogRotatorProjectProperty(project, MatrixProject.LOG_ROTATOR_PROPERTY_NAME).getValue());
        AxisList axes = CascadingUtil.getAxesListProjectProperty(project, MatrixProject.AXES_PROPERTY_NAME).getValue();
        assertEquals(2, axes.size());
        assertEquals("DB", axes.get(0).getName());
        assertEquals(2, axes.get(0).getValues().size());
View Full Code Here

    @Test
    public void testLogRotatorProjectPropertyPrepareValue() {
        //Boolean property acts as BaseProperty
        BaseProjectProperty property = new LogRotatorProjectProperty(project);
        assertNull(property.prepareValue(null));
        LogRotator value = new LogRotator(1, 1, 1, 1);
        assertEquals(value, property.prepareValue(value));
    }
View Full Code Here

    @Test
    public void testLogRotatorProjectPropertyAllowOverrideValue() {
        BaseProjectProperty property = new LogRotatorProjectProperty(project);
        assertFalse(property.allowOverrideValue(null, null));
        assertTrue(property.allowOverrideValue(new LogRotator(1, 1, 1, 1), null));
        assertTrue(property.allowOverrideValue(null, new LogRotator(1, 1, 1, 1)));
        assertTrue(property.allowOverrideValue(new LogRotator(1, 1, 1, 2), new LogRotator(1, 1, 1, 1)));
    }
View Full Code Here

TOP

Related Classes of hudson.tasks.LogRotator

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.