use of jmri.Turnout in project JMRI by JMRI.
the class XNetTurnoutManagerTest method testAsAbstractFactory.
@Test
public void testAsAbstractFactory() {
// create and register the manager object
XNetTurnoutManager l = new XNetTurnoutManager(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 != (XNetTurnout) 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"));
}
use of jmri.Turnout in project JMRI by JMRI.
the class OlcbTurnoutManagerTest method testUpperLower.
@Override
@Test
public void testUpperLower() {
Turnout t = l.provideTurnout("MTX010203040506070" + getNumToTest2() + ";X010203040506070" + (getNumToTest2() - 1));
Assert.assertNull(l.getTurnout(t.getSystemName().toLowerCase()));
}
use of jmri.Turnout in project JMRI by JMRI.
the class SerialTurnoutManagerTest method testAsAbstractFactory.
@Test
public void testAsAbstractFactory() {
// ask for a Turnout, and check type
Turnout o = l.newTurnout("OT21", "my name");
if (log.isDebugEnabled()) {
log.debug("received turnout value " + o);
}
Assert.assertTrue(null != (SerialTurnout) o);
// make sure loaded into tables
if (log.isDebugEnabled()) {
log.debug("by system name: " + l.getBySystemName("OT21"));
}
if (log.isDebugEnabled()) {
log.debug("by user name: " + l.getByUserName("my name"));
}
Assert.assertTrue(null != l.getBySystemName("OT21"));
Assert.assertTrue(null != l.getByUserName("my name"));
}
use of jmri.Turnout in project JMRI by JMRI.
the class ZTC611XNetTurnoutManagerTest method testAsAbstractFactory.
@Test
public void testAsAbstractFactory() {
lnis = new XNetInterfaceScaffold(new LenzCommandStation());
// create and register the manager object
ZTC611XNetTurnoutManager l = new ZTC611XNetTurnoutManager(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 != (ZTC611XNetTurnout) 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"));
}
use of jmri.Turnout in project JMRI by JMRI.
the class AbstractTurnoutMgrTestBase method testRename.
@Test
public void testRename() {
// get turnout
Turnout t1 = l.newTurnout(getSystemName(getNumToTest1()), "before");
Assert.assertNotNull("t1 real object ", t1);
t1.setUserName("after");
Turnout t2 = l.getByUserName("after");
Assert.assertEquals("same object", t1, t2);
Assert.assertEquals("no old object", null, l.getByUserName("before"));
}
Aggregations