Search in sources :

Example 11 with FilePersistenceUtil

use of com.synopsys.integration.alert.common.persistence.util.FilePersistenceUtil in project hub-alert by blackducksoftware.

the class SAMLStartupComponentTest method testInitializeException.

@Test
public void testInitializeException() throws Exception {
    SAMLContext context = Mockito.mock(SAMLContext.class);
    ParserPool parserPool = Mockito.mock(ParserPool.class);
    ExtendedMetadata extendedMetadata = Mockito.mock(ExtendedMetadata.class);
    MetadataManager metadataManager = Mockito.mock(MetadataManager.class);
    MetadataGenerator metadataGenerator = Mockito.mock(MetadataGenerator.class);
    FilePersistenceUtil filePersistenceUtil = Mockito.mock(FilePersistenceUtil.class);
    Mockito.when(context.getCurrentConfiguration()).thenThrow(new AlertConfigurationException("Test exception"));
    SAMLManager samlManager = new SAMLManager(parserPool, extendedMetadata, metadataManager, metadataGenerator, filePersistenceUtil, context);
    SAMLStartupComponent startupComponent = new SAMLStartupComponent(samlManager);
    startupComponent.initializeComponent();
    Mockito.verify(metadataGenerator, Mockito.times(0)).setEntityId(Mockito.anyString());
    Mockito.verify(metadataGenerator, Mockito.times(0)).setEntityBaseURL(Mockito.anyString());
    Mockito.verify(metadataManager, Mockito.times(0)).setProviders(Mockito.anyList());
    Mockito.verify(metadataManager, Mockito.times(0)).afterPropertiesSet();
}
Also used : ParserPool(org.opensaml.xml.parse.ParserPool) MetadataManager(org.springframework.security.saml.metadata.MetadataManager) FilePersistenceUtil(com.synopsys.integration.alert.common.persistence.util.FilePersistenceUtil) SAMLContext(com.synopsys.integration.alert.component.authentication.security.saml.SAMLContext) ExtendedMetadata(org.springframework.security.saml.metadata.ExtendedMetadata) SAMLManager(com.synopsys.integration.alert.component.authentication.security.saml.SAMLManager) MetadataGenerator(org.springframework.security.saml.metadata.MetadataGenerator) AlertConfigurationException(com.synopsys.integration.alert.api.common.model.exception.AlertConfigurationException) Test(org.junit.jupiter.api.Test)

Aggregations

FilePersistenceUtil (com.synopsys.integration.alert.common.persistence.util.FilePersistenceUtil)11 Test (org.junit.jupiter.api.Test)7 EncryptionUtility (com.synopsys.integration.alert.common.security.EncryptionUtility)5 MockAlertProperties (com.synopsys.integration.alert.test.common.MockAlertProperties)5 Gson (com.google.gson.Gson)4 AlertProperties (com.synopsys.integration.alert.common.AlertProperties)4 SettingsEncryptionModel (com.synopsys.integration.alert.component.settings.encryption.model.SettingsEncryptionModel)4 ValidationResponseModel (com.synopsys.integration.alert.common.rest.model.ValidationResponseModel)3 ParserPool (org.opensaml.xml.parse.ParserPool)3 ExtendedMetadata (org.springframework.security.saml.metadata.ExtendedMetadata)3 MetadataGenerator (org.springframework.security.saml.metadata.MetadataGenerator)3 ConfigurationModel (com.synopsys.integration.alert.common.persistence.model.ConfigurationModel)2 AuthenticationDescriptorKey (com.synopsys.integration.alert.component.authentication.descriptor.AuthenticationDescriptorKey)2 SAMLContext (com.synopsys.integration.alert.component.authentication.security.saml.SAMLContext)2 SAMLManager (com.synopsys.integration.alert.component.authentication.security.saml.SAMLManager)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 MetadataManager (org.springframework.security.saml.metadata.MetadataManager)2 AlertConfigurationException (com.synopsys.integration.alert.api.common.model.exception.AlertConfigurationException)1 AlertFieldStatus (com.synopsys.integration.alert.common.descriptor.config.field.errors.AlertFieldStatus)1 FieldModel (com.synopsys.integration.alert.common.rest.model.FieldModel)1