Search in sources :

Example 1 with AlertProperties

use of com.synopsys.integration.alert.common.AlertProperties in project hub-alert by blackducksoftware.

the class SamlManagerTest method init.

@BeforeEach
public void init() throws Exception {
    gson = new Gson();
    context = Mockito.mock(SAMLContext.class);
    parserPool = Mockito.mock(ParserPool.class);
    extendedMetadata = Mockito.mock(ExtendedMetadata.class);
    metadataManager = new CachingMetadataManager(Collections.emptyList());
    metadataManager.setKeyManager(new EmptyKeyManager());
    metadataGenerator = Mockito.mock(MetadataGenerator.class);
    currentConfiguration = Mockito.mock(ConfigurationModel.class);
    alertProperties = Mockito.mock(AlertProperties.class);
    Mockito.when(alertProperties.getAlertSecretsDir()).thenReturn("./testDB/run/secrets");
    filePersistenceUtil = new FilePersistenceUtil(alertProperties, gson);
}
Also used : ParserPool(org.opensaml.xml.parse.ParserPool) ConfigurationModel(com.synopsys.integration.alert.common.persistence.model.ConfigurationModel) FilePersistenceUtil(com.synopsys.integration.alert.common.persistence.util.FilePersistenceUtil) Gson(com.google.gson.Gson) ExtendedMetadata(org.springframework.security.saml.metadata.ExtendedMetadata) EmptyKeyManager(org.springframework.security.saml.key.EmptyKeyManager) AlertProperties(com.synopsys.integration.alert.common.AlertProperties) CachingMetadataManager(org.springframework.security.saml.metadata.CachingMetadataManager) MetadataGenerator(org.springframework.security.saml.metadata.MetadataGenerator) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with AlertProperties

use of com.synopsys.integration.alert.common.AlertProperties in project hub-alert by blackducksoftware.

the class AuthenticationConfigurationValidatorTest method createValidatorAsserter.

private GlobalConfigurationValidatorAsserter createValidatorAsserter(Map<String, FieldValueModel> keyToValues) {
    AlertProperties mockAlertProperties = new MockAlertProperties();
    FilePersistenceUtil filePersistenceUtil = new FilePersistenceUtil(mockAlertProperties, new Gson());
    return new GlobalConfigurationValidatorAsserter(new AuthenticationDescriptorKey().getUniversalKey(), new AuthenticationConfigurationFieldModelValidator(filePersistenceUtil), keyToValues);
}
Also used : FilePersistenceUtil(com.synopsys.integration.alert.common.persistence.util.FilePersistenceUtil) MockAlertProperties(com.synopsys.integration.alert.test.common.MockAlertProperties) Gson(com.google.gson.Gson) AlertProperties(com.synopsys.integration.alert.common.AlertProperties) MockAlertProperties(com.synopsys.integration.alert.test.common.MockAlertProperties) GlobalConfigurationValidatorAsserter(com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter) AuthenticationDescriptorKey(com.synopsys.integration.alert.component.authentication.descriptor.AuthenticationDescriptorKey)

Example 3 with AlertProperties

use of com.synopsys.integration.alert.common.AlertProperties in project hub-alert by blackducksoftware.

the class JobNotificationProcessorTest method createNotificationExtractorBlackDuckServicesFactoryCache.

private NotificationExtractorBlackDuckServicesFactoryCache createNotificationExtractorBlackDuckServicesFactoryCache() {
    ConfigurationModelConfigurationAccessor configurationModelConfigurationAccessor = Mockito.mock(ConfigurationModelConfigurationAccessor.class);
    AlertProperties properties = new AlertProperties();
    ProxyManager proxyManager = Mockito.mock(ProxyManager.class);
    BlackDuckPropertiesFactory blackDuckPropertiesFactory = new BlackDuckPropertiesFactory(configurationModelConfigurationAccessor, GSON, properties, proxyManager);
    return new NotificationExtractorBlackDuckServicesFactoryCache(blackDuckPropertiesFactory);
}
Also used : ProxyManager(com.synopsys.integration.alert.common.rest.proxy.ProxyManager) NotificationExtractorBlackDuckServicesFactoryCache(com.synopsys.integration.alert.provider.blackduck.processor.NotificationExtractorBlackDuckServicesFactoryCache) BlackDuckPropertiesFactory(com.synopsys.integration.alert.provider.blackduck.factory.BlackDuckPropertiesFactory) AlertProperties(com.synopsys.integration.alert.common.AlertProperties) ConfigurationModelConfigurationAccessor(com.synopsys.integration.alert.common.persistence.accessor.ConfigurationModelConfigurationAccessor)

