Search in sources :

Example 1 with SettingsEncryptionCrudActions

use of com.synopsys.integration.alert.component.settings.encryption.action.SettingsEncryptionCrudActions in project hub-alert by blackducksoftware.

the class SettingsEncryptionCrudActionsTest method getOneTest.

@Test
void getOneTest() {
    SettingsEncryptionCrudActions configActions = new SettingsEncryptionCrudActions(authorizationManager, encryptionUtility, validator, settingsDescriptorKey);
    ActionResponse<SettingsEncryptionModel> actionResponse = configActions.getOne();
    assertTrue(actionResponse.isSuccessful());
    assertTrue(actionResponse.hasContent());
    assertEquals(HttpStatus.OK, actionResponse.getHttpStatus());
    assertModelObfuscated(actionResponse);
}
Also used : SettingsEncryptionCrudActions(com.synopsys.integration.alert.component.settings.encryption.action.SettingsEncryptionCrudActions) SettingsEncryptionModel(com.synopsys.integration.alert.component.settings.encryption.model.SettingsEncryptionModel) Test(org.junit.jupiter.api.Test)

Example 2 with SettingsEncryptionCrudActions

use of com.synopsys.integration.alert.component.settings.encryption.action.SettingsEncryptionCrudActions in project hub-alert by blackducksoftware.

the class SettingsEncryptionCrudActionsTest method updateTest.

@Test
void updateTest() {
    SettingsEncryptionModel settingsEncryptionModel = new SettingsEncryptionModel();
    settingsEncryptionModel.setEncryptionPassword("password");
    settingsEncryptionModel.setEncryptionGlobalSalt("globalSalt");
    SettingsEncryptionCrudActions configActions = new SettingsEncryptionCrudActions(authorizationManager, encryptionUtility, validator, settingsDescriptorKey);
    ActionResponse<SettingsEncryptionModel> actionResponse = configActions.update(settingsEncryptionModel);
    assertTrue(actionResponse.isSuccessful());
    assertTrue(actionResponse.hasContent());
    assertEquals(HttpStatus.OK, actionResponse.getHttpStatus());
    assertModelObfuscated(actionResponse);
}
Also used : SettingsEncryptionCrudActions(com.synopsys.integration.alert.component.settings.encryption.action.SettingsEncryptionCrudActions) SettingsEncryptionModel(com.synopsys.integration.alert.component.settings.encryption.model.SettingsEncryptionModel) Test(org.junit.jupiter.api.Test)

Example 3 with SettingsEncryptionCrudActions

use of com.synopsys.integration.alert.component.settings.encryption.action.SettingsEncryptionCrudActions in project hub-alert by blackducksoftware.

the class SettingsEncryptionCrudActionsTest method getOneNotInitializedTest.

@Test
void getOneNotInitializedTest() {
    MockAlertProperties alertPropertiesNoEncryption = new MockAlertProperties();
    alertPropertiesNoEncryption.setEncryptionPassword("");
    alertPropertiesNoEncryption.setEncryptionSalt("");
    FilePersistenceUtil filePersistenceUtilWithoutProperties = new FilePersistenceUtil(alertPropertiesNoEncryption, gson);
    EncryptionUtility encryptionUtilityWithoutProperties = new EncryptionUtility(alertPropertiesNoEncryption, filePersistenceUtilWithoutProperties);
    SettingsEncryptionCrudActions configActions = new SettingsEncryptionCrudActions(authorizationManager, encryptionUtilityWithoutProperties, validator, settingsDescriptorKey);
    ActionResponse<SettingsEncryptionModel> actionResponse = configActions.getOne();
    assertTrue(actionResponse.isError());
    assertFalse(actionResponse.hasContent());
    assertEquals(HttpStatus.NOT_FOUND, actionResponse.getHttpStatus());
}
Also used : SettingsEncryptionCrudActions(com.synopsys.integration.alert.component.settings.encryption.action.SettingsEncryptionCrudActions) FilePersistenceUtil(com.synopsys.integration.alert.common.persistence.util.FilePersistenceUtil) SettingsEncryptionModel(com.synopsys.integration.alert.component.settings.encryption.model.SettingsEncryptionModel) MockAlertProperties(com.synopsys.integration.alert.test.common.MockAlertProperties) EncryptionUtility(com.synopsys.integration.alert.common.security.EncryptionUtility) Test(org.junit.jupiter.api.Test)

Aggregations

SettingsEncryptionCrudActions (com.synopsys.integration.alert.component.settings.encryption.action.SettingsEncryptionCrudActions)3 SettingsEncryptionModel (com.synopsys.integration.alert.component.settings.encryption.model.SettingsEncryptionModel)3 Test (org.junit.jupiter.api.Test)3 FilePersistenceUtil (com.synopsys.integration.alert.common.persistence.util.FilePersistenceUtil)1 EncryptionUtility (com.synopsys.integration.alert.common.security.EncryptionUtility)1 MockAlertProperties (com.synopsys.integration.alert.test.common.MockAlertProperties)1