Search in sources :

Example 21 with Turnout

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"));
}
Also used : TurnoutManager(jmri.TurnoutManager) Turnout(jmri.Turnout) Test(org.junit.Test)

Example 22 with Turnout

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()));
}
Also used : Turnout(jmri.Turnout) Test(org.junit.Test)

Example 23 with Turnout

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"));
}
Also used : Turnout(jmri.Turnout) Test(org.junit.Test)

Example 24 with Turnout

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"));
}
Also used : XNetInterfaceScaffold(jmri.jmrix.lenz.XNetInterfaceScaffold) LenzCommandStation(jmri.jmrix.lenz.LenzCommandStation) TurnoutManager(jmri.TurnoutManager) Turnout(jmri.Turnout) Test(org.junit.Test)

Example 25 with Turnout

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"));
}
Also used : Turnout(jmri.Turnout) Test(org.junit.Test)

Aggregations

Turnout (jmri.Turnout)221 Test (org.junit.Test)63 Sensor (jmri.Sensor)26 SignalHead (jmri.SignalHead)20 Element (org.jdom2.Element)20 TurnoutManager (jmri.TurnoutManager)17 JmriException (jmri.JmriException)11 Light (jmri.Light)10 SignalMast (jmri.SignalMast)10 ActionEvent (java.awt.event.ActionEvent)9 NamedBeanHandle (jmri.NamedBeanHandle)9 JsonException (jmri.server.json.JsonException)9 ActionListener (java.awt.event.ActionListener)8 Block (jmri.Block)7 JsonNode (com.fasterxml.jackson.databind.JsonNode)6 NamedBean (jmri.NamedBean)6 Route (jmri.Route)6 AbstractTurnout (jmri.implementation.AbstractTurnout)6 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)5