protected String getEngineRpmVersion(String sessionId) { return (String) runPublicQuery(QueryType.GetConfigurationValue, new GetConfigurationValueParameters(ConfigValues.ProductRPMVersion, ConfigCommon.defaultConfigurationVersion), sessionId); }
@Override protected ToStringBuilder appendAttributes(ToStringBuilder tsb) { return super.appendAttributes(tsb) .append("version", getVersion()) .append("configurationValue", getConfigValue()); } }
private ApplicationMode findApplicationMode(String sessionId) { GetConfigurationValueParameters parameters = new GetConfigurationValueParameters( ConfigValues.ApplicationMode, ConfigCommon.defaultConfigurationVersion ); parameters.setSessionId(sessionId); QueryReturnValue result = backend.runPublicQuery( QueryType.GetConfigurationValue, parameters); return ApplicationMode.from(result.getReturnValue()); }
private Object getBackendParameter(final ConfigValues key) throws ServletException { final GetConfigurationValueParameters parameters = new GetConfigurationValueParameters(); parameters.setConfigValue(key); parameters.setVersion(ConfigCommon.defaultConfigurationVersion); QueryReturnValue value = backend.runPublicQuery(QueryType.GetConfigurationValue, parameters); if (!value.getSucceeded()) { throw new ServletException("Can't get value of backend parameter \"" + key + "\"."); } return value.getReturnValue(); }
public void getMaxNumOfVmSockets(AsyncQuery<Integer> aQuery, String version) { aQuery.converterCallback = new DefaultValueConverter<>(1); GetConfigurationValueParameters tempVar = new GetConfigurationValueParameters(ConfigValues.MaxNumOfVmSockets); tempVar.setVersion(version); getConfigFromCache(tempVar, aQuery); }
ArgumentMatcher<GetConfigurationValueParameters> configValueParams(final ConfigValues configValue) { return argument -> argument.getConfigValue() == configValue; }
@Test public void testRunPublicQuery_GetConfigurationValue() { String sessionId = "sessionId"; //$NON-NLS-1$ QueryType queryType = QueryType.GetConfigurationValue; QueryReturnValue returnIntValue = new QueryReturnValue(); returnIntValue.setSucceeded(true); returnIntValue.setReturnValue(Integer.valueOf(255)); when(mockBackend.runPublicQuery(eq(QueryType.GetConfigurationValue), eq(mockConfigQueryParams))).thenReturn(returnIntValue); Object result = testServlet.runPublicQuery(queryType, mockConfigQueryParams, sessionId); assertThat(result, is(instanceOf(Integer.class))); verify(mockConfigQueryParams).setSessionId(sessionId); verify(mockConfigQueryParams).setFiltered(testServlet.filterQueries()); verify(mockBackend).runPublicQuery(queryType, mockConfigQueryParams); }
public void getMaxNumOfCPUsPerSocket(AsyncQuery<Integer> aQuery, String version) { aQuery.converterCallback = new DefaultValueConverter<>(1); GetConfigurationValueParameters tempVar = new GetConfigurationValueParameters(ConfigValues.MaxNumOfCpuPerSocket); tempVar.setVersion(version); getConfigFromCache(tempVar, aQuery); }
protected Integer getApplicationMode(String sessionId) { return (Integer) runPublicQuery(QueryType.GetConfigurationValue, new GetConfigurationValueParameters(ConfigValues.ApplicationMode, ConfigCommon.defaultConfigurationVersion), sessionId); }
public void getMaxNumOfThreadsPerCpu(AsyncQuery<Integer> aQuery, String version) { aQuery.converterCallback = new DefaultValueConverter<>(1); GetConfigurationValueParameters tempVar = new GetConfigurationValueParameters(ConfigValues.MaxNumOfThreadsPerCpu); tempVar.setVersion(version); getConfigFromCache(tempVar, aQuery); }
new KeyValuePairCompat<>(parameters.getConfigValue(), parameters.getVersion());
public void getNumOfMonitorList(AsyncQuery<List<Integer>> aQuery) { aQuery.converterCallback = source -> { ArrayList<Integer> nums = new ArrayList<>(); if (source != null) { Iterable numEnumerable = (Iterable) source; Iterator numIterator = numEnumerable.iterator(); while (numIterator.hasNext()) { nums.add(Integer.parseInt(numIterator.next().toString())); } } return nums; }; getConfigFromCache( new GetConfigurationValueParameters(ConfigValues.ValidNumOfMonitors, getDefaultConfigurationVersion()), aQuery); }
public void getMaxNumOfVmCpus(AsyncQuery<Integer> aQuery, String version) { aQuery.converterCallback = new DefaultValueConverter<>(1); GetConfigurationValueParameters tempVar = new GetConfigurationValueParameters(ConfigValues.MaxNumOfVmCpus); tempVar.setVersion(version); getConfigFromCache(tempVar, aQuery); }
public void getDefaultPmProxyPreferences(AsyncQuery<String> query) { getConfigFromCache( new GetConfigurationValueParameters(ConfigValues.FenceProxyDefaultPreferences, getDefaultConfigurationVersion()), query); }
public void getPmTypeList(AsyncQuery<List<String>> aQuery, Version version) { aQuery.converterCallback = source -> { ArrayList<String> list = new ArrayList<>(); if (source != null) { String[] array = ((String) source).split("[,]", -1); //$NON-NLS-1$ for (String item : array) { list.add(item); } } return list; }; GetConfigurationValueParameters param = new GetConfigurationValueParameters(ConfigValues.VdsFenceType); param.setVersion(version != null ? version.toString() : getDefaultConfigurationVersion()); Frontend.getInstance().runQuery(QueryType.GetFenceConfigurationValue, param, aQuery); }
public void getWANDisableEffects(AsyncQuery<List<WanDisableEffects>> aQuery) { aQuery.converterCallback = source -> { if (source == null) { return new ArrayList<>(); } List<WanDisableEffects> res = new ArrayList<>(); String fromDb = (String) source; for (String value : fromDb.split(",")) {//$NON-NLS-1$ if (value == null) { continue; } String trimmedValue = value.trim(); if ("".equals(trimmedValue)) { continue; } res.add(WanDisableEffects.fromString(trimmedValue)); } return res; }; getConfigFromCache( new GetConfigurationValueParameters(ConfigValues.WANDisableEffects, getDefaultConfigurationVersion()), aQuery); }
public void getStorageDomainMaxNameLength(AsyncQuery<Integer> aQuery) { aQuery.converterCallback = new DefaultValueConverter<>(1); getConfigFromCache( new GetConfigurationValueParameters(ConfigValues.StorageDomainNameSizeLimit, getDefaultConfigurationVersion()), aQuery); }
public void getCustomBondNameSupported(AsyncQuery<Boolean> aQuery, Version version) { aQuery.converterCallback = new DefaultValueConverter<>(Boolean.TRUE); getConfigFromCache( new GetConfigurationValueParameters(ConfigValues.CustomBondNameSupported, version.getValue()), aQuery); }
public void getClusterDesktopMemoryOverCommit(AsyncQuery<Integer> aQuery) { aQuery.converterCallback = new DefaultValueConverter<>(0); getConfigFromCache( new GetConfigurationValueParameters(ConfigValues.MaxVdsMemOverCommit, getDefaultConfigurationVersion()), aQuery); }
public void getWANColorDepth(AsyncQuery<WanColorDepth> aQuery) { aQuery.converterCallback = source -> source != null ? WanColorDepth.fromInt((Integer) source) : WanColorDepth.depth16; getConfigFromCache( new GetConfigurationValueParameters(ConfigValues.WANColorDepth, getDefaultConfigurationVersion()), aQuery); }