Package org.opentripplanner.updater

Examples of org.opentripplanner.updater.PropertiesPreferences


    private Graph graph;

    private GraphUpdaterConfigurator decorator = new GraphUpdaterConfigurator();

    public MemoryGraphSource(String routerId, Graph graph) {
        this(routerId, graph, new PropertiesPreferences(new Properties()));
    }
View Full Code Here


*/
public class TestPropertiesPreferences extends TestCase {

    public void testPropertiesPreference() throws Exception {

        Preferences prefs1 = new PropertiesPreferences(makeInput("pe=é\npa=1\npb=xyz\n"));
        assertEquals(1, prefs1.getLong("pa", 0));
        assertEquals("xyz", prefs1.get("pb", ""));
        assertEquals(-1, prefs1.getLong("pd", -1));
        assertEquals("é", prefs1.get("pe", null));

        Preferences prefs2 = new PropertiesPreferences(
                makeInput("pa=1\na.pb=2\na.b.pc=3\na.b2.pd=uvw\nb.pe=42"));
        String[] children = prefs2.childrenNames();
        Arrays.sort(children);
        assertEquals("a", children[0]);
        assertEquals("b", children[1]);
        assertEquals(1, prefs2.getLong("pa", 0));
        assertEquals(2, prefs2.node("a").getLong("pb", 0));
        assertEquals(2, prefs2.node("/a").getLong("pb", 0));
        assertEquals(3, prefs2.node("/a/b").getLong("pc", 0));
        Preferences prefs2a = prefs2.node("/a");
        assertEquals(2, prefs2a.getLong("pb", 0));
        assertEquals(-1, prefs2.node("/a/c").getLong("px", -1));
        assertEquals(null, prefs2.node("/a/c").get("py", null));
        Preferences prefs2ab2 = prefs2.node("/a/b2");
        assertEquals("uvw", prefs2ab2.get("pd", null));
    }
View Full Code Here

        }
        if (graph != null && (params.inMemory || params.preFlight)) {
            /* Hand off graph in memory to server in a in-memory GraphSource. */
            try {
                FileInputStream graphConfiguration = new FileInputStream(params.graphConfigFile);
                Preferences config = new PropertiesPreferences(graphConfiguration);
                this.graphService.registerGraph("", new MemoryGraphSource("", graph, config));
            } catch (Exception e) {
                if (params.graphConfigFile != null)
                    LOG.error("Can't read config file", e);
                this.graphService.registerGraph("", new MemoryGraphSource("", graph));
View Full Code Here

        }

        // Decorate the graph. Even if a config file is not present
        // one could be bundled inside.
        try (InputStream is = graphInputStream.getConfigInputStream()) {
            Preferences config = is == null ? null : new PropertiesPreferences(is);
            configurator.setupGraph(graph, config);
        } catch (IOException e) {
            LOG.error("Can't read config file", e);
        }
        return graph;
View Full Code Here

TOP

Related Classes of org.opentripplanner.updater.PropertiesPreferences

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.