Search in sources :

Example 6 with AlertProperties

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

the class UpdateCheckerTest method getUpdateModelTest.

@Test
@Tags({ @Tag(TestTags.DEFAULT_INTEGRATION), @Tag(TestTags.CUSTOM_EXTERNAL_CONNECTION) })
public void getUpdateModelTest() {
    ProxyManager proxyManager = Mockito.mock(ProxyManager.class);
    Mockito.when(proxyManager.createProxyInfoForHost(Mockito.anyString())).thenReturn(ProxyInfo.NO_PROXY_INFO);
    DefaultSystemStatusAccessor defaultSystemStatusUtility = Mockito.mock(DefaultSystemStatusAccessor.class);
    Mockito.when(defaultSystemStatusUtility.isSystemInitialized()).thenReturn(Boolean.TRUE);
    Mockito.when(defaultSystemStatusUtility.getStartupTime()).thenReturn(DateUtils.createCurrentDateTimestamp());
    DescriptorMetadataActions descriptorMetadataActions = Mockito.mock(DescriptorMetadataActions.class);
    Mockito.when(descriptorMetadataActions.getDescriptorsByType(Mockito.anyString())).thenReturn(new ActionResponse<>(HttpStatus.OK, new DescriptorsResponseModel()));
    AlertWebServerUrlManager alertWebServerUrlManager = Mockito.mock(AlertWebServerUrlManager.class);
    Mockito.when(alertWebServerUrlManager.getServerComponentsBuilder()).thenReturn(UriComponentsBuilder.newInstance());
    AlertProperties alertProperties = Mockito.mock(AlertProperties.class);
    Mockito.when(alertProperties.getAlertTrustCertificate()).thenReturn(Optional.of(Boolean.TRUE));
    AboutReader reader = new AboutReader(gson, alertWebServerUrlManager, defaultSystemStatusUtility, descriptorMetadataActions);
    UpdateChecker updateChecker = new UpdateChecker(gson, reader, proxyManager, alertProperties);
    UpdateModel updateModel = updateChecker.getUpdateModel();
    assertNotNull(updateModel);
}
Also used : AboutReader(com.synopsys.integration.alert.web.api.about.AboutReader) DefaultSystemStatusAccessor(com.synopsys.integration.alert.database.api.DefaultSystemStatusAccessor) ProxyManager(com.synopsys.integration.alert.common.rest.proxy.ProxyManager) DescriptorMetadataActions(com.synopsys.integration.alert.web.api.metadata.DescriptorMetadataActions) AlertWebServerUrlManager(com.synopsys.integration.alert.common.rest.AlertWebServerUrlManager) AlertProperties(com.synopsys.integration.alert.common.AlertProperties) UpdateModel(com.synopsys.integration.alert.update.model.UpdateModel) DescriptorsResponseModel(com.synopsys.integration.alert.web.api.metadata.model.DescriptorsResponseModel) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) TestTags(com.synopsys.integration.alert.test.common.TestTags) Tags(org.junit.jupiter.api.Tags)

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