/** * Can be overridden in tests. */ public Config getConfig() { return Config.getConfig(); }
@Test public void testConfig() { Config p = Config.getConfig("classpath:/test-config/hierarchy", "production"); Config t = Config.getConfig("classpath:/test-config/hierarchy", "test"); Assert.assertTrue(p.getConfiguration().getBoolean("production")); Assert.assertFalse(t.getConfiguration().getBoolean("production")); }
@Test public void testConfig() { Config p = Config.getConfig("classpath:/test-config/legacy", "production"); Config t = Config.getConfig("classpath:/test-config/legacy", "test"); Assert.assertTrue(p.getConfiguration().getBoolean("production")); Assert.assertFalse(t.getConfiguration().getBoolean("production")); }
@Override protected Config getConfig() { return Config.getConfig(URI.create("classpath:/test-config"), "new-token"); }
@Test public void testSuperConfig() { Config ts = Config.getConfig("classpath:/test-config/legacy", "test:test_super"); Configuration c = ts.getConfiguration(); Assert.assertEquals("yay", c.getString("hi")); Assert.assertEquals("frob", c.getString("yay")); }
@Override protected Config getConfig() { return Config.getConfig(URI.create("classpath:/test-config"), "new-token"); }
@Test public void testDefaultConfig() { Config d = Config.getConfig("classpath:/test-config/hierarchy", "default"); Assert.assertFalse(d.getConfiguration().getBoolean("production")); Assert.assertTrue(d.getConfiguration().getBoolean("unitTesting", false)); }
@Override protected Config getConfig() { return Config.getConfig(URI.create("classpath:/test-config"), "new-token"); }
@Before public void setUp() throws Exception { config = Config.getConfig(URI.create("classpath:/test-config"), "builder"); nessJobConfig = config.getConfiguration("ness.job"); scheduler = createMock(Scheduler.class); EasyMock.expect(scheduler.scheduleJob(EasyMock.capture(jobDetailCapture), EasyMock.capture(triggerCapture))).andReturn(null).anyTimes(); scheduler.addJob(EasyMock.capture(jobAddCapture), EasyMock.anyBoolean()); EasyMock.expectLastCall().anyTimes(); replayAll(); }
@Before public void setUp() { cfg = Config.getConfig("classpath:/test-config/prefix", "default"); }
@Before public void setUp() { cfg = Config.getConfig("classpath:/test-config/basic", "databases"); }
@Before public void setUp() { ps = new PropertiesSaver(Config.CONFIG_PROPERTY_NAME, Config.CONFIG_LOCATION_PROPERTY_NAME); System.setProperty(Config.CONFIG_PROPERTY_NAME, "production:webautostart:db2"); System.setProperty(Config.CONFIG_LOCATION_PROPERTY_NAME, "classpath:/test-config/legacy"); cfg = Config.getConfig(); }
@Test(expected = IllegalStateException.class) public void loadStringValues() throws Exception { final URI baseUri = new URI("http", null, localHttpService.getHost(), localHttpService.getPort(), null, null, null); Config.getConfig(baseUri.resolve("/test-config/basic"), "values"); } }
@Before public void setup() { final Config config = Config.getConfig(URI.create("classpath:/test-config"), "quartz"); modules = Lists.newArrayList(); modules.add(new NessQuartzModule(config)); modules.add(new LifecycleModule()); modules.add(new TestingQuartzModule(config)); }
@Before public void setUp() { ps = new PropertiesSaver("string-value"); System.setProperty("string-value", "OVERRIDDEN"); cfg = Config.getConfig("classpath:/test-config/basic", "values"); Assert.assertThat(new SystemConfiguration().getString("string-value"), is("OVERRIDDEN")); cfg2 = Config.getConfig("classpath:/test-config//basic-legacy", "values"); Assert.assertThat(new SystemConfiguration().getString("string-value"), is("OVERRIDDEN")); }