use of hudson.model.BuildListener in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method testArtifactsRunApi.
@Test
public void testArtifactsRunApi() throws Exception {
FreeStyleProject p = j.createFreeStyleProject("pipeline1");
p.getBuildersList().add(new TestBuilder() {
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
FilePath ws = build.getWorkspace();
if (ws == null) {
return false;
}
FilePath dir = ws.child("dir");
dir.mkdirs();
dir.child("fizz").write("contents", null);
dir.child("lodge").symlinkTo("fizz", listener);
return true;
}
});
ArtifactArchiver aa = new ArtifactArchiver("dir/fizz");
aa.setAllowEmptyArchive(true);
p.getPublishersList().add(aa);
FreeStyleBuild b = j.assertBuildStatusSuccess(p.scheduleBuild2(0));
List artifacts = get("/organizations/jenkins/pipelines/pipeline1/runs/" + b.getId() + "/artifacts", List.class);
assertEquals(1, artifacts.size());
assertEquals("fizz", ((Map) artifacts.get(0)).get("name"));
}
use of hudson.model.BuildListener in project violations-plugin by jenkinsci.
the class ViolationsReportBuilder method perform.
public ViolationsReportAsserter perform() throws Exception {
ViolationsConfig config = new ViolationsConfig();
config.setSourcePathPattern(sourcePathPattern);
TypeConfig typeConfig = new TypeConfig(typeDescriptor.getName());
typeConfig.setPattern(sourcePathPattern);
config.getTypeConfigs().put(typeDescriptor.getName(), typeConfig);
FilePath workspace = new FilePath(projectRootDir());
FilePath targetPath = new FilePath(new File(projectRootDir().getPath() + "/" + VIOLATIONS));
FilePath htmlPath = new FilePath(projectRootDir());
AbstractBuild<?, ?> build = mock(Build.class);
when(build.getRootDir()).thenReturn(projectRootDir());
BuildListener listener = mock(BuildListener.class);
ViolationsReport violationsReport = createBuildAction(workspace, targetPath, htmlPath, config, build, listener).getReport();
return assertThat(violationsReport, typeDescriptor);
}
use of hudson.model.BuildListener in project violations-plugin by jenkinsci.
the class RatchetingTest method testThatMinIsUpdatedIfMaxIsLessThenMinCanBeUpdated.
@Test
public void testThatMinIsUpdatedIfMaxIsLessThenMinCanBeUpdated() {
BuildListener listener = mock(BuildListener.class);
when(listener.getLogger()).thenReturn(out);
Collection<TypeReport> typeReports = newArrayList(type(CHECKSTYLE, 7));
ViolationsConfig config = new ViolationsConfig();
config.setAutoUpdateMax(TRUE);
config.getTypeConfigs().get(CHECKSTYLE).setMax(15);
config.getTypeConfigs().get(CHECKSTYLE).setMin(9);
handleRatcheting(SUCCESS, typeReports, listener, config);
assertEquals("Expected ratcheting to have been updated", 8, config.getTypeConfigs().get(CHECKSTYLE).getMax());
assertEquals("Expected ratcheting to have been updated", 7, config.getTypeConfigs().get(CHECKSTYLE).getMin());
}
use of hudson.model.BuildListener in project violations-plugin by jenkinsci.
the class RatchetingTest method testThatUnstableLimitCanBeUpdated.
@Test
public void testThatUnstableLimitCanBeUpdated() {
BuildListener listener = mock(BuildListener.class);
when(listener.getLogger()).thenReturn(out);
Collection<TypeReport> typeReports = newArrayList(type(CHECKSTYLE, 1));
ViolationsConfig config = new ViolationsConfig();
config.setAutoUpdateUnstable(TRUE);
config.getTypeConfigs().get(CHECKSTYLE).setUnstable(4);
handleRatcheting(SUCCESS, typeReports, listener, config);
assertEquals("Expected ratcheting to have been updated", 2, config.getTypeConfigs().get(CHECKSTYLE).getUnstable().intValue());
}
use of hudson.model.BuildListener in project violations-plugin by jenkinsci.
the class RatchetingTest method testThatMaxCanBeUpdated.
@Test
public void testThatMaxCanBeUpdated() {
BuildListener listener = mock(BuildListener.class);
when(listener.getLogger()).thenReturn(out);
Collection<TypeReport> typeReports = newArrayList(type(CHECKSTYLE, 7));
ViolationsConfig config = new ViolationsConfig();
config.setAutoUpdateMax(TRUE);
config.getTypeConfigs().get(CHECKSTYLE).setMax(15);
handleRatcheting(SUCCESS, typeReports, listener, config);
assertEquals("Expected ratcheting to have been updated", 8, config.getTypeConfigs().get(CHECKSTYLE).getMax());
}
Aggregations