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); }
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; }
@Override public LogRotator getLogRotator() { initPython(); if (pexec.isImplemented(20)) { return (LogRotator) pexec.execPython("get_log_rotator"); } else { return super.getLogRotator(); } }
@Override public void setLogRotator(LogRotator logRotator) throws IOException { initPython(); if (pexec.isImplemented(21)) { pexec.execPythonVoid("set_log_rotator", logRotator); } else { super.setLogRotator(logRotator); } }
/** * {@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; }
/** * @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; }
@Test public void testEmptyLogRotatorJob() throws Exception { FreeStyleProject project = j.createFreeStyleProject(""); project.setBuildDiscarder(new LogRotator(null,null,null,null)); assertTrue(checker.executeCheck(project)); }
@Test public void testLogRotatorJob() throws Exception { FreeStyleProject project = j.createFreeStyleProject(""); project.setBuildDiscarder(new LogRotator(-1,-1,-1,-1)); assertTrue(checker.executeCheck(project)); }
public LogRotator superGetLogRotator() { return super.getLogRotator(); }
public void superSetLogRotator(LogRotator logRotator) throws IOException { super.setLogRotator(logRotator); }