use of com.thoughtworks.go.domain.Properties in project gocd by gocd.
the class PropertiesService method listPropertiesForJob.
public RestfulAction listPropertiesForJob(JobIdentifier jobIdentifier, String type, String propertyKey) {
Properties properties;
Long buildId = jobIdentifier.getBuildId();
if (propertyKey != null) {
String value = propertyDao.value(buildId, propertyKey);
if (value == null) {
return PropertyAction.propertyNotFound(propertyKey);
}
properties = new Properties(new Property(propertyKey, value));
} else {
properties = propertyDao.list(jobIdentifier.getBuildId());
}
return listPropertiesAs(type, properties, jobIdentifier.getBuildName());
}
use of com.thoughtworks.go.domain.Properties in project gocd by gocd.
the class PropertySqlMapDao method addToHistory.
private static void addToHistory(LinkedHashMap<String, Properties> propHistory, Map<String, Object> flatMap) {
String id = String.valueOf(flatMap.get("pipelineid"));
String key = (String) flatMap.get("key");
String value = (String) flatMap.get("value");
if (!propHistory.containsKey(id)) {
propHistory.put(id, new Properties());
}
propHistory.get(id).add(new Property(key, value));
}
use of com.thoughtworks.go.domain.Properties in project gocd by gocd.
the class PropertyDaoTest method shouldLoadPropertiesHistoryLimitToSpecifiedCount.
@Test
public void shouldLoadPropertiesHistoryLimitToSpecifiedCount() throws Exception {
Pipeline oldPipeline = createPipelineWithJobProperty(PIPELINE1, property("key1", "value1"));
Pipeline newPipeline = createPipelineWithJobProperty(PIPELINE1, property("key2", "value2"));
List<Properties> history = propertyDao.loadHistory(PIPELINE1, STAGE1, PLAN1, newPipeline.getId(), 1);
assertThat(history.size(), is(1));
assertThat(history.get(0).toString(), history.get(0).getValue("key2"), is("value2"));
history = propertyDao.loadHistory(PIPELINE1, STAGE1, PLAN1, newPipeline.getId(), Integer.MAX_VALUE);
assertThat(history.size(), is(2));
assertThat(history.get(0).toString(), history.get(0).getValue("key1"), is("value1"));
assertThat(history.get(1).toString(), history.get(1).getValue("key2"), is("value2"));
}
Aggregations