Search in sources :

Example 6 with ConfigurationManager

use of com.synopsys.integration.alert.performance.utility.ConfigurationManager in project hub-alert by blackducksoftware.

the class ScalingPerformanceTest method testAlertPerformance.

@Test
@Ignore
@Disabled
public void testAlertPerformance() throws Exception {
    LocalDateTime startingTime = LocalDateTime.now();
    intLogger.info(String.format("Starting time %s", dateTimeFormatter.format(startingTime)));
    ExternalAlertRequestUtility alertRequestUtility = new ExternalAlertRequestUtility(intLogger, client, alertURL);
    // Create an authenticated connection to Alert
    alertRequestUtility.loginToExternalAlert();
    logTimeElapsedWithMessage("Logging in took %s", startingTime, LocalDateTime.now());
    BlackDuckProviderService blackDuckProviderService = new BlackDuckProviderService(alertRequestUtility, gson);
    ConfigurationManager configurationManager = new ConfigurationManager(gson, alertRequestUtility, blackDuckProviderService.getBlackDuckProviderKey(), ChannelKeys.SLACK.getUniversalKey());
    startingTime = LocalDateTime.now();
    // Create the Black Duck Global provider configuration
    String blackDuckProviderID = blackDuckProviderService.setupBlackDuck();
    logTimeElapsedWithMessage("Configuring the Black Duck provider took %s", startingTime, LocalDateTime.now());
    List<String> jobIds = new ArrayList<>();
    startingTime = LocalDateTime.now();
    // create 10 slack jobs, trigger notification, and wait for all 10 to succeed
    createAndTestJobs(alertRequestUtility, blackDuckProviderService, configurationManager, startingTime, jobIds, 10, blackDuckProviderID);
    startingTime = LocalDateTime.now();
    // create 90 more slack jobs, trigger notification, and wait for all 100 to succeed
    createAndTestJobs(alertRequestUtility, blackDuckProviderService, configurationManager, startingTime, jobIds, 90, blackDuckProviderID);
// TODO create 900 more slack jobs for a total of 1000
// TODO create 1000 more slack jobs for a total of 2000
}
Also used : LocalDateTime(java.time.LocalDateTime) ExternalAlertRequestUtility(com.synopsys.integration.alert.performance.utility.ExternalAlertRequestUtility) BlackDuckProviderService(com.synopsys.integration.alert.performance.utility.BlackDuckProviderService) ArrayList(java.util.ArrayList) ConfigurationManager(com.synopsys.integration.alert.performance.utility.ConfigurationManager) Ignore(org.junit.Ignore) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 7 with ConfigurationManager

use of com.synopsys.integration.alert.performance.utility.ConfigurationManager in project hub-alert by blackducksoftware.

the class SlackPerformanceTest method testSlackJob.

@Test
@Ignore
@Disabled
public void testSlackJob() throws Exception {
    AlertRequestUtility alertRequestUtility = IntegrationPerformanceTestRunner.createAlertRequestUtility(webApplicationContext);
    BlackDuckProviderService blackDuckProviderService = new BlackDuckProviderService(alertRequestUtility, gson);
    ConfigurationManager configurationManager = new ConfigurationManager(gson, alertRequestUtility, blackDuckProviderService.getBlackDuckProviderKey(), ChannelKeys.SLACK.getUniversalKey());
    IntegrationPerformanceTestRunner integrationPerformanceTestRunner = new IntegrationPerformanceTestRunner(gson, dateTimeFormatter, alertRequestUtility, blackDuckProviderService, configurationManager);
    Map<String, FieldValueModel> slackJobFields = new HashMap<>();
    slackJobFields.put(ChannelDescriptor.KEY_ENABLED, new FieldValueModel(List.of("true"), true));
    slackJobFields.put(ChannelDescriptor.KEY_CHANNEL_NAME, new FieldValueModel(List.of(ChannelKeys.SLACK.getUniversalKey()), true));
    slackJobFields.put(ChannelDescriptor.KEY_NAME, new FieldValueModel(List.of(SLACK_PERFORMANCE_JOB_NAME), true));
    slackJobFields.put(ChannelDescriptor.KEY_FREQUENCY, new FieldValueModel(List.of(FrequencyType.REAL_TIME.name()), true));
    slackJobFields.put(ChannelDescriptor.KEY_PROVIDER_TYPE, new FieldValueModel(List.of(blackDuckProviderService.getBlackDuckProviderKey()), true));
    slackJobFields.put(SlackDescriptor.KEY_WEBHOOK, new FieldValueModel(List.of(SLACK_CHANNEL_WEBHOOK), true));
    slackJobFields.put(SlackDescriptor.KEY_CHANNEL_NAME, new FieldValueModel(List.of(SLACK_CHANNEL_NAME), true));
    slackJobFields.put(SlackDescriptor.KEY_CHANNEL_USERNAME, new FieldValueModel(List.of(SLACK_CHANNEL_USERNAME), true));
    integrationPerformanceTestRunner.runTest(slackJobFields, SLACK_PERFORMANCE_JOB_NAME);
}
Also used : AlertRequestUtility(com.synopsys.integration.alert.performance.utility.AlertRequestUtility) BlackDuckProviderService(com.synopsys.integration.alert.performance.utility.BlackDuckProviderService) IntegrationPerformanceTestRunner(com.synopsys.integration.alert.performance.utility.IntegrationPerformanceTestRunner) HashMap(java.util.HashMap) ConfigurationManager(com.synopsys.integration.alert.performance.utility.ConfigurationManager) FieldValueModel(com.synopsys.integration.alert.common.rest.model.FieldValueModel) Ignore(org.junit.Ignore) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Disabled(org.junit.jupiter.api.Disabled)

