use of org.apache.cloudstack.framework.config.ConfigKey in project cloudstack by apache.
the class LdapTestConfigTool method overrideConfigValue.
void overrideConfigValue(LdapConfiguration ldapConfiguration, final String configKeyName, final Object o) throws IllegalAccessException, NoSuchFieldException {
Field configKey = LdapConfiguration.class.getDeclaredField(configKeyName);
configKey.setAccessible(true);
ConfigKey key = (ConfigKey) configKey.get(ldapConfiguration);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(configKey, configKey.getModifiers() & ~Modifier.FINAL);
Field f = ConfigKey.class.getDeclaredField("_value");
f.setAccessible(true);
modifiersField.setInt(f, f.getModifiers() & ~Modifier.FINAL);
f.set(key, o);
Field dynamic = ConfigKey.class.getDeclaredField("_isDynamic");
dynamic.setAccessible(true);
modifiersField.setInt(dynamic, dynamic.getModifiers() & ~Modifier.FINAL);
dynamic.setBoolean(key, false);
}
use of org.apache.cloudstack.framework.config.ConfigKey in project cloudstack by apache.
the class ConfigurationServerImpl method getConfigListByScope.
@Override
public List<ConfigurationVO> getConfigListByScope(String scope, Long resourceId) {
// Getting the list of parameters defined at the scope
Set<ConfigKey<?>> configList = _configDepot.getConfigListByScope(scope);
List<ConfigurationVO> configVOList = new ArrayList<ConfigurationVO>();
for (ConfigKey<?> param : configList) {
ConfigurationVO configVo = _configDao.findByName(param.toString());
configVo.setValue(_configDepot.get(param.toString()).valueIn(resourceId).toString());
configVOList.add(configVo);
}
return configVOList;
}
use of org.apache.cloudstack.framework.config.ConfigKey in project cloudstack by apache.
the class DiagnosticsFilesListFactoryTest method testDiagnosticsFileListDefaultsRouter.
@Test
public void testDiagnosticsFileListDefaultsRouter() {
List<String> filesList = Objects.requireNonNull(DiagnosticsFilesListFactory.getDiagnosticsFilesList(null, vmInstance)).generateFileList();
ConfigKey configKey = proxyDiagnosticFiles.RouterDefaultSupportedFiles;
String[] defaultFileArray = configKey.defaultValue().split(",");
assertEquals(filesList.size(), defaultFileArray.length);
}
Aggregations