use of jmri.jmrix.loconet.LocoNetSystemConnectionMemo in project JMRI by JMRI.
the class LocoNetMenuTest method testCTor.
@Test
public void testCTor() {
LnTrafficController lnis = new LocoNetInterfaceScaffold();
SlotManager slotmanager = new SlotManager(lnis);
LocoNetSystemConnectionMemo memo = new LocoNetSystemConnectionMemo(lnis, slotmanager);
LocoNetMenu t = new LocoNetMenu(memo);
Assert.assertNotNull("exists", t);
}
use of jmri.jmrix.loconet.LocoNetSystemConnectionMemo in project JMRI by JMRI.
the class PanelProFrame method makeNavTreeTopNode.
/**
* Make a PanelPro tree, and add the LocoNet stuff, because we assume those
* systems active here
*/
@Override
protected TreeNode makeNavTreeTopNode(String treeFile, PanedInterface rightTopWI) {
// no context
DefaultMutableTreeNode top = JTreeUtil.loadTree(treeFile, rightTopWI, null);
// as a test, we manually create a loconet tree
System.err.print("Manually attempting to create two LocoNet trees for testing purposes");
LocoNetSystemConnectionMemo lm1 = jmri.InstanceManager.getList(LocoNetSystemConnectionMemo.class).get(0);
if (lm1 != null) {
DefaultMutableTreeNode l1 = JTreeUtil.loadTree("xml/config/parts/jmri/jmrix/loconet/ToolsTree.xml", rightTopWI, lm1);
l1.setUserObject("LocoNet");
top.add(l1);
}
LocoNetSystemConnectionMemo lm2 = jmri.InstanceManager.getList(LocoNetSystemConnectionMemo.class).get(1);
if (lm2 != null) {
DefaultMutableTreeNode l2 = JTreeUtil.loadTree("xml/config/parts/jmri/jmrix/loconet/ToolsTree.xml", rightTopWI, lm2);
l2.setUserObject("LocoNet2");
top.add(l2);
}
return top;
}
use of jmri.jmrix.loconet.LocoNetSystemConnectionMemo in project JMRI by JMRI.
the class LocoIOPanelTest method testSetAddr.
public void testSetAddr() {
// prepare an interface
LocoNetInterfaceScaffold lnis = new LocoNetInterfaceScaffold();
// skip the warning dialog box
LocoIOPanel f = new LocoIOPanel() {
@Override
protected int cautionAddrSet() {
return 1;
}
};
LocoNetSystemConnectionMemo memo = new LocoNetSystemConnectionMemo();
memo.setLnTrafficController(lnis);
f.initComponents(memo);
f.addrField.setText("0134");
// click button
f.addrSetButton.doClick();
// check first message of readAll
Assert.assertEquals("One message sent", 1, lnis.outbound.size());
LocoNetMessage msg = lnis.outbound.elementAt(0);
Assert.assertEquals("message length", 16, msg.getNumDataElements());
Assert.assertEquals("message opCode", 0xE5, msg.getOpCode());
Assert.assertEquals("message bytes", "E5 10 50 00 01 00 01 01 00 34 10 00 00 00 00 00", msg.toString());
// dispose and end operation
f.dispose();
}
use of jmri.jmrix.loconet.LocoNetSystemConnectionMemo in project JMRI by JMRI.
the class LocoIOPanelTest method testReadAll.
public void testReadAll() {
// prepare an interface
LocoNetInterfaceScaffold lnis = new LocoNetInterfaceScaffold();
LocoIOPanel f = new LocoIOPanel();
LocoNetSystemConnectionMemo memo = new LocoNetSystemConnectionMemo();
memo.setLnTrafficController(lnis);
f.initComponents(memo);
// click button
f.readAllButton.doClick();
// check first message of ReadAll
Assert.assertEquals("One message sent", 1, lnis.outbound.size());
LocoNetMessage msg = lnis.outbound.elementAt(0);
Assert.assertEquals("message length", 16, msg.getNumDataElements());
Assert.assertEquals("message opCode", 0xE5, msg.getOpCode());
Assert.assertEquals("message bytes", "E5 10 50 51 01 00 02 04 00 00 10 00 00 00 00 00", msg.toString());
// dispose and end operation
f.dispose();
}
use of jmri.jmrix.loconet.LocoNetSystemConnectionMemo in project JMRI by JMRI.
the class LocoIOPanelTest method testAddrField.
public void testAddrField() {
// make sure that the address field does a notify
// and new address is used
// prepare an interface
LocoNetInterfaceScaffold lnis = new LocoNetInterfaceScaffold();
LocoIOPanel f = new LocoIOPanel();
LocoNetSystemConnectionMemo memo = new LocoNetSystemConnectionMemo();
memo.setLnTrafficController(lnis);
f.initComponents(memo);
f.addrField.setText("1234");
f.addrField.postActionEvent();
// click button
f.readAllButton.doClick();
// check first message of readAll
Assert.assertEquals("One message sent", 1, lnis.outbound.size());
LocoNetMessage msg = lnis.outbound.elementAt(0);
Assert.assertEquals("message length", 16, msg.getNumDataElements());
Assert.assertEquals("message opCode", 0xE5, msg.getOpCode());
Assert.assertEquals("message bytes", "E5 10 50 34 01 00 02 04 00 00 10 00 00 00 00 00", msg.toString());
// dispose and end operation
f.dispose();
}
Aggregations