use of jmri.jmrix.lenz.XNetInterfaceScaffold in project JMRI by JMRI.
the class LI100XNetProgrammerTest method testReadCvSequence.
public void testReadCvSequence() throws JmriException {
// infrastructure objects
XNetInterfaceScaffold t = new XNetInterfaceScaffold(new LenzCommandStation());
jmri.ProgListenerScaffold l = new jmri.ProgListenerScaffold();
LI100XNetProgrammer p = new LI100XNetProgrammer(t) {
@Override
protected synchronized void restartTimer(int delay) {
super.restartTimer(RESTART_TIME);
}
};
// and do the read
p.readCV(29, l);
// check "prog mode" message sent
Assert.assertEquals("mode message sent", 1, t.outbound.size());
Assert.assertEquals("read message contents", "22 15 1D 2A", t.outbound.elementAt(0).toString());
// send reply
XNetReply mr1 = new XNetReply();
mr1.setElement(0, 0x61);
mr1.setElement(1, 0x02);
mr1.setElement(2, 0x63);
t.sendTestMessage(mr1);
Assert.assertEquals("inquire message sent", 2, t.outbound.size());
Assert.assertEquals("inquire message contents", "21 10 31", t.outbound.elementAt(1).toString());
// send a result string
XNetReply mr2 = new XNetReply();
mr2.setElement(0, 0x63);
mr2.setElement(1, 0x14);
mr2.setElement(2, 0x1D);
mr2.setElement(3, 0x22);
mr2.setElement(4, 0x48);
t.sendTestMessage(mr2);
// At this point, the LI100 XPressNet programmer
// deviates from the standard XPressNet programmer.
// the LI100 version requests an exit from service
// before sending a result to the registered listeners.
Assert.assertEquals("mode message sent", 3, t.outbound.size());
Assert.assertEquals("exit service mode message contents", "21 81 A0", t.outbound.elementAt(2).toString());
// send reply stating service mode has exited
XNetReply mr3 = new XNetReply();
mr3.setElement(0, 0x61);
mr3.setElement(1, 0x01);
mr3.setElement(2, 0x60);
t.sendTestMessage(mr3);
jmri.util.JUnitUtil.releaseThread(this);
//failure in this test occurs with the next line.
Assert.assertFalse("Receive Called by Programmer", l.getRcvdInvoked() == 0);
Assert.assertEquals("Direct mode received value", 34, l.getRcvdValue());
}
use of jmri.jmrix.lenz.XNetInterfaceScaffold in project JMRI by JMRI.
the class LI100XNetProgrammerTest method testCtor.
public void testCtor() {
// infrastructure objects
XNetInterfaceScaffold t = new XNetInterfaceScaffold(new LenzCommandStation());
LI100XNetProgrammer p = new LI100XNetProgrammer(t);
Assert.assertNotNull(p);
}
use of jmri.jmrix.lenz.XNetInterfaceScaffold in project JMRI by JMRI.
the class EliteXNetSystemConnectionMemoTest method testProivdesConsistManager.
@Test
public void testProivdesConsistManager() {
// infrastructure objects
XNetInterfaceScaffold tc = new XNetInterfaceScaffold(new HornbyEliteCommandStation());
EliteXNetSystemConnectionMemo t = new EliteXNetSystemConnectionMemo();
t.setXNetTrafficController(tc);
t.setCommandStation(tc.getCommandStation());
Assert.assertFalse(t.provides(jmri.ConsistManager.class));
}
use of jmri.jmrix.lenz.XNetInterfaceScaffold in project JMRI by JMRI.
the class EliteXNetProgrammerTest method testReadRegisterSequenceString.
public void testReadRegisterSequenceString() throws JmriException {
// infrastructure objects
XNetInterfaceScaffold t = new XNetInterfaceScaffold(new HornbyEliteCommandStation());
EliteXNetListenerScaffold l = new EliteXNetListenerScaffold();
EliteXNetProgrammer p = new EliteXNetProgrammer(t);
// set register mode
p.setMode(DefaultProgrammerManager.REGISTERMODE);
// and do the read
p.readCV("29", l);
// check "prog mode" message sent
Assert.assertEquals("mode message sent", 2, t.outbound.size());
Assert.assertEquals("read message contents", "22 11 05 36", t.outbound.elementAt(0).toString());
// send reply
XNetReply mr1 = new XNetReply();
mr1.setElement(0, 0x61);
mr1.setElement(1, 0x02);
mr1.setElement(2, 0x63);
t.sendTestMessage(mr1);
Assert.assertEquals("enquire message sent", 2, t.outbound.size());
Assert.assertEquals("enquire message contents", "21 10 31", t.outbound.elementAt(1).toString());
}
use of jmri.jmrix.lenz.XNetInterfaceScaffold in project JMRI by JMRI.
the class EliteXNetTurnoutManagerTest method setUp.
@Override
@Before
public void setUp() {
apps.tests.Log4JFixture.setUp();
jmri.util.JUnitUtil.resetInstanceManager();
// prepare an interface, register
lnis = new XNetInterfaceScaffold(new HornbyEliteCommandStation());
// create and register the manager object
l = new EliteXNetTurnoutManager(lnis, "X");
jmri.InstanceManager.setTurnoutManager(l);
}
Aggregations