Package net.mindengine.galen.config

Examples of net.mindengine.galen.config.GalenConfig


       
        File configFile = new File("config");
        configFile.createNewFile();
        FileUtils.copyFile(new File(getClass().getResource("/config").getFile()), configFile);
       
        GalenConfig config = GalenConfig.getConfig();
        config.reset();
       
        configFile.delete();
       
        MatcherAssert.assertThat(config.getRangeApproximation(), is(3));
        assertThat(config.getReportingListeners(), Matchers.contains("net.mindengine.CustomListener", "net.mindengine.CustomListener2"));
        config.reset();
    }
View Full Code Here


        configFile.createNewFile();
        FileUtils.copyFile(new File(getClass().getResource("/config2").getFile()), configFile);

        System.setProperty("galen.config.file", "config2");

        GalenConfig config = GalenConfig.getConfig();
        config.reset();

        MatcherAssert.assertThat(config.getRangeApproximation(), is(12345));
    }
View Full Code Here

        MatcherAssert.assertThat(config.getRangeApproximation(), is(12345));
    }
   
    @Test public void shouldRead_configForLocalProject_fromSystemProperties() throws IOException {
        GalenConfig config = GalenConfig.getConfig();
        System.setProperty("galen.range.approximation", "5");
        System.setProperty("galen.reporting.listeners", "net.mindengine.system.CustomListener, net.mindengine.system.CustomListener2 ");
       
        config.reset();
        assertThat(config.getRangeApproximation(), is(5));
        assertThat(config.getReportingListeners(), Matchers.contains("net.mindengine.system.CustomListener", "net.mindengine.system.CustomListener2"));
       
        deleteSystemProperty("galen.range.approximation");
        deleteSystemProperty("galen.reporting.listeners");
        config.reset();
    }
View Full Code Here

   
    @Test public void shouldUseDefaultValues_whenConfigIsNotSet() throws IOException {
        deleteSystemProperty("galen.range.approximation");
        deleteSystemProperty("galen.reporting.listeners");
       
        GalenConfig config = GalenConfig.getConfig();
        config.reset();
        assertThat(config.getRangeApproximation(), is(2));
        assertThat(config.getReportingListeners().size(), is(0));
       
    }
View Full Code Here

       
    }
   
   
    @Test public void shouldUseConfig_forRangeReader() throws IOException {
        GalenConfig config = GalenConfig.getConfig();
        System.setProperty("galen.range.approximation", "5");
        config.reset();
       
        StringCharReader reader = new StringCharReader("~ 20 px");
        Range range = Expectations.range().read(reader);
       
        assertThat(range, is(Range.between(15, 25)));
View Full Code Here

       
        deleteSystemProperty("galen.range.approximation");
    }

    @Test public void shouldUseConfig_forReportingListeners() throws IOException, SecurityException, IllegalArgumentException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
        GalenConfig config = GalenConfig.getConfig();
        System.setProperty("galen.reporting.listeners", "net.mindengine.galen.components.DummyCompleteListener");
        config.reset();
       
       
        List<CompleteListener> listeners = new GalenMain().getConfiguredListeners();
        assertThat(listeners, is(notNullValue()));
        assertThat(listeners.size(), is(1));
View Full Code Here

TOP

Related Classes of net.mindengine.galen.config.GalenConfig

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.