use of com.thoughtworks.go.domain.JobInstance in project gocd by gocd.
the class StageSummaryModelTest method shouldRetrivePercentCompleteOnJobs.
@Test
public void shouldRetrivePercentCompleteOnJobs() throws Exception {
JobInstance first = JobInstanceMother.completed("first", JobResult.Failed);
Stage stage = StageMother.custom("pipeline", "stage", new JobInstances(first));
StageSummaryModel model = new StageSummaryModel(stage, new Stages(stage), new JobDurationStrategy.ConstantJobDuration(1000 * 1000), null);
assertThat(model.nonPassedJobs().get(0).getElapsedTime(), is(new Duration(120 * 1000)));
assertThat(model.nonPassedJobs().get(0).getPercentComplete(), is(12));
}
use of com.thoughtworks.go.domain.JobInstance in project gocd by gocd.
the class JobResourceImporterTest method testArtifactsAreImported.
@Test
public void testArtifactsAreImported() throws Exception {
Clock.fakeNowUTC(2008, 1, 20, 0, 0, 1);
JobInstance failedJob = JobInstanceMother.failed("test");
Document document = docFor(happyJobResourceXML);
document.selectSingleNode("//link[@rel='self']/@href").setText(new JobXmlViewModel(failedJob).httpUrl(baseUri));
when(xmlApiService.write(any(JobXmlViewModel.class), eq(baseUri))).thenReturn(document);
JobResourceImporter rdfImporter = new JobResourceImporter("src/test-shared/resources/cruise/artifacts", new InMemoryTempGraphFactory(), transformerRegistry, xmlApiService, systemEnvironment);
Graph graph = rdfImporter.importJob(failedJob, baseUri);
String testCountSelect = "PREFIX xunit: <" + XUnitOntology.URI + "> SELECT ?testcase WHERE { ?testCase a xunit:TestCase }";
assertEquals(5, graph.select(testCountSelect).size());
}
Aggregations