Search in sources :

Example 26 with Reporter

use of jmri.Reporter in project JMRI by JMRI.

the class AbstractReporterMgrTestBase method testUpperLower.

@Test
public void testUpperLower() {
    Reporter t = l.provideReporter("" + getNameToTest1());
    String name = t.getSystemName();
    Assert.assertNull(l.getReporter(name.toLowerCase()));
}
Also used : Reporter(jmri.Reporter) Test(org.junit.Test)

Example 27 with Reporter

use of jmri.Reporter in project JMRI by JMRI.

the class AbstractReporterMgrTestBase method testReporterGetBySystemName.

@Test
public void testReporterGetBySystemName() {
    // Create
    Reporter t = l.provideReporter("" + getNameToTest1());
    t.setUserName("Fred");
    // Try a successful one
    t = l.getBySystemName(getSystemName(getNameToTest1()));
    Assert.assertTrue("get retrieved existing object ", t != null);
    // Try a nonexistant one. Should return null
    if (maxN() < 2)
        return;
    t = l.getBySystemName(getSystemName(getNameToTest2()));
    Assert.assertTrue("get nonexistant object ", t == null);
}
Also used : Reporter(jmri.Reporter) Test(org.junit.Test)

Example 28 with Reporter

use of jmri.Reporter in project JMRI by JMRI.

the class AbstractReporterMgrTestBase method testSingleObject.

@Test
public void testSingleObject() {
    // test that you always get the same representation
    Reporter t1 = l.newReporter(getSystemName(getNameToTest1()), "mine");
    Assert.assertTrue("t1 real object returned ", t1 != null);
    Assert.assertTrue("same by user ", t1 == l.getByUserName("mine"));
    Assert.assertTrue("same by system ", t1 == l.getBySystemName(getSystemName(getNameToTest1())));
    Reporter t2 = l.newReporter(getSystemName(getNameToTest1()), "mine");
    Assert.assertTrue("t2 real object returned ", t2 != null);
    // check
    Assert.assertTrue("same new ", t1 == t2);
}
Also used : Reporter(jmri.Reporter) Test(org.junit.Test)

Example 29 with Reporter

use of jmri.Reporter in project JMRI by JMRI.

the class AbstractReporterMgrTestBase method testReporterGetByUserName.

@Test
public void testReporterGetByUserName() {
    // Create
    Reporter t = l.provideReporter("" + getNameToTest1());
    t.setUserName("Fred");
    // Try a successful one
    t = l.getByUserName("Fred");
    Assert.assertTrue("get retrieved existing object ", t != null);
    // Try a nonexistant one. Should return null
    t = l.getBySystemName("Barney");
    Assert.assertTrue("get nonexistant object ", t == null);
}
Also used : Reporter(jmri.Reporter) Test(org.junit.Test)

Example 30 with Reporter

use of jmri.Reporter in project JMRI by JMRI.

the class ProxyReporterManagerTest method testTwoNames.

@Test
public void testTwoNames() {
    Reporter ir211 = l.provideReporter("LR211");
    Reporter lr211 = l.provideReporter("IR211");
    Assert.assertNotNull(ir211);
    Assert.assertNotNull(lr211);
    Assert.assertTrue(ir211 != lr211);
}
Also used : Reporter(jmri.Reporter) Test(org.junit.Test)

Aggregations

Reporter (jmri.Reporter)55 Test (org.junit.Test)18 ReporterManager (jmri.ReporterManager)10 Block (jmri.Block)6 Element (org.jdom2.Element)5 JsonNode (com.fasterxml.jackson.databind.JsonNode)4 IOException (java.io.IOException)4 BlockManager (jmri.BlockManager)4 JsonException (jmri.server.json.JsonException)4 Date (java.util.Date)3 JmriException (jmri.JmriException)3 Sensor (jmri.Sensor)3 OBlock (jmri.jmrit.logix.OBlock)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 ParseException (java.text.ParseException)2 PhysicalLocationReporter (jmri.PhysicalLocationReporter)2 Location (jmri.jmrit.operations.locations.Location)2 JsonMockConnection (jmri.server.json.JsonMockConnection)2 GuiLafPreferencesManager (apps.gui.GuiLafPreferencesManager)1