use of com.thoughtworks.go.domain.JobInstanceLog in project gocd by gocd.
the class JobInstanceLogTest method shouldFindIndexPageFromTestOutputGivenNunitTestOutput.
@Test
public void shouldFindIndexPageFromTestOutputGivenNunitTestOutput() throws Exception {
final File testOutput = new File(rootFolder, TestArtifactPlan.TEST_OUTPUT_FOLDER);
testOutput.mkdirs();
IOUtils.write("Test", new FileOutputStream(new File(testOutput, "index.html")));
HashMap map = new HashMap();
map.put("artifactfolder", rootFolder);
jobInstanceLog = new JobInstanceLog(null, map);
assertThat(jobInstanceLog.getTestIndexPage().getName(), is("index.html"));
FileUtil.deleteFolder(rootFolder);
}
use of com.thoughtworks.go.domain.JobInstanceLog in project gocd by gocd.
the class JobInstanceLogTest method shouldFindIndexPageFromTestOutputRecursivelyWithMultipleFolders.
@Test
public void shouldFindIndexPageFromTestOutputRecursivelyWithMultipleFolders() throws Exception {
final File logFolder = new File(rootFolder, "logs");
final File testOutput = new File(rootFolder, TestArtifactPlan.TEST_OUTPUT_FOLDER);
final File junitReportFolder = new File(testOutput, "junitreport");
junitReportFolder.mkdirs();
logFolder.mkdirs();
FileOutputStream fileOutputStream = new FileOutputStream(new File(junitReportFolder, "index.html"));
IOUtils.write("Test", fileOutputStream);
IOUtils.closeQuietly(fileOutputStream);
HashMap map = new HashMap();
map.put("artifactfolder", rootFolder);
jobInstanceLog = new JobInstanceLog(null, map);
assertThat(jobInstanceLog.getTestIndexPage().getName(), is("index.html"));
}
use of com.thoughtworks.go.domain.JobInstanceLog in project gocd by gocd.
the class JobInstanceLogTest method canGetNumberOfTestErrors.
@Test
public void canGetNumberOfTestErrors() {
BuildTestSuite suiteWithTwoErrors = new BuildTestSuite("", 0.0f);
suiteWithTwoErrors.addTestCase(new BuildTestCase(null, null, null, null, null, BuildTestCaseResult.ERROR));
suiteWithTwoErrors.addTestCase(new BuildTestCase(null, null, null, null, null, BuildTestCaseResult.ERROR));
BuildTestSuite suiteWithThreeErrors = new BuildTestSuite("", 0.0f);
suiteWithThreeErrors.addTestCase(new BuildTestCase(null, null, null, null, null, BuildTestCaseResult.ERROR));
suiteWithThreeErrors.addTestCase(new BuildTestCase(null, null, null, null, null, BuildTestCaseResult.ERROR));
suiteWithThreeErrors.addTestCase(new BuildTestCase(null, null, null, null, null, BuildTestCaseResult.ERROR));
List fiveErrors = new ArrayList();
fiveErrors.add(suiteWithTwoErrors);
fiveErrors.add(suiteWithThreeErrors);
Map props = new HashMap();
props.put("testsuites", fiveErrors);
JobInstanceLog laterJob = new JobInstanceLog(defaultLogFile, props);
assertEquals(5, laterJob.getNumberOfErrors());
}
use of com.thoughtworks.go.domain.JobInstanceLog in project gocd by gocd.
the class JobDetailService method loadBuildInstanceLog.
public void loadBuildInstanceLog(JobInstance instance) throws Exception {
if (instance.isCompleted()) {
LogFile logFile = artifactsService.getInstanceLogFile(instance.getIdentifier());
Map properties = artifactsService.parseLogFile(logFile, instance.isPassed());
properties.put("artifactfolder", artifactsService.findArtifact(instance.getIdentifier(), ""));
instance.setInstanceLog(new JobInstanceLog(logFile, properties));
}
}
use of com.thoughtworks.go.domain.JobInstanceLog in project gocd by gocd.
the class JobInstanceLogTest method shouldFindIndexPageFromTestOutputRecursively.
@Test
public void shouldFindIndexPageFromTestOutputRecursively() throws Exception {
final File testOutput = new File(rootFolder, "testoutput");
final File junitReportFolder = new File(testOutput, "junitreport");
junitReportFolder.mkdirs();
FileOutputStream fileOutputStream = new FileOutputStream(new File(junitReportFolder, "index.html"));
IOUtils.write("Test", fileOutputStream);
IOUtils.closeQuietly(fileOutputStream);
HashMap map = new HashMap();
map.put("artifactfolder", rootFolder);
jobInstanceLog = new JobInstanceLog(null, map);
assertThat(jobInstanceLog.getTestIndexPage().getName(), is("index.html"));
}
Aggregations