use of org.neo4j.ogm.domain.gh806.Element in project JMRI by JMRI.
the class SampleFactory method main.
// Main entry point for standalone run
public static void main(String[] args) {
// dump a document to stdout
Element root = getBasicSample();
Document doc = new Document(root);
try {
org.jdom2.output.XMLOutputter fmt = new org.jdom2.output.XMLOutputter();
fmt.setFormat(org.jdom2.output.Format.getPrettyFormat());
fmt.output(doc, System.out);
} catch (Exception e) {
System.err.println("Exception writing file: " + e);
}
}
use of org.neo4j.ogm.domain.gh806.Element in project JMRI by JMRI.
the class AbstractNamedBeanManagerConfigXMLTest method testStoreNullProperty.
public void testStoreNullProperty() {
// Create the manager to test
AbstractNamedBeanManagerConfigXML x = new NamedBeanManagerConfigXMLTest();
// create a NamedBean with two properties to store
NamedBean from = new AbstractNamedBean("sys", "usr") {
@Override
public int getState() {
return 0;
}
@Override
public void setState(int i) {
}
@Override
public String getBeanType() {
return "";
}
};
from.setProperty("foo", null);
from.setProperty("biff", Boolean.valueOf(true));
// create element for properties
Element p = new Element("test");
x.storeProperties(from, p);
// create NamedBean to load
NamedBean to = new AbstractNamedBean("sys", "usr") {
@Override
public int getState() {
return 0;
}
@Override
public void setState(int i) {
}
@Override
public String getBeanType() {
return "";
}
};
x.loadProperties(to, p);
// and test
Assert.assertEquals(null, to.getProperty("foo"));
Assert.assertEquals(Boolean.valueOf(true), to.getProperty("biff"));
}
use of org.neo4j.ogm.domain.gh806.Element in project JMRI by JMRI.
the class LocaleSelectorTest method testFindPartialCode.
public void testFindPartialCode() {
LocaleSelector.suffixes = new String[] { "kl_KL", "kl" };
Namespace xml = Namespace.XML_NAMESPACE;
Element el = new Element("foo").setAttribute("temp", "a").addContent(new Element("temp").setAttribute("lang", "aa_BB", xml).addContent("b")).addContent(new Element("temp").setAttribute("lang", "kl", xml).addContent("c")).addContent(new Element("temp").setAttribute("lang", "kl_AA", xml).addContent("d"));
String result = LocaleSelector.getAttribute(el, "temp");
Assert.assertEquals("find default", "c", result);
}
use of org.neo4j.ogm.domain.gh806.Element in project JMRI by JMRI.
the class LocaleSelectorTest method testFindFullCode.
public void testFindFullCode() {
LocaleSelector.suffixes = new String[] { "kl_KL", "kl" };
Namespace xml = Namespace.XML_NAMESPACE;
Element el = new Element("foo").setAttribute("temp", "a").addContent(new Element("temp").setAttribute("lang", "aa_BB", xml).addContent("b")).addContent(new Element("temp").setAttribute("lang", "kl", xml).addContent("b")).addContent(new Element("temp").setAttribute("lang", "kl_KL", xml).addContent("c"));
String result = LocaleSelector.getAttribute(el, "temp");
Assert.assertEquals("find default", "c", result);
}
use of org.neo4j.ogm.domain.gh806.Element in project JMRI by JMRI.
the class SE8cSignalHeadXml method addTurnoutElement.
Element addTurnoutElement(NamedBeanHandle<Turnout> to, String which) {
Element el = new Element("turnoutname");
el.setAttribute("defines", which);
el.addContent(to.getName());
return el;
}
Aggregations