Example 4 with AlertProperties

use of com.synopsys.integration.alert.common.AlertProperties in project hub-alert by blackducksoftware.

the class DefaultConfigurationModelConfigurationAccessorTest method createEncryptionUtility.

private EncryptionUtility createEncryptionUtility() {
    alertProperties = Mockito.mock(AlertProperties.class);
    Mockito.when(alertProperties.getAlertEncryptionPassword()).thenReturn(Optional.of(TEST_PASSWORD));
    Mockito.when(alertProperties.getAlertEncryptionGlobalSalt()).thenReturn(Optional.of(TEST_SALT));
    Mockito.when(alertProperties.getAlertConfigHome()).thenReturn(TEST_DIRECTORY);
    Mockito.when(alertProperties.getAlertSecretsDir()).thenReturn(TEST_SECRETS_DIRECTORY);
    filePersistenceUtil = new FilePersistenceUtil(alertProperties, new Gson());
    return new EncryptionUtility(alertProperties, filePersistenceUtil);
}
Also used : FilePersistenceUtil(com.synopsys.integration.alert.common.persistence.util.FilePersistenceUtil) Gson(com.google.gson.Gson) AlertProperties(com.synopsys.integration.alert.common.AlertProperties) EncryptionUtility(com.synopsys.integration.alert.common.security.EncryptionUtility)

Example 5 with AlertProperties

use of com.synopsys.integration.alert.common.AlertProperties in project hub-alert by blackducksoftware.

the class EncryptionUtilityTest method initializeTest.

@BeforeEach
public void initializeTest() {
    alertProperties = Mockito.mock(AlertProperties.class);
    Mockito.when(alertProperties.getAlertEncryptionPassword()).thenReturn(Optional.of(TEST_PASSWORD));
    Mockito.when(alertProperties.getAlertEncryptionGlobalSalt()).thenReturn(Optional.of(TEST_SALT));
    Mockito.when(alertProperties.getAlertConfigHome()).thenReturn(TEST_DIRECTORY);
    Mockito.when(alertProperties.getAlertSecretsDir()).thenReturn(TEST_SECRETS_DIRECTORY);
    filePersistenceUtil = new FilePersistenceUtil(alertProperties, new Gson());
    encryptionUtility = new EncryptionUtility(alertProperties, filePersistenceUtil);
    File file = new File(TEST_DIRECTORY, "data");
    file.mkdirs();
}
Also used : FilePersistenceUtil(com.synopsys.integration.alert.common.persistence.util.FilePersistenceUtil) Gson(com.google.gson.Gson) AlertProperties(com.synopsys.integration.alert.common.AlertProperties) File(java.io.File) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

AlertProperties (com.synopsys.integration.alert.common.AlertProperties)6 Gson (com.google.gson.Gson)4 FilePersistenceUtil (com.synopsys.integration.alert.common.persistence.util.FilePersistenceUtil)4 ProxyManager (com.synopsys.integration.alert.common.rest.proxy.ProxyManager)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 ConfigurationModelConfigurationAccessor (com.synopsys.integration.alert.common.persistence.accessor.ConfigurationModelConfigurationAccessor)1 ConfigurationModel (com.synopsys.integration.alert.common.persistence.model.ConfigurationModel)1 AlertWebServerUrlManager (com.synopsys.integration.alert.common.rest.AlertWebServerUrlManager)1 EncryptionUtility (com.synopsys.integration.alert.common.security.EncryptionUtility)1 AuthenticationDescriptorKey (com.synopsys.integration.alert.component.authentication.descriptor.AuthenticationDescriptorKey)1 DefaultSystemStatusAccessor (com.synopsys.integration.alert.database.api.DefaultSystemStatusAccessor)1 BlackDuckPropertiesFactory (com.synopsys.integration.alert.provider.blackduck.factory.BlackDuckPropertiesFactory)1 NotificationExtractorBlackDuckServicesFactoryCache (com.synopsys.integration.alert.provider.blackduck.processor.NotificationExtractorBlackDuckServicesFactoryCache)1 MockAlertProperties (com.synopsys.integration.alert.test.common.MockAlertProperties)1 TestTags (com.synopsys.integration.alert.test.common.TestTags)1 GlobalConfigurationValidatorAsserter (com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter)1 UpdateModel (com.synopsys.integration.alert.update.model.UpdateModel)1 AboutReader (com.synopsys.integration.alert.web.api.about.AboutReader)1 DescriptorMetadataActions (com.synopsys.integration.alert.web.api.metadata.DescriptorMetadataActions)1 DescriptorsResponseModel (com.synopsys.integration.alert.web.api.metadata.model.DescriptorsResponseModel)1