Search in sources :

Example 6 with AboutReader

use of com.synopsys.integration.alert.web.api.about.AboutReader 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

AboutReader (com.synopsys.integration.alert.web.api.about.AboutReader)6 Test (org.junit.jupiter.api.Test)6 Gson (com.google.gson.Gson)3 ProxyManager (com.synopsys.integration.alert.common.rest.proxy.ProxyManager)2 AboutModel (com.synopsys.integration.alert.web.api.about.AboutModel)2 ProviderPhoneHomeHandler (com.synopsys.integration.alert.api.provider.ProviderPhoneHomeHandler)1 AlertProperties (com.synopsys.integration.alert.common.AlertProperties)1 Descriptor (com.synopsys.integration.alert.common.descriptor.Descriptor)1 DescriptorMap (com.synopsys.integration.alert.common.descriptor.DescriptorMap)1 JobAccessor (com.synopsys.integration.alert.common.persistence.accessor.JobAccessor)1 RestApiAuditAccessor (com.synopsys.integration.alert.common.persistence.accessor.RestApiAuditAccessor)1 ConfigurationModel (com.synopsys.integration.alert.common.persistence.model.ConfigurationModel)1 AlertWebServerUrlManager (com.synopsys.integration.alert.common.rest.AlertWebServerUrlManager)1 DefaultConfigurationModelConfigurationAccessor (com.synopsys.integration.alert.database.api.DefaultConfigurationModelConfigurationAccessor)1 DefaultSystemStatusAccessor (com.synopsys.integration.alert.database.api.DefaultSystemStatusAccessor)1 BlackDuckProviderKey (com.synopsys.integration.alert.descriptor.api.BlackDuckProviderKey)1 DescriptorKey (com.synopsys.integration.alert.descriptor.api.model.DescriptorKey)1 ProviderKey (com.synopsys.integration.alert.descriptor.api.model.ProviderKey)1 PhoneHomeTask (com.synopsys.integration.alert.task.PhoneHomeTask)1 TestTags (com.synopsys.integration.alert.test.common.TestTags)1