Search in sources :

Example 31 with XNetInterfaceScaffold

use of jmri.jmrix.lenz.XNetInterfaceScaffold in project JMRI by JMRI.

the class EliteXNetProgrammerTest method testWriteRegisterSequenceString.

public void testWriteRegisterSequenceString() 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 write
    p.writeCV("29", 12, l);
    // check "prog mode" message sent
    Assert.assertEquals("read message sent", 2, t.outbound.size());
    Assert.assertEquals("write message contents", "23 12 05 0C 38", 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());
}
Also used : XNetInterfaceScaffold(jmri.jmrix.lenz.XNetInterfaceScaffold) XNetReply(jmri.jmrix.lenz.XNetReply)

Example 32 with XNetInterfaceScaffold

use of jmri.jmrix.lenz.XNetInterfaceScaffold in project JMRI by JMRI.

the class EliteXNetThrottleManagerTest method setUp.

// The minimal setup for log4J
@Override
@Before
public void setUp() {
    apps.tests.Log4JFixture.setUp();
    jmri.util.JUnitUtil.resetInstanceManager();
    XNetInterfaceScaffold tc = new XNetInterfaceScaffold(new HornbyEliteCommandStation());
    tm = new EliteXNetThrottleManager(new XNetSystemConnectionMemo(tc));
}
Also used : XNetInterfaceScaffold(jmri.jmrix.lenz.XNetInterfaceScaffold) XNetSystemConnectionMemo(jmri.jmrix.lenz.XNetSystemConnectionMemo) Before(org.junit.Before)

Example 33 with XNetInterfaceScaffold

use of jmri.jmrix.lenz.XNetInterfaceScaffold in project JMRI by JMRI.

the class EliteXNetThrottleTest method testCtor.

public void testCtor() {
    // infrastructure objects
    XNetInterfaceScaffold tc = new XNetInterfaceScaffold(new HornbyEliteCommandStation());
    EliteXNetThrottle t = new EliteXNetThrottle(new jmri.jmrix.lenz.XNetSystemConnectionMemo(tc), tc);
    Assert.assertNotNull(t);
}
Also used : XNetInterfaceScaffold(jmri.jmrix.lenz.XNetInterfaceScaffold)

Example 34 with XNetInterfaceScaffold

use of jmri.jmrix.lenz.XNetInterfaceScaffold in project JMRI by JMRI.

the class EliteXNetTurnoutManagerTest method testAsAbstractFactory.

@Test
public void testAsAbstractFactory() {
    lnis = new XNetInterfaceScaffold(new HornbyEliteCommandStation());
    // create and register the manager object
    EliteXNetTurnoutManager l = new EliteXNetTurnoutManager(lnis, "X");
    jmri.InstanceManager.setTurnoutManager(l);
    // ask for a Turnout, and check type
    TurnoutManager t = jmri.InstanceManager.turnoutManagerInstance();
    Turnout o = t.newTurnout("XT21", "my name");
    if (log.isDebugEnabled()) {
        log.debug("received turnout value " + o);
    }
    Assert.assertTrue(null != (EliteXNetTurnout) o);
    // make sure loaded into tables
    if (log.isDebugEnabled()) {
        log.debug("by system name: " + t.getBySystemName("XT21"));
    }
    if (log.isDebugEnabled()) {
        log.debug("by user name:   " + t.getByUserName("my name"));
    }
    Assert.assertTrue(null != t.getBySystemName("XT21"));
    Assert.assertTrue(null != t.getByUserName("my name"));
}
Also used : XNetInterfaceScaffold(jmri.jmrix.lenz.XNetInterfaceScaffold) TurnoutManager(jmri.TurnoutManager) Turnout(jmri.Turnout) Test(org.junit.Test)

Example 35 with XNetInterfaceScaffold

use of jmri.jmrix.lenz.XNetInterfaceScaffold in project JMRI by JMRI.

the class EliteXNetTurnoutTest method setUp.

// The minimal setup for log4J
@Override
@Before
public void setUp() {
    apps.tests.Log4JFixture.setUp();
    // prepare an interface
    jmri.util.JUnitUtil.resetInstanceManager();
    jmri.util.JUnitUtil.initInternalSensorManager();
    lnis = new XNetInterfaceScaffold(new HornbyEliteCommandStation());
    t = new EliteXNetTurnout("XT", 21, lnis);
    jmri.InstanceManager.store(new jmri.NamedBeanHandleManager(), jmri.NamedBeanHandleManager.class);
}
Also used : XNetInterfaceScaffold(jmri.jmrix.lenz.XNetInterfaceScaffold) Before(org.junit.Before)

Aggregations

XNetInterfaceScaffold (jmri.jmrix.lenz.XNetInterfaceScaffold)46 LenzCommandStation (jmri.jmrix.lenz.LenzCommandStation)26 XNetReply (jmri.jmrix.lenz.XNetReply)18 XNetSystemConnectionMemo (jmri.jmrix.lenz.XNetSystemConnectionMemo)13 Test (org.junit.Test)13 Before (org.junit.Before)10 XNetListenerScaffold (jmri.jmrix.lenz.XNetListenerScaffold)4 Turnout (jmri.Turnout)3 TurnoutManager (jmri.TurnoutManager)3 XNetThrottleTest (jmri.jmrix.lenz.XNetThrottleTest)2