Search in sources :

Example 26 with Element

use of org.omegat.filters3.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);
}
Also used : Element(org.jdom2.Element) Test(org.junit.Test)

Example 27 with Element

use of org.omegat.filters3.Element in project gocd by gocd.

the class DirectoryEntriesTest method shouldReturnAMessageWhenAllArtifactsHaveBeenDeletedButArtifactsDeletedFlagHasNotBeenSet.

@Test
public void shouldReturnAMessageWhenAllArtifactsHaveBeenDeletedButArtifactsDeletedFlagHasNotBeenSet() throws Exception {
    HtmlRenderer renderer = new HtmlRenderer("context");
    DirectoryEntries directoryEntries = new DirectoryEntries();
    directoryEntries.render(renderer);
    Element document = getRenderedDocument(renderer);
    assertThat(document.getChildren().size(), is(1));
    assertThat(document.getChild("p").getTextNormalize(), Matchers.containsString("Artifacts for this job instance are unavailable as they may have been or deleted externally. Re-run the stage or job to generate them again."));
}
Also used : Element(org.jdom2.Element) HtmlRenderer(com.thoughtworks.go.server.presentation.models.HtmlRenderer) Test(org.junit.Test)

Example 28 with Element

use of org.omegat.filters3.Element in project gocd by gocd.

the class DirectoryEntriesTest method shouldReturnAMessageWhenThereAreNoArtifacts.

@Test
public void shouldReturnAMessageWhenThereAreNoArtifacts() throws Exception {
    HtmlRenderer renderer = new HtmlRenderer("context");
    DirectoryEntries directoryEntries = new DirectoryEntries();
    directoryEntries.add(new FolderDirectoryEntry("cruise-output", "", new DirectoryEntries()));
    directoryEntries.setIsArtifactsDeleted(true);
    directoryEntries.render(renderer);
    Element document = getRenderedDocument(renderer);
    assertThat(document.getChildren().size(), is(2));
    assertThat(document.getChild("p").getTextNormalize(), Matchers.containsString("Artifacts for this job instance are unavailable as they may have been or deleted externally. Re-run the stage or job to generate them again."));
    assertThat(document.getChild("ul").getChild("div").getChild("span").getChild("a").getTextNormalize(), is("cruise-output"));
}
Also used : Element(org.jdom2.Element) HtmlRenderer(com.thoughtworks.go.server.presentation.models.HtmlRenderer) Test(org.junit.Test)

Example 29 with Element

use of org.omegat.filters3.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);
}
Also used : Element(org.jdom2.Element)

Example 30 with Element

use of org.omegat.filters3.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;
}
Also used : Element(org.jdom2.Element)

Aggregations

Element (org.jdom2.Element)1444 Document (org.jdom2.Document)242 Test (org.junit.Test)157 ArrayList (java.util.ArrayList)111 Attribute (org.jdom2.Attribute)106 IOException (java.io.IOException)76 File (java.io.File)71 JDOMException (org.jdom2.JDOMException)65 XMLOutputter (org.jdom2.output.XMLOutputter)54 List (java.util.List)51 SAXBuilder (org.jdom2.input.SAXBuilder)51 HashMap (java.util.HashMap)49 Test (org.junit.jupiter.api.Test)34 Map (java.util.Map)33 Node (gov.cms.qpp.conversion.model.Node)29 MCRException (org.mycore.common.MCRException)28 MCRJDOMContent (org.mycore.common.content.MCRJDOMContent)28 NamedIcon (jmri.jmrit.catalog.NamedIcon)27 Namespace (org.jdom2.Namespace)25 XmlFile (jmri.jmrit.XmlFile)24