use of com.thoughtworks.go.domain.Properties in project gocd by gocd.
the class JobController method presenter.
private JobDetailPresentationModel presenter(JobInstance current) {
String pipelineName = current.getIdentifier().getPipelineName();
String stageName = current.getIdentifier().getStageName();
JobInstances recent25 = jobInstanceService.latestCompletedJobs(pipelineName, stageName, current.getName());
AgentConfig agentConfig = goConfigService.agentByUuid(current.getAgentUuid());
Pipeline pipelineWithOneBuild = pipelineService.wrapBuildDetails(current);
Tabs customizedTabs = goConfigService.getCustomizedTabs(pipelineWithOneBuild.getName(), pipelineWithOneBuild.getFirstStage().getName(), current.getName());
TrackingTool trackingTool = goConfigService.pipelineConfigNamed(new CaseInsensitiveString(pipelineWithOneBuild.getName())).trackingTool();
Properties properties = propertiesService.getPropertiesForJob(current.getId());
Stage stage = stageService.getStageByBuild(current);
return new JobDetailPresentationModel(current, recent25, agentConfig, pipelineWithOneBuild, customizedTabs, trackingTool, artifactService, properties, stage);
}
use of com.thoughtworks.go.domain.Properties in project gocd by gocd.
the class PropertiesController method jobsSearch.
@RequestMapping("/repository/restful/properties/jobs/search")
public ModelAndView jobsSearch(@RequestParam("pipelineName") String pipelineName, @RequestParam("stageName") String stageName, @RequestParam("jobName") String jobName, @RequestParam(value = "limitPipeline", required = false) String limitPipeline, @RequestParam(value = "limitCount", required = false) Integer limitCount, HttpServletResponse response) throws Exception {
Long limitPipelineId = null;
if (limitPipeline != null) {
Pipeline pipeline = pipelineService.findPipelineByCounterOrLabel(pipelineName, limitPipeline);
if (pipeline != null) {
limitPipelineId = pipeline.getId();
} else {
return notFound(String.format("The value [%s] of query parameter 'limitPipeline' is neither a pipeline counter nor label", limitPipeline)).respond(response);
}
}
limitCount = limitCount == null ? 100 : limitCount;
try {
List<Properties> result = propertyService.loadHistory(pipelineName, stageName, jobName, limitPipelineId, limitCount);
PropertiesService.PropertyLister propertyLister = PropertiesService.asCsv(jobName);
return propertyLister.listPropertiesHistory(result).respond(response);
} catch (Exception e) {
String message = String.format("Error on listing properties history for job %s/%s/%s with limitPipeline=%s and limitCount=%s", pipelineName, stageName, jobName, limitPipeline, limitCount);
LOGGER.error(message, e);
return notFound(message + "\n" + e.getMessage()).respond(response);
}
}
use of com.thoughtworks.go.domain.Properties in project gocd by gocd.
the class PropertyDaoTest method shouldLoadAllPropertiesHistoryIfLimitPipelineNotSpecified.
@Test
public void shouldLoadAllPropertiesHistoryIfLimitPipelineNotSpecified() throws Exception {
Pipeline oldPipeline = createPipelineWithJobProperty(PIPELINE1, property("key1", "value1"));
Pipeline newPipeline = createPipelineWithJobProperty(PIPELINE1, property("key2", "value2"));
List<Properties> history = propertyDao.loadHistory(PIPELINE1, STAGE1, PLAN1, null, Integer.MAX_VALUE);
assertThat(history.size(), is(2));
}
use of com.thoughtworks.go.domain.Properties in project gocd by gocd.
the class PropertyDaoTest method shouldReturnListOfAllProperties.
@Test
public void shouldReturnListOfAllProperties() throws Exception {
Property propertyB = property("a/2", "d");
Property propertyA = property("a/1", "b");
propertyDao.save(buildId, propertyB);
propertyDao.save(buildId, propertyA);
Properties properties = propertyDao.list(buildId);
assertThat(properties.size(), is(2));
assertThat(properties.get(0), is(propertyA));
assertThat(properties.get(1), is(propertyB));
}
use of com.thoughtworks.go.domain.Properties in project gocd by gocd.
the class PropertiesServiceTest method shouldReturnEmptyListIfLimitCountIsNotPositive.
@Test
public void shouldReturnEmptyListIfLimitCountIsNotPositive() {
Pipeline pipeline1 = createNewPipeline();
Pipeline pipeline2 = createNewPipeline();
List<Properties> propertiesList = propertiesService.loadHistory(fixture.pipelineName, fixture.devStage, PipelineWithTwoStages.JOB_FOR_DEV_STAGE, pipeline2.getId(), -1);
assertThat(propertiesList.size(), is(0));
propertiesList = propertiesService.loadHistory(fixture.pipelineName, fixture.devStage, PipelineWithTwoStages.JOB_FOR_DEV_STAGE, pipeline2.getId(), 0);
assertThat(propertiesList.size(), is(0));
}
Aggregations