use of com.thoughtworks.go.util.JsonTester in project gocd by gocd.
the class JobStatusJsonPresentationModelTest method shouldReturnNotYetAssignedIfAgentUuidIsNull.
@Test
public void shouldReturnNotYetAssignedIfAgentUuidIsNull() throws Exception {
JobInstance instance = JobInstanceMother.building("Plan1");
instance.setAgentUuid(null);
JobStatusJsonPresentationModel presenter = new JobStatusJsonPresentationModel(instance, null);
JsonTester tester = new JsonTester(presenter.toJsonHash());
tester.shouldContain(" { 'agent' : 'Not yet assigned' } ");
}
use of com.thoughtworks.go.util.JsonTester in project gocd by gocd.
the class JobStatusJsonPresentationModelTest method shouldShowElapsedAndRemainingTimeForIncompleteBuild.
@Test
public void shouldShowElapsedAndRemainingTimeForIncompleteBuild() throws Exception {
JobInstance instance = JobInstanceMother.building("test", new DateTime().minusSeconds(5).toDate());
JobStatusJsonPresentationModel presenter = new JobStatusJsonPresentationModel(instance, null, new DurationBean(instance.getId(), 10L));
Map json = presenter.toJsonHash();
new JsonTester(json).shouldContain("{ 'name' : 'test'," + " 'current_status' : 'building', " + " 'current_build_duration' : '5', " + " 'last_build_duration' : '10' " + "}");
}
use of com.thoughtworks.go.util.JsonTester in project gocd by gocd.
the class JobStatusJsonPresentationModelTest method shouldReturnAgentHostname.
@Test
public void shouldReturnAgentHostname() throws Exception {
JobInstance instance = JobInstanceMother.building("Plan1");
instance.setAgentUuid("1234");
JobStatusJsonPresentationModel presenter = new JobStatusJsonPresentationModel(instance, new AgentConfig("1234", "localhost", null));
JsonTester tester = new JsonTester(presenter.toJsonHash());
tester.shouldContain(" { 'agent' : 'localhost' } ");
}
use of com.thoughtworks.go.util.JsonTester in project gocd by gocd.
the class PipelineJsonPresentationModelTest method shouldHaveCanForceStatus.
@Test
public void shouldHaveCanForceStatus() throws Exception {
pipeline.setCanForce(true);
Map<String, Object> json = pipeline.toJson();
new JsonTester(json).shouldContain("{ 'name' : 'connectfour'," + " 'paused' : 'true'," + " 'pauseCause' : 'upgrading uat'," + " 'pauseBy' : 'jez'," + " 'stages' : []," + " 'forcedBuild' : 'true'," + " 'canForce' : 'true'" + "}");
}
use of com.thoughtworks.go.util.JsonTester in project gocd by gocd.
the class PipelineJsonPresentationModelTest method shouldHaveCanPauseStatus.
@Test
public void shouldHaveCanPauseStatus() throws Exception {
pipeline.setCanPause(true);
Map<String, Object> json = pipeline.toJson();
new JsonTester(json).shouldContain("{ 'canPause' : 'true'}");
pipeline.setCanPause(false);
json = pipeline.toJson();
new JsonTester(json).shouldContain("{ 'canPause' : 'false'}");
}
Aggregations