use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.
the class ManualBuildTest method setUp.
@Before
public void setUp() {
manualBuild = new ManualBuild(new Username(new CaseInsensitiveString("cruise-user")));
SvnMaterial material = new SvnMaterial("http://foo.bar/baz", "user", "pass", false);
materialRevisions = new MaterialRevisions(new MaterialRevision(material, new Modification(new Date(), "1234", "MOCK_LABEL-12", null)));
}
use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.
the class MaterialRevisionsJsonBuilderTest method shouldNotProcessPackageMaterialComment.
@Test
public void shouldNotProcessPackageMaterialComment() throws Exception {
HashMap<String, String> map = new HashMap<>();
map.put("TYPE", "PACKAGE_MATERIAL");
map.put("TRACKBACK_URL", "google.com");
map.put("COMMENT", "comment");
String packageMaterialComment = JsonHelper.toJsonString(map);
Modification modification = new Modification("user", packageMaterialComment, "some@com", new Date(), "1234");
materialRevisions = new MaterialRevisions(new MaterialRevision(MaterialsMother.packageMaterial(), modification));
JSONArray jsonArray = buildJson();
JSONObject modificationJson = (JSONObject) ((JSONArray) ((JSONObject) jsonArray.get(0)).get("modifications")).get(0);
assertThat(modificationJson.get("comment").render(false), is(JsonHelper.toJsonString(packageMaterialComment)));
}
use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.
the class EnvironmentTest method shouldBeAbleToTellIfThereAreAnyPiplinesThatHaveNewMaterialRevisions.
@Test
public void shouldBeAbleToTellIfThereAreAnyPiplinesThatHaveNewMaterialRevisions() {
MaterialRevisions latest = new MaterialRevisions();
latest.addRevision(MaterialsMother.hgMaterial(), ModificationsMother.aCheckIn("21"));
assertThat(new Environment("blah", Arrays.asList(pipeline(), pipelineWithLatestRevision(latest))).hasNewRevisions(), is(true));
assertThat(new Environment("blah", Arrays.asList(pipeline(), pipelineWithLatestRevisionAndMaterialRevision(latest, latest))).hasNewRevisions(), is(false));
}
use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.
the class PipelineInstanceModelTest method shouldFallbackToPipelineFingerpringWhenGettingCurrentMaterialRevisionForMaterialIsNull.
@Test
public void shouldFallbackToPipelineFingerpringWhenGettingCurrentMaterialRevisionForMaterialIsNull() {
MaterialRevisions revisions = new MaterialRevisions();
HgMaterial material = MaterialsMother.hgMaterial();
HgMaterial materialWithDifferentDest = MaterialsMother.hgMaterial();
materialWithDifferentDest.setFolder("otherFolder");
revisions.addRevision(material, HG_MATERIAL_MODIFICATION);
PipelineInstanceModel model = PipelineInstanceModel.createPipeline("pipeline", -1, "label", BuildCause.createWithModifications(revisions, ""), new StageInstanceModels());
assertThat(model.findCurrentMaterialRevisionForUI(materialWithDifferentDest.config()), is(revisions.getMaterialRevision(0)));
}
use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.
the class PipelineInstanceModelTest method shouldKnowApproverAsApproverForTheFirstStage.
@Test
public void shouldKnowApproverAsApproverForTheFirstStage() {
MaterialRevisions revisions = new MaterialRevisions();
StageInstanceModels models = new StageInstanceModels();
StageInstanceModel firstStage = new StageInstanceModel("dev", "1", new JobHistory());
firstStage.setApprovedBy("some_user");
models.add(firstStage);
PipelineInstanceModel model = PipelineInstanceModel.createPipeline("pipeline", -1, "label", BuildCause.createWithModifications(revisions, ""), models);
assertThat(model.getApprovedBy(), is("some_user"));
assertThat(model.getApprovedByForDisplay(), is("Triggered by some_user"));
}
Aggregations