use of com.thoughtworks.go.config.TrackingTool in project gocd by gocd.
the class TrackingToolTest method shouldValidateLinkProtocol.
@Test
public void shouldValidateLinkProtocol() {
TrackingTool tool = new TrackingTool("file:///home/user/${ID}", "");
tool.validate(null);
assertThat(tool.errors().on(TrackingTool.LINK), is("Link must be a URL starting with https:// or http://"));
tool = new TrackingTool("javascript:alert(${ID})", "");
tool.validate(null);
assertThat(tool.errors().on(TrackingTool.LINK), is("Link must be a URL starting with https:// or http://"));
}
use of com.thoughtworks.go.config.TrackingTool in project gocd by gocd.
the class MaterialRevisionsJsonBuilderTest method setUp.
@Before
public void setUp() {
svnMaterial = MaterialsMother.svnMaterial("http://url", "svn-folder");
materialRevisions = new MaterialRevisions();
materialRevisions.addRevision(svnMaterial, ModificationsMother.multipleModificationList());
builder = new MaterialRevisionsJsonBuilder(new TrackingTool());
}
use of com.thoughtworks.go.config.TrackingTool in project gocd by gocd.
the class MaterialRevisionsJsonBuilderTest method shouldRenderDependencyMaterialRevision.
@Test
public void shouldRenderDependencyMaterialRevision() {
String revision = "cruise/10/dev/1";
MaterialRevisions revisions = new MaterialRevisions(new MaterialRevision(new DependencyMaterial(new CaseInsensitiveString("cruise"), new CaseInsensitiveString("dev")), new Modification(new Date(), revision, "MOCK_LABEL-12", null)));
MaterialRevisionsJsonBuilder jsonBuilder = new MaterialRevisionsJsonBuilder(new TrackingTool());
revisions.accept(jsonBuilder);
JsonValue revisionsJson = JsonUtils.from(jsonBuilder.json());
assertThat(revisionsJson.getString(0, "revision_href"), is("pipelines/" + revision));
}
use of com.thoughtworks.go.config.TrackingTool in project gocd by gocd.
the class CachedCurrentActivityService method stageModel.
private StageJsonPresentationModel stageModel(Pipeline currentPipeline, Stage stage) {
StageIdentifier lastSuccessfulPipelineForStage = pipelineService.findLastSuccessfulStageIdentifier(currentPipeline.getName(), stage.getName());
final DurationBeans durations = stageService.getBuildDurations(currentPipeline.getName(), stage);
TrackingTool trackingTool = goConfigService.pipelineConfigNamed(new CaseInsensitiveString(currentPipeline.getName())).trackingTool();
return new StageJsonPresentationModel(currentPipeline, stage, lastSuccessfulPipelineForStage, agentService, durations, trackingTool);
}
use of com.thoughtworks.go.config.TrackingTool in project gocd by gocd.
the class ViewCacheKey method forPipelineModelBuildCauses.
public String forPipelineModelBuildCauses(PipelineModel model) {
StringBuilder s = new StringBuilder();
s.append("view_buildCausesForPipelineModel_");
s.append(model.getName());
for (PipelineInstanceModel pim : model.getActivePipelineInstances()) {
TrackingTool trackingTool = pim.getTrackingTool();
MingleConfig mingleConfig = pim.getMingleConfig();
int trackingToolHash = trackingTool == null ? -1 : trackingTool.hashCode();
int mingleToolHash = mingleConfig == null ? -1 : mingleConfig.hashCode();
s.append("[").append(pim.getId()).append("|").append(trackingToolHash).append("|").append(mingleToolHash).append("]");
}
return s.toString();
}
Aggregations