private static boolean isBelowPctThreshold(final storage_domains domain) { storage_domain_dynamic dynamic = domain.getStorageDynamicData(); return (dynamic != null && dynamic.getfreeDiskInGB() > Config.<Integer>GetValue(ConfigValues.FreeSpaceCriticalLowInGB) && dynamic.getfreeDiskPercent() > Config.<Integer>GetValue(ConfigValues.FreeSpaceLow)); }
@Test public void testGeneralQuotaLimitations() throws Exception { // Set new Quota definition. Quota quota = new Quota(); Guid quotaId = Guid.NewGuid(); quota.setId(quotaId); quota.setStoragePoolId(FixturesTool.STORAGE_POOL_NFS); quota.setQuotaName("Watson"); quota.setDescription("General quota"); quota.setThresholdVdsGroupPercentage( Config.<Integer>GetValue(ConfigValues.QuotaThresholdVdsGroup)); quota.setThresholdStoragePercentage( Config.<Integer>GetValue(ConfigValues.QuotaThresholdStorage)); quota.setGraceVdsGroupPercentage(Config.<Integer>GetValue(ConfigValues.QuotaGraceVdsGroup)); quota.setGraceStoragePercentage(Config.<Integer>GetValue(ConfigValues.QuotaGraceStorage)); setQuotaGlobalLimitations(quota); quota.setQuotaVdsGroups(getQuotaVdsGroup(null)); quota.setQuotaStorages(getQuotaStorage(null)); dao.save(quota); Quota quotaEntity = dao.getById(quota.getId()); assertNotNull(quotaEntity); assertEquals(quotaEntity, quota); assertEquals(quotaEntity.getStoragePoolName(), "rhel6.NFS"); assertEquals(quotaEntity.getQuotaEnforcementType(), QuotaEnforcementTypeEnum.DISABLED); }
/* * (non-Javadoc) * * @see * org.springframework.ldap.core.support.DirContextAuthenticationStrategy * #setupEnvironment(java.util.Hashtable, java.lang.String, * java.lang.String) */ @Override public void setupEnvironment(Hashtable env, String userDn, String password) throws NamingException { env.put(Context.SECURITY_AUTHENTICATION, GSS_API_AUTHENTICATION); String qopValue = Config.<String>GetValue(ConfigValues.SASL_QOP); env.put("javax.security.sasl.qop", qopValue); }
/** * get the return value and wait for the reply with default host connection timeout. We need to * assure that this thread is released after a timeout so the blocking call for get is overridden * here and delegated to the get(long timeout, TimeUnit unit) * * @return {@link VDSReturnValue} */ @Override public VDSReturnValue get() { try { return get(Config.<Integer>GetValue(ConfigValues.vdsTimeout), TimeUnit.SECONDS); } catch (TimeoutException e) { return getVDSReturnValue(); } }
protected boolean CheckStorageDomainNameLengthValid() { boolean result = true; if (getStorageDomain().getstorage_name().length() > Config.<Integer>GetValue(ConfigValues.StorageDomainNameSizeLimit)) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NAME_LENGTH_IS_TOO_LONG); result = false; } return result; }
private StoragePoolStatusHandler scheduleTimeout() { Class[] argTypes = new Class[0]; Object[] args = new Object[0]; Integer timeout = Config.<Integer>GetValue(ConfigValues.StoragePoolNonOperationalResetTimeoutInMin); timerId = getScheduler() .scheduleAOneTimeJob(this, "onTimeout", argTypes, args, timeout, TimeUnit.MINUTES); return this; }
@Test public void testSpecificQuotaLimitations() throws Exception { // Set new Quota definition. Quota quota = new Quota(); Guid quotaId = Guid.NewGuid(); quota.setId(quotaId); quota.setStoragePoolId(FixturesTool.STORAGE_POOL_NFS); quota.setQuotaName("Watson"); quota.setDescription("Specific quota"); quota.setThresholdVdsGroupPercentage( Config.<Integer>GetValue(ConfigValues.QuotaThresholdVdsGroup)); quota.setThresholdStoragePercentage( Config.<Integer>GetValue(ConfigValues.QuotaThresholdStorage)); quota.setGraceVdsGroupPercentage(Config.<Integer>GetValue(ConfigValues.QuotaGraceVdsGroup)); quota.setGraceStoragePercentage(Config.<Integer>GetValue(ConfigValues.QuotaGraceStorage)); quota.setQuotaVdsGroups(getQuotaVdsGroup(getSpecificQuotaVdsGroup(quotaId))); quota.setQuotaStorages(getQuotaStorage(getSpecificQuotaStorage(quotaId))); dao.save(quota); Quota quotaEntity = dao.getById(quota.getId()); assertNotNull(quotaEntity); assertEquals(quotaEntity, quota); }
private static Integer getLowDiskSpaceThreshold() { return Config.<Integer>GetValue(ConfigValues.FreeSpaceCriticalLowInGB); }
private static Integer getLowDiskPercentThreshold() { return Config.<Integer>GetValue(ConfigValues.FreeSpaceLow); }
private void expectConfigGetValue() { PowerMockito.mockStatic(Config.class); Mockito.when(Config.GetValue(eq(ConfigValues.IsNeedSupportForOldVgAPI), any(String.class))) .thenReturn(Boolean.TRUE); }