Java 类hudson.tasks.LogRotator 实例源码

项目:jenkins-inheritance-plugin    文件:InheritanceProject.java   
public BuildDiscarder getBuildDiscarder(IMode mode) {
    InheritanceGovernor<BuildDiscarder> gov =
            new InheritanceGovernor<BuildDiscarder>(
                    "logRotator", SELECTOR.MISC, this) {
        @Override
        protected BuildDiscarder castToDestinationType(
                Object o) {
            if (o instanceof BuildDiscarder) {
                return (BuildDiscarder) o;
            } else if (o instanceof LogRotator) {
                // Old-style log-rotator object; LR is a subtype of BD
                return (LogRotator) o;
            }
            return null;
        }

        @Override
        public BuildDiscarder getRawField(
                InheritanceProject ip) {
            return ip.getRawBuildDiscarder();
        }
    };

    return gov.retrieveFullyDerivedField(this, mode);
}
项目:jenkinslint-plugin    文件:JobLogRotatorChecker.java   
private boolean isLogRotatorOkConfigured (BuildDiscarder buildDiscarder) {
    if (buildDiscarder instanceof LogRotator) {

        LogRotator rotator = (LogRotator) buildDiscarder;

        return (rotator.getArtifactDaysToKeep() > EMPTY ||
                rotator.getArtifactNumToKeep() > EMPTY ||
                rotator.getDaysToKeep() > EMPTY ||
                rotator.getNumToKeep() > EMPTY);
    }
    return false;
}
项目:jenkins.py    文件:JobPW.java   
@Override
public LogRotator getLogRotator() {
    initPython();
    if (pexec.isImplemented(20)) {
        return (LogRotator) pexec.execPython("get_log_rotator");
    } else {
        return super.getLogRotator();
    }
}
项目:jenkins.py    文件:JobPW.java   
@Override
public void setLogRotator(LogRotator logRotator) throws IOException {
    initPython();
    if (pexec.isImplemented(21)) {
        pexec.execPythonVoid("set_log_rotator", logRotator);
    } else {
        super.setLogRotator(logRotator);
    }
}
项目:jenkins-inheritance-plugin    文件:InheritanceProject.java   
/**
 * {@inheritDoc}
 * 
 * @deprecated as of 1.503
 *    Use {@link #getBuildDiscarder()}.
 */
@Deprecated
@Override
public LogRotator getLogRotator() {
    BuildDiscarder d = this.getBuildDiscarder();
    if (d instanceof LogRotator) {
        return (LogRotator) d;
    }
    return null;
}
项目:jenkins-inheritance-plugin    文件:InheritanceProject.java   
/**
 * @deprecated as of 1.503
 *    Use {@link #getBuildDiscarder()}.
 * 
 * @see #getLogRotator()
 */
@Deprecated
public LogRotator getLogRotator(IMode mode) {
    BuildDiscarder d = this.getBuildDiscarder(mode);
    if (d instanceof LogRotator) {
        return (LogRotator) d;
    }
    return null;
}
项目:jenkinslint-plugin    文件:JobLogRotatorCheckerTestCase.java   
@Test public void testEmptyLogRotatorJob() throws Exception {
    FreeStyleProject project = j.createFreeStyleProject("");
    project.setBuildDiscarder(new LogRotator(null,null,null,null));
    assertTrue(checker.executeCheck(project));
}
项目:jenkinslint-plugin    文件:JobLogRotatorCheckerTestCase.java   
@Test public void testLogRotatorJob() throws Exception {
    FreeStyleProject project = j.createFreeStyleProject("");
    project.setBuildDiscarder(new LogRotator(-1,-1,-1,-1));
    assertTrue(checker.executeCheck(project));
}
项目:jenkins.py    文件:JobPW.java   
public LogRotator superGetLogRotator() {
    return super.getLogRotator();
}
项目:jenkins.py    文件:JobPW.java   
public void superSetLogRotator(LogRotator logRotator) throws IOException {
    super.setLogRotator(logRotator);
}