Object genericDefaultValue = configurationValue.getDefaultValue();
Object genericDefaultValue = configurationValue.getDefaultValue();
@Test public void testGetPropertyInstance() { ConfigurationValue configurationValue = ConfigurationValue.HERD_ENVIRONMENT; String value = configurationHelper.getProperty(configurationValue, String.class); assertEquals("value", configurationValue.getDefaultValue(), value); }
@Test public void testGetRequiredProperty() { ConfigurationValue configurationValue = ConfigurationValue.HERD_ENVIRONMENT; String value = configurationHelper.getRequiredProperty(configurationValue); assertEquals(configurationValue.getDefaultValue(), value); }
@Test public void testGetPropertyInstanceNoTargetType() { ConfigurationValue configurationValue = ConfigurationValue.HERD_ENVIRONMENT; String value = configurationHelper.getProperty(configurationValue); assertEquals("value", configurationValue.getDefaultValue(), value); }
@Test public void testGetPropertyThrowsWhenDefaultTypeDoesNotMatch() { ConfigurationValue configurationValue = ConfigurationValue.HERD_ENVIRONMENT; Class<?> expectedDefaultType = configurationValue.getDefaultValue().getClass(); Class<?> givenType = Integer.class; MockEnvironment environment = new MockEnvironment(); try { ConfigurationHelper.getProperty(configurationValue, givenType, environment); fail("expected IllegalArgumentException, but no exception was thrown"); } catch (Exception e) { assertEquals("thrown exception type", IllegalStateException.class, e.getClass()); assertEquals("thrown exception message", "targetType \"" + givenType + "\" is not assignable from the default value of type \"" + expectedDefaultType + "\" for configuration value " + "\"HERD_ENVIRONMENT\".", e.getMessage()); } }
@Test public void testGetPropertyNoTargetType() { ConfigurationValue configurationValue = ConfigurationValue.HERD_ENVIRONMENT; MockEnvironment environment = new MockEnvironment(); String value = ConfigurationHelper.getProperty(configurationValue, environment); assertEquals("value", configurationValue.getDefaultValue(), value); }
LdapQuery ldapQuery = query().where((String) ConfigurationValue.LDAP_ATTRIBUTE_USER_ID.getDefaultValue()).is(USER_ID); new SubjectMatterExpertDaoImpl.SubjectMatterExpertContactDetailsMapper((String) ConfigurationValue.LDAP_ATTRIBUTE_USER_FULL_NAME.getDefaultValue(), (String) ConfigurationValue.LDAP_ATTRIBUTE_USER_JOB_TITLE.getDefaultValue(), (String) ConfigurationValue.LDAP_ATTRIBUTE_USER_EMAIL_ADDRESS.getDefaultValue(), (String) ConfigurationValue.LDAP_ATTRIBUTE_USER_TELEPHONE_NUMBER.getDefaultValue());
.thenReturn((String) ConfigurationValue.FIELD_DATA_DELIMITER.getDefaultValue()); when(awsClientFactory.getEmrClient(awsParamsDto)).thenReturn(amazonElasticMapReduceClient); when(emrOperations.listEmrClusters(amazonElasticMapReduceClient, listClustersRequest)).thenReturn(listClusterResultWithMarker);
@Test public void testGetPropertyReturnDefaultWhenPropertyDoesNotExists() { ConfigurationValue configurationValue = ConfigurationValue.HERD_ENVIRONMENT; String expectedValue = (String) configurationValue.getDefaultValue(); MockEnvironment environment = new MockEnvironment(); environment.setProperty(configurationValue.getKey(), expectedValue); String value = ConfigurationHelper.getProperty(configurationValue, String.class, environment); assertNotNull("value", value); assertEquals("value", expectedValue, value); }
ConfigurationValue.S3_ATTRIBUTE_NAME_VALIDATE_FILE_EXISTENCE.getDefaultValue(), STORAGE_NAME, INVALID_BOOLEAN_VALUE), e.getMessage());
@Test public void testPrepareToInitiateRestoreMissingOptionalParameters() throws Exception { // Create a business object data key without sub-partition values. BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, DATA_VERSION); // Create database entities required for testing. BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataServiceTestHelper.createDatabaseEntitiesForInitiateRestoreTesting(businessObjectDataKey); // Execute a before step for the initiate a business object data restore request for business object data without sub-partition values. BusinessObjectDataRestoreDto storagePolicyTransitionParamsDto = businessObjectDataInitiateRestoreHelperService.prepareToInitiateRestore(businessObjectDataKey, NO_EXPIRATION_IN_DAYS); // Validate the returned object. assertEquals(businessObjectDataKey, storagePolicyTransitionParamsDto.getBusinessObjectDataKey()); // Validate that restore expiration time is set correctly on the storage unit. StorageUnitEntity storageUnitEntity = storageUnitDaoHelper.getStorageUnitEntity(STORAGE_NAME, businessObjectDataEntity); assertNotNull(storageUnitEntity.getRestoreExpirationOn()); Long differenceInDays = TimeUnit.DAYS.convert(storageUnitEntity.getRestoreExpirationOn().getTime() - storageUnitEntity.getCreatedOn().getTime(), TimeUnit.MILLISECONDS); assertTrue((Integer) ConfigurationValue.BDATA_RESTORE_EXPIRATION_IN_DAYS_DEFAULT.getDefaultValue() - differenceInDays <= 1); }
.thenReturn((String) ConfigurationValue.S3_STAGING_RESOURCE_LOCATION.getDefaultValue()); when(emrHelper.getS3StagingLocation()).thenReturn(S3_STAGING_LOCATION); when(xmlHelper.unmarshallXmlToObject(EmrClusterDefinition.class, EMR_CLUSTER_CONFIGURATION)).thenReturn(emrClusterDefinition);
@Test public void testGetPropertyReturnDefaultWhenValueConversionFails() throws Exception { ConfigurationValue configurationValue = ConfigurationValue.BUSINESS_OBJECT_DATA_GET_ALL_MAX_RESULT_COUNT; Integer expectedValue = (Integer) configurationValue.getDefaultValue(); MockEnvironment environment = new MockEnvironment(); environment.setProperty(configurationValue.getKey(), "NOT_AN_INTEGER"); executeWithoutLogging(ConfigurationHelper.class, () -> { Integer value = ConfigurationHelper.getProperty(configurationValue, Integer.class, environment); assertNotNull("value", value); assertEquals("value", expectedValue, value); }); }
Tag expectedTag = new Tag((String) ConfigurationValue.S3_ARCHIVE_TO_GLACIER_TAG_KEY.getDefaultValue(), (String) ConfigurationValue.S3_ARCHIVE_TO_GLACIER_TAG_VALUE.getDefaultValue());