protected override IConfigurationManager CreateManager(String fileName) { PropertiesFileConfigurationSourceConfig sourceConfig = StringPropertySources .NewPropertiesFileSourceConfigBuilder().SetName("properties-source").SetFileName(fileName).Build(); Console.WriteLine("source config: " + sourceConfig + "\n"); ConfigurationManagerConfig managerConfig = ConfigurationManagers.NewConfigBuilder().SetName("test") .AddSource(1, StringPropertySources.NewPropertiesFileSource(sourceConfig)).Build(); Console.WriteLine("manager config: " + managerConfig + "\n"); return(LabeledConfigurationManagers.NewManager(managerConfig)); }
protected virtual ILabeledConfigurationManager CreateLabeledManager() { ConfigurationSourceConfig sourceConfig = ConfigurationSources.NewConfig("labeled-source"); Console.WriteLine("source config: " + sourceConfig + "\n"); TestDataCenterSetting Setting1 = new TestDataCenterSetting("exist", "ok", "sh-1", "app-1"); TestDataCenterSetting Setting2 = new TestDataCenterSetting("int-value", "1", "sh-1", "app-1"); TestDataCenterSetting Setting3 = new TestDataCenterSetting("list-value", "s1, s2, s3", "sh-1", "app-1"); TestDataCenterSetting Setting4 = new TestDataCenterSetting("map-value", "k1: v1, k2: v2, k3: v3", "sh-1", "app-1"); TestDataCenterSetting Setting5 = new TestDataCenterSetting("int-list-value", "1, 2, 3", "sh-1", "app-1"); TestDataCenterSetting Setting6 = new TestDataCenterSetting("int-long-map-value", "1: 2, 3: 4, 5: 6", "sh-1", "app-1"); TestLabeledConfigurationSource source = new TestLabeledConfigurationSource(sourceConfig, new List <TestDataCenterSetting>() { Setting1, Setting2, Setting3, Setting4, Setting5, Setting6 }); ConfigurationManagerConfig managerConfig = ConfigurationManagers.NewConfigBuilder().SetName("test") .AddSource(1, source).Build(); Console.WriteLine("manager config: " + managerConfig + "\n"); return(LabeledConfigurationManagers.NewManager(managerConfig)); }