Search in sources :

Example 6 with Element

use of com.zhan_dui.utils.m3u8.Element in project gocd by gocd.

the class BuildLogElement method setBuildLogHeader.

public Element setBuildLogHeader(String execCommand) {
    Element target = new Element("target");
    target.setAttribute("name", "exec");
    build.addContent(target);
    buildTask = new Element("task");
    buildTask.setAttribute("name", execCommand);
    target.addContent(buildTask);
    return buildTask;
}
Also used : Element(org.jdom2.Element)

Example 7 with Element

use of com.zhan_dui.utils.m3u8.Element in project gocd by gocd.

the class StageCctrayPresentationModelTest method shouldContainBuilds.

private void shouldContainBuilds(Element root) {
    Element buildProject = findChildByName(root, "cruise :: ft :: firefox");
    assertThat(buildProject, hasAttribute("activity", "Sleeping"));
    assertThat(buildProject, hasAttribute("lastBuildStatus", "Success"));
    assertThat(buildProject, hasAttribute("lastBuildLabel", String.valueOf(LABEL)));
    assertThat(buildProject, hasAttribute("lastBuildTime", DATE_STR));
    assertThat(buildProject, hasAttribute("webUrl", buildDetailUrl()));
}
Also used : Element(org.jdom2.Element)

Example 8 with Element

use of com.zhan_dui.utils.m3u8.Element in project gocd by gocd.

the class StageCctrayPresentationModelTest method shouldGetGoodCctrayXml.

@Test
public void shouldGetGoodCctrayXml() throws Exception {
    Element root = new Element("Projects");
    cctrayXmlPresenter.toCctrayXml(root, CONTEXT_PATH);
    assertThat(root.getChildren().size(), is(2));
    shouldContainStage(root);
    shouldContainBuilds(root);
}
Also used : Element(org.jdom2.Element) Test(org.junit.Test)

Example 9 with Element

use of com.zhan_dui.utils.m3u8.Element in project gocd by gocd.

the class GoConfigMigration method getCurrentSchemaVersion.

private int getCurrentSchemaVersion(String content) {
    try {
        SAXBuilder builder = new SAXBuilder();
        Document document = builder.build(new ByteArrayInputStream(content.getBytes()));
        Element root = document.getRootElement();
        String currentVersion = root.getAttributeValue(schemaVersion) == null ? "0" : root.getAttributeValue(schemaVersion);
        return Integer.parseInt(currentVersion);
    } catch (Exception e) {
        throw bomb(e);
    }
}
Also used : SAXBuilder(org.jdom2.input.SAXBuilder) Element(org.jdom2.Element) Document(org.jdom2.Document) XmlUtils.buildXmlDocument(com.thoughtworks.go.util.XmlUtils.buildXmlDocument) TransformerException(javax.xml.transform.TransformerException) TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException)

Example 10 with Element

use of com.zhan_dui.utils.m3u8.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;
}
Also used : GoCipher(com.thoughtworks.go.security.GoCipher) ByteArrayInputStream(java.io.ByteArrayInputStream) FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) Element(org.jdom2.Element) ConfigReferenceElements(com.thoughtworks.go.config.parser.ConfigReferenceElements)

Aggregations

Element (org.jdom2.Element)673 Attribute (org.jdom2.Attribute)73 Document (org.jdom2.Document)58 File (java.io.File)49 ArrayList (java.util.ArrayList)36 NamedIcon (jmri.jmrit.catalog.NamedIcon)27 IOException (java.io.IOException)26 JDOMException (org.jdom2.JDOMException)26 XmlFile (jmri.jmrit.XmlFile)24 Test (org.junit.Test)24 Turnout (jmri.Turnout)20 DataConversionException (org.jdom2.DataConversionException)20 DocType (org.jdom2.DocType)19 Editor (jmri.jmrit.display.Editor)18 Point (java.awt.Point)15 HashMap (java.util.HashMap)15 Dimension (java.awt.Dimension)14 FileNotFoundException (java.io.FileNotFoundException)13 SignalHead (jmri.SignalHead)13 List (java.util.List)12