Search in sources :

Example 26 with Preference

use of com.epam.pipeline.entity.preference.Preference in project cloud-pipeline by epam.

the class AwsRegionManagerTest method createShouldSetPolicyToDefaultValueIfMissing.

@Test
public void createShouldSetPolicyToDefaultValueIfMissing() {
    final String defaultPolicyAsString = "{" + "\"key1\":\"value1\"," + "\"key2\":\"value2\"" + "}";
    Preference policy = new Preference();
    policy.setValue(defaultPolicyAsString);
    doReturn(Optional.of(policy)).when(preferenceManager).load(SystemPreferences.DATA_STORAGE_POLICY.getKey());
    final AwsRegionVO regionVO = getAwsRegionVoBuilder().corsRules(EMPTY_CORS_RULES).kmsKeyId(KMS_KEY_ID).kmsKeyArn(KMS_KEY_ARN).awsRegionName(VALID_REGION_ID).isDefault(false).build();
    awsRegionManager.create(regionVO);
    final ArgumentCaptor<AwsRegion> regionCaptor = ArgumentCaptor.forClass(AwsRegion.class);
    verify(awsRegionDao).create(regionCaptor.capture());
    final AwsRegion actualRegion = regionCaptor.getValue();
    assertThat(actualRegion.getPolicy(), is(defaultPolicyAsString));
}
Also used : AwsRegion(com.epam.pipeline.entity.region.AwsRegion) Preference(com.epam.pipeline.entity.preference.Preference) Matchers.isEmptyOrNullString(org.hamcrest.Matchers.isEmptyOrNullString) AwsRegionVO(com.epam.pipeline.controller.vo.AwsRegionVO) Test(org.junit.Test)

Example 27 with Preference

use of com.epam.pipeline.entity.preference.Preference in project cloud-pipeline by epam.

the class PreferenceApiServiceTest method setUp.

@Before
public void setUp() throws Exception {
    visiblePreference = new Preference("visible.preference", "", "TEST", "", PreferenceType.STRING, true);
    preferenceManager.update(Collections.singletonList(visiblePreference));
}
Also used : Preference(com.epam.pipeline.entity.preference.Preference) Before(org.junit.Before)

Aggregations

Preference (com.epam.pipeline.entity.preference.Preference)27 Test (org.junit.Test)20 Transactional (org.springframework.transaction.annotation.Transactional)17 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)11 AbstractManagerTest (com.epam.pipeline.manager.AbstractManagerTest)5 Before (org.junit.Before)5 DataStorageVO (com.epam.pipeline.controller.vo.DataStorageVO)3 AwsRegionVO (com.epam.pipeline.controller.vo.AwsRegionVO)2 Attachment (com.epam.pipeline.entity.issue.Attachment)2 AwsRegion (com.epam.pipeline.entity.region.AwsRegion)2 ObjectPreference (com.epam.pipeline.manager.preference.AbstractSystemPreference.ObjectPreference)2 PreferenceManager (com.epam.pipeline.manager.preference.PreferenceManager)2 SystemPreferences (com.epam.pipeline.manager.preference.SystemPreferences)2 Matchers.isEmptyOrNullString (org.hamcrest.Matchers.isEmptyOrNullString)2 MessageHelper (com.epam.pipeline.common.MessageHelper)1 EntityVO (com.epam.pipeline.controller.vo.EntityVO)1 PreferenceDao (com.epam.pipeline.dao.preference.PreferenceDao)1 AbstractDataStorage (com.epam.pipeline.entity.datastorage.AbstractDataStorage)1 DataStorageFile (com.epam.pipeline.entity.datastorage.DataStorageFile)1 DataStorageStreamingContent (com.epam.pipeline.entity.datastorage.DataStorageStreamingContent)1