Search in sources :

Example 1 with ConfigCollection

use of com.netflix.exhibitor.core.config.ConfigCollection in project exhibitor by soabase.

the class MockConfigProvider method setConfig.

void setConfig(final IntConfigs type, final int value) {
    final InstanceConfig config = collection.getRootConfig();
    final InstanceConfig newConfig = new InstanceConfig() {

        @Override
        public String getString(StringConfigs configType) {
            return config.getString(configType);
        }

        @Override
        public int getInt(IntConfigs configType) {
            if (configType == type) {
                return value;
            }
            return config.getInt(configType);
        }
    };
    collection = new ConfigCollection() {

        @Override
        public InstanceConfig getConfigForThisInstance(String hostname) {
            return getRootConfig();
        }

        @Override
        public InstanceConfig getRootConfig() {
            return newConfig;
        }

        @Override
        public InstanceConfig getRollingConfig() {
            return null;
        }

        @Override
        public boolean isRolling() {
            return false;
        }

        @Override
        public RollingConfigState getRollingConfigState() {
            return null;
        }
    };
}
Also used : LoadedInstanceConfig(com.netflix.exhibitor.core.config.LoadedInstanceConfig) InstanceConfig(com.netflix.exhibitor.core.config.InstanceConfig) PropertyBasedInstanceConfig(com.netflix.exhibitor.core.config.PropertyBasedInstanceConfig) IntConfigs(com.netflix.exhibitor.core.config.IntConfigs) ConfigCollection(com.netflix.exhibitor.core.config.ConfigCollection) StringConfigs(com.netflix.exhibitor.core.config.StringConfigs) RollingConfigState(com.netflix.exhibitor.core.config.RollingConfigState)

Example 2 with ConfigCollection

use of com.netflix.exhibitor.core.config.ConfigCollection in project exhibitor by soabase.

the class MockConfigProvider method setConfig.

void setConfig(final StringConfigs type, final String value) {
    final InstanceConfig config = collection.getRootConfig();
    final InstanceConfig newConfig = new InstanceConfig() {

        @Override
        public String getString(StringConfigs configType) {
            if (configType == type) {
                return value;
            }
            return config.getString(configType);
        }

        @Override
        public int getInt(IntConfigs configType) {
            return config.getInt(configType);
        }
    };
    collection = new ConfigCollection() {

        @Override
        public InstanceConfig getConfigForThisInstance(String hostname) {
            return getRootConfig();
        }

        @Override
        public InstanceConfig getRootConfig() {
            return newConfig;
        }

        @Override
        public InstanceConfig getRollingConfig() {
            return null;
        }

        @Override
        public boolean isRolling() {
            return false;
        }

        @Override
        public RollingConfigState getRollingConfigState() {
            return null;
        }
    };
}
Also used : LoadedInstanceConfig(com.netflix.exhibitor.core.config.LoadedInstanceConfig) InstanceConfig(com.netflix.exhibitor.core.config.InstanceConfig) PropertyBasedInstanceConfig(com.netflix.exhibitor.core.config.PropertyBasedInstanceConfig) IntConfigs(com.netflix.exhibitor.core.config.IntConfigs) ConfigCollection(com.netflix.exhibitor.core.config.ConfigCollection) StringConfigs(com.netflix.exhibitor.core.config.StringConfigs) RollingConfigState(com.netflix.exhibitor.core.config.RollingConfigState)

Aggregations

ConfigCollection (com.netflix.exhibitor.core.config.ConfigCollection)2 InstanceConfig (com.netflix.exhibitor.core.config.InstanceConfig)2 IntConfigs (com.netflix.exhibitor.core.config.IntConfigs)2 LoadedInstanceConfig (com.netflix.exhibitor.core.config.LoadedInstanceConfig)2 PropertyBasedInstanceConfig (com.netflix.exhibitor.core.config.PropertyBasedInstanceConfig)2 RollingConfigState (com.netflix.exhibitor.core.config.RollingConfigState)2 StringConfigs (com.netflix.exhibitor.core.config.StringConfigs)2