use of com.google.cloud.language.v1beta2.Document in project JMRI by JMRI.
the class PaneProgFrameTest method setupDoc.
// provide a test document in the above static variables
void setupDoc() {
// create a JDOM tree with just some elements
root = new Element("programmer-config");
doc = new Document(root);
doc.setDocType(new DocType("programmer-config", "programmer-config.dtd"));
// add some elements
root.addContent(new Element("programmer").setAttribute("showFnLanelPane", "yes").setAttribute("showRosterMediaPane", "yes").addContent(new Element("pane").setAttribute("name", "Basic").addContent(new Element("column").addContent(new Element("display").setAttribute("item", "Address")).addContent(new Element("display").setAttribute("item", "Start voltage")).addContent(new Element("display").setAttribute("item", "Normal direction of motion"))).addContent(new Element("column").addContent(new Element("display").setAttribute("item", "Address")).addContent(new Element("display").setAttribute("item", "Normal direction of motion")).addContent(new Element("display").setAttribute("item", "Normal direction of motion").setAttribute("format", "checkbox")).addContent(new Element("display").setAttribute("item", "Normal direction of motion").setAttribute("format", "radiobuttons")))).addContent(new Element("pane").setAttribute("name", "CV").addContent(new Element("column").addContent(new Element("cvtable")))).addContent(new Element("pane").setAttribute("name", "Other").addContent(new Element("column").addContent(new Element("display").setAttribute("item", "Address")).addContent(new Element("display").setAttribute("item", "Normal direction of motion")))));
return;
}
use of com.google.cloud.language.v1beta2.Document in project JMRI by JMRI.
the class QualifierAdderTest method testExistsProtectsEq.
public void testExistsProtectsEq() {
Element e = new Element("variable").addContent(new Element("qualifier").addContent(new Element("variableref").addContent("none")).addContent(new Element("relation").addContent("exists")).addContent(new Element("value").addContent("1"))).addContent(new Element("qualifier").addContent(new Element("variableref").addContent("none")).addContent(new Element("relation").addContent("eq")).addContent(new Element("value").addContent("3")));
// create a JDOM tree with just some elements
Element root = new Element("decoder-config");
Document doc = new Document(root);
doc.setDocType(new DocType("decoder-config", "decoder-config.dtd"));
root.addContent(// the sites information here lists all relevant
new Element("decoder").addContent(new Element("variables").addContent(e)));
// test Exists
processModifierElements(e, v2);
Assert.assertFalse(v2.getAvailable());
jmri.util.JUnitAppender.assertErrorMessage("Arithmetic EQ operation when watched value doesn't exist");
}
use of com.google.cloud.language.v1beta2.Document in project JMRI by JMRI.
the class QualifierAdderTest method testNotExistsOk0.
public void testNotExistsOk0() {
Element e = new Element("variable").addContent(new Element("qualifier").addContent(new Element("variableref").addContent("one")).addContent(new Element("relation").addContent("exists")).addContent(new Element("value").addContent("0")));
// create a JDOM tree with just some elements
Element root = new Element("decoder-config");
Document doc = new Document(root);
doc.setDocType(new DocType("decoder-config", "decoder-config.dtd"));
root.addContent(// the sites information here lists all relevant
new Element("decoder").addContent(new Element("variables").addContent(e)));
// test Exists
processModifierElements(e, v2);
Assert.assertFalse(v2.getAvailable());
}
use of com.google.cloud.language.v1beta2.Document in project JMRI by JMRI.
the class QualifierAdderTest method testNotExistsOk1.
public void testNotExistsOk1() {
Element e = new Element("variable").addContent(new Element("qualifier").addContent(new Element("variableref").addContent("none")).addContent(new Element("relation").addContent("exists")).addContent(new Element("value").addContent("1")));
// create a JDOM tree with just some elements
Element root = new Element("decoder-config");
Document doc = new Document(root);
doc.setDocType(new DocType("decoder-config", "decoder-config.dtd"));
root.addContent(// the sites information here lists all relevant
new Element("decoder").addContent(new Element("variables").addContent(e)));
// test Exists
processModifierElements(e, v2);
Assert.assertFalse(v2.getAvailable());
}
use of com.google.cloud.language.v1beta2.Document in project JMRI by JMRI.
the class QualifierCombinerTest method setUp.
// The minimal setup for log4J
@Before
public void setUp() {
apps.tests.Log4JFixture.setUp();
p = new ProgDebugger();
cvtable = new CvTableModel(new JLabel(""), p);
model = new VariableTableModel(new JLabel(""), new String[] { "Name", "Value" }, cvtable, new IndexedCvTableModel(new JLabel(""), p));
// create a JDOM tree with just some elements
Element root = new Element("decoder-config");
Document doc = new Document(root);
doc.setDocType(new DocType("decoder-config", "decoder-config.dtd"));
// add some elements
Element el1, el2, el3;
root.addContent(// the sites information here lists all relevant
new Element("decoder").addContent(new Element("variables").addContent(el1 = new Element("variable").setAttribute("CV", "1").setAttribute("item", "one").addContent(new Element("decVal").setAttribute("max", "31").setAttribute("min", "1"))).addContent(el2 = new Element("variable").setAttribute("CV", "2").setAttribute("item", "two").addContent(new Element("decVal").setAttribute("max", "31").setAttribute("min", "1"))).addContent(el3 = new Element("variable").setAttribute("CV", "3").setAttribute("item", "three").addContent(new Element("decVal").setAttribute("max", "31").setAttribute("min", "1")))));
// end of adding contents
// and test reading this
model.setRow(0, el1);
model.setRow(1, el2);
model.setRow(1, el3);
v1 = model.findVar("one");
v2 = model.findVar("two");
v3 = model.findVar("three");
}
Aggregations