Code example for Properties

Methods: setProperty

0
 
  @Test 
  public void testLoadConfig_HappyPath() throws Exception 
  { 
 
    Properties props = new Properties();
    props.setProperty("com.linkedin.databus2.intSetting", "1");
    props.setProperty("com.linkedin.databus2.nestedConfig.stringSetting", "Hello");
    props.setProperty("com.linkedin.databus2.listSetting[0].stringSetting", "item0");
    props.setProperty("com.linkedin.databus2.listSetting[1].stringSetting", "item1");
    props.setProperty("com.linkedin.databus.intSetting", "2");
 
    _configManager.loadConfig(props);
 
    DynamicConfig dynConfig = _configManager.getReadOnlyConfig();
    assertEquals("intSetting correct", 1, dynConfig.getIntSetting());
    assertEquals("nestedConfig.stringSetting correct", "Hello", 
                 dynConfig.getNestedConfig().getStringSetting());
    assertEquals("listSetting size correct", 2, dynConfig.getListSetting().size());
    assertEquals("listSetting[0].stringSetting", "item0", 
                 dynConfig.getListSetting(0).getStringSetting());