Example 8 with ConfigurationManager

use of com.synopsys.integration.alert.performance.utility.ConfigurationManager in project hub-alert by blackducksoftware.

the class ComponentUnknownVersionNotificationSerializationTest method configureJob.

private void configureJob(AlertRequestUtility alertRequestUtility, BlackDuckProviderService blackDuckProviderService) throws IntegrationException {
    String blackDuckProviderID = blackDuckProviderService.setupBlackDuck();
    ConfigurationManager configurationManager = new ConfigurationManager(gson, alertRequestUtility, blackDuckProviderService.getBlackDuckProviderKey(), ChannelKeys.SLACK.getUniversalKey());
    Map<String, FieldValueModel> slackJobFields = new HashMap<>();
    slackJobFields.put(ChannelDescriptor.KEY_ENABLED, new FieldValueModel(List.of("true"), true));
    slackJobFields.put(ChannelDescriptor.KEY_CHANNEL_NAME, new FieldValueModel(List.of(ChannelKeys.SLACK.getUniversalKey()), true));
    slackJobFields.put(ChannelDescriptor.KEY_NAME, new FieldValueModel(List.of(SLACK_JOB_NAME), true));
    slackJobFields.put(ChannelDescriptor.KEY_FREQUENCY, new FieldValueModel(List.of(FrequencyType.REAL_TIME.name()), true));
    slackJobFields.put(ChannelDescriptor.KEY_PROVIDER_TYPE, new FieldValueModel(List.of(blackDuckProviderService.getBlackDuckProviderKey()), true));
    slackJobFields.put(SlackDescriptor.KEY_WEBHOOK, new FieldValueModel(List.of(SLACK_CHANNEL_WEBHOOK), true));
    slackJobFields.put(SlackDescriptor.KEY_CHANNEL_NAME, new FieldValueModel(List.of(SLACK_CHANNEL_NAME), true));
    slackJobFields.put(SlackDescriptor.KEY_CHANNEL_USERNAME, new FieldValueModel(List.of(SLACK_CHANNEL_USERNAME), true));
    configurationManager.createJob(slackJobFields, SLACK_JOB_NAME, blackDuckProviderID, blackDuckProviderService.getBlackDuckProjectName(), List.of(NotificationType.COMPONENT_UNKNOWN_VERSION));
}
Also used : HashMap(java.util.HashMap) ConfigurationManager(com.synopsys.integration.alert.performance.utility.ConfigurationManager) FieldValueModel(com.synopsys.integration.alert.common.rest.model.FieldValueModel)

Aggregations

ConfigurationManager (com.synopsys.integration.alert.performance.utility.ConfigurationManager)8 BlackDuckProviderService (com.synopsys.integration.alert.performance.utility.BlackDuckProviderService)7 AlertRequestUtility (com.synopsys.integration.alert.performance.utility.AlertRequestUtility)5 IntegrationPerformanceTestRunner (com.synopsys.integration.alert.performance.utility.IntegrationPerformanceTestRunner)5 Ignore (org.junit.Ignore)5 Disabled (org.junit.jupiter.api.Disabled)5 Test (org.junit.jupiter.api.Test)5 FieldValueModel (com.synopsys.integration.alert.common.rest.model.FieldValueModel)4 HashMap (java.util.HashMap)4 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 ExternalAlertRequestUtility (com.synopsys.integration.alert.performance.utility.ExternalAlertRequestUtility)2 FieldModel (com.synopsys.integration.alert.common.rest.model.FieldModel)1 LocalDateTime (java.time.LocalDateTime)1 ArrayList (java.util.ArrayList)1