use of org.jdom2.Element in project gocd by gocd.
the class MagicalGoConfigXmlLoader method deserializeConfig.
public CruiseConfig deserializeConfig(String content) throws Exception {
String md5 = CachedDigestUtils.md5Hex(content);
Element element = parseInputStream(new ByteArrayInputStream(content.getBytes()));
LOGGER.debug("[Config Save] Updating config cache with new XML");
CruiseConfig configForEdit = classParser(element, BasicCruiseConfig.class, configCache, new GoCipher(), registry, new ConfigReferenceElements()).parse();
setMd5(configForEdit, md5);
configForEdit.setOrigins(new FileConfigOrigin());
return configForEdit;
}
use of org.jdom2.Element in project gocd by gocd.
the class ProjectStatus method ccTrayXmlElement.
public Element ccTrayXmlElement(String fullContextPath) {
Element element = new Element("Project");
element.setAttribute("name", name);
element.setAttribute("activity", activity);
element.setAttribute("lastBuildStatus", lastBuildStatus);
element.setAttribute("lastBuildLabel", lastBuildLabel);
element.setAttribute("lastBuildTime", DateUtils.formatIso8601ForCCTray(lastBuildTime));
element.setAttribute("webUrl", fullContextPath + "/" + webUrl);
if (!breakers.isEmpty()) {
addBreakers(element);
}
return element;
}
use of org.jdom2.Element in project gocd by gocd.
the class GoConfigFieldTest method shouldValidateAndConvertOnlyIfAppropriate.
@Test(expected = RuntimeException.class)
public void shouldValidateAndConvertOnlyIfAppropriate() throws NoSuchFieldException {
final Foo object = new Foo();
final GoConfigFieldWriter field = new GoConfigFieldWriter(Foo.class.getDeclaredField("number"), object, configCache, null);
final Element element = new Element("foo");
element.setAttribute("number", "anything");
field.setValueIfNotNull(element, object);
}
use of org.jdom2.Element in project gocd by gocd.
the class GoConfigFieldTest method shouldConvertFromXmlToJavaObjectCorrectly.
@Test
public void shouldConvertFromXmlToJavaObjectCorrectly() throws Exception {
final Foo object = new Foo();
final GoConfigFieldWriter field = new GoConfigFieldWriter(Foo.class.getDeclaredField("number"), object, configCache, null);
final Element element = new Element("foo");
element.setAttribute("number", "100");
field.setValueIfNotNull(element, object);
assertThat(object.number, is(100L));
}
use of org.jdom2.Element in project gocd by gocd.
the class StageCctrayPresentationModel method createProjectElement.
private void createProjectElement(Element parent, String name, String activity, String lastBuildStatus, String lastBuildLabel, String lastBuildTime, String webUrl) {
Element project = new Element("Project");
project.setAttribute("name", name);
project.setAttribute("activity", activity);
project.setAttribute("lastBuildStatus", lastBuildStatus);
project.setAttribute("lastBuildLabel", lastBuildLabel);
project.setAttribute("lastBuildTime", lastBuildTime);
project.setAttribute("webUrl", webUrl);
parent.addContent(project);
}
Aggregations